/* TextLot Pro — web app, sign-in screens and staff panel
   Themes: light (default) · dark · purple · ocean · system (follows the device) */

:root {
  --brand-1: #5546FF;
  --brand-2: #9333EA;
  --brand-grad: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  --pro: #22C55E;

  --ink: #0F1220;
  --ink-2: #3A3F55;
  --muted: #6B7089;
  --line: #E7E6F0;
  --line-2: #F0EFF6;
  --bg: #F5F4FB;
  --surface: #FFFFFF;
  --surface-2: #F8F7FC;
  --hover: #F2F1FA;

  --accent: #5546FF;
  --accent-2: #9333EA;
  --accent-ink: #FFFFFF;
  --accent-soft: #EEECFF;
  --accent-text: #4A3BF0;

  --ok: #12A150;
  --ok-soft: #E3F7EB;
  --warn: #B26A00;
  --warn-soft: #FFF3DC;
  --bad: #DC2645;
  --bad-soft: #FDE8EC;

  --rail-bg: #FFFFFF;
  --rail-ink: #6B7089;
  --rail-active: var(--accent);
  --rail-active-bg: var(--accent-soft);
  --rail-line: var(--line);

  --bubble-theirs: #EFEEF5;
  --bubble-theirs-ink: var(--ink);
  --bubble-mine: linear-gradient(135deg, #5546FF, #7C3AED);
  --bubble-mine-ink: #FFFFFF;

  --shadow-sm: 0 1px 2px rgba(15, 18, 32, .06);
  --shadow: 0 1px 2px rgba(15, 18, 32, .05), 0 10px 30px rgba(15, 18, 32, .07);
  --shadow-lg: 0 20px 60px rgba(15, 18, 32, .18);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --av-l1: 62%; --av-l2: 50%;
  color-scheme: light;
}

/* ---------- Dark ---------- */
:root[data-theme="dark"] {
  --ink: #EEF0F8; --ink-2: #C5C9DB; --muted: #8C92AB;
  --line: #262B3E; --line-2: #1E2333;
  --bg: #0D1019; --surface: #151926; --surface-2: #1A1F2F; --hover: #1E2436;
  --accent: #7B6EFF; --accent-2: #A855F7; --accent-soft: #24204A; --accent-text: #A69DFF;
  --ok: #3DD68C; --ok-soft: #12301F; --warn: #F2B54B; --warn-soft: #33270F; --bad: #FF6B81; --bad-soft: #3A1820;
  --rail-bg: #11141F; --rail-ink: #8C92AB; --rail-active-bg: #24204A; --rail-active: #A69DFF; --rail-line: #1E2333;
  --bubble-theirs: #222839; --bubble-theirs-ink: #EEF0F8;
  --bubble-mine: linear-gradient(135deg, #5D4FFF, #8B3FEA);
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 30px rgba(0,0,0,.3);
  --av-l1: 42%; --av-l2: 32%;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --ink: #EEF0F8; --ink-2: #C5C9DB; --muted: #8C92AB;
    --line: #262B3E; --line-2: #1E2333;
    --bg: #0D1019; --surface: #151926; --surface-2: #1A1F2F; --hover: #1E2436;
    --accent: #7B6EFF; --accent-2: #A855F7; --accent-soft: #24204A; --accent-text: #A69DFF;
    --ok: #3DD68C; --ok-soft: #12301F; --warn: #F2B54B; --warn-soft: #33270F; --bad: #FF6B81; --bad-soft: #3A1820;
    --rail-bg: #11141F; --rail-ink: #8C92AB; --rail-active-bg: #24204A; --rail-active: #A69DFF; --rail-line: #1E2333;
    --bubble-theirs: #222839; --bubble-theirs-ink: #EEF0F8;
    --bubble-mine: linear-gradient(135deg, #5D4FFF, #8B3FEA);
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 30px rgba(0,0,0,.3);
    --av-l1: 42%; --av-l2: 32%;
    color-scheme: dark;
  }
}

/* ---------- Purple (TextLot signature: gradient side menu) ---------- */
:root[data-theme="purple"] {
  --bg: #F4F1FF; --surface-2: #F7F5FF; --hover: #EFEBFF; --line: #E4DFFA; --line-2: #EEEAFD;
  --accent: #6D3DF5; --accent-soft: #ECE6FF; --accent-text: #5B2EE8;
  --rail-bg: linear-gradient(180deg, #5546FF 0%, #7C3AED 55%, #9333EA 100%);
  --rail-ink: rgba(255,255,255,.78); --rail-active: #FFFFFF; --rail-active-bg: rgba(255,255,255,.18); --rail-line: transparent;
  --bubble-theirs: #ECE8F8;
}

/* ---------- Ocean ---------- */
:root[data-theme="ocean"] {
  --bg: #EEF7FA; --surface-2: #F4FAFC; --hover: #E6F3F8; --line: #D8E9F0; --line-2: #E6F2F6;
  --accent: #0284C7; --accent-2: #0D9488; --accent-soft: #E0F2FE; --accent-text: #0369A1;
  --rail-bg: linear-gradient(180deg, #0284C7 0%, #0E7490 60%, #0D9488 100%);
  --rail-ink: rgba(255,255,255,.8); --rail-active: #FFFFFF; --rail-active-bg: rgba(255,255,255,.18); --rail-line: transparent;
  --bubble-theirs: #E3EFF4;
  --bubble-mine: linear-gradient(135deg, #0284C7, #0D9488);
}

/* ================= Base ================= */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--ink); background: var(--bg);
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 750; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic-lg { width: 24px; height: 24px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
img { max-width: 100%; }
.wordmark { height: 30px; width: auto; display: block; color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font: 700 15px/1 var(--font); cursor: pointer; text-decoration: none !important;
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease, opacity .15s;
  white-space: nowrap; color: var(--ink); background: var(--surface);
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: 0 6px 18px rgba(85, 70, 255, .28); }
:root[data-theme="ocean"] .btn-primary { background: linear-gradient(135deg, #0284C7, #0D9488); box-shadow: 0 6px 18px rgba(2, 132, 199, .25); }
.btn-primary:hover { box-shadow: 0 8px 24px rgba(85, 70, 255, .36); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--hover); }
.btn-soft { background: var(--accent-soft); color: var(--accent-text); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger-ghost { background: transparent; border-color: var(--bad-soft); color: var(--bad); }
.btn-danger-ghost:hover { background: var(--bad-soft); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12.5px; font-weight: 650; }
.btn-block { width: 100%; }
.btn-outline-lg { height: 54px; width: 100%; border: 1.5px solid var(--line); background: var(--surface); font-weight: 650; font-size: 16px; }
.btn-outline-lg:hover { border-color: #cfcbe8; background: var(--surface-2); }
.btn-outline-lg .provider { position: absolute; left: 22px; display: flex; }
.btn-outline-lg { position: relative; }
.link { background: none; border: 0; padding: 0; color: var(--accent-text); font: inherit; font-weight: 650; cursor: pointer; }
.link:hover { text-decoration: underline; }
.link-danger { color: var(--bad); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--ink-2);
  display: inline-grid; place-items: center; cursor: pointer; flex: none; position: relative;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.primary { background: var(--accent-soft); color: var(--accent-text); }
.icon-btn.primary:hover { filter: brightness(.97); }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- Forms ---------- */
label { font-weight: 650; font-size: 13.5px; color: var(--ink-2); display: block; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=search], input[type=url], input[type=date], input[type=month], select, textarea {
  width: 100%; font: 500 15px/1.4 var(--font); color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: 14px; color: var(--ink-2); }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.input-group { position: relative; }
.input-group .toggle-pass { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.input-floating { position: relative; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); padding: 8px 14px 6px; }
.input-floating:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.input-floating span { display: block; font-size: 12px; font-weight: 650; color: var(--accent-text); }
.input-floating input { border: 0 !important; box-shadow: none !important; padding: 2px 0 4px; font-size: 16px; background: transparent; }

/* ---------- Alerts / flash ---------- */
.flash { border-radius: 12px; padding: 11px 14px; margin-bottom: 14px; font-size: 14px; font-weight: 550; display: flex; gap: 10px; align-items: flex-start; }
.flash-success { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--bad-soft); color: var(--bad); }
.flash-info { background: var(--accent-soft); color: var(--accent-text); }
.flash-warn { background: var(--warn-soft); color: var(--warn); }
.flash .ic { margin-top: 1px; }
.announce { background: var(--brand-grad); color: #fff; font-size: 13.5px; font-weight: 600; text-align: center; padding: 8px 16px; }

/* ---------- Pills / badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent-text); white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-grey { background: var(--line-2); color: var(--muted); }
.pill-pro { background: var(--pro); color: #fff; letter-spacing: .04em; }

/* ---------- Avatars ---------- */
.avatar {
  --h: 250; width: 44px; height: 44px; border-radius: 50%; flex: none; position: relative;
  display: grid; place-items: center; font-weight: 750; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 70% var(--av-l1)), hsl(calc(var(--h) + 40) 70% var(--av-l2)));
  overflow: visible; user-select: none;
}
.avatar.has-img { background: var(--line-2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar .online { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2px solid var(--surface); }
.avatar-sm { width: 34px; height: 34px; font-size: 13px; }
.avatar-lg { width: 84px; height: 84px; font-size: 28px; }
.avatar-xl { width: 112px; height: 112px; font-size: 36px; }

/* ================= Sign-in screens (layout_auth) ================= */
.auth-page { min-height: 100%; display: flex; flex-direction: column; background: var(--surface); }
.auth-top { padding: 22px 28px; display: flex; justify-content: space-between; align-items: center; }
.auth-top .wordmark { height: 32px; }
.auth-center { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 20px 40px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card.wide { max-width: 620px; }
.auth-card h1 { font-size: 34px; letter-spacing: -.025em; margin-bottom: 8px; }
.auth-card .lead { color: var(--muted); margin-bottom: 26px; }
.auth-card .stack { display: grid; gap: 14px; }
.auth-sep { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 20px 0; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-foot { border-top: 1px solid var(--line); padding: 18px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.auth-foot nav { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.auth-foot a { color: var(--muted); }
.email-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 999px; font-weight: 600; font-size: 14px; margin-bottom: 18px; }
.email-chip .avatar { width: 28px; height: 28px; font-size: 12px; }
.status-msg { border-radius: 12px; padding: 12px 14px; font-size: 14px; font-weight: 600; margin-top: 12px; line-height: 1.45; }
.status-msg.is-error { background: var(--bad-soft); color: var(--bad); }
.status-msg.is-warn { background: var(--warn-soft); color: var(--warn); }
.status-msg a { color: inherit; text-decoration: underline; }

/* human-check modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 18, 32, .5); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 28px 26px; width: 100%; max-width: 380px; text-align: center; animation: pop .18s ease; }
.modal .wordmark { height: 30px; margin: 0 auto 14px; }
.modal h3 { font-size: 19px; font-weight: 650; margin-bottom: 16px; }
.modal-wide { max-width: 560px; text-align: left; }
.turnstile-box { min-height: 70px; display: grid; place-items: center; }
.hold-btn { position: relative; overflow: hidden; width: 220px; height: 52px; border-radius: 999px; border: 2px solid var(--accent); color: var(--accent-text); background: transparent; font: 650 16px var(--font); cursor: pointer; user-select: none; touch-action: none; }
.hold-btn .fill { position: absolute; inset: 0; width: 0; background: var(--accent-soft); z-index: 0; }
.hold-btn span { position: relative; z-index: 1; }
@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { transform: scale(.96); opacity: 0 } }

/* number picker (choose your number) */
.picker-card { border: 1px solid var(--line); border-radius: 22px; padding: 26px; box-shadow: var(--shadow); background: var(--surface); }
.area-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; color: var(--ink-2); font-weight: 600; }
.area-row b { font-size: 22px; color: var(--ink); }
.num-option { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; margin-bottom: 10px; font-weight: 650; font-size: 18px; transition: border-color .15s, background .15s; }
.num-option:hover { background: var(--surface-2); }
.num-option input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.num-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.num-option .pill { margin-left: auto; }
.congrats { text-align: center; }
.congrats .big-number { font-size: 40px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 14px; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.confetti { font-size: 44px; }

/* ================= App shell (layout_app) ================= */
.app-shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.rail {
  width: 84px; flex: none; background: var(--rail-bg); border-right: 1px solid var(--rail-line);
  display: flex; flex-direction: column; align-items: center; padding: 14px 0 12px; gap: 4px; z-index: 5;
}
.rail-brand { display: block; width: 46px; height: 46px; margin-bottom: 14px; }
.rail-brand svg { width: 46px; height: 46px; display: block; border-radius: 13px; }
:root[data-theme="purple"] .rail-brand svg, :root[data-theme="ocean"] .rail-brand svg { box-shadow: 0 0 0 2px rgba(255,255,255,.35); border-radius: 13px; }
.rail-link {
  width: 70px; padding: 9px 0 7px; border-radius: 14px; color: var(--rail-ink);
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 650; text-decoration: none !important;
  position: relative; transition: background .15s, color .15s;
}
.rail-link:hover { background: var(--rail-active-bg); color: var(--rail-active); }
.rail-link.is-active { background: var(--rail-active-bg); color: var(--rail-active); }
.rail-link .ic { width: 23px; height: 23px; }
.rail-spacer { flex: 1; }
.tab-badge { position: absolute; top: 3px; right: 12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #F43F5E; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--surface); }
.rail-me { margin-top: 6px; }
.rail-me .avatar { width: 38px; height: 38px; font-size: 13px; box-shadow: 0 0 0 2px var(--surface); }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.app-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page { max-width: 880px; margin: 0 auto; padding: 28px 24px 60px; }
.page-narrow { max-width: 640px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 650; font-size: 14px; margin-bottom: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.card h2 { margin-bottom: 4px; }
.card > .muted:first-of-type { margin-bottom: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; flex: 1; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200;
  background: var(--ink); color: var(--surface); padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-lg); max-width: calc(100% - 32px);
}
.toast.is-error { background: var(--bad); color: #fff; }

/* list menu (account hub, settings) */
.menu-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.menu-list li + li { border-top: 1px solid var(--line-2); }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: 14px; padding: 15px 18px; color: var(--ink); text-decoration: none !important; width: 100%; background: none; border: 0; font: 600 15px var(--font); cursor: pointer; text-align: left; }
.menu-list a:hover, .menu-list button:hover { background: var(--hover); }
.menu-list .ic { color: var(--accent-text); }
.menu-list .sub { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
.menu-list .chev { margin-left: auto; color: var(--muted); }
.menu-list .grow { flex: 1; }

/* account hub */
.number-hero { border-radius: 20px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.number-hero .num { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.number-hero .lbl { font-size: 13px; color: var(--muted); }
.hub-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; min-height: 112px; display: flex; flex-direction: column; text-decoration: none !important; color: var(--ink); }
.tile:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.tile .ic { width: 26px; height: 26px; color: var(--accent-text); }
.tile b { font-size: 17px; margin-top: auto; }
.tile span { color: var(--muted); font-size: 13px; }
.progress { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #22C55E, #16A34A); border-radius: 99px; }
.profile-card { display: flex; align-items: center; gap: 16px; }

/* stats & usage chart */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 650; display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat.is-bad .v { color: var(--bad); }
.stat.is-ok .v { color: var(--ok); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot-sent { background: var(--accent); }
.dot-ok { background: var(--ok); }
.dot-bad { background: var(--bad); }
.dot-pending { background: color-mix(in srgb, var(--muted) 45%, transparent); }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid line { stroke: var(--line-2); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .bar-ok { fill: var(--ok); }
.chart .bar-bad { fill: var(--bad); }
.chart .bar-pending { fill: color-mix(in srgb, var(--muted) 40%, transparent); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover { fill: color-mix(in srgb, var(--accent) 8%, transparent); }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--surface); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; font-weight: 600; white-space: nowrap; transform: translate(-50%, -100%); box-shadow: var(--shadow); z-index: 3; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-bad td { background: color-mix(in srgb, var(--bad-soft) 55%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* failed list */
.failed-list { list-style: none; padding: 0; margin: 0; }
.failed-list li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.failed-list li:last-child { border-bottom: 0; }
.failed-list .x { width: 30px; height: 30px; border-radius: 50%; background: var(--bad-soft); color: var(--bad); display: grid; place-items: center; flex: none; }
.failed-list .x .ic { width: 16px; height: 16px; }
.failed-list .who { font-weight: 700; }
.failed-list .why { color: var(--bad); font-size: 13px; font-weight: 600; }
.failed-list .body { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* avatar chooser */
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.avatar-grid button { border: 2px solid transparent; border-radius: 50%; padding: 2px; background: none; cursor: pointer; aspect-ratio: 1; }
.avatar-grid button img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.avatar-grid button[aria-pressed="true"] { border-color: var(--accent); }
.avatar-grid button:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* theme chooser */
.theme-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.theme-opt { border: 2px solid var(--line); border-radius: 14px; padding: 8px; cursor: pointer; background: var(--surface); text-align: center; font: 650 13px var(--font); color: var(--ink); }
.theme-opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-swatch { height: 64px; border-radius: 9px; display: flex; overflow: hidden; margin-bottom: 7px; border: 1px solid rgba(0,0,0,.06); }
.theme-swatch i { width: 26%; display: block; }
.theme-swatch b { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 0 7px; }
.theme-swatch em { display: block; height: 9px; border-radius: 5px; width: 70%; }
.theme-swatch em + em { align-self: flex-end; }

/* switch */
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.setting-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.setting-row + .setting-row { border-top: 1px solid var(--line-2); }
.setting-row .grow { flex: 1; }
.setting-row .sub { display: block; font-size: 13px; color: var(--muted); }

/* security */
.qr-box { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.qr-box .qr { width: 180px; height: 180px; background: #fff; border-radius: 12px; padding: 10px; border: 1px solid var(--line); }
.qr-box .qr img, .qr-box .qr canvas, .qr-box .qr svg { width: 100%; height: 100%; display: block; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 15px; letter-spacing: .08em; background: var(--surface-2); border: 1px dashed var(--line); padding: 8px 12px; border-radius: 10px; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 15px; }
.codes span { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; text-align: center; }

/* ================= Messages ================= */
.chat { flex: 1; display: flex; min-height: 0; }
.inbox { width: 360px; flex: none; border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.inbox-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line-2); }
.me-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.me-num { flex: 1; min-width: 0; }
.me-num .n { font-size: 17px; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: center; gap: 6px; }
.me-num .s { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-switch { position: relative; }
.line-switch > button { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.line-switch .ic { width: 16px; height: 16px; color: var(--muted); }
.dropdown { position: absolute; top: calc(100% + 6px); left: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); min-width: 250px; padding: 6px; z-index: 30; }
.dropdown button, .dropdown a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 10px; font: 600 14px var(--font); color: var(--ink); cursor: pointer; text-align: left; text-decoration: none !important; }
.dropdown button:hover, .dropdown a:hover { background: var(--hover); }
.dropdown .on { color: var(--accent-text); }
.dropdown .meta { font-size: 12px; color: var(--muted); font-weight: 500; display: block; }
.dropdown .danger { color: var(--bad); }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 0 12px; height: 40px; }
.search .ic { color: var(--muted); width: 18px; height: 18px; }
.search input { border: 0 !important; box-shadow: none !important; padding: 0; background: transparent; height: 38px; }
.conv-list { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 12px; align-items: center; width: 100%; padding: 11px 16px; border: 0; background: none; cursor: pointer; text-align: left; font: inherit; color: inherit; position: relative; }
.conv:hover { background: var(--hover); }
.conv.is-active { background: var(--accent-soft); }
.conv-body { flex: 1; min-width: 0; }
.conv-top, .conv-bottom { display: flex; align-items: center; gap: 8px; }
.conv-title { font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv time { font-size: 12px; color: var(--muted); flex: none; }
.conv-preview { flex: 1; min-width: 0; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.is-unread .conv-title { font-weight: 800; }
.conv.is-unread .conv-preview { color: var(--ink); font-weight: 600; }
.conv.is-failed .conv-preview { color: var(--bad); font-weight: 600; }
.conv .fail-mark { position: absolute; left: 44px; top: 38px; width: 18px; height: 18px; border-radius: 50%; background: var(--bad); color: #fff; display: grid; place-items: center; border: 2px solid var(--surface); font-size: 11px; font-weight: 900; }
.unread { min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 800; display: grid; place-items: center; padding: 0 6px; flex: none; }
.chip { font-size: 10.5px; font-weight: 800; letter-spacing: .04em; padding: 2px 6px; border-radius: 6px; background: var(--line-2); color: var(--muted); flex: none; }
.chip-member { background: var(--ok-soft); color: var(--ok); }
.chip-ro { background: var(--warn-soft); color: var(--warn); }
.conn-banner { margin: 8px 12px 0; padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; }
.empty { text-align: center; padding: 40px 24px; color: var(--muted); }
.empty-art { width: 84px; height: 84px; margin: 0 auto 12px; border-radius: 26px; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent-text); }
.empty-art .ic { width: 38px; height: 38px; }
.inbox-cta { margin: 10px 12px; padding: 12px 14px; border-radius: 14px; background: var(--brand-grad); color: #fff; display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 14px; text-decoration: none !important; }
.inbox-cta .ic { color: #fff; }

.thread { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface); }
.thread-placeholder { flex: 1; display: grid; place-items: center; align-content: center; gap: 10px; color: var(--muted); text-align: center; padding: 20px; }
.thread-placeholder .big { font-size: 22px; font-weight: 800; color: var(--ink); }
.thread-inner { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); min-height: 66px; }
.thread-head .back { display: none; }
.thread-title { flex: 1; min-width: 0; }
.thread-title h2 { font-size: 16.5px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-title p { margin: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-pill { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--accent); color: var(--accent-text); font-weight: 700; font-size: 13.5px; background: transparent; cursor: pointer; }
.call-pill .ic { width: 17px; height: 17px; }
.menu-wrap { position: relative; }
.menu-wrap .dropdown { left: auto; right: 0; }
.ro-bar, .blocked-bar { padding: 9px 16px; font-size: 13.5px; font-weight: 600; text-align: center; }
.ro-bar { background: var(--warn-soft); color: var(--warn); }
.blocked-bar { background: var(--bad-soft); color: var(--bad); }
.messages { flex: 1; overflow-y: auto; padding: 18px 20px 10px; display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); }
.day-sep { text-align: center; margin: 14px 0 10px; }
.day-sep span { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--line-2); padding: 3px 10px; border-radius: 99px; }
.older-hint { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.msg { display: flex; flex-direction: column; max-width: min(76%, 560px); }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.bubble { padding: 9px 14px; border-radius: 20px; font-size: 15px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.theirs .bubble { background: var(--bubble-theirs); color: var(--bubble-theirs-ink); border-bottom-left-radius: 6px; }
.msg.mine .bubble { background: var(--bubble-mine); color: var(--bubble-mine-ink); border-bottom-right-radius: 6px; }
.msg.grouped .bubble { border-radius: 20px; }
.msg.mine.grouped .bubble { border-bottom-right-radius: 20px; }
.msg.mine .bubble a { color: #fff; text-decoration: underline; }
.msg.failed .bubble { background: var(--bad-soft); color: var(--bad); border: 1.5px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.msg .media { display: grid; gap: 4px; margin-bottom: 3px; }
.msg .media img { display: block; width: auto; height: auto; max-width: min(280px, 100%); max-height: 320px; border-radius: 16px; background: var(--line-2); cursor: zoom-in; object-fit: contain; }
.msg.failed .media img { opacity: .55; outline: 2px solid var(--bad); }
.meta { display: flex; gap: 6px; align-items: center; font-size: 11.5px; color: var(--muted); margin: 3px 6px 8px; }
.st-failed { color: var(--bad); font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.st-seen { color: var(--accent-text); font-weight: 650; }
.thread-empty { margin: auto; color: var(--muted); }
.giphy-tag { font-size: 10px; color: var(--muted); }

.composer { border-top: 1px solid var(--line-2); padding: 10px 12px 12px; background: var(--surface); }
.new-to { display: flex; align-items: center; gap: 10px; padding: 4px 4px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 10px; }
.new-to label { margin: 0; color: var(--muted); }
.new-to input { border: 0 !important; box-shadow: none !important; padding: 6px 0; font-size: 16px; }
.new-to .from-line { font-size: 12px; color: var(--muted); white-space: nowrap; }
.attach-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 4px 8px; }
.attach { position: relative; width: 72px; height: 72px; border-radius: 12px; overflow: hidden; background: var(--line-2); }
.attach img { width: 100%; height: 100%; object-fit: cover; }
.attach button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(15, 18, 32, .7); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.attach button .ic { width: 13px; height: 13px; stroke-width: 2.4; }
.attach .spin { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.6); }
.compose-row { display: flex; align-items: flex-end; gap: 6px; }
.compose-tools { display: flex; gap: 2px; padding-bottom: 3px; }
.compose-tools .icon-btn { width: 38px; height: 38px; color: var(--muted); }
.compose-tools .icon-btn:hover { color: var(--accent-text); }
.compose-box { flex: 1; display: flex; align-items: flex-end; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 22px; padding: 4px 4px 4px 14px; }
.compose-box:focus-within { border-color: var(--accent); }
.compose-box textarea { border: 0 !important; box-shadow: none !important; background: transparent; padding: 9px 0; min-height: 0; resize: none; max-height: 160px; font-size: 15px; }
.send-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--brand-grad); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; transition: opacity .15s, transform .1s; }
:root[data-theme="ocean"] .send-btn { background: linear-gradient(135deg, #0284C7, #0D9488); }
.send-btn:disabled { opacity: .35; cursor: default; }
.send-btn .ic { width: 19px; height: 19px; }
.compose-hint { font-size: 12px; color: var(--muted); margin: 6px 6px 0; min-height: 0; }
.compose-hint:empty { display: none; }
.wait-banner { font-size: 13px; font-weight: 600; margin: 6px 4px 0; padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); }
.st-held { color: var(--warn); font-weight: 700; }
.st-pending { color: var(--muted); }
.link-table td.url { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.gif-panel { position: absolute; bottom: calc(100% + 8px); left: 12px; width: min(420px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 12px; z-index: 40; }
.gif-panel .search { margin-bottom: 10px; }
.gif-grid { columns: 3 110px; column-gap: 6px; max-height: 320px; overflow-y: auto; }
.gif-grid button { display: block; width: 100%; margin: 0 0 6px; border: 0; padding: 0; background: var(--line-2); border-radius: 10px; overflow: hidden; cursor: pointer; break-inside: avoid; }
.gif-grid img { width: 100%; display: block; }
.gif-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.composer { position: relative; }

.lightbox { position: fixed; inset: 0; background: rgba(8, 10, 18, .9); z-index: 150; display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* keypad */
.keypad-wrap { max-width: 360px; margin: 0 auto; padding: 24px 20px; text-align: center; }
.dial-display { font-size: 30px; font-weight: 750; min-height: 46px; letter-spacing: .02em; word-break: break-all; }
.dial-match { min-height: 22px; color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0; }
.key { aspect-ratio: 1.15; border-radius: 20px; border: 0; background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid var(--line); font: 700 26px var(--font); color: var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.key small { font-size: 10px; letter-spacing: .14em; color: var(--muted); font-weight: 700; }
.key:active { background: var(--accent-soft); }
.dial-actions { display: flex; gap: 12px; justify-content: center; align-items: center; }

/* contacts */
.contacts-list { list-style: none; margin: 0; padding: 0; }
.contact-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line-2); }
.contact-row .grow { flex: 1; min-width: 0; }
.contact-row .name { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.contact-row .num { font-size: 13px; color: var(--muted); }
.letter { font-size: 12px; font-weight: 800; color: var(--accent-text); padding: 14px 4px 2px; }
.import-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.import-opt { border: 1.5px dashed var(--line); border-radius: 14px; padding: 16px; text-align: center; background: var(--surface-2); }
.import-opt .ic { width: 28px; height: 28px; color: var(--accent-text); margin-bottom: 6px; }

/* ================= Bottom tabs on phones ================= */
.tabbar { display: none; }
@media (max-width: 860px) {
  .rail { display: none; }
  .tabbar {
    display: flex; position: relative; z-index: 10; background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  :root[data-theme="purple"] .tabbar, :root[data-theme="ocean"] .tabbar { background: var(--rail-bg); border-top: 0; }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0; font-size: 11px; font-weight: 700; color: var(--rail-ink); text-decoration: none !important; position: relative; border-radius: 12px; }
  .tabbar a.is-active { color: var(--rail-active); }
  .tabbar a.is-active .ic { background: var(--rail-active-bg); border-radius: 99px; width: 52px; padding: 3px 0; height: 30px; }
  .tabbar .ic { width: 24px; height: 24px; }
  .tabbar .tab-badge { right: calc(50% - 24px); top: 0; }
  .app-shell { flex-direction: column; }
  .app-main { order: 1; }
  .tabbar { order: 2; }
  .inbox { width: 100%; border-right: 0; }
  .chat[data-view="list"] .thread { display: none; }
  .chat[data-view="thread"] .inbox { display: none; }
  body[data-chat-view="thread"] .tabbar { display: none; }
  .thread-head .back { display: inline-grid; }
  .page { padding: 18px 16px 40px; }
  .hub-grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 12px; }
  .stat .v { font-size: 24px; }
  .theme-grid { grid-template-columns: repeat(3, 1fr); }
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
  .call-pill span { display: none; }
  .call-pill { padding: 0 11px; }
  .msg { max-width: 86%; }
  .import-opts { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .auth-card h1 { font-size: 28px; }
  .auth-top { padding: 16px 18px; }
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .stat .k { font-size: 11.5px; }
  .stat .v { font-size: 21px; }
}

/* ================= Staff panel ================= */
.admin-shell { display: flex; min-height: 100vh; }
.admin-side { width: 250px; flex: none; background: #11141F; color: #C9CDE0; padding: 18px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-side .wordmark { color: #fff; height: 26px; margin: 2px 8px 6px; }
.admin-side .role-tag { margin: 0 8px 16px; font-size: 12px; color: #8C92AB; }
.admin-side nav { display: flex; flex-direction: column; gap: 2px; }
.admin-side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: #C9CDE0; font-weight: 600; font-size: 14px; text-decoration: none !important; }
.admin-side nav a:hover { background: #1C2133; color: #fff; }
.admin-side nav a.is-active { background: linear-gradient(135deg, rgba(85,70,255,.35), rgba(147,51,234,.35)); color: #fff; }
.admin-side nav .ic { width: 18px; height: 18px; }
.admin-side nav .pill { margin-left: auto; background: #F43F5E; color: #fff; height: 20px; }
.admin-side .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6B7089; font-weight: 800; padding: 14px 12px 6px; }
.admin-side-foot { margin-top: auto; padding: 14px 12px 0; display: grid; gap: 8px; font-size: 14px; }
.admin-side-foot a, .admin-side-foot .link { color: #C9CDE0; font-weight: 600; }
.admin-main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.admin-main > .page-head h1 { font-size: 24px; }
.admin-top { display: none; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; text-decoration: none !important; color: var(--ink); display: block; }
.kpi:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.kpi .k { font-size: 12.5px; color: var(--muted); font-weight: 650; }
.kpi .v { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi.alert .v { color: var(--bad); }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 999px; font-weight: 650; font-size: 13.5px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); text-decoration: none !important; }
.tabs a.is-active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar form { display: flex; gap: 8px; flex: 1; min-width: 240px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 14px; margin: 0; }
.dl dt { color: var(--muted); font-weight: 600; }
.dl dd { margin: 0; font-weight: 550; word-break: break-word; }
.inline-form { display: inline; }
.form-inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .field { margin: 0; }
.code-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.code-list span { font-family: ui-monospace, Menlo, monospace; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 10px; padding: 8px 10px; text-align: center; font-weight: 700; }
.note-box { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--ink-2); }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.check-list label { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 0; font-size: 14px; color: var(--ink); }
.check-list input { accent-color: var(--accent); }
.faq-edit { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--surface-2); }
@media (max-width: 960px) {
  .admin-shell { flex-direction: column; }
  .admin-side { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 6px; }
  .admin-side nav { flex-direction: row; flex-wrap: wrap; }
  .admin-side .grp, .admin-side .role-tag { display: none; }
  .admin-side nav a { padding: 7px 10px; font-size: 13px; }
  .admin-side-foot { margin: 0; padding: 0; display: flex; gap: 12px; }
  .admin-main { padding: 18px 16px 50px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
}

/* keypad input */
.dial-input { text-align: center; font-size: 30px !important; font-weight: 750 !important; border: 0 !important; box-shadow: none !important; background: transparent !important; letter-spacing: .02em; padding: 6px 0 !important; }

/* Free / SMS switch */
.mode-btn { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border-radius: 8px; border: 0; font: 800 11px var(--font); letter-spacing: .04em; cursor: pointer; background: var(--line-2); color: var(--muted); }
.mode-btn.is-free { background: var(--ok-soft); color: var(--ok); }
.mode-btn.is-sms { background: var(--accent-soft); color: var(--accent-text); }
.mode-btn::after { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-1px, -1px); margin-left: 3px; }
.mode-btn.no-menu { cursor: default; }
.mode-btn.no-menu::after { display: none; }
.sms-toggle { display: inline-flex; align-items: center; gap: 5px; margin: 0; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; cursor: pointer; }
.sms-toggle input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }

/* Install banner */
.install-banner { position: fixed; left: 50%; bottom: 20px; z-index: 120; width: min(520px, calc(100% - 24px)); transform: translate(-50%, 140%); transition: transform .32s cubic-bezier(.2,.8,.2,1);
  display: flex; align-items: center; gap: 14px; padding: 14px 44px 14px 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); }
.install-banner.is-open { transform: translate(-50%, 0); }
.install-banner img { border-radius: 12px; flex: none; }
.install-banner .ib-text { flex: 1; min-width: 0; font-size: 14px; }
.install-banner .ib-text p { margin: 2px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.install-banner .ib-actions { display: flex; flex-direction: column; gap: 6px; }
.install-banner .ib-x { position: absolute; top: 6px; right: 8px; width: 30px; height: 30px; border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; border-radius: 8px; }
.install-banner .ib-x:hover { background: var(--hover); }
@media (max-width: 860px) {
  .install-banner { bottom: calc(76px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .install-banner .ib-actions { flex-direction: row; width: 100%; justify-content: flex-end; }
}

/* ---- P2P compliance update: permissions, moderation, notices ---- */
.perm-table th.c, .perm-table td.c { text-align: center; width: 92px; }
.perm-table .perm-group td { background: var(--surface-2, rgba(85, 70, 255, .06)); padding-top: 12px; padding-bottom: 8px; }
.perm-cell { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.perm-cell input, .perm-table input[type=checkbox] { width: 18px; height: 18px; }
.perm-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #9AA0B4; vertical-align: middle; }
.perm-select { width: auto; min-width: 150px; height: 34px; padding: 4px 10px; font-size: 13px; }
.notice-bar { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; background: #FFF4E5; color: #7A4100; border-bottom: 1px solid #F5D1A0; font-size: 14px; line-height: 1.45; }
.notice-bar b { display: block; margin-bottom: 2px; }
.notice-bar form { margin-left: auto; flex: none; }
.notice-bar.notice-info { background: #EEF0FF; color: #2E2A7A; border-color: #D4D6FA; }
[data-theme=dark] .notice-bar.notice-info { background: #1F2147; color: #CFD2FF; border-color: #33366B; }
[data-theme=dark] .notice-bar { background: #3A2A12; color: #FFD9A8; border-color: #5A4220; }
.compose-tools.is-off { display: none; }

/* ---------- Carriers, number filters, cost report (admin) ---------- */
.pill-carrier { font-weight: 750; }
.pc-c1 { background: #E3F7F1; color: #0B7A5C; }
.pc-c2 { background: #FCE7F3; color: #B4236E; }
.pc-c3 { background: #FEF3C7; color: #92400E; }
.pc-c4 { background: #EDE9FE; color: #6D28D9; }
.pc-c5 { background: #DBEAFE; color: #1D4ED8; }
.pc-other { background: var(--line-2); color: var(--muted); }
:root[data-theme="dark"] .pc-c1 { background: #0F3A2F; color: #6EE7C3; }
:root[data-theme="dark"] .pc-c2 { background: #3E1430; color: #F9A8D4; }
:root[data-theme="dark"] .pc-c3 { background: #3B2A0A; color: #FCD34D; }
:root[data-theme="dark"] .pc-c4 { background: #2A1F4A; color: #C4B5FD; }
:root[data-theme="dark"] .pc-c5 { background: #172A4D; color: #93C5FD; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filter-bar label { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 12px; font-weight: 700; color: var(--muted); }
.filter-bar select, .filter-bar input { height: 36px; padding: 4px 10px; width: auto; min-width: 130px; font-size: 14px; }
.filter-bar .btn { height: 36px; }
.filter-bar > .small { align-self: center; }
.carrier-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 16px; }
.carrier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 12px; margin-bottom: 16px; }
.carrier-card .table td:first-child { white-space: nowrap; }
.carrier-card .card-head { flex-wrap: wrap; gap: 6px; }
.carrier-box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; color: var(--ink); text-decoration: none !important; display: grid; gap: 4px; }
.carrier-box:hover { border-color: var(--accent); }
.carrier-box .v { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.carrier-card { margin: 0; }
.carrier-total { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.report-total { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.report-total .k { font-size: 13px; color: var(--muted); font-weight: 650; }
.report-total .v { font-size: 38px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.report-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 20px; flex: 1; margin: 0; }
.report-split dt { font-size: 12px; color: var(--muted); font-weight: 650; }
.report-split dd { margin: 2px 0 0; font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; }
.table-compact th, .table-compact td { padding: 7px 10px; }
.est { color: var(--warn); font-weight: 800; margin-left: 2px; cursor: help; }
.row-edit { position: relative; }
.row-edit > summary { list-style: none; display: inline-flex; align-items: center; }
.row-edit > summary::-webkit-details-marker { display: none; }
.row-edit-form { position: absolute; right: 0; top: 34px; z-index: 20; width: 250px; display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 12px 30px rgba(15, 18, 32, .14); }
.row-edit-form label { display: grid; gap: 3px; font-size: 12px; font-weight: 700; color: var(--muted); margin: 0; }
.row-edit-form select, .row-edit-form input { height: 34px; padding: 4px 8px; font-size: 14px; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
@media (max-width: 720px) {
  .filter-bar select, .filter-bar input { min-width: 0; width: 100%; }
  .filter-bar label { flex: 1 1 140px; }
  .report-total .v { font-size: 30px; }
  .row-edit-form { right: auto; left: 0; }
  .carrier-card .table td:first-child { white-space: normal; }
}

/* Admin → Calling */
.setup-steps { margin: 0; padding-left: 20px; display: grid; gap: 14px; }
.setup-steps li b { margin-right: 6px; }
.setup-steps code { font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; word-break: break-all; }

/* Voice call screen */
.callui { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; background: rgba(15, 14, 30, .55); backdrop-filter: blur(6px); }
.callui[hidden] { display: none; }
.callui-card { width: min(360px, calc(100vw - 32px)); background: linear-gradient(160deg, #2A2370 0%, #4B2FB8 55%, #7A3FE0 100%); color: #fff; border-radius: 28px; padding: 34px 24px 26px; text-align: center; box-shadow: 0 30px 80px rgba(20, 10, 60, .45); }
.callui-av { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; font-size: 34px; font-weight: 800; background: rgba(255,255,255,.16); overflow: hidden; }
.callui-av img { width: 100%; height: 100%; object-fit: cover; }
.callui.is-incoming .callui-av { animation: cu-pulse 1.6s ease-out infinite; }
@keyframes cu-pulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.45); } 100% { box-shadow: 0 0 0 26px rgba(255,255,255,0); } }
.callui-name { font-size: 24px; font-weight: 800; letter-spacing: -.01em; word-break: break-word; }
.callui-sub { font-size: 14px; opacity: .78; margin-top: 4px; }
.callui-status { font-size: 16px; font-weight: 650; margin: 14px 0 22px; min-height: 22px; font-variant-numeric: tabular-nums; }
.callui-btns { display: flex; justify-content: center; gap: 22px; }
.callui-btns[hidden] { display: none; }
.cbtn { display: grid; justify-items: center; gap: 6px; background: none; border: 0; color: #fff; font: 600 12.5px/1 var(--font, inherit); cursor: pointer; }
.cbtn .ic { width: 58px; height: 58px; padding: 16px; border-radius: 50%; background: rgba(255,255,255,.16); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; box-sizing: border-box; }
.cbtn.on .ic { background: #fff; color: #3B2A99; }
.cbtn-green .ic { background: #1DB954; }
.cbtn-red .ic { background: #E5484D; }
.cbtn-red .ic path { fill: currentColor; stroke: none; }
.cbtn:focus-visible .ic { outline: 3px solid #fff; outline-offset: 3px; }
.callui-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 auto 20px; max-width: 240px; }
.callui-pad[hidden] { display: none; }
.callui-pad button { height: 48px; border-radius: 14px; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 20px; font-weight: 700; cursor: pointer; }
.callui-pad button:active { background: rgba(255,255,255,.3); }
@media (max-width: 560px) { .callui { place-items: stretch; } .callui-card { width: 100%; border-radius: 0; display: flex; flex-direction: column; justify-content: center; padding-bottom: calc(40px + env(safe-area-inset-bottom)); } }

/* Recent calls (keypad page) */
.recent-calls { max-width: 420px; margin: 26px auto 0; text-align: left; }
.recent-calls h2 { font-size: 15px; margin: 0 0 8px; }
.rc-row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.rc-row:last-child { border-bottom: 0; }
.rc-row .rc-main { flex: 1; min-width: 0; }
.rc-row .rc-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-row .rc-meta { font-size: 12.5px; color: var(--muted); }
.rc-row.is-missed .rc-name { color: var(--bad); }
.rc-row .icon-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.callui-av .ic { width: 42px; height: 42px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Message requests */
.req-row { display: flex; align-items: center; gap: 12px; width: calc(100% - 16px); margin: 4px 8px 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: inherit; }
.req-row:hover { background: var(--hover); }
.req-row > span:nth-child(2) { flex: 1; min-width: 0; }
.req-row b { font-weight: 700; }
.req-row .req-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.req-row .req-ic svg { width: 20px; height: 20px; }
.req-head { padding: 6px 16px 8px; border-bottom: 1px solid var(--line); }
.req-head .link { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; padding: 4px 0; background: none; border: 0; color: var(--accent-text); cursor: pointer; font: inherit; }
.req-head .link svg { width: 18px; height: 18px; }
.req-head p { margin: 4px 0 0; }
.request-bar { padding: 12px 16px; background: var(--line-2); border-bottom: 1px solid var(--line); font-size: 14px; }
.request-bar p { margin: 0 0 8px; }
.request-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Number costs panel */
.nc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.nc-month { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--surface-2); }
.nc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.nc-head .k { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.nc-head .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.table tr.is-past td { color: var(--muted); }
.cost-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.cost-kpis .ck { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface-2); text-decoration: none; color: inherit; }
.cost-kpis .ck .k { font-size: 12px; font-weight: 700; color: var(--muted); }
.cost-kpis .ck .v { font-size: 22px; font-weight: 800; margin-top: 2px; }
.cost-kpis .ck .s { font-size: 12px; color: var(--muted); }
.susp-row { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
.susp-row:last-child { border-bottom: 0; }
.susp-row details summary { cursor: pointer; }
.plan-left { font-size: 15px; margin-bottom: 8px; }
.plan-left b { font-size: 22px; }
.meter { height: 10px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--brand-grad); border-radius: 999px; }
.meter.is-warn span { background: var(--warn); }

.switch-group { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 0 6px; }

/* Permissions: open / close sections */
.perm-toggle { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.perm-toggle .ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; flex: none; }
.perm-toggle[aria-expanded="true"] .ic { transform: rotate(90deg); }
.perm-table td.perm-sub { padding-left: 34px; }

/* ---------- Batch 2: billing, "texts left" meters ---------- */
.bill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.bill-opt { display: flex; flex-direction: column; gap: 6px; border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 16px; background: var(--surface); }
.bill-opt .price { font-size: 22px; font-weight: 800; }
.bill-opt .price small { font-size: 12px; font-weight: 600; }
.bill-opt .btn { align-self: flex-start; margin-top: auto; }
.bill-plan { cursor: pointer; position: relative; }
.bill-plan input { position: absolute; top: 14px; right: 14px; }
.bill-plan:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { display: inline-flex; gap: 6px; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 650; font-size: 14px; }
.seg label:has(input:checked) { border-color: var(--accent); color: var(--accent-text, var(--accent)); }
.seg small { color: var(--ok, #16A34A); font-weight: 800; }

.rail-meter { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none !important; margin-bottom: 8px; }
.rail-meter .ring { --p: 100; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--m-color, var(--accent)) calc(var(--p) * 1%), color-mix(in srgb, var(--muted) 22%, transparent) 0); }
.rail-meter .ring b { width: 30px; height: 30px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 10.5px; color: var(--ink); }
.rail-meter.is-low { --m-color: var(--warn); }
.rail-meter.is-out { --m-color: var(--bad); }

.water { --p: 50; width: 168px; height: 168px; border-radius: 50%; position: relative; overflow: hidden; margin: 6px auto 10px;
  border: 4px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.water .fill { position: absolute; left: -50%; width: 200%; height: 200%; top: calc(100% - var(--p) * 1%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 70%, #fff) 0%, var(--accent) 60%); border-radius: 42%; animation: water-wave 7s linear infinite; }
.water.is-low { border-color: var(--warn); } .water.is-low .fill { background: linear-gradient(180deg, #FFC56B, var(--warn)); }
.water.is-out { border-color: var(--bad); } .water.is-out .fill { background: linear-gradient(180deg, #FF8FA1, var(--bad)); }
.water .lbl { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 800; font-size: 30px; color: var(--ink); text-shadow: 0 1px 0 rgba(255,255,255,.6); }
.water .lbl small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
@keyframes water-wave { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .water .fill { animation: none; border-radius: 0; left: 0; width: 100%; } }

.score-ring { --p: 50; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; margin: 4px auto 8px;
  background: conic-gradient(var(--s-color, var(--ok, #16A34A)) calc(var(--p) * 1%), color-mix(in srgb, var(--muted) 20%, transparent) 0); }
.score-ring b { width: 96px; height: 96px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 30px; font-weight: 800; }
.score-ring.is-mid { --s-color: var(--warn); } .score-ring.is-low { --s-color: var(--bad); }

.usage-alert { display: flex; gap: 12px; align-items: center; padding: 10px 16px; background: var(--warn-soft); color: var(--warn); font-weight: 650; font-size: 14px; border-bottom: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.usage-alert a.btn { margin-left: auto; }

/* ---------- Batch 3: sales & revenue ---------- */
.day-pick { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }
.day-pick input[type="date"], .day-pick input[type="month"] { max-width: 190px; }
.row-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.edit-row summary { list-style: none; cursor: pointer; }
.edit-row summary::-webkit-details-marker { display: none; }
.edit-row[open] form { display: grid; gap: 6px; min-width: 220px; margin-top: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.submit-bar { display: flex; gap: 12px; align-items: center; border-color: var(--warn); background: var(--warn-soft); }
.share-table input[type="text"] { width: 100%; }

/* ---------- Short links page ---------- */
.links-page { max-width: 980px; }
.lk-hero { border-radius: 22px; padding: 22px; margin-bottom: 18px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #9333EA 0%, #5546FF 55%, #3B2FD9 100%); box-shadow: 0 18px 44px rgba(85, 70, 255, .22); }
.lk-hero-text { display: flex; gap: 14px; align-items: flex-start; }
.lk-hero h2 { margin: 0 0 4px; font-size: 20px; color: #fff; }
.lk-hero p { margin: 0; opacity: .92; font-size: 14px; line-height: 1.5; }
.lk-badge { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,255,255,.18); }
.lk-badge .ic { width: 24px; height: 24px; color: #fff; }
.lk-make { display: flex; gap: 10px; margin-top: 16px; }
.lk-make input { flex: 1; min-width: 0; height: 50px; border-radius: 14px; border: 0; padding: 0 16px; font-size: 15px; background: #fff; color: #111; }
.lk-make .btn { height: 50px; padding: 0 20px; background: #0F1220; border-color: #0F1220; color: #fff; display: inline-flex; gap: 8px; align-items: center; }
.lk-make .btn .ic { width: 18px; height: 18px; }
.lk-result { margin-top: 12px; background: #fff; color: var(--ink, #0F1220); border-radius: 14px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.lk-result > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lk-result b { font-size: 18px; }
.lk-tip { display: flex; gap: 8px; align-items: center; margin: 12px 0 0 !important; font-size: 13px !important; }
.lk-tip .ic { width: 16px; height: 16px; flex: none; }
.lk-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lk-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.lk-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.lk-kpi .k { display: block; font-size: 12.5px; color: var(--muted); font-weight: 650; }
.lk-kpi b { font-size: 26px; font-weight: 800; }
.lk-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.lk-bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 18px; }
.lk-bars .bar { flex: 1; height: var(--h); min-height: 2px; background: linear-gradient(180deg, #9333EA, #5546FF); border-radius: 5px 5px 2px 2px; position: relative; opacity: .9; }
.lk-bars .bar[style*="--h:0%"] { background: color-mix(in srgb, var(--muted) 22%, transparent); opacity: 1; }
.lk-bars .bar i { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 10px; font-weight: 700; color: var(--muted); }
.lk-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.lk-dev { display: grid; grid-template-columns: 74px 1fr 40px; gap: 10px; align-items: center; margin: 10px 0; font-size: 13.5px; font-weight: 600; }
.lk-dev .track { height: 10px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 18%, transparent); overflow: hidden; }
.lk-dev .track i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.lk-dev b { text-align: right; }
.lk-matrix { width: 100%; border-collapse: separate; border-spacing: 4px; }
.lk-matrix th { font-size: 11.5px; color: var(--muted); font-weight: 700; text-align: center; }
.lk-matrix th small { display: block; font-weight: 600; }
.lk-matrix th:first-child, .lk-matrix td:first-child { text-align: left; }
.lk-matrix td:first-child small { display: block; color: var(--muted); font-size: 11.5px; }
.lk-matrix .cell { display: grid; place-items: center; height: 34px; min-width: 34px; border-radius: 9px; font-size: 12.5px; font-weight: 750;
  background: color-mix(in srgb, var(--accent) calc(var(--a) * 100%), color-mix(in srgb, var(--muted) 10%, transparent)); color: var(--ink); }
.lk-matrix .cell[style*="--a:0;"], .lk-matrix .cell[style="--a:0"] { color: transparent; }
.lk-matrix td.tot { text-align: center; font-weight: 800; }
.lk-list { list-style: none; margin: 0; padding: 0; }
.lk-list li { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.lk-list li:first-child { border-top: 0; }
.lk-list li.is-off { opacity: .65; }
.lk-main { flex: 1; min-width: 0; }
.lk-short { display: flex; gap: 8px; align-items: center; font-size: 15.5px; }
.lk-long { color: var(--muted); font-size: 13px; margin: 2px 0 6px; }
.lk-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.lk-meta b { color: var(--ink); }
.lk-actions { display: flex; gap: 8px; flex: none; }
.lk-del { color: var(--bad) !important; }
.lk-empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.lk-empty .ic { width: 34px; height: 34px; color: var(--accent); }
@media (max-width: 760px) {
  .lk-kpis { grid-template-columns: repeat(2, 1fr); }
  .lk-grid { grid-template-columns: 1fr; }
  .lk-make { flex-direction: column; }
  .lk-list li { flex-direction: column; align-items: stretch; }
}

/* ---------- link help pop-up (chat) ---------- */
.link-help { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); width: min(460px, calc(100vw - 24px)); z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 50px rgba(15, 18, 32, .25); padding: 16px 18px; }
.link-help .lh-top { display: flex; gap: 12px; align-items: flex-start; }
.link-help .lh-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #5546FF, #9333EA); }
.link-help .lh-icon .ic { width: 22px; height: 22px; color: #fff; }
.link-help b { display: block; margin-bottom: 3px; }
.link-help p { margin: 0; font-size: 13.5px; color: var(--ink-2, var(--muted)); line-height: 1.45; }
.link-help .lh-chain { display: inline-flex; vertical-align: middle; width: 22px; height: 22px; border-radius: 7px; border: 1px solid var(--line); align-items: center; justify-content: center; }
.link-help .lh-chain .ic { width: 14px; height: 14px; }
.link-help .lh-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
@media (max-width: 760px) { .link-help { bottom: 150px; } }

/* ---------- staff usage report ---------- */
.stats.stats-usage { grid-template-columns: repeat(3, 1fr); }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dot-in { background: #0EA5E9; } .dot-reply { background: #8B5CF6; } .dot-block { background: #F59E0B; }
.stat.is-in .v { color: #0EA5E9; } .stat.is-reply .v { color: #8B5CF6; } .stat.is-block .v { color: #D97706; }
.usage-table td.num, .usage-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.usage-table tfoot th { font-weight: 800; }

/* ---------- contact request replies ---------- */
.req-msg { white-space: pre-wrap; margin: 0 0 10px; padding: 12px 14px; background: color-mix(in srgb, var(--muted) 8%, transparent); border-radius: 12px; }
.req-reply { margin: 0 0 10px 18px; padding: 10px 14px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 0 12px 12px 0; }
.req-reply.is-failed { border-left-color: var(--bad); }
.req-reply .req-body { white-space: pre-wrap; margin-top: 4px; font-size: 14px; }
.req-compose summary { list-style: none; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.req-compose summary::-webkit-details-marker { display: none; }
.req-compose summary .ic { width: 16px; height: 16px; }
.req-compose[open] form { margin-top: 12px; }

/* ---------- pay with crypto ---------- */
.cr-pay { display: flex; gap: 18px; align-items: center; padding: 14px; border: 1.5px dashed var(--line); border-radius: 16px; margin: 4px 0 14px; flex-wrap: wrap; }
.cr-qr { width: 150px; height: 150px; flex: none; background: #fff; border-radius: 12px; padding: 6px; }
.cr-qr svg { width: 100%; height: 100%; }
.cr-info { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.cr-amount { font-size: 26px; font-weight: 800; }
.cr-addr { word-break: break-all; font-size: 13.5px; padding: 6px 8px; background: color-mix(in srgb, var(--muted) 10%, transparent); border-radius: 8px; }
.cr-warn { margin: 6px 0 0; font-size: 12.5px; color: var(--warn); }
.cr-row { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.cr-row.is-pending { background: var(--warn-soft); margin: 0 -12px; padding: 12px; border-radius: 12px; }
.cr-row code { word-break: break-all; }
.cr-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- account balance ---------- */
.bal-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.bal-top > div { display: flex; flex-direction: column; }
.bal-amount { font-size: 32px; font-weight: 800; }
.bal-pay { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.bal-pay select { flex: 1; min-width: 220px; }
.bal-ledger { list-style: none; padding: 0; margin: 12px 0 0; }
.bal-ledger li { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.bal-ledger .grow { flex: 1; }
.bal-ledger .plus { color: var(--ok); } .bal-ledger .minus { color: var(--bad); }

/* ---- user labels ---- */
.label-pill { font-weight: 600; }
.label-colors { display: flex; gap: 8px; flex-wrap: wrap; }
.label-color { position: relative; cursor: pointer; }
.label-color input { position: absolute; opacity: 0; pointer-events: none; }
.label-color span { display: block; width: 28px; height: 28px; border-radius: 50%; border: 3px solid transparent; box-shadow: 0 0 0 1px var(--line); }
.label-color input:checked + span { border-color: var(--surface); box-shadow: 0 0 0 2px var(--ink); }
.label-color input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-text); }
