/* KHP Panel v1 — mobile-first, dark navy + emerald (matches the sample) */
:root {
  --bg: #040b1a;
  --bg2: #061126;
  --surface: #111927;
  --surface2: #162038;
  --border: #233047;
  --emerald: #00ff81;
  --emerald-dk: #00c868;
  --cyan: #00e5ff; /* v6.1.8: usage-bar fill (neon cyan, user-picked) */
  --text: #f1f5f9;
  --muted: #94a3b8;
  --gold: #f59e0b;
  --red: #ef4444;
  --amber: #fbbf24;
  /* v6.1.18: emerald TEXT (headings/links/stat numbers) — #00ff81 is
     unreadable on light backgrounds, so light mode overrides this to
     #00a050. Emerald FILLS (buttons, findbox, pills) keep --emerald. */
  --emerald-ink: #00ff81;
}
html { color-scheme: dark; }

/* ---- v6.1.18: Dark/Light mode — dark is the default (no data-theme
   attribute); light sets html[data-theme="light"]. Only the chrome
   goes light: page bg #eef2f7, white cards, dark text (matches the
   approved sample). The coloured boxes stay EXACTLY as they are
   (findboxes, owner boxes, TOTAL bars, nav pills, buttons). */
html[data-theme="light"] {
  --bg: #eef2f7;
  --bg2: #ffffff;
  --surface: #ffffff;
  --surface2: #e8edf3;
  --border: #d7dee8;
  --text: #0b1220;
  --muted: #5a687a;
  --emerald-ink: #00a050;
  color-scheme: light;
}
/* v6.1.18 light-only readability: these were light-on-dark text
   colours that go unreadable on white cards, so they get darker
   values in light mode only. */
html[data-theme="light"] .client .name { color: #3B82F6; } /* v6.2.18: key names BLUE on light too (same as dark) */
html[data-theme="light"] .server .srv-online .n { color: #16a34a; }
html[data-theme="light"] .alert-banner .sub { color: #991b1b; }
html[data-theme="light"] .alert-banner .retry { color: #b91c1c; }
html[data-theme="light"] .error { color: #991b1b; }
html[data-theme="light"] input[type="date"] { color-scheme: light; }
html[data-theme="light"] nav.bottom a.on { box-shadow: 0 0 0 2px #0b1220; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  /* v6.2.23 (item 3): DejaVu Sans for the WHOLE panel — the phone
     font + DejaVu mix on headings/bars looked ugly, so the base
     stack is DejaVu-first now. DejaVu has NO Burmese glyphs, so
     Burmese text still falls back per-glyph to the phone's font. */
  font-family: 'DejaVu Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
}
a { color: var(--emerald-ink); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* header */
header {
  background: var(--bg2);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
}
.logo {
  width: 44px; height: 44px;
  background: var(--emerald);
  border-radius: 12px;
  color: var(--bg);
  font-weight: 800;
  font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
/* v6.1.19: channel name on ONE line only — nowrap + hidden overflow
   (JS fitHeaderTitle steps it down from 21px to a 15px floor, so the
   longest name "STH - PREMIUM - KEY" fits at 360px). The ellipsis is
   the safety net if JS never runs. */
/* v6.2.12: the h1 is a plain name again — the version no longer sits
   beside it (v6.2.10/6.2.11), so no flex row and no .hdr-name span. */
header h1 { color: var(--emerald-ink); font-size: 21px; letter-spacing: 0.5px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-title { min-width: 0; }
header .sub { color: var(--muted); font-size: 13px; }
header .spacer { flex: 1; }
.chip {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  color: var(--text);
  font-size: 14px;
  background: transparent;
}
.chip:hover { border-color: var(--emerald); }

/* v6.1.18: Dark/Light toggle pill in the header, next to Logout.
   Shows the CURRENT theme: a moon + "Dark" in dark mode, a sun +
   "Light" in light mode. Same pill shape as the Logout chip. */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  color: var(--text);
  font-size: 14px;
  background: transparent;
}
.theme-toggle:hover { border-color: var(--emerald); }
.theme-toggle svg { width: 16px; height: 16px; flex: none; }
.theme-toggle .theme-sun { display: none; }
html[data-theme="light"] .theme-toggle .theme-sun { display: inline-flex; }
html[data-theme="light"] .theme-toggle .theme-moon { display: none; }

/* v6.1.19: header fix — the v6.1.18 Dark pill + Logout pill side by
   side squeezed the channel name to 2 lines ("Dolly VPN KEY"). The
   two pills now stack vertically in one 76px column on the right
   (Dark on top, Logout below). Header padding/gap tightened so the
   longest name ("STH - PREMIUM - KEY", 201px at 19px) fits at 360px:
   360 - 12 - 44 - 10 - 76 - 12 = 206px available. */
/* v6.2.8 (item 3): Logout is CENTRED in its column, lining up with
   the Dark pill above it. The chip is an <a> with no text-align, so
   "Logout" sat left while the Dark pill's content is centred. */
.hdr-actions { display: flex; flex-direction: column; gap: 6px; width: 76px; flex: none; align-items: center; }
.hdr-actions .theme-toggle,
.hdr-actions .chip { width: 100%; justify-content: center; text-align: center; font-size: 12px; line-height: 1.2; padding: 6px 8px; }
/* Dark pill keeps its green frame (sample); in light mode the frame
   is gold to match the sun icon. */
.hdr-actions .theme-toggle { border-color: var(--emerald); }
html[data-theme="light"] .hdr-actions .theme-toggle { border-color: #f59e0b; }
/* v6.1.19: Logout pill gets a coloured frame like the Dark pill's
   green one — red border #ef4444; red text #ef4444 in dark, #b91c1c
   in light (sample). Hover keeps the red, never goes green. */
.hdr-actions .chip { border-color: var(--red); color: var(--red); }
.hdr-actions .chip:hover { border-color: var(--red); }
html[data-theme="light"] .hdr-actions .chip { color: #b91c1c; border-color: #b91c1c; }
html[data-theme="light"] .hdr-actions .chip:hover { border-color: #b91c1c; }

main { max-width: 720px; margin: 0 auto; padding: 16px 16px 16px; }

/* cards + stats */
.stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 20px; }
/* v6.2.18 (item 2): THE root cause of the v6.2.16 Messages failure.
   The rule above sets `display: grid` on .stats, and an author
   display rule BEATS the browser's built-in `[hidden] { display:
   none }` — so `stats.hidden = true` in openMessages() did nothing
   visible on the real phone, and the stat cards sat above the
   Messages list (user's screenshot 2, crossed out). The [hidden]
   rule below restores the hiding. The body.msg-open rule is a
   second layer: the class lives on <body> (outside <main>), so it
   survives snapshot restores that rebuild the main element. */
.stats[hidden] { display: none; }
body.msg-open .stats { display: none; }
/* v6.2.18 (item 5): NO Settings/Messages pills while the Messages
   view is open — the body class is set by openMessages() and
   cleared by closeMessages() / tab swaps. */
body.msg-open nav.bottom { display: none; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 12px;
}
.stat b { font-size: 24px; display: block; line-height: 1.2; }
.stat b.green { color: var(--emerald-ink); }
.stat span { color: var(--muted); font-size: 13px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}
.card h2 { font-size: 18px; margin-bottom: 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* server rows */
.server {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
}
.server:hover { border-color: var(--emerald); }
/* usage progress bar on dashboard server cards (v3) — real numbers:
   used GB vs the sum of that server's clients' GB limits */
.serverbar {
  flex: 1 1 100%; height: 6px;
  background: var(--surface2); border-radius: 3px; overflow: hidden;
}
.serverbar > i { display: block; height: 100%; background: var(--cyan); border-radius: 3px; }
.flag {
  width: 46px; height: 46px; flex: none;
  background: var(--surface2);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px;
  overflow: hidden;
}
/* inline SVG flags (v3) — drawn shapes, no emoji font needed */
.flag svg.flag-svg { width: 100%; height: 100%; display: block; }
.group-h .gflag svg.flag-svg { width: 100%; height: 100%; display: block; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: #22c55e; }
.dot.off { background: var(--red); }
.badge-free {
  background: var(--gold); color: var(--bg);
  font-size: 11px; font-weight: 800;
  border-radius: 12px; padding: 2px 8px;
  vertical-align: middle; margin-left: 6px;
}
.bar { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--cyan); border-radius: 3px; }

/* v6.1.8: server-row sub-line never breaks inside a word ("3X-UI"
   must not split into "3X-" / "UI"); the GB number never wraps or
   overlaps the meta text (the row wraps whole items instead). */
.server .grow .muted { word-break: keep-all; }

/* v6.1.9: narrow-phone server-row layout (max-width 560px).
   WHY v6.1.8 failed on the real phone: 15px + keep-all + nowrap only
   treated the symptoms. The single-line flex row's minimum width
   (~450px: flag 46 + name + GB + online + Key + chevron + gaps)
   exceeds a ~360px phone, so items wrapped and the vertically
   centered .used GB landed on top of the sub-line text
   ("Marzban,343 GB"). This restructures the row into 4 lines, so
   every element gets its own grid cell and overlap is structurally
   impossible. Desktop is untouched: the base flex rules above still
   apply outside this query (the .grow only becomes display:contents
   inside it, so on desktop name + sub stay stacked in one column
   exactly as before). */
@media (max-width: 560px) {
  .server {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto auto;
    column-gap: 12px;
    row-gap: 10px;
    align-items: center;
  }
  /* L1: flag + name (one line, ellipsis if ever too long) + Edit + chevron */
  .server .flag { grid-column: 1; grid-row: 1; }
  .server .grow { display: contents; }
  .server .grow > b {
    grid-column: 2; grid-row: 1;
    display: block; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* v6.1.10: Edit pill (col 3) beside the name, before the chevron */
  .server .srv-edit { grid-column: 3; grid-row: 1; align-self: center; }
  .server .chev.chev-l3 {
    grid-column: 4; grid-row: 1;
    align-self: center; justify-self: end;
  }
  /* L2: meta (left) + GB (right) — separate grid cells, never overlap */
  .server .grow .muted { grid-column: 1 / 3; grid-row: 2; }
  .server .used {
    grid-column: 3 / 5; grid-row: 2;
    display: flex; align-items: center; gap: 6px; justify-self: end;
  }
  /* L3: usage bar, full width (cyan fill unchanged) */
  .server .serverbar { grid-column: 1 / -1; grid-row: 3; }
  /* L4: online (left) + Key button (right) */
  .server .srv-online { grid-column: 1 / 3; grid-row: 4; text-align: left; }
  .server .keybtn { grid-column: 3 / 5; grid-row: 4; justify-self: end; }
}

/* client rows */
.client { padding: 14px; }
/* v6.1.8: key name in gold (#fbbf24 = var(--amber), user-picked) so it
   stands out from the white action-button text below it. Color only —
   size/weight/wrapping unchanged. */
/* v6.2.5 (item 4): key names a touch smaller so long names fit on
   one line — the text ellipsises instead of wrapping. */
/* v6.2.12: the ellipsis is GONE — key names shrink to fit instead
   (fitKeyNames in app.js steps 15px -> 10px), so a name is never
   cut to "…". overflow hidden stays as the safety net only. */
/* v6.2.18 (item 1): key names are BLUE #3B82F6 — readable on the
   dark navy AND on the light theme (no light override needed:
   #3B82F6 holds contrast on #040B1A and on #eef2f7 alike). */
.client .name { font-weight: 700; font-size: 15px; color: #3B82F6; display: flex; align-items: center; gap: 6px; }
.client .name-text { overflow: hidden; white-space: nowrap; min-width: 0; flex: 1 1 auto; }
/* v6.2.5 (item 2): the searched key flashes once when the server
   page opens on it — a soft emerald glow that fades out. */
.card.client.flash { animation: flashbg 2.4s ease-out 1; }
@keyframes flashbg {
  0% { box-shadow: 0 0 0 3px var(--emerald); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.status { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 12px; }
/* v6.2.7: "Active" is SOLID cyan neon #00E5FF with dark text, everywhere
   it appears (user order 2026-11-29 — the old translucent green is gone). */
.status.active { background: #00E5FF; color: #0b1220; }
/* v6.2.8: EVERY status pill is a DIFFERENT solid colour (user order
   2026-11-29 — the old translucent tints are gone, like Active's solid
   cyan in v6.2.7). Disabled is a darker slate than Offline's grey so
   the two never read as the same pill. */
.status.expired { background: #EF4444; color: #fff; }
.status.disabled { background: #475569; color: #fff; }
.status.over-limit { background: #F59E0B; color: #0b1220; }

/* buttons */
.btn {
  display: inline-block;
  background: var(--emerald);
  color: var(--bg);
  border: none;
  border-radius: 24px;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 700;
}
.btn:hover { background: var(--emerald-dk); }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.ghost:hover { border-color: var(--emerald); color: var(--emerald-ink); }
.btn.danger { background: var(--red); color: #fff; }
.btn.block { display: block; width: 100%; text-align: center; padding: 15px; font-size: 18px; border-radius: 28px; }
.btn:disabled { opacity: .5; cursor: default; }

/* forms */
input, select, textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--emerald); }
/* native date picker icon is dark-on-dark otherwise (v3 Edit dialog) */
input[type="date"] { color-scheme: dark; }
label { display: block; color: var(--muted); font-size: 14px; margin: 12px 0 5px; }
.searchbox { margin-bottom: 16px; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button { min-width: 0; }
/* v6.1.6: Settings preset editor rows (months / GB / price). */
.preset-row { display: flex; gap: 6px; align-items: center; margin: 6px 0; }
.preset-row input { width: 84px; flex: none; }
.preset-row .btn { flex: none; }
.seg button {
  flex: 1; padding: 12px 0; border-radius: 12px;
  background: var(--surface2); color: var(--muted);
  border: 1px solid var(--border); font-size: 16px; font-weight: 700;
}
.seg button.sel { background: var(--emerald); color: var(--bg); border-color: var(--emerald); }

/* section titles */
h2.sec { font-size: 19px; margin: 22px 0 10px; }
h2.sec:first-child { margin-top: 0; }

/* modal */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: none; align-items: flex-end; justify-content: center; z-index: 50;
}
.modal-back.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: 720px;
  padding: 20px 16px 30px;
  max-height: 85vh; overflow-y: auto;
}
.modal h3 { font-size: 20px; margin-bottom: 8px; }
.linkbox {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  word-break: break-all;
  font-size: 14px;
  margin: 10px 0;
  font-family: ui-monospace, monospace;
}

/* bottom nav — v6.2.18 (item 3): the pills are BACK in normal
   page flow, DIRECTLY under the last dashboard content (TOTAL
   EXPIRED KEYS) — the v6.2.17 fixed bottom bar was the WRONG
   reading of the user's video (see the v6.2.18 lesson: the video
   meant KEEP the in-flow placement, just make it fully visible).
   The nav lives in base.html AFTER </main>, so in flow it sits
   under whatever the page ends with, on EVERY page. The v6.2.16
   failure was clearance, not placement: main's bottom padding sits
   ABOVE the nav, so it never helped the pills themselves — the
   fixed version footer (28px) overlapped them at the bottom edge.
   The fix is margin AFTER the nav: 40px clears the 28px footer
   with 12px to spare, so the pills show COMPLETELY when scrolled
   to the bottom. Colours stay v6.2.16 (gray Settings / white
   Messages) and the badge-clip fix stays. main is back to 52px
   (footer only). */
nav.bottom {
  position: static;
  display: flex;
  padding: 10px 16px;
  margin-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
}
nav.bottom a {
  flex: 1; text-align: center; padding: 14px 0 18px;
  color: var(--muted); font-size: 15px;
}
nav.bottom a.on { color: var(--emerald); font-weight: 700; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 90px;
  transform: translateX(-50%) translateY(20px);
  background: var(--emerald); color: var(--bg);
  font-weight: 700; padding: 10px 20px; border-radius: 24px;
  opacity: 0; transition: all .25s; pointer-events: none;
  z-index: 100; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.error { background: rgba(239,68,68,.15); color: #fca5a5; border: 1px solid rgba(239,68,68,.4); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }
.center { max-width: 420px; margin: 60px auto 0; }
.spin { color: var(--muted); text-align: center; padding: 20px; }
@media (min-width: 700px) {
  .modal-back { align-items: center; }
  .modal { border-radius: 20px; border-bottom: 1px solid var(--border); }
}

/* ---- v2 ---- */
.logo-img { width: 44px; height: 44px; flex: none; border-radius: 12px; }
.badge-sales {
  background: var(--emerald); color: var(--bg);
  font-size: 11px; font-weight: 800;
  border-radius: 12px; padding: 2px 8px;
  vertical-align: middle; margin-left: 6px;
}
.badge-down {
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 800;
  border-radius: 12px; padding: 2px 8px;
  vertical-align: middle; margin-left: 6px;
}
.server.down { border-color: var(--red); }
.server.down:hover { border-color: var(--red); }
.exp-count { color: var(--red); font-weight: 700; }

/* down-server alert banner */
.alert-banner {
  background: rgba(239,68,68,.15);
  border: 1px solid var(--red);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 12px;
}
.alert-banner .warn {
  width: 30px; height: 30px; flex: none;
  background: var(--red); color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px;
}
.alert-banner b { font-size: 17px; }
.alert-banner .sub { color: #fca5a5; font-size: 13px; }
.alert-banner .retry {
  margin-left: auto; flex: none;
  background: transparent; color: #fff;
  border: 1px solid var(--red); border-radius: 20px;
  padding: 7px 16px; font-size: 15px; font-weight: 700;
}
.stat.down { border-color: var(--red); }
.stat.down b { color: var(--red); }

/* country groups on the dashboard */
.group-h {
  display: flex; align-items: center; gap: 14px;
  margin: 22px 0 12px; cursor: pointer; user-select: none;
  /* v5: roomy row + neon frame around each country group */
  padding: 14px 16px; border: 2px solid var(--emerald); border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 0 14px rgba(0, 255, 129, 0.22);
}
.group-h .gflag { width: 44px; height: 32px; flex: none; border-radius: 6px; overflow: hidden; display: block; }
.group-h b { font-size: 20px; }
.group-h .chev { margin-left: auto; color: var(--muted); font-size: 14px; }
.server .keybtn {
  flex: none;
  background: var(--emerald); color: var(--bg);
  border: none; border-radius: 20px;
  padding: 8px 14px; font-size: 14px; font-weight: 700;
}
.server .used { text-align: right; flex: none; white-space: nowrap; }
.see-all {
  display: block; width: 100%;
  background: transparent; color: var(--emerald-ink);
  border: 1px solid var(--border); border-radius: 24px;
  padding: 12px; font-size: 16px; font-weight: 700; margin-bottom: 6px;
}

/* sort / filter chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.chip-btn {
  padding: 8px 16px; border-radius: 20px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); font-size: 15px; font-weight: 700;
}
.chip-btn.sel { background: var(--emerald); color: var(--bg); border-color: var(--emerald); }
.chip-btn.sel.blue { background: #38bdf8; border-color: #38bdf8; }

/* v6.1.10: key-card action buttons in a 3-column grid — link
   buttons (Outline / Vless-WS / Vless-X) on row 1, Renew /
   Swap / Disable on row 2, Edit / Delete on row 3. Buttons are
   small enough that the longest label ("Vless-WS") fits at
   360px (12px font under 560px); labels never wrap or overflow.
   v6.1.12: Vless-XHTTP renamed Vless-X (truncated in narrow cards). */
.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.actions .btn { min-width: 0; padding: 7px 6px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) { .actions .btn { font-size: 12px; } }
.btn.sm { padding: 7px 14px; font-size: 14px; border-radius: 18px; }
.btn.sm.red { color: var(--red); border-color: rgba(239,68,68,.5); }
.client .name-row { display: flex; align-items: center; gap: 8px; }

/* ---- v4 ---- */
/* dashboard section headings — ALL CAPS, one colour each */
/* v5: each heading sits in a SOLID colour box with dark text */
h2.sec { text-transform: uppercase; letter-spacing: 0.5px; padding: 10px 14px; border-radius: 10px; }
/* v6.1.15: FIND A KEY / FIND A SERVER are boxes with a magnifier at
   the far right — tapping it turns the box itself into the search
   field (the separate Find/Filter input boxes are gone). The head is
   a button so the whole box is tappable; the input view keeps the
   same solid colour with a darker inset field. Same colours as the
   old h2.sec-find / h2.sec-servers boxes they replace. */
.findbox { margin: 22px 0 16px; border-radius: 10px; padding: 10px 14px; }
.findbox.find-key { background: #38bdf8; }
.findbox.find-server { background: var(--emerald); }
.findbox-head {
  display: flex; align-items: center; width: 100%;
  background: none; border: none; padding: 0; cursor: pointer;
  color: #0b1220; font: inherit; font-size: 19px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; text-align: left;
}
.findbox-mag { margin-left: auto; flex: none; }
.findbox-input { display: none; align-items: center; gap: 8px; }
.findbox.open .findbox-input { display: flex; }
.findbox.open .findbox-head { display: none; }
.findbox-input input {
  flex: 1; min-width: 0; padding: 10px 12px;
  background: rgba(11, 18, 32, 0.28); border: 1px solid transparent;
  border-radius: 9px; color: #fff; font-size: 15px;
}
.findbox-input input::placeholder { color: rgba(255, 255, 255, 0.75); }
.findbox-input input:focus {
  border-color: rgba(255, 255, 255, 0.6); box-shadow: none;
}
.findbox-x {
  flex: none; background: none; border: none; padding: 0 4px;
  color: #0b1220; font-size: 22px; font-weight: 700; cursor: pointer;
  line-height: 1;
}
h2.sec-exp { color: #0b1220; background: #f59e0b; }
/* stat numbers — one colour each (down state still turns it red) */
.stat b.stat-green { color: var(--emerald-ink); }
.stat b.stat-blue { color: #38bdf8; }
.stat b.stat-red { color: var(--red); }
/* v6.2.12: the NEW badge is GONE (user order 2026-11-30) — its rules
   are removed, not just hidden. If a badge ever comes back, it goes
   ONLY on today's sold keys. */
/* slimmer usage bar on key cards — snug under the exp line
   (v6.2.24, item 3: the compact card pulls the bar up). */
.client .bar { height: 5px; margin-top: 4px; }
/* collapsible key-section header (v4) — tap to show/hide */
.sec-head {
  display: flex; align-items: center; gap: 10px;
  margin: 22px 0 10px; cursor: pointer; user-select: none;
}
.sec-head h2.sec { margin: 0; flex: none; }
.sec-head .chev { color: var(--muted); font-size: 14px; }
.badge-exp {
  background: var(--red); color: #fff;
  font-size: 13px; font-weight: 800;
  border-radius: 12px; padding: 2px 9px;
  margin-left: auto;
}
/* bottom nav — one colour per tab; active tab is a filled pill */
nav.bottom a { margin: 8px 6px; border-radius: 20px; padding: 10px 0 12px; }
nav.bottom a.nav-servers { color: var(--emerald); }
nav.bottom a.nav-search { color: #38bdf8; }
nav.bottom a.nav-settings { color: #f59e0b; }
nav.bottom a.on.nav-servers { background: var(--emerald); color: var(--bg); }
nav.bottom a.on.nav-search { background: #38bdf8; color: var(--bg); }
nav.bottom a.on.nav-settings { background: #f59e0b; color: var(--bg); }
/* small flag tile on Settings rows */
.flag-sm {
  width: 40px; height: 40px; flex: none;
  background: var(--surface2);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; font-weight: 700; font-size: 14px;
}
.flag-sm svg.flag-svg { width: 100%; height: 100%; display: block; }

/* ---- v5 ---- */
/* every key card gets its own neon frame, so cards stand apart */
.card.client {
  border: 2px solid var(--emerald);
  margin-bottom: 14px;
  box-shadow: 0 0 10px rgba(0, 255, 129, 0.18);
}
/* v6.2.8: frame rule — RED only when the key is EXPIRED; GOLD when it
   expires within 3 days (the "Expiring in 3 days" gold #F59E0B). The
   old 24h-red rule (expiring-today) painted still-valid keys red —
   e.g. Nov29-TEST-KEY, exp 30 Nov 2026, showed a red frame while it
   was still valid. frameClass() in app.js assigns these classes. */
.card.client.frame-expired { border-color: #EF4444; }
.card.client.frame-expiring { border-color: #F59E0B; }

/* ---- v6 ---- */
/* login page (approved sample): hero shield + neon card + glowing button */
.login-page { margin-top: 40px; }
.login-hero { text-align: center; margin-bottom: 24px; }
.login-logo {
  width: 96px; height: 96px; border-radius: 24px;
  box-shadow: 0 0 28px rgba(0, 255, 129, 0.55);
}
.login-title { color: var(--emerald-ink); font-size: 28px; letter-spacing: 1px; margin-top: 14px; line-height: 1.15; }
.login-sub { color: var(--muted); font-size: 15px; margin-top: 2px; }
.login-card {
  border: 2px solid var(--emerald);
  box-shadow: 0 0 18px rgba(0, 255, 129, 0.25);
}
.login-card h2 { font-size: 22px; margin-bottom: 2px; }
.login-btn { box-shadow: 0 0 16px rgba(0, 255, 129, 0.45); }
.login-foot { text-align: center; margin-top: 16px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 64px; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; color: var(--emerald-ink);
  font-size: 13px; font-weight: 800; padding: 6px 8px;
}
/* dashboard polish (approved sample): neon stat cards, bigger inputs,
   country group meta on the right */
.stat {
  border: 2px solid var(--emerald);
  box-shadow: 0 0 14px rgba(0, 255, 129, 0.18);
}
.stat b { font-size: 28px; }
.searchbox input { padding: 14px 16px; }
.searchbox input:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 12px rgba(0, 255, 129, 0.25);
}
.group-h .meta { margin-left: auto; text-align: right; }
.group-h .chev { margin-left: 6px; }
.group-h .meta .n { font-size: 15px; font-weight: 700; color: var(--emerald-ink); }
.group-h .meta .s { font-size: 12px; color: var(--muted); }
.group-h .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--emerald); box-shadow: 0 0 8px var(--emerald); flex: none;
}
/* VLESS section heading on the server page */
h2.sec-vless { color: #0b1220; background: #38bdf8; }
/* protocol badge on key cards + search results */
.badge-vless {
  background: #38bdf8; color: #0b1220;
  font-size: 11px; font-weight: 800;
  border-radius: 12px; padding: 2px 8px;
  vertical-align: middle; margin-left: 8px;
}
.badge-outline {
  background: var(--emerald); color: var(--bg);
  font-size: 11px; font-weight: 800;
  border-radius: 12px; padding: 2px 8px;
  vertical-align: middle; margin-left: 8px;
}

/* ---- v6.1 ---- */
/* stat cards: 2x2 grid on mobile, 4 across on wide screens; every card
   is bordered in its own colour (green servers, blue active keys,
   yellow expiring, red expired). */
.stats { grid-template-columns: 1fr 1fr; }
@media (min-width: 700px) { .stats { grid-template-columns: 1fr 1fr 1fr 1fr; } }
.stat.stat-green { border-color: var(--emerald); box-shadow: 0 0 14px rgba(0, 255, 129, 0.18); }
.stat.stat-blue { border-color: #38bdf8; box-shadow: 0 0 14px rgba(56, 189, 248, 0.18); }
.stat.stat-yellow { border-color: #facc15; box-shadow: 0 0 14px rgba(250, 204, 21, 0.18); }
.stat.stat-red { border-color: var(--red); box-shadow: 0 0 14px rgba(239, 68, 68, 0.18); }
.stat b.stat-yellow { color: #facc15; }
/* key-section bars (v6.1) */
h2.sec-exp3 { color: #0b1220; background: #facc15; }
h2.sec-lowgb { color: #0b1220; background: #f97316; }
h2.sec-expired { color: #fff; background: var(--red); }
.badge-lowgb {
  background: #c2410c; color: #fff;
  font-size: 13px; font-weight: 800;
  border-radius: 12px; padding: 2px 9px;
  margin-left: auto;
}
.badge-expired {
  background: #7f1d1d; color: #fff;
  font-size: 13px; font-weight: 800;
  border-radius: 12px; padding: 2px 9px;
  margin-left: auto;
}
/* owner groups (admin dashboard): the person sub-groups inside OTHER
   are darker boxes than the neon country/owner group frames. */
.person-h {
  display: flex; align-items: center; gap: 14px;
  margin: 12px 0; cursor: pointer; user-select: none;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface2);
}
.person-h b { font-size: 18px; }
.person-h .meta { margin-left: auto; text-align: right; }
.person-h .meta .n { font-size: 15px; font-weight: 700; color: var(--emerald-ink); }
.person-h .meta .s { font-size: 12px; color: var(--muted); }
.person-h .chev { color: var(--muted); font-size: 14px; }
.person-h .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--emerald); box-shadow: 0 0 8px var(--emerald); flex: none;
}
.person-body { padding: 0 4px 8px; }
/* server page: bigger blue "← All servers" back link */
.back-link { margin-bottom: 12px; }
.back-link a { display: inline-flex; align-items: center; gap: 4px; color: #38bdf8; font-size: 26px; font-weight: 800; }
/* v6.1.1: the arrow is a real 30px SVG (the old ← text glyph rendered
   small and thin) — same blue #38BDF8 as the text. */
.back-link svg.back-arrow { width: 30px; height: 30px; flex: none; }
/* Bulk Create button: blue outline, next to the green + Add Key */
.btn.bulk-btn {
  background: transparent; color: #38bdf8;
  border: 2px solid #38bdf8;
}
.btn.bulk-btn:hover { background: rgba(56, 189, 248, .12); color: #38bdf8; }
/* bulk delete: select-all bar + per-row checkboxes */
.sel-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px;
}
.sel-all { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; color: var(--text); cursor: pointer; margin: 0; }
.sel-all input[type="checkbox"] { width: 18px; height: 18px; accent-color: #38bdf8; margin: 0; }
.key-check { width: 18px; height: 18px; accent-color: #38bdf8; flex: none; margin: 0; }
/* online / offline pill on key rows (next to the status badge) */
.badges { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
/* v6.2.7: the status stack is one tidy right-aligned column — every
   pill the same width with centred text (the scattered Active / Online
   / Outline the user circled on his phone). */
.badges .status, .badges .pill-online, .badges .pill-offline,
.badges .pill-proto, .badges .pill-new { width: 84px; text-align: center; }
/* v6.2.18 (item 1): the green New badge — solid #22C55E, white
   text, same width as the status pills above it, sitting under
   Active/Offline in the right-hand column. */
.pill-new { background: #22C55E; color: #fff; font-size: 12px; font-weight: 800;
  padding: 3px 9px; border-radius: 12px; }
/* v6.2.7: search cards stack THREE pills (Active / Online / protocol)
   in the row height the name + 2-line meta already sets (~60px), so
   the card does NOT grow: 3 x ~15px pills + 2 x 2px gaps ≈ 50px, inside
   the ~53px the old 2-pill stack already took. Font a touch smaller,
   as the user allowed. */
.badges.compact { gap: 2px; }
.badges.compact .status, .badges.compact .pill-online,
.badges.compact .pill-offline, .badges.compact .pill-proto,
.badges.compact .pill-new {
  font-size: 11px; line-height: 1.2; padding: 1px 8px;
}
/* protocol pill on search cards — a copy button shaped like the other
   pills; same copyLink behaviour as the old "Outline" button it
   replaces. v6.2.8: solid colours, one per protocol — Outline blue,
   VLESS purple (the dark fill + grey frame are gone). */
.pill-proto {
  font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 12px;
  border: none; white-space: nowrap; cursor: pointer; font-family: inherit;
}
.pill-proto-outline { background: #3B82F6; color: #fff; }
.pill-proto-vless { background: #A855F7; color: #fff; }
/* v6.2.8: Online / Offline are solid boxes too — Online solid green
   with a dark-green dot, Offline solid grey with a white dot. */
.pill-online {
  font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 12px;
  background: #22C55E; color: #052e16; border: none; white-space: nowrap;
}
.pill-offline {
  font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 12px;
  background: #64748B; color: #fff; border: none; white-space: nowrap;
}
/* bottom nav (v6.1): all three tabs solid-filled pills; Settings is
   PURPLE so it never reads as the orange LOW GB bar. The active tab
   gets a white ring so the current page stays obvious. */
nav.bottom a.nav-settings { color: #a855f7; }
nav.bottom a.on.nav-settings { background: #a855f7; color: #fff; }
nav.bottom a.on { box-shadow: 0 0 0 2px #fff; }

/* ---- v6.1.1 ---- */
/* bottom nav (DEFECT 2): ALL THREE tabs are always solid-filled pills
   (Servers green, Search blue, Settings purple) — before, only the
   .on tab was filled and Search/Settings were coloured text only.
   The white ring still marks the active tab. These rules sit last so
   they win over the colour-only rules above at equal specificity. */
nav.bottom a.nav-servers { background: var(--emerald); color: var(--bg); }
nav.bottom a.nav-search { background: #38bdf8; color: var(--bg); }
nav.bottom a.nav-settings { background: #a855f7; color: #fff; }

/* ---- v6.1.2 ---- */
/* Resellers have no bottom nav (admin-only, see base.html), so the
   large bottom padding that clears the fixed nav would be dead space
   on their pages — and the toast's 90px bottom offset would float it. */
body[data-role="reseller"] main { padding-bottom: 24px; }
body[data-role="reseller"] #toast { bottom: 24px; }

/* ---- v6.1.3 ---- */
/* ITEM 6 — frame colors: owner-level frames (MY SERVERS, OTHER) stay
   neon green; COUNTRY-group frames (SG / JP / TH, admin and reseller)
   are BLUE — the same #38BDF8 as the Search pill. Only the frame
   changes; section colours, nav pills and everything else stay. */
.group-h.country { border-color: #38bdf8; box-shadow: 0 0 14px rgba(56, 189, 248, 0.22); }
/* v6.1.15: owner headers are SOLID colour boxes — MY SERVERS solid
   cyan, OTHERS' solid light purple — dark text, dark dot + chevron.
   Neither colour repeats any other box on the page: FIND A KEY is
   blue #38BDF8, FIND A SERVER is green #00FF81, TOTAL bars are
   yellow/orange/red. Country groups + channel headers keep their
   neon frames (untouched). */
.group-h.owner-mine { background: #00e5ff; border-color: #00e5ff; box-shadow: 0 0 14px rgba(0, 229, 255, 0.25); color: #0b1220; }
.group-h.owner-others { background: #c084fc; border-color: #c084fc; box-shadow: 0 0 14px rgba(192, 132, 252, 0.25); color: #0b1220; }
.group-h.owner-mine b, .group-h.owner-others b { color: #0b1220; }
.group-h.owner-mine .meta .n, .group-h.owner-others .meta .n { color: #0b1220; }
.group-h.owner-mine .meta .s, .group-h.owner-others .meta .s { color: rgba(11, 18, 32, 0.72); }
.group-h.owner-mine .dot, .group-h.owner-others .dot { background: #0b1220; box-shadow: none; }
.group-h.owner-mine .chev.chev-l1, .group-h.owner-others .chev.chev-l1 { color: #0b1220; }
/* ITEM 5 — total-online strip: full-width stat-style row under the
   4 cards, same card look (emerald border + glow, big green number). */
.online-strip {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 2px solid var(--emerald);
  border-radius: 16px; padding: 12px 16px; margin-bottom: 20px;
  box-shadow: 0 0 14px rgba(0, 255, 129, 0.18);
}
.online-strip b { font-size: 28px; color: var(--emerald-ink); }
.online-strip span { color: var(--muted); font-size: 14px; }
.online-strip .dot { width: 12px; height: 12px; }
/* ---- v6.2.1: Down Servers ---- */
/* The online strip is now TWO half-width boxes. Left keeps the green
   online strip (same colours, number stacked over the label so it
   fits); right is the red Down Servers box — a <button>, tappable,
   opens the down-only view. Red is #ef4444 on dark, #b91c1c on light
   (the same darker-red pattern as the Logout pill), so the frame +
   count stay readable in both themes. */
.online-row { display: flex; gap: 8px; margin-bottom: 20px; }
.online-row .online-strip, .online-row .down-strip { flex: 1 1 0; min-width: 0; margin-bottom: 0; }
.online-row .online-strip { display: block; }
.online-strip .os-top, .down-strip .os-top { display: flex; align-items: center; gap: 10px; }
.online-strip .os-label, .down-strip .os-label { color: var(--muted); font-size: 13px; }
.down-strip {
  font: inherit; text-align: left; cursor: pointer;
  background: var(--surface); border: 2px solid var(--red);
  border-radius: 16px; padding: 12px 16px;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.18);
}
.down-strip b { font-size: 28px; color: var(--red); }
.down-strip .os-chev { margin-left: auto; color: var(--red); font-size: 20px; font-weight: 800; line-height: 1; }
html[data-theme="light"] .down-strip { border-color: #EC4899; box-shadow: 0 0 14px rgba(236, 72, 153, 0.15); }
html[data-theme="light"] .down-strip b, html[data-theme="light"] .down-strip .os-chev { color: #500724; }
/* Down-only view header: big back arrow, title, red count badge. */
.down-view-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 8px; }
.down-back { font: inherit; font-size: 30px; font-weight: 800; line-height: 1; color: var(--emerald-ink); background: none; border: none; cursor: pointer; padding: 0 6px 0 0; }
.down-view-head h2 { font-size: 20px; margin: 0; flex: none; }
.down-count-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 13px; font-weight: 800; border-radius: 12px; padding: 3px 10px; }
html[data-theme="light"] .down-count-badge { background: #b91c1c; }
/* Down-view rows: the "last seen" line is red (darker red on light). */
.server.down-row .down-seen { color: var(--red); }
html[data-theme="light"] .server.down-row .down-seen { color: #b91c1c; }
/* v6.2.1: at phone width the shared .server media query puts every
   .grow .muted on grid row 2 — the down row has TWO meta lines, so
   the "last seen" line gets its own row 3 instead of overlapping. */
@media (max-width: 560px) {
  .server.down-row .grow .down-seen { grid-column: 1 / -1; grid-row: 3; }
}
/* v6.1.3 + chevron update: expand-arrow hierarchy — parent vs child
   arrows differ in colour AND size (colour matters most). L1 owner
   groups (MY SERVERS / OTHER) green 18px; L2 country + channel
   groups blue 14px; L3 server rows grey 13px. Triple-class selectors
   so these win over the plain .chev rules regardless of order.
   Nothing is made smaller than the old 14px chevrons: L1 grows,
   L2 stays 14px, L3 is new (server rows had no arrow before).
   Section-header chevrons (.sec-head .chev) are NOT touched. */
.group-h .chev.chev-l1 { color: #00ff81; font-size: 18px; }
.group-h .chev.chev-l2, .person-h .chev.chev-l2 { color: #38bdf8; font-size: 12px; }
.server .chev.chev-l3 { color: #94a3b8; font-size: 13px; flex: none; }
/* v6.1.4 — per-server online count on dashboard server rows:
   "● N online" green bold + "of N keys" small grey, on the row's
   right next to the grey chevron. Same live source as the Total
   online strip; the row wraps on narrow phones (flex-wrap).
   v6.1.10: the two lines are LEFT-aligned (was right) — on the
   mobile 4-line grid the online block must sit flush-left at the
   card's left edge (line 4), and this later rule was overriding
   the media query's text-align:left (same specificity, later
   wins), which is why v6.1.9 showed it center/right next to
   + Key. The block's POSITION on desktop is unchanged (right
   side, next to Key); only the lines' alignment changes. */
.server .srv-online { text-align: left; flex: none; }
.server .srv-online .n { font-size: 14px; font-weight: 800; color: #4ade80; white-space: nowrap; }
.server .srv-online .n .dot { width: 8px; height: 8px; display: inline-block; margin-right: 5px; vertical-align: 1px; }
.server .srv-online .lbl { font-size: 11px; color: var(--muted); }

/* ---- v6.1.10 ---- */
/* Server-row Edit pill (Item 4): small outlined button on line 1 of
   every server row, beside the name, before the chevron. Flex item
   on desktop; grid cell (col 3, row 1) on narrow phones. The
   .btn.ghost.sm classes give it the outlined-pill look. */
.server .srv-edit { flex: none; white-space: nowrap; }
/* "+" button on country-group headers (Item 5, admin only): opens
   the add-server form with that country pre-filled. Sits between
   the group meta and the expand chevron. v6.1.17: the same circular
   button also sits on reseller owner-group headers (.person-h) —
   same size, border and colour, opening the form with that reseller
   as the Owner. */
.group-h .group-add, .person-h .group-add {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid #38bdf8; background: transparent; color: #38bdf8;
  font-size: 18px; font-weight: 800; line-height: 1;
}
.group-h .group-add:hover, .person-h .group-add:hover { background: rgba(56, 189, 248, .12); }

/* ---- v6.1.11 ---- */
/* Fixed layout, 3X-UI style (user's complaint, 2026-11-28): on his
   phone the bottom nav's Settings button ran off the right edge, the
   Singapore group meta stacked vertically ("6 / servers / 444 keys /
   • all / online"), and the layout differed between phones/browsers/
   zoom. Zoom is NOT disabled — the layout is fixed instead. */

/* Nothing on the page may widen the layout viewport past the screen:
   one overflowing element used to stretch the page, which pushed the
   fixed nav's right end off-screen. overflow: clip (not hidden) so
   the sticky header keeps working — clip creates no scroll container. */
html, body { overflow-x: hidden; overflow-x: clip; }

/* Bottom nav: the three tabs sit in a centered inner container at the
   same 720px max-width as the page content, so the bar is identical
   at 360px, 430px and desktop. Each tab flexes equally, min-width: 0
   so it can shrink below its content, nowrap + ellipsis so a label
   can never push its neighbour off the screen. Safe-area padding so
   the pills clear the Android gesture bar / iPhone home indicator,
   and the page content is padded by the same amount. */
nav.bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }
nav.bottom .nav-inner {
  display: flex; width: 100%; max-width: 720px; margin: 0 auto;
}
nav.bottom a {
  flex: 1 1 0; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
main { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }

/* Country-group (and reseller channel) headers: the meta gets its own
   dedicated line — the name row keeps flag + name + dot + "+" +
   chevron, and the meta wraps to line 2 at full width. order: 5 puts
   it after the "+" and chevron in layout flow, so they stay on the
   name row. One line, never stacked: nowrap + ellipsis, and the
   string is short enough to fit 360px whole ("6 servers • 444 keys •
   all online" is ~240px at 14px). Owner headers (MY SERVERS / OTHER)
   keep their two-line meta: their short fixed names leave it room. */
.group-h.country, .person-h { flex-wrap: wrap; row-gap: 8px; }
.group-h.country .meta, .person-h .meta {
  flex: 1 1 100%; order: 5; min-width: 0;
  margin-left: 0; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.group-h.country .meta .n, .person-h .meta .n,
.group-h.country .meta .s, .person-h .meta .s {
  display: inline; font-size: 14px; font-weight: 700; color: var(--emerald-ink);
}

/* ---- v6.1.13 ---- */
/* ITEM 1 — version footer: "KHP Panel • v6.1.13" at the bottom of
   EVERY page, BELOW the bottom nav (fixed, always visible). The nav
   is lifted by the footer's height, and the page/toast bottom
   padding grows by the same 28px so nothing is hidden behind it.
   Resellers have no nav, so only their padding/toast move. */
footer.ver-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  height: calc(28px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border-top: 1px solid var(--border);
  color: var(--muted); font-size: 13px;
}
footer.ver-foot b { color: var(--muted); font-weight: 700; margin-left: 4px; }
/* v6.2.20 (item b): the footer is display:flex, so the space in
   "Version <b>6.2.19</b>" collapsed away (a flex item's trailing
   whitespace is dropped) and the live footer read "Version6.2.19".
   The margin puts the space back. */
/* v6.2.18 (item 3): main clearance back to 52px (footer only) —
   the pills are in flow now, so the 138px fixed-bar clearance is
   gone; the nav's own 40px bottom margin clears the footer.
   v6.2.24 (item 8): clearance is 16px now — the pills sit ONE small
   gap below the last total box, like the gap between the total
   boxes. The nav margin below still clears the fixed footer. */
main { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
body[data-role="reseller"] main { padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px)); }
#toast { bottom: calc(52px + env(safe-area-inset-bottom, 0px)); }
body[data-role="reseller"] #toast { bottom: calc(52px + env(safe-area-inset-bottom, 0px)); }

/* ITEM 2 — group-header actions at the FAR RIGHT: the "+" add-server
   button and the expand chevron live in one .g-actions wrapper that
   is pushed to the row's right edge with a clear 14px gap between
   them. Before, they hung cramped mid-row (right after the dot)
   with empty space to their right. The owner headers (MY SERVERS /
   OTHER) keep their two-line meta's margin-left:auto doing the
   pushing, so their wrapper only needs the 6px gap the chevron
   had before. The chevron rules stay (L1 green 18px, L2 blue 14px)
   — only the position changes. */
/* v6.2.19 (item 6): + on TOP, chevron BELOW, slightly smaller —
   the two controls stack vertically (approved sample). */
.g-actions { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.group-h.country .g-actions, .person-h .g-actions { margin-left: auto; }
.group-h .g-actions { margin-left: 6px; }
.g-actions .chev { margin-left: 0; }
.g-actions .group-add { margin-left: 0; }

/* ITEMS 5+6 — TOTAL / owner section bars (sec-head): the badge sits
   OUTSIDE the coloured bar, to its right, in the BAR's own colour
   (yellow expiring, orange low-GB, red expired) — before, all three
   badges were dark red/maroon regardless of the bar. The bar itself
   is now flex:1 with min-width:0 (it was flex:none, so the long
   "TOTAL LOW GB — UNDER 10 GB LEFT" label took the whole row and
   pushed the number off-screen — the old Low GB bug). The label
   v6.1.14: the Low GB label is shortened to "TOTAL UNDER 10GB
   LEFT" (user: 12px was too small, keep 19px) so all three labels
   render at 19px on ONE line beside the badge at 360px (measured
   with Liberation Sans Bold: "TOTAL UNDER 10GB LEFT" 242px,
   "TOTAL EXPIRING IN 3 DAYS" 254px, "TOTAL EXPIRED KEYS" 207px,
   vs a ~256px text budget after the side padding was trimmed
   12px -> 10px). min-width:0 + normal wrapping is the safety net:
   on a device whose font runs wider, the label wraps instead of
   ever pushing the badge off-screen again.
   The chevron and "tap to show" text are gone from the markup
   (app.js secHeaderHtml); the bar stays tappable to expand. */
.sec-head h2.sec { flex: 1 1 auto; min-width: 0; }
.badge-exp { background: #facc15; color: #0b1220; }
.badge-lowgb { background: #f97316; color: #0b1220; }
.badge-expired { background: var(--red); color: #fff; }
@media (max-width: 560px) {
  /* v6.2.22 (coordinator): DejaVu Bold runs wider than the Liberation
     Sans Bold the v6.1.14 one-line measurements used (TOTAL EXPIRING
     IN 3 DAYS 288px, TOTAL UNDER 10GB LEFT 269.5px vs the ~256px text
     budget at 19px), so the two longest TOTAL bars would wrap to two
     lines. 16px keeps every TOTAL/status bar one line at 360px
     (worst: TOTAL EXPIRING 242.7px). Desktop 19px untouched. */
  .sec-head h2.sec { font-size: 16px; padding: 10px 10px; }
}

/* ---- v6.2.3 ---- */
/* TODAY'S SALES (reseller-only): solid green box directly above
   the EXPIRING IN 3 DAYS bar. Same green as FIND A SERVER
   (var(--emerald) #00ff81) with dark text — the approved sample's
   green. The bar is a .sec-head like the TOTAL bars (v6.1.13): the
   count badge sits OUTSIDE the bar, in the bar's own colour. No
   chevron (user: the arrow is not needed — everyone knows to tap).
   The + / − round buttons live INSIDE the bar, pulled back from
   its right edge. v6.2.3: ONE line only — the "N servers on sale"
   sub-line is gone (the count badge already shows the number), so
   the bar is exactly the TOTAL bars' height: same h2.sec padding +
   19px label, body line-height 1.45 (27.6px line) — taller than
   the 26px round buttons, so the buttons can never stretch it.
   The bar is flex so nothing can push the buttons or the badge
   off-screen at 360px. Rows navigate to /server/<id> (v6.2.3). */
h2.sec-sale { color: #0b1220; background: var(--emerald);
  display: flex; align-items: center; gap: 8px; }
.sales-title { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sales-actions { display: flex; gap: 6px; flex: none; margin-left: auto; }
.sales-round { flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #0b1220; background: transparent; color: #0b1220;
  font-size: 16px; font-weight: 800; line-height: 1; cursor: pointer; padding: 0; }
.badge-sale { background: var(--emerald); color: #0b1220;
  font-size: 13px; font-weight: 800;
  border-radius: 12px; padding: 2px 9px; margin-left: auto; }
/* expanded: the rows continue the SAME green box (no gap, square
   bottom corners on the bar, square top corners on the list). */
.sales-head.sales-open h2.sec-sale { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.sales-list { background: var(--emerald); border-radius: 0 0 10px 10px;
  margin: -10px 0 10px; padding: 2px 0 8px; }
.sales-row { display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; color: #0b1220; font-size: 15px; font-weight: 700;
  cursor: pointer; }
/* v6.2.3: rows navigate to the server page (tap = open /server/<id>),
   so the row is a pointer — the SALE pill stays put at the right. */
.sales-row .sale-badge { margin-left: auto; }
.sales-empty { padding: 8px 14px; color: rgba(11, 18, 32, 0.72); font-size: 14px; }
/* v6.2.4: Sub-info dialog rows (label left, value right). */
.subinfo-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.subinfo-row:last-child { border-bottom: 0; }
/* the SALE badge — the SAME small SOLID GOLD pill with dark text
   everywhere it shows: the box rows, the dashboard server rows,
   and the server-page header. User pick A (2026-11-29 13:03):
   solid gold reads on the dark server rows AND on the bright
   green box. The style lives ONLY in this one .sale-badge rule,
   so a future restyle swaps in here and restyles everywhere at
   once. Do not restyle the badge anywhere else. */
.sale-badge { background: #F59E0B; color: #111827;
  font-size: 11px; font-weight: 800;
  border-radius: 12px; padding: 2px 8px;
  vertical-align: middle; margin-left: 6px; white-space: nowrap; }
/* v6.2.9: TODAY'S SOLD KEY — the orange box that replaced FIND A
   SERVER. Same bar shape as TODAY'S SALES (one line, 19px label,
   count badge at the far right edge); the expanded list is a card
   with an orange frame (not a solid fill — the rows need to read
   as a list, like the sample). The bar is the SAME fixed orange in
   both themes; the list rows use theme surfaces so they read in
   light mode too. */
h2.sec-sold { color: #431407; background: #F97316;
  display: flex; align-items: center; gap: 8px; }
.badge-sold { background: #431407; color: #fff;
  font-size: 13px; font-weight: 800;
  border-radius: 12px; padding: 2px 9px; margin-left: auto; }
.sold-head.sold-open h2.sec-sold { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.sold-list { background: var(--surface); border: 2px solid #F97316;
  border-top: 0; border-radius: 0 0 10px 10px;
  margin: -10px 0 10px; padding: 10px 12px 12px; }
.sold-label { color: var(--muted); font-size: 14px; font-weight: 700;
  padding: 2px 2px 6px; }
.sold-row { display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px; margin-bottom: 6px;
  font-size: 15px; font-weight: 700; }
.sold-num { color: var(--muted); flex: none; }
.sold-name { flex: 1 1 auto; min-width: 0; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.sold-dur { color: var(--gold); flex: none; }
.sold-country { color: var(--cyan); flex: none; }
.sold-count { margin-left: auto; flex: none; }
.sold-divider { height: 2px; background: #F97316; margin: 10px 2px; border-radius: 1px; }
.sold-more { color: var(--muted); font-size: 14px; padding: 2px 2px 4px; }
.sold-empty { color: var(--muted); font-size: 14px; padding: 6px 2px; }
.sold-total { background: rgba(245, 158, 11, 0.14); border-color: #F97316; }
.sold-total .sold-name { color: var(--gold); }
/* light theme: the neon cyan/gold need darker inks on white. */
html[data-theme="light"] .sold-dur { color: #b45309; }
html[data-theme="light"] .sold-country { color: #0284c7; }
html[data-theme="light"] .sold-total .sold-name { color: #b45309; }
/* + / − picker rows inside the shared action modal. */
.sales-pick-country { display: flex; align-items: center; gap: 8px;
  margin: 14px 0 4px; font-size: 16px; }
.sales-pick-country .gflag { width: 26px; height: 18px; flex: none; }
.sales-pick-row { display: flex; align-items: center; gap: 10px;
  padding: 10px 2px; border-bottom: 1px solid var(--border); cursor: pointer; }
.sales-pick-row.is-disabled { opacity: .45; cursor: default; }
.sales-pick-name { font-weight: 700; font-size: 15px; }
.sales-pick-row .muted { margin-left: auto; text-align: right; }

/* ---- v6.2.10 ---- */
/* ITEM 4 — header brand is a reload button (logo + channel name). */
/* v6.2.12 — version under "Own VPN Panel": SMALL white 11px in dark
   mode; dark ink on light mode (white would vanish on the light
   header). Replaces the v6.2.10/6.2.11 beside-the-name version. */
.hdr-brand { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.hdr-ver-sub { color: #fff; font-size: 11px; font-weight: 700; line-height: 1.3; }
html[data-theme="light"] .hdr-ver-sub { color: #0b1220; }
/* ITEM 5 — the bottom nav is now ONE floating circular Settings
   button (admin only). The old pill rules (nav-servers / nav-search /
   nav-settings) no longer match anything and stay as dead CSS. */
nav.bottom a.nav-circle { flex: none; width: 64px; height: 64px;
  margin: 6px auto; padding: 0; border-radius: 50%;
  background: #22C55E; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .45); }
/* ITEM 2 — sold-history date navigator in the orange bar (‹ ›) and
   the Last-30-days rows. The nav buttons are flex-none siblings of
   the flexing h2; .off dims the dead end (30 days back / today). */
.sold-nav { flex: none; background: none; border: 0; color: #431407;
  font-size: 26px; font-weight: 800; line-height: 1; padding: 4px 6px;
  cursor: pointer; }
.sold-nav.off { opacity: .3; cursor: default; }
.sold-row.tappable { cursor: pointer; }
.sold-chev { color: var(--muted); flex: none; font-size: 18px; }
.sold-day { cursor: pointer; }
.sold-day.is-viewing { border-color: #F97316; }
/* ITEM 6 — Settings buttons-first menu: six solid bars, one per
   section; the sections hide until opened, Back returns to the menu. */
.set-menu { display: flex; flex-direction: column; gap: 12px; }
.set-menu-btn { display: flex; align-items: center; justify-content: space-between;
  width: 100%; border: 0; border-radius: 14px; padding: 16px 20px;
  font-size: 19px; font-weight: 800; letter-spacing: .5px;
  cursor: pointer; text-align: left; }
.set-menu-btn span { font-size: 22px; }
.set-m-servers { background: #00E5FF; color: #082F49; }
.set-m-add { background: #22C55E; color: #052E16; }
.set-m-users { background: #C084FC; color: #431407; }
.set-m-adduser { background: #F59E0B; color: #431407; }
.set-m-backup { background: #3B82F6; color: #fff; }
.set-m-import { background: #F97316; color: #431407; }
.set-back { margin-bottom: 4px; }
/* ITEM 6 — owner groups inside SERVERS, per-reseller rows inside
   USERS. KHP (admin) starts open, the rest collapsed; a chevron
   rotates when its group is open. */
.set-owner-head, .set-user-head { display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px;
  cursor: pointer; font-size: 17px; font-weight: 700; }
.set-owner-name, .set-user-name { flex: none; }
.set-owner-count { margin-left: auto; color: var(--cyan); font-size: 15px; }
.set-user-disp { flex: 1 1 auto; min-width: 0; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.set-owner-chev { color: var(--muted); flex: none; font-size: 20px;
  transition: transform .15s ease; }
.is-open .set-owner-chev { transform: rotate(90deg); }
.set-owner-servers .card, .set-user-body { margin-bottom: 8px; }
.set-user-body { background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }

/* ---- v6.2.15 ---- */
/* (11) Stat cards SOLID — Sample 2 (user pick 2026-11-30): the 4
   stat cards + the online/down strip are solid DEEP tones with WHITE
   text throughout (no borders, no glows, no coloured numbers).
   Servers #16A34A, active #2563EB, expiring #D97706, expired
   #DC2626, online #16A34A, down #DC2626. Same colours in both
   themes — the light-theme overrides below stay dead. */
.stat.stat-green { background: #16A34A; border-color: #16A34A; box-shadow: none; }
.stat.stat-blue { background: #2563EB; border-color: #2563EB; box-shadow: none; }
.stat.stat-yellow { background: #D97706; border-color: #D97706; box-shadow: none; }
.stat.stat-red { background: #DC2626; border-color: #DC2626; box-shadow: none; }
.stat b.stat-green, .stat b.stat-blue, .stat b.stat-yellow, .stat b.stat-red { color: #fff; }
.stat.stat-green span, .stat.stat-blue span, .stat.stat-yellow span, .stat.stat-red span { color: rgba(255, 255, 255, 0.85); }
/* (8) the EXPIRED card is tappable (scrolls to + expands TOTAL
   EXPIRED KEYS); the EXPIRING card stays DEAD — no pointer, no
   hover lift (user: too many keys, 489). */
.stat-tappable { cursor: pointer; }
.stat-tappable:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
.stat-dead { cursor: default; }
/* online strip solid green, down strip takes SOLD KEY's PINK
   #EC4899 (colour A rotation, user pick 2026-11-30), dark text
   #500724, white dot — sample khp-panel-v6216-colors-A.png. */
.online-strip { background: #16A34A; border-color: #16A34A; box-shadow: none; }
.online-strip b { color: #fff; }
.online-strip .os-label { color: rgba(255, 255, 255, 0.85); }
.online-strip .dot.on { background: #fff; }
.down-strip { background: #EC4899; border-color: #EC4899; box-shadow: none; }
.down-strip b, .down-strip .os-chev { color: #500724; }
.down-strip .os-label { color: rgba(80, 7, 36, 0.85); }
.down-strip .dot.off { background: #fff; }
html[data-theme="light"] .down-strip { border-color: #EC4899; box-shadow: none; }
html[data-theme="light"] .down-strip b, html[data-theme="light"] .down-strip .os-chev { color: #500724; }
/* (7) FIND A KEY = WHITE #F8FAFC (dark text, reads as a search
   bar); MY SERVERS stays cyan #22D3EE (Design E, user pick). */
.findbox.find-key { background: #F8FAFC; color: #0B1220; }
.findbox.find-key .findbox-head { color: #0B1220; }
.findbox.find-key .findbox-input input { color: #0B1220; }
.findbox.find-key .findbox-input input::placeholder { color: rgba(11, 18, 32, 0.55); }
.findbox.find-key .findbox-x { color: #0B1220; }
/* (9) Key-card deep-blue accents — the "All N" filter chip, the
   "Active" pill and the usage progress bar are DEEP BLUE #2563EB
   (white text on chip/pill). Online stays green, Offline gray. */
.status.active { background: #2563EB; color: #fff; }
.bar > i { background: #2563EB; }
#filter-chips .chip-btn.sel { background: #2563EB; border-color: #2563EB; color: #fff; }
/* (6) TODAY'S SOLD KEY — colour A rotation (user pick 2026-11-30):
   the box takes Settings' LIME #BFFF00, dark text #1A2E05, dark
   chevron chips + dark count badge (sample
   khp-panel-v6216-colors-A.png). Design B: one full-width box,
   title (+ date under it) at the left, the ‹ › chevrons side by side
   inside the box at the right end, the count badge at the far right
   edge. (8) the chevron chips are FILLED TRIANGLES ◀ ▶ (user pick
   2026-11-30 ~17:46, option 2) with a 12px gap — finger-friendly. */
h2.sec-sold { background: #BFFF00; color: #1A2E05; }
.badge-sold { background: #1A2E05; color: #fff; margin-left: 0; }
.sold-title-wrap { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.sold-date { font-size: 12px; font-weight: 700; color: rgba(26, 46, 5, 0.75); line-height: 1.3; }
.sold-chevs { display: flex; gap: 12px; flex: none; }
/* v6.2.19 (item 7): chevron style C (user pick) — small round
   OUTLINE buttons with small filled triangles inside (the old
   filled dark chips with big ◀ ▶ were too big and ugly). */
.sold-nav { background: transparent; color: #1A2E05; border: 2px solid #1A2E05; border-radius: 50%; width: 36px; height: 36px; padding: 0; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.sold-nav.off { opacity: .35; }
.sold-list { border-color: #BFFF00; }
.sold-divider { background: #BFFF00; }
.sold-day.is-viewing { border-color: #BFFF00; }
/* (10) Settings button — Design G pill. v6.2.16 (item 3, colour A
   rotation, user pick): the pill is GRAY #9CA3AF with BLACK text/gear
   — the lime moved to the SOLD KEY box. Messages pill stays white,
   text BLACK. (2) the unread badge sticks 7px above the pill, so the
   pill needs overflow:visible — `nav.bottom a { overflow:hidden }`
   clipped it (the half-cut "1" in the user's screenshot); the
   `nav.bottom a.` prefix is required, plain `.nav-messages-pill`
   loses to it on specificity. */
nav.bottom .nav-inner.nav-pills { display: flex; gap: 10px; justify-content: center; }
.nav-pill { flex: 1 1 0; max-width: 220px; display: flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 12px 18px; font-size: 16px; font-weight: 800; text-decoration: none; }
.nav-settings-pill { background: #9CA3AF; color: #000; }
.nav-messages-pill { background: #F8FAFC; color: #000; position: relative; }
/* v6.2.19 (item 8c): the REAL cause of the faint Settings text —
   `nav.bottom a { color: var(--muted) }` (specificity 0,1,1) BEAT
   `.nav-settings-pill { color: #000 }` (0,1,0), so BOTH pills'
   text rendered muted grey — grey-on-grey on the #9CA3AF
   Settings pill (the gear SVG carries an explicit black stroke,
   so only the text faded). These triple selectors win. */
nav.bottom a.nav-settings-pill, nav.bottom a.nav-messages-pill { color: #000; }
nav.bottom a.nav-messages-pill { overflow: visible; }
.msg-badge { position: absolute; top: -7px; right: 6px; min-width: 22px; height: 22px;
  background: #DC2626; color: #fff; border-radius: 11px; padding: 0 6px;
  font-size: 12px; font-weight: 800; line-height: 22px; text-align: center; }
/* (13/14) Messages — inbox thread list + 1:1 thread. Own messages
   blue right, theirs dark left; the admin reading a
   reseller-to-reseller thread sees it read-only (no input row).
   v6.2.16 (items 5-7): peer list to start a chat, linkified bodies,
   photo/video attachments, emoji picker, SEND pill button. */
.msg-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.msg-head h2 { flex: 1 1 auto; margin: 0; font-size: 20px; }
.msg-total-badge { margin-left: auto; }
.msg-sec-label { font-size: 13px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em; margin: 4px 0 8px; }
.msg-thread-row { display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px; cursor: pointer; text-align: left; color: var(--text); }
/* v6.2.18 (item 4): Messenger channel names are GREEN #22C55E —
   in the MESSAGE A RESELLER list AND in the CHATS rows (both use
   .msg-thread-name), and in the thread header title too (the
   cooler-thread sample shows the peer name green there as well).
   The green reads on dark and on light. */
.msg-thread-name { font-size: 16px; font-weight: 800; color: #22C55E; }
.msg-thread-preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-thread-text { flex: 1 1 auto; min-width: 0; }
.msg-unread { flex: none; min-width: 22px; height: 22px; background: #DC2626; color: #fff;
  border-radius: 11px; padding: 0 6px; font-size: 12px; font-weight: 800; line-height: 22px; text-align: center; }
.msg-thread-title { font-size: 18px; font-weight: 800; margin: 2px 0 12px; color: #22C55E; }
/* v6.2.17 (item 3): peer presence under the thread title + in the
   peer list. Green dot = Online (active <5 min), gray dot =
   Offline • N min/hr/day ago. (item 2) Seen under my latest
   message, Messenger-style, right-aligned like the time line. */
.msg-peer-status { display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); margin: -8px 0 12px; }
.msg-peer-status[hidden] { display: none; }
.msg-presence { display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--muted); white-space: nowrap; }
.msg-dot { width: 8px; height: 8px; border-radius: 50%; flex: none;
  display: inline-block; background: #9CA3AF; }
.msg-dot.online { background: #22C55E; }
.msg-dot.offline { background: #9CA3AF; }
.msg-seen { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
#msg-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.msg-bubble { max-width: 80%; padding: 9px 13px; border-radius: 14px; font-size: 15px; line-height: 1.45; word-break: break-word; }
.msg-bubble.mine { align-self: flex-end; background: #2563EB; color: #fff; border-bottom-right-radius: 4px; }
.msg-bubble.theirs { align-self: flex-start; background: var(--surface2); color: var(--text); border-bottom-left-radius: 4px; }
.msg-time { font-size: 11px; color: var(--muted); margin-top: 2px; }
.msg-bubble.mine + .msg-time { text-align: right; }
.msg-input-row { display: flex; gap: 8px; align-items: center; }
.msg-input-row input { flex: 1 1 auto; min-width: 0; }
/* v6.2.16 (item 5b): the Send button is a BLUE pill #2563EB with
   "SEND" text FIRST then a white paper-plane icon (variant 2, user
   pick 2026-11-30 ~17:38 — sample khp-panel-v6216-send-pill.png). */
.msg-send { flex: none; background: #2563EB; color: #fff; border: 0; border-radius: 999px;
  padding: 10px 18px; font-size: 15px; font-weight: 800; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; }
.msg-send svg { flex: none; }
/* v6.2.16 (items 6-7): attach + emoji buttons beside the input,
   the emoji grid panel, and the picked-file preview row. */
.msg-icon-btn { flex: none; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.msg-emoji-panel { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.msg-emoji-panel[hidden] { display: none; }
.msg-emoji-btn { font-size: 24px; line-height: 1; background: none; border: 0; padding: 6px; cursor: pointer; }
.msg-attach-preview { display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-size: 14px; }
.msg-attach-preview[hidden] { display: none; }
.msg-attach-x { margin-left: auto; flex: none; background: none; border: 0; color: var(--muted);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.msg-img { display: block; max-width: 100%; border-radius: 10px; margin-bottom: 6px; }
.msg-video { display: block; max-width: 100%; border-radius: 10px; margin-bottom: 6px; }
.msg-bubble a { text-decoration: underline; }
.msg-bubble.mine a { color: #fff; }
.msg-bubble.theirs a { color: #2563EB; }
.msg-empty { color: var(--muted); font-size: 15px; padding: 18px 4px; text-align: center; }
/* ---- v6.2.18 (item 7): cooler Messenger thread (sample
   khp-panel-v6218-messenger-cool.png) — avatar circles, bubbles
   with the time inside, "Today" date separators, typing
   indicator. ---- */
.msg-row { display: flex; gap: 8px; align-items: flex-end; }
.msg-row.mine { justify-content: flex-end; }
.msg-bubble-wrap { display: flex; flex-direction: column; max-width: 80%; }
.msg-bubble-wrap .msg-bubble { max-width: 100%; }
.msg-row.mine .msg-bubble-wrap { align-items: flex-end; }
.msg-avatar { width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: #22C55E; color: #fff; font-size: 16px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; }
.msg-bubble-time { display: block; text-align: right; font-size: 11px;
  opacity: .75; margin-top: 4px; }
.msg-bubble.mine .msg-bubble-time { color: rgba(255, 255, 255, .85); }
.msg-bubble.theirs .msg-bubble-time { color: var(--muted); }
.msg-date-sep { display: flex; justify-content: center; margin: 6px 0; }
.msg-date-sep span { background: var(--surface2); color: var(--muted);
  font-size: 12px; font-weight: 700; padding: 4px 14px; border-radius: 999px; }
.msg-thread-head { display: flex; gap: 10px; align-items: flex-start; margin: 2px 0 12px; }
.msg-thread-head .msg-avatar { width: 40px; height: 40px; font-size: 20px; }
.msg-thread-head-text { flex: 1 1 auto; min-width: 0; }
.msg-thread-head .msg-thread-title { margin: 0; }
.msg-thread-head .msg-peer-status { margin: 2px 0 0; }
/* typing indicator: three bouncing dots + "X is typing..." */
#msg-typing { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px;
  color: var(--muted); font-size: 13px; font-weight: 700; }
.msg-typing-dots { display: inline-flex; gap: 4px; background: var(--surface2);
  border-radius: 999px; padding: 8px 12px; }
.msg-typing-dots i { width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted); animation: msg-typing-bounce 1.2s infinite; }
.msg-typing-dots i:nth-child(2) { animation-delay: .15s; }
.msg-typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes msg-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}
/* ---- v6.2.19 (item 1): FB-web-Messenger-style chat box. The
   thread is a FIXED full-screen flex column: the header (back +
   avatar + name) is pinned at the top, the message list is the ONLY
   scroller (its own overflow-y), and the composer (attach + emoji
   + input + SEND) is pinned at the bottom from the moment the chat
   opens. The page itself never scrolls in a thread, the fixed
   version footer never shows inside it, and the Android keyboard
   resizing the viewport cannot shift the list (the visualViewport
   handler re-anchors it; the meta interactive-widget tag resizes
   the box with the keyboard). The v6.2.18 page-scroll thread +
   sticky input is gone: sticky bottom + fixed footer + keyboard
   resize fought over the same viewport, and the typing box jumped
   (user video v1). [hidden] MUST beat the flex display (the
   v6.2.16/.stats lesson: an author display rule beats the
   browser's [hidden] rule). */
#msg-thread {
  position: fixed; inset: 0; z-index: 40;
  height: 100dvh; /* v6.2.19 (item 1): full viewport height, dynamic so the Android keyboard resizing never leaves a gap */
  left: 0; right: 0; margin: 0 auto; max-width: 720px;
  display: flex; flex-direction: column;
  background: var(--bg);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
}
#msg-thread[hidden] { display: none; }
body.msg-thread-open { overflow: hidden; }
body.msg-thread-open footer.ver-foot { display: none; }
#msg-thread .msg-thread-head { flex: none; margin: 2px 0 8px; }
#msg-thread #msg-list {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  margin-bottom: 8px; padding-bottom: 4px;
}
#msg-thread #msg-typing { flex: none; }
#msg-thread .msg-emoji-panel { flex: none; }
#msg-thread .msg-attach-preview { flex: none; }
#msg-thread .msg-input-row { flex: none; background: var(--bg); padding: 8px 0 0; }
.msg-thread-back { flex: none; }
/* ---- v6.2.19 (item 4): per-reseller TODAY'S SOLD KEY — admin
   only, below MY SERVERS' country groups, above the admin's own
   TODAY'S SALES box. One row per reseller: short name + dark count
   badge + small round outline chevron (style C shape, muted on
   the surface). The expanded list reuses the main sold box's rows
   (.sold-list / .sold-row / .sold-divider / .sold-label /
   .sold-total). */
.rsold-sec { margin-bottom: 10px; }
.rsold-label { color: var(--muted); font-size: 13px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.04em; margin: 4px 0 8px; }
.rsold-row { display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 14px; margin-bottom: 8px;
  cursor: pointer; font-size: 16px; font-weight: 800; color: var(--text); }
.rsold-name { flex: 1 1 auto; min-width: 0; }
.rsold-count { margin-left: auto; }
.rsold-chev { flex: none; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--muted); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1; }
.rsold-list { margin: -2px 0 8px; }

/* ---- v6.2.20 ---- */
/* (d) the mo pill — dark green pill with a green outline, beside
   the count badge in the sold headers (main box + TOTAL box).
   v6.2.21 (item 1): the pill reads "41 M" now, not "41 mo". */
.badge-mo { background: #14532D; color: #4ADE80; border: 2px solid #22C55E;
  border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 800;
  flex: none; white-space: nowrap; }
/* v6.2.21 (item 1): the sold headers are ONE LINE again — the
   chevrons + badges ride in one .sold-controls group beside the
   title, and the h2 wraps ONLY when the line truly cannot fit
   (title line 1, chevrons + badges line 2, the same shape as the
   v6.2.20 fallback). The v6.2.20 ≤560px rule that forced the
   title to 100% width is gone; margin-left: auto keeps the
   wrapped controls right-aligned on line 2. */
h2.sec-sold, h2.sec-chsold { flex-wrap: wrap; }
.sold-controls { display: inline-flex; gap: 8px; flex: none; align-items: center; margin-left: auto; }
.sold-badges { display: inline-flex; gap: 8px; flex: none; align-items: center; }
.sold-badges .badge-sold { margin-left: 0; }
@media (max-width: 560px) {
  /* v6.2.21 (item 1): the compact phone header — 15px title (the
     sample's proportions) + 20px chevrons — so the one-line
     header fits the 308px content width at 360px (measured with
     Liberation Sans Bold: "TODAY'S SOLD KEY" 145px + chevrons
     46px + count 33px + "41 M" 53px + gaps 24px = 301px). */
  h2.sec-sold .sales-title, h2.sec-chsold .sales-title { font-size: 15px; letter-spacing: 0; }
  h2.sec-sold .sold-nav, h2.sec-chsold .sold-nav { width: 20px; height: 20px; font-size: 8px; }
  h2.sec-sold .sold-chevs, h2.sec-chsold .sold-chevs { gap: 6px; }
}
/* (d, B) the Total Months row — dark green, like the Total Keys
   row is gold. */
.sold-months { background: rgba(34, 197, 94, 0.14); border-color: #22C55E; }
.sold-months .sold-name, .sold-months .sold-count { color: #4ADE80; }
html[data-theme="light"] .sold-months .sold-name,
html[data-theme="light"] .sold-months .sold-count { color: #15803D; }
/* (a) TODAY'S SOLD KEY inside a reseller channel — v6.2.21
   (item 2): SOLID LIME like the main box, same size, same
   one-line header (count + M pill), NO NEW tag anywhere. The
   dark card + green frame from v6.2.20 is gone. The expanded
   list reuses the main sold box's rows. */
.chsold-box { margin-bottom: 10px; }
.chsold-head h2.sec-chsold { background: #BFFF00; color: #1A2E05;
  display: flex; align-items: center; gap: 8px; }
.chsold-head.chsold-open h2.sec-chsold { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.chsold-head .sold-date { color: rgba(26, 46, 5, 0.75); }
.chsold-head .sold-nav { color: #1A2E05; border-color: #1A2E05; }
.chsold-head .sold-nav.off { opacity: .35; }
.chsold-head .badge-sold { background: #1A2E05; color: #fff; }
.chsold-list { border-color: #BFFF00; }
.chsold-list .sold-divider { background: #BFFF00; }
/* (c) the TOTAL TODAY'S SOLD KEYS box — the lime header is the
   main sold box's; the rows show the short name + split line, the
   TOTAL row is dark green with the grand split. Rows are
   display-only (no pointer). */
.tsold-row { cursor: default; }
.tsold-name { flex: 1 1 auto; min-width: 0; font-size: 17px; font-weight: 800; }
.tsold-sub { display: block; font-size: 13px; color: var(--muted); font-weight: 700; }
.tsold-total { background: #14532D; border-color: #22C55E; }
.tsold-total .tsold-name, .tsold-total .tsold-sub, .tsold-total .sold-count { color: #4ADE80; }
.tsold-total .sold-count { text-align: right; line-height: 1.35; }
/* (e) the native pull-to-refresh is off — it reloads the page and
   dumps the user at the top (dashboard) or does nothing (thread).
   The custom pull shows this pill at the top. */
html, body { overscroll-behavior-y: none; }
#ptr-ind { position: fixed; top: 8px; left: 50%; transform: translateX(-50%);
  z-index: 80; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px;
  font-size: 13px; font-weight: 800; box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  pointer-events: none; }
/* (f) the Todays Sales card must clear the fixed header when the
   back button scrolls to it. */
.sales-head { scroll-margin-top: 70px; }
/* (g) the + menu — Photo / Video / File / Audio — and the audio
   player + file chip inside message bubbles. */
.msg-attach-menu { display: flex; gap: 8px; flex-wrap: wrap; flex: none;
  margin-bottom: 10px; }
.msg-attach-menu[hidden] { display: none; }
/* v6.2.24 (item 12): the file inputs are visually hidden OFFSCREEN,
   NOT display:none — Android Chrome often refuses to open the
   system picker (Files + Camera + Gallery) from a programmatic
   .click() on a display:none input, so the File option looked dead
   even though the upload path worked. Offscreen + opacity 0 keeps
   the input "visible" to the browser while invisible to the user. */
.msg-file-input { position: absolute; width: 1px; height: 1px;
  opacity: 0; overflow: hidden; }
.msg-attach-menu button { flex: 1 1 auto; background: var(--surface);
  color: var(--text); border: 1px solid var(--border); border-radius: 999px;
  padding: 9px 12px; font-size: 14px; font-weight: 800; cursor: pointer; }
.msg-plus-btn { font-size: 24px; font-weight: 800; line-height: 1; }
.msg-audio { display: block; max-width: 100%; margin-bottom: 6px; }
.msg-file-chip { display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface2); color: var(--text); border-radius: 8px;
  padding: 6px 10px; font-size: 14px; font-weight: 700; margin-bottom: 6px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* (h) the composer is a textarea that grows while typing (up to 5
   lines) — the typed text + caret stay visible. */
.msg-input-row textarea { flex: 1 1 auto; min-width: 0; resize: none;
  overflow-y: auto; max-height: 132px; line-height: 1.45; font-size: 15px;
  font-family: inherit; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
/* v6.2.21 (items 3-6) — composer: Enter = newline (no CSS change
   needed), multi-file thumbnails, voice-recording bar, focus. */
.msg-attach-preview { flex-wrap: wrap; align-items: flex-start; }
.msg-attach-item { position: relative; display: inline-flex; flex-direction: column;
  gap: 4px; flex: none; }
.msg-attach-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px;
  display: block; background: var(--surface2); }
.msg-attach-name { display: block; max-width: 72px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--muted); }
.msg-attach-kind { width: 64px; height: 64px; display: flex; align-items: center;
  justify-content: center; background: var(--surface2); color: var(--text);
  border-radius: 8px; font-size: 22px; font-weight: 800; }
.msg-attach-item .msg-attach-x { position: absolute; top: -8px; right: -8px;
  margin-left: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 50%; width: 22px; height: 22px; padding: 0; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; }
.msg-voice-bar { display: flex; align-items: center; gap: 10px; flex: none;
  background: rgba(239, 68, 68, .14); border: 1px solid #ef4444; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 10px; }
.msg-voice-bar[hidden] { display: none; }
.msg-voice-dot { flex: none; width: 14px; height: 14px; border-radius: 50%;
  background: #ef4444; animation: msg-voice-blink 1s infinite; }
@keyframes msg-voice-blink { 50% { opacity: .3; } }
.msg-voice-text { flex: 1 1 auto; min-width: 0; font-size: 16px; font-weight: 800;
  color: var(--text); }
.msg-voice-hint { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.msg-voice-cancel { flex: none; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 20px; font-weight: 800; line-height: 1; cursor: pointer; }
.msg-voice-send { flex: none; background: #22c55e; color: #fff; border: 0;
  border-radius: 999px; padding: 10px 16px; font-size: 14px; font-weight: 800; cursor: pointer; }
.msg-input-row.msg-composer-focused .msg-plus-btn,
.msg-input-row.msg-composer-focused #msg-emoji-btn { display: none; }

/* ---- v6.2.21 (items 8-10) ---- */
/* (item 9) Messages list header: the back arrow is a BIG bold
   green ← (52px since v6.2.24, item 14 — was ~44px). Scoped to
   .msg-head so the Down Servers view and the thread header keep
   their own small ‹. The button is a flex box so the glyph sits
   vertically centred on the "Messages" line. */
.msg-head .down-back { font-size: 52px; font-weight: 900; color: #22C55E; line-height: 1; padding: 0 8px 0 0; display: flex; align-items: center; justify-content: center; }
/* (item 9) Section headings are solid BLUE boxes (#2563EB, white
   bold text, full-width) instead of plain muted text. This rule
   overrides the earlier .msg-sec-label (muted, no background);
   the earlier rule still supplies the size/weight/uppercase. */
.msg-sec-label { background: #2563EB; color: #fff; padding: 10px 12px; border-radius: 8px; margin: 4px 0 8px; }
/* (item 8) Seen is GREEN (per the sample) — this overrides the
   earlier .msg-seen (muted grey); Delivered is grey, same size
   and alignment as Seen, and replaces nothing — Seen replaces
   Delivered once the peer opens the thread. */
.msg-seen { color: #22C55E; font-weight: 700; }
.msg-delivered { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
/* v6.2.21 (item 7) — key-card redesign (picked A3 sample + lifecycle
   badge + collapse). All rules are APPENDED here; no earlier CSS
   was edited. Later rules win at equal specificity, so these
   override the v6.2.18 blue-text name (line ~294) and the light
   theme name colour (line ~42) — the light override needs its own
   equal-specificity rule below, or blue text would return on a
   blue box in light mode. */
/* 7a: the name is a BLUE SOLID BOX (#2563EB, the sample's blue),
   white text, hugging the name (inline-flex, capped at the row
   width; fitKeyNames still shrinks long names inside it). The
   .client > .row top-aligns the name box with the Active pill —
   the old align-items:center centred the name against the whole
   3-pill badges column, so it sat BELOW Active. */
.client .name { display: inline-flex; max-width: 100%;
  background: #2563EB; color: #fff; border-radius: 12px;
  padding: 3px 10px; }
html[data-theme="light"] .client .name { color: #fff; background: #2563EB; }
.client > .row { align-items: flex-start; }
/* 7a: the usage line is SMALL and MUTED now (v6.2.24, item 3):
   the whole "48.9 GB / 400.0 GB" reads at 15px like the old
   "/ limit" part — the big 22px number is gone. The exp date
   sits on the next line, then the usage bar. No "days left"
   chip and no usage percent are rendered anywhere on the card
   (renderClients never prints either — the bar keeps its width). */
.client .usage-big { font-size: 15px; font-weight: 700;
  color: var(--muted); margin-top: 4px; line-height: 1.2; }
.client .usage-big .muted { font-size: 15px; font-weight: 700; }
/* 7b: the LIFECYCLE badge — same shape/width as the v6.2.18 New
   badge it replaces, in the same 3rd spot of the .badges column
   (under Online/Offline), so the card does NOT grow. Colours are
   the spec's exact hexes. */
.badges .pill-life { width: 84px; text-align: center; }
.pill-life { background: #64748B; color: #fff; font-size: 12px;
  font-weight: 800; padding: 3px 9px; border-radius: 12px;
  white-space: nowrap; }
.pill-life-new { background: #8B5CF6; }
.pill-life-plan { background: #8B5CF6; }
.pill-life-amber { background: #F59E0B; }
.pill-life-orange { background: #F97316; }
.pill-life-red { background: #EF4444; }
/* 7c: collapse / expand. The "▼ Show" pill is hidden while the
   card is expanded; when collapsed the .actions grid hides and
   the pill shows — v6.2.24 (item 3): a SMALL ghost pill at the
   RIGHT corner (variant A, like Hide), WHITE text, NOT a
   full-width strip. The card ends after the usage bar + pill. */
.card.client .show-strip { display: none; width: fit-content;
  margin-top: 8px; margin-left: auto; padding: 7px 14px; font-size: 13px;
  font-weight: 700; color: #fff; border-radius: 999px; }
.card.client.collapsed .actions { display: none; }
.card.client.collapsed .show-strip { display: block; }

/* v6.2.22 W3: speed + font */
/* FONT — DejaVu Sans (user pick B from khp-panel-font-compare.png).
   The files are local (static/fonts/DejaVuSans.woff2 13,132 bytes +
   DejaVuSans-Bold.woff2 12,392 bytes, 25.5 KB total, Latin subset —
   the → ▲ ▼ ● ☎ ◀ ▶ × • — glyphs the panel uses are all in it).
   DejaVu has NO Burmese glyphs, so the stack below ALWAYS ends in
   the system fonts: Burmese text falls back per-glyph to the
   phone's own font. v6.2.23 (item 3): the base body font is
   DejaVu-first too (whole panel, not just headings/bars) — the
   heading rule below stays because it pins the same stack on
   elements that would otherwise inherit it anyway. */
@font-face {
  font-family: 'DejaVu Sans';
  src: url('/static/fonts/DejaVuSans.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DejaVu Sans';
  src: url('/static/fonts/DejaVuSans-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* Headings + bars: every section bar (TOTAL / SOLD KEYS / sales /
   find boxes), the key-card name box, buttons and pills. The
   .client .name-text size is still driven by fitKeyNames(), which
   measures the live width — DejaVu Bold runs wider than Roboto,
   so a long name just shrinks one step sooner. */
h2.sec, .findbox-head,
.client .name, .client .name-text,
button, .nav-pill, .sale-badge,
.pill, .badge, [class^="pill-"], [class^="badge-"] {
  font-family: 'DejaVu Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
@media (max-width: 560px) {
  /* v6.2.23 (item 4): SOLD titles are 16px now, like the TOTAL
     bars below (user: the 13px title was too small). Measured with
     DejaVu Bold: "TODAY'S SOLD KEY" 171px + controls ~148px =
     ~319px vs the 308px content width at 360px — 11px over, so at
     360px the title ellipsizes / the controls wrap (the approved
     v6.2.21 fallback; flex-wrap + ellipsis, never an overlap), and
     it fits outright on the user's phone (inner ~355px). The TOTAL
     title gains room from item 5's dropped S: "TOTAL TODAY'S SOLD
     KEY" 234px at 16px (was 245px with the S). Desktop 15px
     untouched. */
  h2.sec-sold .sales-title, h2.sec-chsold .sales-title { font-size: 16px; }
  /* v6.2.24 (item 5): FIND A KEY is 16px now, like TODAY'S SOLD KEY
     (was 19px). Scoped to the key box only — FIND A SERVER keeps
     19px. Desktop untouched. */
  .findbox.find-key .findbox-head { font-size: 16px; }
}
/* v6.2.22 W2: change server + moved keys */
/* Item 2 — Change Server: full-width BLUE button, ROW 4 under the
   3-row .actions grid (same blue as the key-name box, #2563EB, white
   text). Hidden with the grid when the card is collapsed, so the
   collapsed card still ends after the usage bar + Show strip. */
.move-btn { display: block; width: 100%; margin-top: 8px; padding: 10px 6px;
  font-size: 15px; font-weight: 800; color: #fff; background: #2563EB;
  border: 0; border-radius: 10px; cursor: pointer; }
.card.client.collapsed .move-btn { display: none; }
/* The picker drops in under the button: a bordered panel with one
   row per own server (country code + name, server name in muted
   small text — several servers can share one country). The current
   server is greyed out and disabled; an armed row (first tap) goes
   green-edged with "Tap again to move". */
.move-picker { display: none; margin-top: 8px; border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; background: var(--surface2); }
.move-picker.open { display: block; }
.card.client.collapsed .move-picker { display: none; }
.move-pick-title { font-size: 15px; font-weight: 800; color: var(--text);
  margin-bottom: 6px; }
.move-pick { display: flex; align-items: center; justify-content: space-between;
  gap: 8px; width: 100%; padding: 9px 10px; margin-bottom: 6px;
  font-size: 15px; font-weight: 700; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; text-align: left; }
.move-pick:last-of-type { margin-bottom: 0; }
.move-pick-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.move-pick .move-hint { flex: none; font-size: 13px; font-weight: 700; color: var(--muted); }
.move-pick.current { opacity: 0.55; cursor: default; }
.move-pick.current .move-hint { color: var(--muted); }
.move-pick.armed { border-color: #22C55E; background: rgba(34, 197, 94, 0.12); }
.move-pick.armed .move-hint { color: #22C55E; }
.move-pick-note { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.move-pick-loading { font-size: 14px; color: var(--muted); padding: 4px 0; }
/* Item 2 — the moved-key tag: 4th pill in the .badges column, UNDER
   the lifecycle badge (same 84px width, same shape). Slate like the
   plan pill (the moved-key sample's slate tag); format B "SG → JP"
   — country codes only, never the long server name. Tappable: the
   tap toasts the full origin + date. */
.badges .pill-moved { width: 84px; text-align: center; }
.pill-moved { background: #64748B; color: #fff; font-size: 12px;
  font-weight: 800; padding: 3px 9px; border-radius: 12px;
  white-space: nowrap; cursor: pointer; }
/* Item 4 — MOVED KEYS bars: solid CYAN #06B6D4 with DARK text, never
   blue (blue is the Active key-name colour). Same bar shape as the
   TOTAL bars (one line, 19px label, count pill at the far right);
   the pill is dark cyan with white text (the admin sample's darker
   cyan pill). The expanded list reuses the sold-list rows. */
h2.sec-moved { color: #0b1220; background: #06B6D4;
  display: flex; align-items: center; gap: 8px; }
.badge-moved { background: #155E75; color: #fff;
  font-size: 13px; font-weight: 800;
  border-radius: 12px; padding: 2px 9px; margin-left: auto; }
.moved-head.moved-open h2.sec-moved { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.moved-list { border-color: #06B6D4; }
.moved-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.moved-main .sold-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moved-sub { font-size: 13px; font-weight: 600; color: var(--muted); }
/* v6.2.24 W3: long-press message menu (item 10) + missed call (item 11).
   Solid panel colors (var(--surface) / var(--text) / var(--border)),
   like the attach menu — no dark-card-with-accent-edge. The sheet is
   a fixed bottom sheet above the thread (z-index 40) and the call
   overlay (z-index 60). */
.msg-missed { display: flex; justify-content: center; margin: 8px 0; }
.msg-missed span { background: var(--surface2); color: var(--muted);
  font-size: 13px; font-weight: 700; border-radius: 999px;
  padding: 6px 14px; }
.msg-quote { font-size: 12px; color: var(--muted);
  background: var(--surface2); border-left: 3px solid #2563EB;
  border-radius: 6px; padding: 4px 8px; margin-bottom: 4px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.msg-reactions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.msg-react-chip { background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 2px 8px; font-size: 13px; cursor: pointer; }
.msg-react-chip.mine { background: #2563EB; color: #fff;
  border-color: #2563EB; }
.msg-pinned-bar { display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px; margin-bottom: 8px;
  cursor: pointer; font-size: 13px; color: var(--text); }
.msg-pinned-text { flex: 1 1 auto; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.msg-reply-bar { display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px; margin-bottom: 8px;
  font-size: 13px; color: var(--text); flex: none; }
.msg-reply-bar[hidden] { display: none; }
.msg-reply-text { flex: 1 1 auto; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.msg-reply-x { flex: none; background: none; border: 0;
  color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
#msg-action-backdrop { position: fixed; inset: 0; z-index: 70;
  background: rgba(0, 0, 0, 0.45); }
#msg-action-backdrop[hidden] { display: none; }
#msg-action-sheet { position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 71; display: flex; justify-content: center;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
#msg-action-sheet[hidden] { display: none; }
.msg-sheet { width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px;
  padding: 12px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5); }
.msg-sheet-reacts { display: flex; justify-content: space-around;
  padding: 4px 0 10px; border-bottom: 1px solid var(--border);
  margin-bottom: 6px; }
.msg-sheet-emoji { font-size: 28px; line-height: 1; background: none;
  border: 0; padding: 6px; cursor: pointer; }
.msg-sheet-btn { display: block; width: 100%; text-align: left;
  background: var(--surface); color: var(--text);
  border: 0; border-radius: 10px; padding: 12px;
  font-size: 15px; font-weight: 700; cursor: pointer; }
.msg-sheet-btn:hover { background: var(--surface2); }
.msg-sheet-danger { color: #EF4444; }

/* v6.2.22 W1: voice calls */
.msg-call-btn { flex: none; width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid #22C55E; background: transparent; color: #22C55E;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; align-self: center; }
.msg-call-btn:active { background: rgba(34, 197, 94, 0.15); }
/* The overlay is a full-screen dim; the card is capped at 340px so
   it fits a 360px phone with 16px margins each side (308px card at
   360px wide). Buttons are 48px tall touch targets. */
#call-overlay { position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, 0.6); display: flex; align-items: center;
  justify-content: center; padding: 16px; }
#call-overlay[hidden] { display: none; }
.call-card { width: 100%; max-width: 340px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; padding: 24px 20px;
  text-align: center; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5); }
.call-avatar { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px;
  background: #22C55E; color: #fff; font-size: 30px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; }
.call-name { font-size: 18px; font-weight: 800; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-status { font-size: 14px; color: var(--muted); margin: 6px 0 18px; }
.call-status #call-timer { font-size: 18px; font-weight: 800; color: var(--text); }
.call-actions { display: flex; gap: 12px; justify-content: center; }
.call-btn { min-width: 104px; height: 48px; padding: 0 18px; border-radius: 999px;
  border: 0; font-size: 16px; font-weight: 800; color: #fff; cursor: pointer; }
.call-accept { background: #22C55E; }
.call-decline { background: #EF4444; }
.call-mute { background: var(--surface2); color: var(--text);
  border: 1px solid var(--border); }
.call-mute.muted { background: #F59E0B; color: #fff; border-color: #F59E0B; }
