/* ==========================================================================
   Apex Followers — app UI (user dashboard, admin panel, auth)
   ========================================================================== */
:root {
  --bg: #F4F2ED;
  --bg-2: #ECE9E2;
  --surface: #FFFFFF;
  --surface-2: #FAF9F6;
  --ink: #16171C;
  --ink-2: #3A3C44;
  --muted: #6E717A;
  --faint: #A3A6AE;
  --line: #E4E0D7;
  --line-2: #D6D1C5;
  --accent: #FF5B2E;
  --accent-2: #E9481C;
  --accent-soft: #FFE9E1;
  --accent-ink: #FFFFFF;
  --ok: #1A8F4E;
  --ok-soft: #E2F4E9;
  --warn: #B87700;
  --warn-soft: #FBF0D7;
  --bad: #D23A3A;
  --bad-soft: #FBE4E4;
  --info: #2B5FD9;
  --info-soft: #E3EBFC;
  --violet: #6D4AD8;
  --violet-soft: #ECE6FB;
  --shadow-sm: 0 1px 2px rgba(22, 23, 28, .06);
  --shadow: 0 1px 2px rgba(22, 23, 28, .05), 0 8px 24px -12px rgba(22, 23, 28, .18);
  --shadow-lg: 0 24px 60px -20px rgba(22, 23, 28, .35);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --sidebar: 248px;
  --topbar: 64px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Bricolage Grotesque", "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0E0F12;
  --bg-2: #15161A;
  --surface: #17181D;
  --surface-2: #1C1D23;
  --ink: #EEEEF0;
  --ink-2: #C9CAD0;
  --muted: #8F929B;
  --faint: #5D6069;
  --line: #26282F;
  --line-2: #33353D;
  --accent-soft: #3A1D13;
  --ok-soft: #10291B;
  --warn-soft: #2D2410;
  --bad-soft: #321616;
  --info-soft: #141F3A;
  --violet-soft: #221A3A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 650; letter-spacing: -.02em; line-height: 1.15; }
p { margin: 0; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.sm { gap: 8px; }
.stack.lg { gap: 22px; }
::selection { background: var(--accent); color: #fff; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 9px; border: 2px solid var(--bg); }

/* ---------------------------------------------------------------- Shell */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -.03em; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--ink); color: var(--bg);
  display: grid; place-items: center; font-size: 15px; font-weight: 800; position: relative; flex: none;
}
.brand-mark::after { content: ""; position: absolute; right: -3px; top: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.brand small { display: block; font-family: var(--font); font-weight: 500; font-size: 11px; letter-spacing: 0; color: var(--muted); margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--ink-2); font-weight: 500;
  transition: background .15s, color .15s;
  position: relative;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .75; }
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.active { background: var(--ink); color: var(--bg); }
.nav a.active svg { opacity: 1; }
.nav .count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-grid; place-items: center;
}
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 10px; }
.balance-card { background: var(--bg); border-radius: var(--r); padding: 12px 14px; }
.balance-card .label { font-size: 11.5px; color: var(--muted); }
.balance-card .amount { font-family: var(--mono); font-size: 20px; font-weight: 600; letter-spacing: -.02em; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar);
  display: flex; align-items: center; gap: 12px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar h1 { font-size: 19px; }
.topbar .crumb { font-size: 12px; color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu-btn { display: none; }
.content { padding: 6px 28px 40px; max-width: 1320px; width: 100%; }
.content.wide { max-width: none; }
.content.flush { padding: 0; max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 8px 0 20px; }
.page-head h2 { font-size: 26px; letter-spacing: -.035em; }
.page-head p { color: var(--muted); margin-top: 4px; }
.qty-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.qty-quick button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; height: 28px; padding: 0 10px; font-size: 12px; font-family: var(--mono); cursor: pointer; color: var(--ink-2); }
.qty-quick button:hover { border-color: var(--ink); color: var(--ink); }
.step-n { width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--bg); display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.svc-scroll { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; margin: -2px; }
.sticky-side { position: sticky; top: calc(var(--topbar) + 10px); }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.how > div { padding: 16px 18px; border-right: 1px solid var(--line); }
.how > div:last-child { border-right: 0; }
.how b { display: block; margin: 8px 0 3px; }
@media (max-width: 900px) {
  .how { grid-template-columns: 1fr; }
  .how > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .sticky-side { position: static; }
  .page-head h2 { font-size: 22px; }
}

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 550; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
  user-select: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.loading { opacity: .6; pointer-events: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.primary:hover { background: var(--ink-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-2); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.icon { width: 38px; padding: 0; }
.btn.icon.sm { width: 30px; }
.btn.loading::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; position: relative; color: var(--ink-2);
}
.icon-btn:hover { border-color: var(--line-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }

/* ---------------------------------------------------------------- Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label-text { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 13px;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 96px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236E717A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.input.sm, .select.sm { height: 34px; font-size: 13px; border-radius: 8px; }
.input-group { position: relative; }
.input-group > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.input-group .input { padding-left: 36px; }
.input-group .suffix { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--ink); margin: 0; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 38px; height: 22px; border-radius: 22px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: var(--shadow-sm); }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(16px); }

/* ---------------------------------------------------------------- Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 15.5px; }
.card-head .sub { font-size: 12.5px; color: var(--muted); }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-title h2 { font-size: 17px; }

.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.split.even { grid-template-columns: 1fr 1fr; }
.split.side { grid-template-columns: minmax(0, 1fr) 340px; }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; position: relative; overflow: hidden; }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.stat .k svg { width: 15px; height: 15px; }
.stat .v { font-family: var(--mono); font-size: 25px; font-weight: 600; letter-spacing: -.03em; margin-top: 6px; line-height: 1.1; }
.stat .d { font-size: 12px; color: var(--muted); margin-top: 6px; }
.stat.dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.stat.dark .k, .stat.dark .d { color: color-mix(in srgb, var(--bg) 62%, transparent); }
.stat.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.stat.accent .k, .stat.accent .d { color: rgba(255, 255, 255, .8); }

/* ---------------------------------------------------------------- Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 23px; padding: 0 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--bg-2); color: var(--ink-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.accent { background: var(--accent-soft); color: var(--accent-2); }
.badge.live::before { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.plat {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 9px;
  color: #fff; font-weight: 750; font-size: 11px; letter-spacing: .02em;
  font-family: var(--font);
}
.plat.sm { width: 24px; height: 24px; border-radius: 7px; font-size: 9.5px; }
.plat.lg { width: 42px; height: 42px; border-radius: 12px; font-size: 13px; }

/* ---------------------------------------------------------------- Tabs */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-2); border-radius: 11px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: transparent; height: 32px; padding: 0 13px; border-radius: 8px;
  font-weight: 550; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.tabs .n { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.tabs button.active .n { color: var(--muted); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 9px; height: 42px; padding: 0 14px 0 6px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  cursor: pointer; font-weight: 550; transition: border-color .15s, background .15s, transform .1s;
}
.chip:hover { border-color: var(--line-2); }
.chip.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.chip .plat { width: 30px; height: 30px; }

/* ---------------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2);
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table .link-cell { max-width: 260px; }
.table .right { text-align: right; }
.table input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--ink); }

/* Mobile list cards */
.mlist { display: none; }
.mitem { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.mitem:last-child { border-bottom: 0; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- Progress */
.progress { height: 6px; border-radius: 6px; background: var(--bg-2); overflow: hidden; min-width: 60px; }
.progress > i { display: block; height: 100%; background: var(--ok); border-radius: 6px; transition: width .4s; }
.progress.warn > i { background: var(--warn); }
.progress.info > i { background: var(--info); }

/* ---------------------------------------------------------------- Empty / skeleton */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ico { width: 54px; height: 54px; border-radius: 16px; background: var(--bg-2); display: grid; place-items: center; margin: 0 auto 14px; color: var(--ink-2); }
.empty .ico svg { width: 24px; height: 24px; }
.empty h4 { color: var(--ink); font-size: 16px; margin-bottom: 5px; }
.skel { background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg) 37%, var(--bg-2) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------------------------------------------------------- Notices */
.notice { display: flex; gap: 12px; padding: 13px 16px; border-radius: var(--r); background: var(--info-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--info) 22%, transparent); }
.notice svg { width: 18px; height: 18px; flex: none; color: var(--info); margin-top: 1px; }
.notice.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.notice.warn svg { color: var(--warn); }
.notice.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.notice.ok svg { color: var(--ok); }
.notice.promo { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.notice.promo svg { color: var(--accent); }
.notice b { display: block; font-weight: 650; margin-bottom: 2px; }
.impersonate-bar { background: var(--warn); color: #fff; font-weight: 600; text-align: center; padding: 8px 14px; font-size: 13px; }
.impersonate-bar a { text-decoration: underline; margin-left: 8px; }

/* ---------------------------------------------------------------- Toasts */
.toasts { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; min-width: 260px; max-width: 380px;
  padding: 12px 14px; border-radius: 12px; background: var(--ink); color: var(--bg);
  box-shadow: var(--shadow-lg); font-weight: 500; animation: tin .25s ease;
}
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.ok svg { color: #4ADE80; }
.toast.bad svg { color: #FB7185; }
.toast.out { animation: tout .2s ease forwards; }
@keyframes tin { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes tout { to { opacity: 0; transform: translateY(6px); } }

/* ---------------------------------------------------------------- Modal + drawer */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(14, 15, 18, .45); display: grid; place-items: center; padding: 20px; animation: fade .15s ease; backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 520px; max-height: calc(100dvh - 40px); overflow: auto; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop .2s cubic-bezier(.2, .9, .3, 1.2); }
.modal.wide { max-width: 760px; }
.modal.xl { max-width: 1040px; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }

.dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 210px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; animation: pop .15s ease;
}
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-weight: 500; text-align: left; color: var(--ink-2); }
.menu a:hover, .menu button:hover { background: var(--bg); color: var(--ink); }
.menu svg { width: 16px; height: 16px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; text-transform: uppercase;
  background: var(--accent-soft); color: var(--accent-2);
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }

/* ---------------------------------------------------------------- Bottom nav (mobile) */
.bottom-nav { display: none; }

/* ---------------------------------------------------------------- Chat */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; background: var(--surface); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); min-height: 64px; }
.chat-head .title { font-weight: 650; font-size: 15px; }
.chat-head .sub { font-size: 12px; color: var(--muted); }
.chat-body {
  flex: 1; overflow-y: auto; padding: 18px 18px 8px; position: relative;
  background-color: var(--bg);
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 6%, transparent) 1px, transparent 1px);
  background-size: 18px 18px;
  overscroll-behavior: contain;
}
.day-sep { display: flex; justify-content: center; margin: 14px 0 10px; position: sticky; top: 0; z-index: 2; }
.day-sep span { background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--line); padding: 3px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.msg { display: flex; margin: 2px 0; }
.msg.me { justify-content: flex-end; }
.msg .bubble {
  max-width: min(72%, 560px); padding: 8px 12px 6px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); position: relative; word-wrap: break-word; overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.msg.me .bubble { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.msg.tail .bubble { border-bottom-left-radius: 5px; }
.msg.me.tail .bubble { border-bottom-left-radius: 16px; border-bottom-right-radius: 5px; }
.msg.gap { margin-top: 10px; }
.bubble .meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 10.5px; color: var(--faint); margin-top: 2px; white-space: nowrap; font-family: var(--mono); float: right; margin-left: 12px; position: relative; top: 5px; }
.msg.me .bubble .meta { color: color-mix(in srgb, var(--bg) 55%, transparent); }
.bubble .meta svg { width: 15px; height: 15px; }
.bubble .meta .seen { color: #5AB8FF; }
.bubble .text { display: inline; }
.bubble.pending { opacity: .6; }
.bubble.failed { border-color: var(--bad) !important; }
.bubble .att { display: block; margin: -2px -6px 6px; border-radius: 11px; overflow: hidden; cursor: zoom-in; background: var(--bg-2); }
.bubble .att img { max-height: 320px; width: auto; max-width: 100%; object-fit: cover; }
.msg.system { justify-content: center; margin: 10px 0; }
.msg.system .bubble { background: color-mix(in srgb, var(--warn-soft) 85%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--ink); font-size: 12.5px; text-align: center; max-width: 86%; border-radius: 12px; font-weight: 500; }
.msg .who { font-size: 11px; font-weight: 700; color: var(--accent-2); margin-bottom: 2px; display: block; }
.typing-row { display: flex; padding: 2px 0 8px; }
.typing { display: inline-flex; gap: 4px; padding: 11px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; border-bottom-left-radius: 5px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: tdot 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes tdot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.unread-sep { text-align: center; margin: 12px 0; font-size: 11.5px; font-weight: 700; color: var(--accent-2); display: flex; align-items: center; gap: 10px; }
.unread-sep::before, .unread-sep::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--accent) 40%, transparent); }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--line-2); border-radius: 20px; padding: 10px 15px;
  max-height: 160px; min-height: 42px; height: 42px; line-height: 1.45; outline: none; background: var(--surface-2);
}
.composer textarea:focus { border-color: var(--ink); background: var(--surface); }
.composer .icon-btn { border-radius: 50%; width: 42px; height: 42px; flex: none; }
.composer .send { background: var(--accent); border-color: var(--accent); color: #fff; }
.composer .send:hover { background: var(--accent-2); color: #fff; }
.composer .send:disabled { opacity: .4; }
.attach-preview { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 12.5px; }
.attach-preview img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.scroll-down {
  position: absolute; right: 18px; bottom: 86px; width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: grid; place-items: center; cursor: pointer; z-index: 5; color: var(--ink-2);
}
.scroll-down .n { position: absolute; top: -6px; right: -4px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.quick-replies { display: flex; gap: 6px; padding: 8px 12px 0; overflow-x: auto; scrollbar-width: none; background: var(--surface); }
.quick-replies::-webkit-scrollbar { display: none; }
.quick-replies button { flex: none; border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 5px 11px; font-size: 12px; cursor: pointer; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.quick-replies button:hover { border-color: var(--ink); color: var(--ink); }

.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(0, 0, 0, .88); display: grid; place-items: center; padding: 24px; cursor: zoom-out; animation: fade .15s; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* Ticket list */
.tlist { display: flex; flex-direction: column; }
.titem { display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .1s; position: relative; }
.titem:hover { background: var(--surface-2); }
.titem.active { background: var(--bg); }
.titem.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
.titem .top { display: flex; align-items: center; gap: 8px; }
.titem .name { font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.titem .time { font-size: 11.5px; color: var(--faint); font-family: var(--mono); flex: none; }
.titem .subj { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.titem .prev { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.titem .unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: none; }
.titem.has-unread .name, .titem.has-unread .prev { color: var(--ink); }

/* ---------------------------------------------------------------- Services list */
.svc-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.svc-row:last-child { border-bottom: 0; }
.svc-id { font-family: var(--mono); font-size: 12px; color: var(--muted); background: var(--bg-2); padding: 2px 7px; border-radius: 6px; flex: none; }
.svc-option { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; display: flex; gap: 12px; align-items: center; background: var(--surface); transition: border-color .12s, background .12s; }
.svc-option:hover { border-color: var(--line-2); background: var(--surface-2); }
.svc-option.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.svc-option .price { font-family: var(--mono); font-weight: 600; white-space: nowrap; text-align: right; }
.svc-option .price small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; font-family: var(--font); }
.star { border: 0; background: none; cursor: pointer; color: var(--faint); padding: 4px; display: grid; place-items: center; border-radius: 6px; }
.star:hover { color: var(--warn); background: var(--warn-soft); }
.star.on { color: #E8A20C; }
.star svg { width: 17px; height: 17px; }

.summary { background: var(--ink); color: var(--bg); border-radius: var(--r-lg); padding: 20px; }
.summary .line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed color-mix(in srgb, var(--bg) 18%, transparent); }
.summary .line:last-of-type { border-bottom: 0; }
.summary .line span:first-child { color: color-mix(in srgb, var(--bg) 60%, transparent); }
.summary .total { font-family: var(--mono); font-size: 32px; font-weight: 600; letter-spacing: -.03em; margin: 6px 0 2px; }

.desc-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; font-size: 13px; color: var(--ink-2); white-space: pre-wrap; max-height: 220px; overflow: auto; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; text-align: right; overflow-wrap: anywhere; }

.copy-field { display: flex; gap: 6px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 5px 5px 5px 13px; }
.copy-field code { flex: 1; font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
pre.code { background: #111216; color: #E7E7EA; padding: 16px; border-radius: 12px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; margin: 0; }
pre.code .c { color: #7D8290; }
pre.code .s { color: #FFB089; }

.method { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.method:hover { border-color: var(--line-2); }
.method.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.method .mi { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; flex: none; }

/* Chart */
.chart { width: 100%; height: 220px; position: relative; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); padding: 7px 10px; border-radius: 9px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: var(--shadow); z-index: 3; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------------------------------------------------------------- Auth */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-side { background: var(--ink); color: var(--bg); padding: 40px 48px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-side .brand-mark { background: var(--bg); color: var(--ink); }
.auth-side .brand-mark::after { border-color: var(--ink); }
.auth-side h2 { font-size: clamp(32px, 3.4vw, 48px); line-height: 1.02; letter-spacing: -.04em; margin-top: auto; max-width: 560px; }
.auth-side h2 em { font-style: normal; color: var(--accent); }
.auth-side p { color: color-mix(in srgb, var(--bg) 62%, transparent); margin-top: 16px; max-width: 440px; font-size: 15px; }
.auth-points { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }
.auth-points div { display: flex; gap: 10px; align-items: center; font-size: 14px; color: color-mix(in srgb, var(--bg) 80%, transparent); }
.auth-points svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.auth-side .ticker { margin-top: 40px; border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 18px; font-size: 12.5px; color: color-mix(in srgb, var(--bg) 55%, transparent); }
.auth-main { display: flex; flex-direction: column; justify-content: center; padding: 40px; }
.auth-box { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-box h1 { font-size: 30px; letter-spacing: -.035em; }
.auth-box .lead { color: var(--muted); margin: 6px 0 26px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; color: var(--muted); border-radius: 7px; }
.pw-wrap button:hover { background: var(--bg-2); }
.pw-wrap svg { width: 17px; height: 17px; }
.strength { display: flex; gap: 4px; margin-top: 6px; }
.strength i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); transition: background .2s; }
.form-error { color: var(--bad); background: var(--bad-soft); border-radius: 10px; padding: 10px 13px; font-size: 13px; font-weight: 500; }

/* ---------------------------------------------------------------- Admin theme */
.admin .sidebar { background: #111216; border-right-color: #111216; color: #E7E7EA; }
.admin .sidebar .brand-mark { background: #F4F2ED; color: #111216; }
.admin .sidebar .brand-mark::after { border-color: #111216; }
.admin .sidebar .brand small { color: #8A8D96; }
.admin .nav a { color: #B4B6BE; }
.admin .nav a:hover { background: #1D1E24; color: #fff; }
.admin .nav a.active { background: #F4F2ED; color: #111216; }
.admin .nav-label { color: #5F626C; }
.admin .sidebar-foot { border-top-color: #24252C; }
.admin .balance-card { background: #1B1C22; }
.admin .balance-card .label { color: #8A8D96; }

.ticket-shell { display: grid; grid-template-columns: 340px minmax(0, 1fr) 320px; height: calc(100dvh - var(--topbar)); border-top: 1px solid var(--line); }
.ticket-shell > aside, .ticket-shell > section { min-height: 0; display: flex; flex-direction: column; }
.ticket-shell .t-left { border-right: 1px solid var(--line); background: var(--surface); }
.ticket-shell .t-right { border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
.ticket-shell .t-left .tlist { overflow-y: auto; flex: 1; }
.ticket-shell.user-mode { grid-template-columns: 340px minmax(0, 1fr); }
.t-search { padding: 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.side-block { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.side-block h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-family: var(--font); font-weight: 650; margin-bottom: 10px; }
.chat-empty { flex: 1; display: grid; place-items: center; background: var(--bg); color: var(--muted); text-align: center; padding: 20px; }

/* Admin services */
.cat-block { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.cat-block + .cat-block { margin-top: 14px; }
.cat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); cursor: pointer; }
.cat-head h4 { font-size: 14.5px; font-family: var(--font); font-weight: 650; letter-spacing: 0; }
.cat-block.collapsed .cat-body { display: none; }
.cat-block.collapsed .cat-head { border-bottom: 0; }
.cat-head .chev { transition: transform .2s; width: 16px; height: 16px; color: var(--muted); }
.cat-block.collapsed .chev { transform: rotate(-90deg); }
.svc-admin { display: grid; grid-template-columns: 28px 56px minmax(0, 1fr) 110px 110px 90px 96px 104px; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.svc-admin:last-child { border-bottom: 0; }
.svc-admin.head { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface); padding-top: 8px; padding-bottom: 8px; }
.svc-admin.off { opacity: .55; }
.svc-admin .price-edit { width: 100%; height: 32px; border: 1px solid transparent; background: transparent; border-radius: 7px; padding: 0 8px; font-family: var(--mono); font-weight: 600; text-align: right; }
.svc-admin .price-edit:hover { border-color: var(--line-2); }
.svc-admin .price-edit:focus { border-color: var(--ink); background: var(--surface); outline: none; }
.margin-pos { color: var(--ok); }
.margin-neg { color: var(--bad); }
.bulk-bar { position: sticky; bottom: 16px; z-index: 20; margin-top: 16px; background: var(--ink); color: var(--bg); border-radius: 14px; padding: 10px 12px 10px 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; box-shadow: var(--shadow-lg); animation: pop .2s ease; }
.bulk-bar .btn { background: #26272E; border-color: #33343C; color: #fff; }
.bulk-bar .btn:hover { background: #33343C; }
.bulk-bar .input, .bulk-bar .select { background: #1E1F25; border-color: #33343C; color: #fff; height: 32px; width: auto; }

.user-hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.mini-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.mini-stats > div { padding: 14px 18px; border-right: 1px solid var(--line); }
.mini-stats > div:last-child { border-right: 0; }
.mini-stats .k { font-size: 11.5px; color: var(--muted); }
.mini-stats .v { font-family: var(--mono); font-weight: 600; font-size: 17px; margin-top: 2px; }

.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.tl-item:last-child { border-bottom: 0; }
.tl-dot { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--bg-2); }
.tl-dot svg { width: 15px; height: 15px; }
.amount-pos { color: var(--ok); font-family: var(--mono); font-weight: 600; }
.amount-neg { color: var(--ink); font-family: var(--mono); font-weight: 600; }

.setup-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--bg); }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1280px) {
  .ticket-shell { grid-template-columns: 300px minmax(0, 1fr); }
  .ticket-shell .t-right { display: none; }
  .ticket-shell .t-right.show { display: flex; position: fixed; right: 0; top: 0; bottom: 0; width: 340px; z-index: 90; box-shadow: var(--shadow-lg); }
  .svc-admin { grid-template-columns: 28px 50px minmax(0, 1fr) 100px 100px 86px 96px; }
  .svc-admin .col-orders { display: none; }
}
@media (max-width: 1100px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split.side { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mini-stats > div:nth-child(3) { border-right: 0; }
}
@media (max-width: 900px) {
  :root { --topbar: 58px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 35; animation: fade .2s; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 14px; }
  .topbar h1 { font-size: 17px; }
  .content { padding: 4px 14px 96px; }
  .cols-3, .cols-2, .split.even, .grid-3 { grid-template-columns: 1fr; }
  .hide-m { display: none !important; }
  .table.responsive { display: none; }
  .mlist { display: block; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 10.5px; font-weight: 600; color: var(--muted); border-radius: 10px; position: relative; }
  .bottom-nav a svg { width: 21px; height: 21px; }
  .bottom-nav a.active { color: var(--ink); }
  .bottom-nav a.active svg { color: var(--accent); }
  .bottom-nav .count { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 4px; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-main { padding: 28px 20px; justify-content: flex-start; padding-top: 48px; }
  .ticket-shell, .ticket-shell.user-mode { grid-template-columns: 1fr; height: calc(100dvh - var(--topbar)); }
  .ticket-shell.chat-open .t-left { display: none; }
  .ticket-shell:not(.chat-open) > section { display: none; }
  .user-mode-chat-pad { padding-bottom: 0 !important; }
  .msg .bubble { max-width: 84%; }
  .modal { border-radius: 20px 20px 0 0; max-height: 92dvh; margin-top: auto; animation: sheet .25s cubic-bezier(.2, .8, .2, 1); }
  .overlay { padding: 0; place-items: end stretch; }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
  .toasts { left: 14px; right: 14px; bottom: 84px; }
  .toast { max-width: none; }
  .svc-admin { grid-template-columns: 24px minmax(0, 1fr) 90px 64px; }
  .svc-admin .col-id, .svc-admin .col-cost, .svc-admin .col-margin, .svc-admin .col-orders { display: none; }
  .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-stats > div { border-bottom: 1px solid var(--line); }
  .mini-stats > div:nth-child(2n) { border-right: 0; }
  .mini-stats > div:nth-child(3) { border-right: 1px solid var(--line); }
  .stat .v { font-size: 21px; }
  .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
  .scroll-down { bottom: 80px; }
}
@media (max-width: 520px) {
  .cols-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat .v { font-size: 19px; }
  .grid-2 { grid-template-columns: 1fr; }
  .chips .chip { flex: 1 1 calc(50% - 8px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.hide-desktop { display: none !important; }
@media (max-width: 1280px) { .hide-desktop { display: inline-flex !important; } }
.settings-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; margin-top: 8px; align-items: start; }
.settings-grid .nav { flex: none; overflow: visible; }
.admin .card .nav a { color: var(--ink-2); }
.admin .card .nav a:hover { background: var(--bg); color: var(--ink); }
.admin .card .nav a.active { background: var(--ink); color: var(--bg); }
@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .nav { flex-direction: row; overflow-x: auto; }
  .settings-grid .nav a { white-space: nowrap; }
}

/* ---- fixes: grid overflow, menu button, mobile chat ---- */
.split > *, .grid > *, .shell > *, .ticket-shell > * { min-width: 0; }
.icon-btn.menu-btn { display: none; }
@media (max-width: 900px) {
  .icon-btn.menu-btn { display: inline-grid; }
  .split, .split.side, .split.even { grid-template-columns: minmax(0, 1fr); }
  .ticket-shell, .ticket-shell.user-mode { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - var(--topbar) - 64px - env(safe-area-inset-bottom)); }
  body.chat-full .bottom-nav { display: none; }
  body.chat-full .ticket-shell { height: calc(100dvh - var(--topbar)); }
  .chat-head .btn.ghost[href] { display: inline-flex; }
}
@media (min-width: 901px) {
  .chat-head a.btn.ghost[aria-label="Back"] { display: none; }
}

/* ---------- Two-factor login + WhatsApp ---------- */
.tfa-steps { display: grid; gap: 8px; font-size: 14px; }
.tfa-steps > div { display: flex; gap: 10px; align-items: flex-start; }
.tfa-qr { display: grid; place-items: center; }
.tfa-qr svg { width: 200px; height: 200px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.otp-input { font-size: 22px; letter-spacing: .3em; text-align: center; height: 52px; }
.backup-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.backup-codes code { font-family: var(--mono, monospace); font-size: 15px; text-align: center; padding: 9px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); letter-spacing: .05em; }
.wa-card { display: flex; gap: 10px; align-items: center; padding: 11px 13px; border-radius: 12px; background: color-mix(in srgb, #25D366 12%, transparent); border: 1px solid color-mix(in srgb, #25D366 30%, transparent); color: var(--ink); }
.wa-card svg { width: 20px; height: 20px; color: #1DA851; flex: none; }
.wa-card .grow { min-width: 0; }
.wa-card b { display: block; font-size: 13.5px; }
.wa-card span { font-size: 12px; color: var(--muted); }
.btn.wa { background: #25D366; border-color: #25D366; color: #fff; }
.btn.wa:hover { background: #1FBE5B; }
@media (max-width: 700px) { .hide-mobile { display: none !important; } }
