:root {
  color-scheme: dark;
  --bg: #0c0f14;
  --panel: rgba(24, 28, 36, 0.82);
  --panel-strong: #171b23;
  --line: rgba(255,255,255,0.09);
  --text: #eef2f8;
  --muted: #96a1b3;
  --accent: #7cc7ff;
  --green: #37d68b;
  --yellow: #f3c969;
  --orange: #ff9f58;
  --red: #ff6675;
  --blue: #82a8ff;
  --gray: #717b8c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 30% 0%, rgba(124, 199, 255, 0.12), transparent 28%),
    linear-gradient(135deg, #0c0f14 0%, #111720 50%, #0b0d12 100%);
  color: var(--text);
  letter-spacing: 0;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; }
button {
  border: 0;
  color: inherit;
  cursor: pointer;
  background: none;
}

.login {
  min-height: 100vh;
  display: grid;
  align-items: center;
  justify-items: end;
  position: relative;
  padding: clamp(22px, 5vw, 72px);
  background:
    linear-gradient(90deg, rgba(3, 6, 10, 0.1) 0%, rgba(3, 6, 10, 0.64) 48%, rgba(3, 6, 10, 0.9) 100%),
    linear-gradient(180deg, rgba(3, 6, 10, 0.12), rgba(3, 6, 10, 0.42)),
    url("/assets/login-background.png") center / cover no-repeat;
  overflow: hidden;
}
.login::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
.login-panel {
  width: min(430px, 100%);
  position: relative;
  z-index: 1;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background:
    linear-gradient(180deg, rgba(22, 27, 35, 0.9), rgba(10, 13, 19, 0.88));
  box-shadow: 0 30px 90px rgba(0,0,0,.58), 0 0 0 1px rgba(255, 55, 55, 0.08) inset;
  border-radius: 8px;
  backdrop-filter: blur(20px);
}
.login-kicker {
  width: fit-content;
  margin-bottom: 12px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 77, 91, 0.28);
  border-radius: 999px;
  color: #ffb8bd;
  background: rgba(255, 62, 76, 0.09);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #7cc7ff, #37d68b);
  color: #061018;
  font-weight: 900;
  margin-bottom: 18px;
}
h1, h2, h3 { margin: 0; }
.login h1 { font-size: 34px; margin-bottom: 20px; line-height: 1.05; }
.login p, .muted { color: var(--muted); }
.field { display: grid; gap: 8px; margin-top: 16px; }
.field label { color: #c6ceda; font-size: 13px; }
.input, .select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255,255,255,.045);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
}
.input:focus, .select:focus, textarea:focus { border-color: rgba(124,199,255,.65); }
.login .input {
  min-height: 48px;
  border-color: rgba(255,255,255,.13);
  background: rgba(255,255,255,.075);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
}
.login .input:focus {
  border-color: rgba(255, 83, 95, 0.65);
  box-shadow: 0 0 0 4px rgba(255, 83, 95, 0.11);
}
.remember-login {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  color: #d4dbe7;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.remember-login input {
  width: 17px;
  height: 17px;
  accent-color: #ff3f4d;
}
.login .btn.primary {
  min-height: 46px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
    #c92c38;
  color: #fff;
  border: 1px solid rgba(255, 96, 108, 0.55);
  box-shadow: 0 12px 28px rgba(201, 44, 56, 0.22), 0 1px 0 rgba(255,255,255,.12) inset;
  letter-spacing: 0;
}
.login .btn.primary:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0)),
    #df3341;
}
.login-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}
.login-submit {
  min-width: 148px;
  padding-inline: 20px;
  font-weight: 800;
}
.upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.image-preview {
  display: grid;
  place-items: center;
  min-height: 120px;
  margin-top: 10px;
  border: 1px dashed rgba(255,255,255,.18);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
  color: var(--muted);
  overflow: hidden;
}
.image-preview img {
  display: block;
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
}
.empty-preview {
  padding: 18px;
  text-align: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.06);
}
.btn.primary {
  color: #061018;
  border-color: transparent;
  background: linear-gradient(135deg, #8ed4ff, #4de0a0);
  font-weight: 750;
}
.btn.danger { background: rgba(255,102,117,.12); border-color: rgba(255,102,117,.3); color: #ffd4d8; }
.btn.small { min-height: 30px; padding: 6px 9px; border-radius: 8px; font-size: 12px; }
.error { color: #ffd4d8; margin-top: 12px; font-size: 13px; }

.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}
.sidebar {
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: rgba(9,12,17,.72);
  backdrop-filter: blur(22px);
  min-width: 0;
  overflow: hidden;
}
.side-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.side-brand .brand-mark { margin: 0; width: 38px; height: 38px; border-radius: 11px; }
.side-brand strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-brand span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.nav { display: grid; gap: 6px; }
.nav button {
  text-align: left;
  padding: 11px 12px;
  border-radius: 10px;
  color: #cbd4e2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav button.active, .nav button:hover { background: rgba(255,255,255,.07); color: var(--text); }
.sidebar-footer {
  position: sticky;
  top: calc(100vh - 160px);
  margin-top: 32px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  font-size: 12px;
}
.main {
  padding: 20px 24px 40px;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}
.topbar {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.topbar > div:first-child { min-width: 240px; }
.topbar h1 { font-size: 24px; }
.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  color: #cbd4e2;
  font-size: 12px;
  white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 99px; background: var(--green); }
.dot.error { background: var(--red); }
.grid { display: grid; gap: 14px; }
.grid > *, .split > *, .profile > *, .security-grid > * { min-width: 0; }
.metrics { grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }
.card {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(20px);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 16px 50px rgba(0,0,0,.18);
}
.metric .label { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.metric .value { font-size: 28px; font-weight: 800; }
.movement-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.date-filter {
  display: grid;
  gap: 6px;
  min-width: 170px;
}
.date-filter label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.date-filter .input {
  min-height: 38px;
  padding-block: 8px;
}
.movement-card {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.035);
  border-radius: 8px;
  padding: 13px;
}
.movement-title {
  color: #f1f6ff;
  font-weight: 800;
  margin-bottom: 12px;
}
.movement-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.movement-values div {
  display: grid;
  gap: 4px;
}
.movement-values span {
  color: var(--muted);
  font-size: 11px;
}
.movement-values strong {
  color: #edf4ff;
  font-size: 20px;
}
.movement-values .ok { color: #8ff0bf; }
.movement-values .bad { color: #ff9aa7; }
.section { margin-top: 16px; }
.section.split {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  align-items: start;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.section-head h2 { font-size: 17px; }
.table-wrap {
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; min-width: 920px; background: rgba(12,15,20,.54); }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; vertical-align: middle; }
th { color: #aeb8c8; font-weight: 650; background: rgba(255,255,255,.035); position: sticky; top: 0; }
tr:hover td { background: rgba(255,255,255,.025); }
.dashboard-table-wrap {
  overflow: hidden;
}
.dashboard-table {
  min-width: 0;
  table-layout: fixed;
}
.dashboard-table th,
.dashboard-table td {
  padding: 11px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dashboard-table th:nth-child(1),
.dashboard-table td:nth-child(1) { width: 22%; }
.dashboard-table th:nth-child(2),
.dashboard-table td:nth-child(2) { width: 18%; }
.dashboard-table th:nth-child(3),
.dashboard-table td:nth-child(3) { width: 20%; }
.dashboard-table th:nth-child(4),
.dashboard-table td:nth-child(4) { width: 24%; }
.dashboard-table th:nth-child(5),
.dashboard-table td:nth-child(5) { width: 16%; }
.dashboard-table .badge {
  max-width: 100%;
}
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(113,123,140,.16);
  color: #d6dbe4;
}
.verified, .manual_verified { background: rgba(55,214,139,.15); color: #a9f3d0; }
.warning_sent { background: rgba(243,201,105,.16); color: #ffe0a1; }
.pending_removal, .left_ib { background: rgba(255,102,117,.16); color: #ffd0d6; }
.pending_verification, .manual_review { background: rgba(130,168,255,.16); color: #cbd8ff; }
.removed_from_vip, .banned { background: rgba(113,123,140,.18); color: #c4cad4; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; min-width: 0; }
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 14px;
}
.filter-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.045);
  color: #cbd4e2;
  font-size: 13px;
}
.filter-tabs button.active {
  border-color: rgba(124,199,255,.45);
  background: rgba(124,199,255,.14);
  color: var(--text);
}
.filter-tabs span {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  font-size: 12px;
  text-align: center;
}
.split { display: grid; grid-template-columns: 1.25fr .75fr; gap: 14px; }
.security-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, .9fr);
  gap: 14px;
  max-width: 100%;
  overflow: hidden;
}
.security-grid .card {
  min-width: 0;
}
.compact-table {
  min-width: 0;
  table-layout: fixed;
}
.compact-table th,
.compact-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compact-table td:nth-child(4) {
  white-space: normal;
  overflow-wrap: anywhere;
}
.security-grid .table-wrap {
  max-width: 100%;
}
.profile { display: grid; grid-template-columns: 320px 1fr; gap: 14px; }
.kv { display: grid; gap: 10px; margin-top: 14px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.kv span:first-child { color: var(--muted); }
.timeline { display: grid; gap: 8px; }
.timeline-list {
  max-height: min(72vh, 760px);
  overflow: auto;
  padding-right: 4px;
}
.timeline-item {
  border: 1px solid var(--line);
  border-left: 3px solid rgba(124,199,255,.55);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,.028);
}
.timeline-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.timeline-item strong { display: block; font-size: 13px; }
.timeline-item time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.timeline-item strong, .timeline-item span { overflow-wrap: anywhere; }
.timeline-item span { display: block; color: var(--muted); font-size: 12px; line-height: 1.45; margin-top: 5px; }
.event-details {
  margin: 8px 0 0;
  color: #cbd4e2;
  font-size: 11px;
}
.event-details summary {
  cursor: pointer;
  color: #aeb8c8;
}
.event-details pre {
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0,0,0,.22);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0,0,0,.55);
  z-index: 20;
}
.modal { width: min(520px, 100%); border: 1px solid var(--line); border-radius: 8px; padding: 18px; background: #151922; box-shadow: 0 28px 100px rgba(0,0,0,.45); }
.timeline-modal { width: min(980px, 96vw); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.empty { color: var(--muted); padding: 22px; text-align: center; }
@media (max-width: 1500px) {
  .section.split { grid-template-columns: 1fr; }
}

@media (max-width: 1280px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr); }
  .topbar { align-items: flex-start; }
  .top-actions { justify-content: flex-start; }
}

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .profile, .security-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body {
    background: linear-gradient(180deg, #0c0f14 0%, #101720 58%, #0b0d12 100%);
  }

  .login {
    padding: 18px;
    align-items: end;
    justify-items: center;
    padding-top: 18vh;
    background-position: 34% center;
  }

  .login-panel {
    padding: 22px;
    background: linear-gradient(180deg, rgba(20, 24, 32, 0.94), rgba(8, 11, 17, 0.94));
  }

  .login h1 {
    font-size: 28px;
  }

  .shell {
    min-height: 100dvh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 12px 12px 10px;
    background: rgba(9,12,17,.93);
  }

  .side-brand {
    margin-bottom: 12px;
  }

  .side-brand .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }

  .side-brand strong {
    font-size: 14px;
  }

  .side-brand span {
    font-size: 11px;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav button {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.035);
    white-space: nowrap;
    font-size: 13px;
  }

  .sidebar-footer {
    display: none;
  }

  .main {
    padding: 14px 12px 28px;
  }

  .topbar {
    display: grid;
    align-items: start;
    gap: 12px;
    min-height: 0;
    margin-bottom: 14px;
  }

  .topbar h1 {
    font-size: 22px;
    line-height: 1.12;
  }

  .topbar .muted {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.35;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .top-actions .pill {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .top-actions .btn {
    width: 100%;
    min-height: 40px;
    padding-inline: 10px;
    white-space: normal;
    text-align: center;
  }

  .grid {
    gap: 10px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card {
    padding: 13px;
    box-shadow: 0 10px 34px rgba(0,0,0,.16);
  }

  .metric .label {
    margin-bottom: 8px;
  }

  .metric .value {
    font-size: 24px;
  }

  .section {
    margin-top: 12px;
  }

  .section-head {
    display: grid;
    align-items: start;
    gap: 10px;
  }

  .section-head h2 {
    font-size: 16px;
  }

  .toolbar {
    width: 100%;
    gap: 8px;
  }

  .filter-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-tabs button {
    justify-content: space-between;
    width: 100%;
  }

  .toolbar .btn,
  .toolbar .input,
  .toolbar .select {
    flex: 1 1 150px;
  }

  #search {
    width: 100% !important;
    flex-basis: 100%;
  }

  .input, .select, textarea {
    min-height: 42px;
    border-radius: 8px;
    font-size: 16px;
  }

  .upload-row {
    grid-template-columns: 1fr;
  }

  .btn {
    border-radius: 8px;
  }

  .pill,
  .badge {
    border-radius: 8px;
    white-space: normal;
  }

  .split,
  .profile,
  .security-grid {
    grid-template-columns: 1fr;
  }

  .movement-grid {
    grid-template-columns: 1fr;
  }

  .date-filter {
    width: 100%;
  }

  table {
    min-width: 760px;
  }

  th, td {
    padding: 10px 11px;
    font-size: 12px;
  }

  .compact-table {
    min-width: 680px;
  }

  .kv div {
    display: grid;
    gap: 4px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .modal {
    max-height: calc(100dvh - 20px);
    overflow: auto;
    padding: 16px;
  }

  .modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 430px) {
  .main {
    padding-inline: 10px;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .card {
    padding: 12px;
  }

  .toolbar .btn,
  .toolbar .input,
  .toolbar .select {
    flex-basis: 100%;
  }

  .filter-tabs {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 350px) {
  .top-actions {
    grid-template-columns: 1fr;
  }

  .top-actions .pill {
    grid-column: auto;
  }
}
