/* XCR9 app design system — /panel and /admin.
   Same tokens as the public site (ui/xcr9.css). No dependency on the old sketch theme.
   Tailwind (CDN) still provides layout utilities used by JS-rendered fragments; the
   ".app" layer below maps its colour utilities onto the semantic palette. */

@font-face { font-family: "SiteDigits"; src: local("Segoe UI"), local("Roboto"), local("Helvetica Neue"), local("Arial"); unicode-range: U+0030-0039; }
@font-face { font-family: "LabSans"; src: url("fonts/Vazirmatn-FD-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "LabSans"; src: url("fonts/Vazirmatn-FD-Medium.woff2") format("woff2"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "LabSans"; src: url("fonts/Vazirmatn-FD-Bold.woff2") format("woff2"); font-weight: 700 900; font-display: swap; }

/* ============================ tokens ============================ */
:root {
  --bg: #f6f6f3; --surface: #ffffff; --surface-2: #f0f0ec; --surface-3: #e7e7e2;
  --line: rgba(20,22,26,.09); --line-strong: rgba(20,22,26,.16);
  --text: #121417; --text-2: #3a3f46; --muted: #676d76; --faint: #9aa0a8;
  --accent: #3f6d00; --accent-ink: #f7ffe6; --accent-soft: rgba(95,150,0,.11); --accent-line: rgba(63,109,0,.35);
  --ok: #3f6d00; --ok-soft: rgba(95,150,0,.1); --ok-line: rgba(63,109,0,.3);
  --warn: #a16207; --warn-soft: rgba(202,138,4,.1); --warn-line: rgba(161,98,7,.3);
  --danger: #dc2626; --danger-soft: rgba(220,38,38,.08); --danger-line: rgba(220,38,38,.3);
  --info: #3f4d63; --info-soft: rgba(63,77,99,.08); --info-line: rgba(63,77,99,.22);
  --shadow: 0 1px 0 rgba(20,22,26,.04), 0 12px 32px -18px rgba(20,22,26,.2);
  --overlay: rgba(10,11,13,.45);
  --radius: 18px; --radius-sm: 12px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "SiteDigits", "LabSans", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  color-scheme: light;
  /* names still referenced by inline styles inside the page scripts */
  --pencil-ink: var(--text); --pencil-soft: var(--muted); --pencil-ink-rgb: 18, 20, 23; --paper-bg-day: var(--surface);
  --accent-coral: var(--accent); --accent-yellow: var(--accent); --accent-mint: var(--accent); --accent-peach: var(--warn-soft);
  --wobble-1: 16px; --wobble-2: 16px; --wobble-subtle: 16px; --wobble-sharp: 12px;
}
:root[data-theme="dark"] {
  --bg: #0a0b0d; --surface: #111317; --surface-2: #171a1f; --surface-3: #1e2228;
  --line: rgba(255,255,255,.07); --line-strong: rgba(255,255,255,.14);
  --text: #eceef1; --text-2: #c9cdd3; --muted: #8b929c; --faint: #5c636d;
  --accent: #c6f432; --accent-ink: #0d1200; --accent-soft: rgba(198,244,50,.1); --accent-line: rgba(198,244,50,.35);
  --ok: #c6f432; --ok-soft: rgba(198,244,50,.09); --ok-line: rgba(198,244,50,.28);
  --warn: #fbbf24; --warn-soft: rgba(251,191,36,.09); --warn-line: rgba(251,191,36,.28);
  --danger: #f87171; --danger-soft: rgba(248,113,113,.09); --danger-line: rgba(248,113,113,.3);
  --info: #aab6c8; --info-soft: rgba(170,182,200,.08); --info-line: rgba(170,182,200,.2);
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 20px 40px -24px rgba(0,0,0,.8);
  --overlay: rgba(5,6,8,.66);
  --pencil-ink-rgb: 236, 238, 241;
  color-scheme: dark;
}

/* ============================ base ============================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.app { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.7; -webkit-font-smoothing: antialiased; }
body.app::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(900px 480px at 50% -240px, var(--accent-soft), transparent 70%), radial-gradient(var(--line) 1px, transparent 1.2px) 0 0 / 22px 22px;
  -webkit-mask-image: linear-gradient(#000, transparent 60%); mask-image: linear-gradient(#000, transparent 60%); }
.app a { color: inherit; text-decoration: none; }
.app button, .app input, .app select, .app textarea { font: inherit; color: inherit; }
.app button { cursor: pointer; }
.app :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.app ::selection { background: var(--accent); color: var(--accent-ink); }
.app .mono, .app .font-mono, .app code, .app pre, .app kbd { font-family: var(--mono) !important; }
.app .ltr { direction: ltr; unicode-bidi: isolate; }
.app h1, .app h2, .app h3, .app h4 { margin: 0; line-height: 1.35; letter-spacing: -.01em; }
.app p { margin: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.app .i { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.app .i-sm { width: 15px; height: 15px; }
.app .i-lg { width: 22px; height: 22px; }

/* ============================ shell ============================ */
.app .topbar { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.app .topbar-in { max-width: 1200px; margin: 0 auto; height: 62px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
@media (min-width: 720px) { .app .topbar-in { padding: 0 28px; } }
.app .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 0; }
.app .brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--text); color: var(--bg); display: grid; place-items: center; font-family: var(--mono); font-size: 12px; font-weight: 700; flex: none; }
.app .brand-name { font-family: var(--mono); font-size: 15px; }
.app .brand-sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-inline-start: 4px; padding-inline-start: 10px; border-inline-start: 1px solid var(--line-strong); white-space: nowrap; }
@media (max-width: 560px) { .app .brand-sub { display: none; } }
.app .top-actions { display: flex; align-items: center; gap: 6px; }
.app .who { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 6px 0 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; max-width: 220px; background: transparent; }
.app .who .av { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.app .who .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .app .who .nm { display: none; } .app .who { padding: 0 6px; } }

.app .shell { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; display: grid; gap: 24px; }
@media (min-width: 720px) { .app .shell { padding: 32px 28px 80px; } }
@media (min-width: 1040px) { .app .shell.has-side { grid-template-columns: 220px minmax(0, 1fr); align-items: start; } }
.app .side { display: none; }
@media (min-width: 1040px) { .app .side { display: block; position: sticky; top: 86px; } }
.app .side nav { display: flex; flex-direction: column; gap: 2px; }
.app .side a, .app .side button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 11px; font-size: 14px; color: var(--muted); background: none; border: 0; text-align: start; width: 100%; transition: background .15s, color .15s; }
.app .side a:hover, .app .side button:hover { color: var(--text); background: var(--surface-2); }
.app .side a.on, .app .side button.on, .app .side button.active { color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.app .side .i { opacity: .8; }
.app .side .side-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); }
.app .jump { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: -4px -16px 0; padding: 0 16px 4px; }
.app .jump::-webkit-scrollbar { display: none; }
.app .jump a, .app .jump button { flex: none; font-size: 13px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: var(--surface); }
.app .jump button.active { color: var(--bg); background: var(--text); border-color: transparent; }
@media (min-width: 1040px) { .app .jump { display: none; } }
.app .main { display: grid; gap: 18px; min-width: 0; }
.app .split { display: grid; gap: 18px; }
@media (min-width: 900px) { .app .split { grid-template-columns: 1fr 1fr; align-items: start; } }

/* ============================ surfaces ============================ */
.app .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
@media (min-width: 720px) { .app .card { padding: 24px; } }
.app .card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.app .card-head h2, .app .card-head h3 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.app .card-head .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--text-2); flex: none; }
.app .card-head p, .app .sub { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.app .eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); direction: ltr; unicode-bidi: isolate; }
.app .inset { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.app .divider { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.app .kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; padding: 6px 0; }
.app .kv > span:first-child { color: var(--muted); }
.app .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.app .row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.app .stack { display: grid; gap: 12px; }

/* hero / greeting */
.app .hello { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.app .hello h1 { font-size: clamp(22px, 3.4vw, 30px); font-weight: 700; }
.app .hello h1 em { font-style: normal; color: var(--accent); }
.app .meta-tiles { display: flex; gap: 10px; flex-wrap: wrap; }
.app .tile { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; min-width: 150px; }
.app .tile .lbl { font-size: 12px; color: var(--muted); display: block; }
.app .tile .val { font-size: 15px; font-weight: 600; }

/* big ip */
.app .ip-big { font-family: var(--mono); font-size: clamp(24px, 4.6vw, 34px); font-weight: 600; letter-spacing: -.02em; direction: ltr; unicode-bidi: isolate; line-height: 1.2; }
.app .ip-big.is-text { font-family: var(--sans); font-size: clamp(17px, 3.4vw, 22px); font-weight: 500; letter-spacing: 0; direction: rtl; color: var(--muted); }
.app .status-line { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); }
.app .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; display: inline-block; }
.app .dot.ok, .app .pulse-dot { background: var(--accent) !important; box-shadow: 0 0 0 4px var(--accent-soft); }
.app .pulse-dot { width: 8px !important; height: 8px !important; border-radius: 50%; display: inline-block; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }

/* ============================ controls ============================ */
.app .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s, filter .15s, transform .1s; text-decoration: none; }
.app .btn:hover { border-color: var(--text); }
.app .btn:active { transform: scale(.98); }
.app .btn:disabled, .app .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.app .btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.app .btn-lg { height: 48px; padding: 0 20px; font-size: 15px; }
.app .btn-block { width: 100%; }
.app .btn-accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.app .btn-accent:hover { border-color: transparent; filter: brightness(1.06); }
.app .btn-strong { background: var(--text); color: var(--bg); border-color: transparent; font-weight: 600; }
.app .btn-strong:hover { border-color: transparent; filter: brightness(1.1); }
.app .btn-ghost { background: transparent; }
.app .btn-danger { background: transparent; color: var(--danger); border-color: var(--danger-line); }
.app .btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.app .icon-btn { width: 38px; height: 38px; padding: 0; border-radius: 12px; border: 1px solid var(--line); background: transparent; display: inline-grid; place-items: center; color: var(--text-2); transition: background .15s, border-color .15s; }
.app .icon-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.app .link { background: none; border: 0; padding: 0; color: var(--text); border-bottom: 1px solid var(--accent); font-size: 13.5px; }
.app .link:hover { color: var(--accent); }

.app .field { display: grid; gap: 6px; }
.app .field > label, .app .lbl { font-size: 13px; color: var(--muted); }
.app .input, .app input[type="text"], .app input[type="email"], .app input[type="password"], .app input[type="number"], .app input[type="url"], .app input[type="search"], .app input:not([type]), .app select, .app textarea {
  width: 100%; min-height: 42px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); font-size: 14.5px; transition: border-color .15s, box-shadow .15s; }
.app textarea { min-height: 110px; resize: vertical; line-height: 1.7; }
.app select { appearance: none; -webkit-appearance: none; padding-inline-end: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b929c' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 12px center; background-size: 16px; }
.app input:focus, .app select:focus, .app textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.app input::placeholder, .app textarea::placeholder { color: var(--faint); }
.app input[dir="ltr"] { text-align: left; }
.app input[type="checkbox"], .app input[type="radio"] { accent-color: var(--accent); width: auto; min-height: 0; }
.app .input-row { display: flex; gap: 8px; flex-wrap: wrap; }
.app .input-row > .grow { flex: 1 1 200px; }

.app .seg { display: inline-flex; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); flex-wrap: wrap; }
.app .seg > button { height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.app .seg > button:hover { color: var(--text); }
.app .seg > button.active, .app .seg > button[aria-selected="true"] { background: var(--text); color: var(--bg); font-weight: 600; }
.app .seg.full { display: flex; } .app .seg.full > button { flex: 1; justify-content: center; }

/* chips & badges */
.app .chip, .app .badge-chip, .app .stamp-paid { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid var(--line-strong); color: var(--text-2); background: transparent; }
.app .chip.ok, .app .badge-chip-emerald, .app .stamp-paid { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.app .chip.warn, .app .badge-chip-amber { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.app .chip.danger, .app .badge-chip-red { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.app .chip.info, .app .badge-chip-sky, .app .badge-chip-purple { color: var(--info); background: var(--info-soft); border-color: transparent; }
.app .chip.pro { color: var(--accent-ink); background: var(--accent); border-color: transparent; font-family: var(--mono); font-size: 11px; height: 22px; padding: 0 8px; letter-spacing: .04em; }

/* notices */
.app .note { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 14px; font-size: 13.5px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); }
.app .note .i { margin-top: 3px; }
.app .note.ok { background: var(--ok-soft); border-color: var(--ok-line); }
.app .note.ok .i { color: var(--ok); }
.app .note.warn { background: var(--warn-soft); border-color: var(--warn-line); }
.app .note.warn .i { color: var(--warn); }
.app .note.danger { background: var(--danger-soft); border-color: var(--danger-line); }
.app .note.danger .i { color: var(--danger); }
.app .note strong { color: var(--text); }

/* copy rows */
.app .copyrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); min-width: 0; }
.app .copyrow .v { font-family: var(--mono); font-size: 14px; font-weight: 600; direction: ltr; unicode-bidi: isolate; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.app .copyrow .k { font-size: 12px; color: var(--muted); display: block; }
.app .copyrow.big .v { font-size: clamp(18px, 3vw, 22px); }

/* tables (panel + admin + JS rows) */
.app .tbl-wrap, .app .sketch-table-wrap, .app .dossier-table { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.app table { width: 100%; border-collapse: collapse; text-align: right; font-size: 14px; }
.app table th { background: var(--surface-2); color: var(--muted); font-weight: 500; font-size: 12.5px; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: right; }
.app table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.app table tr:last-child td { border-bottom: 0; }
.app table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.app .ip-row td:first-child span { color: var(--text) !important; }
.app .btn-table-action { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 9px; font-size: 12.5px; border: 1px solid var(--line-strong); background: transparent; color: var(--text-2); }
.app .btn-table-action:hover { border-color: var(--text); }
.app .btn-table-delete { color: var(--danger); border-color: var(--danger-line); }
.app .btn-table-delete:hover { background: var(--danger-soft); border-color: var(--danger); }
.app .btn-table-locked { color: var(--warn); border-color: var(--warn-line); }
.app .btn-table-detail { color: var(--text); }

/* plan cards (ids/classes toggled by panel JS) */
.app .panel-plans { display: grid; gap: 14px; }
@media (min-width: 900px) { .app .panel-plans { grid-template-columns: repeat(3, 1fr); } }
.app .panel-plan { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 22px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.app .panel-plan.is-featured { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line); }
.app .panel-plan.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.app .panel-plan h4 { font-size: 17px; font-weight: 700; }
.app .panel-plan-top { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.app .panel-plan-tag, .app .panel-plan-ips { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; border: 1px solid var(--line-strong); color: var(--muted); }
.app .panel-plan-tag.hot { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
.app .panel-plan-tag.active { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.app .panel-plan-tag.expired { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.app .panel-plan-tag.active.hidden, .app .panel-plan-tag.expired.hidden { display: none; }
.app .panel-plan-ips { font-family: var(--mono); margin-inline-start: auto; }
.app .panel-plan-note { font-size: 13px; color: var(--muted); }
.app .panel-plan-price { display: flex; align-items: baseline; gap: 8px; }
.app .panel-plan-price b { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.app .panel-plan-price span { font-size: 13px; color: var(--muted); }
.app .panel-plan ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; color: var(--text-2); flex: 1; }
.app .panel-plan li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; }
.app .panel-plan li::before { content: ""; width: 11px; height: 6px; border-inline-start: 1.6px solid var(--accent); border-bottom: 1.6px solid var(--accent); transform: rotate(-45deg) scaleX(-1); margin-top: 8px; }
.app .panel-plan-status:empty { display: none; }
.app .panel-plan-status { font-size: 13px; color: var(--muted); }
.app .panel-plan-btn { height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; }
.app .panel-plan-btn.coral { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.app .panel-plan-btn.yellow { background: var(--text); color: var(--bg); border-color: transparent; }
.app .panel-plan-btn.current, .app .panel-plan-btn:disabled { background: var(--surface-2); color: var(--muted); border-color: var(--line); cursor: default; }

/* duration picker (JS swaps tailwind classes; selected = sky) */
.app .duration-btn { border: 1px solid var(--line) !important; background: var(--surface-2) !important; color: var(--text-2) !important; border-radius: 12px !important; box-shadow: none !important; padding: 10px !important; }
.app .duration-btn[class*="bg-sky-500"] { background: var(--text) !important; color: var(--bg) !important; border-color: transparent !important; }
.app .duration-btn[class*="bg-sky-500"] * { color: var(--bg) !important; }

/* admin-only legacy classes rendered by admin JS */
.app .dossier-card, .app .dossier-ip { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.app .dossier-kicker { font-size: 11.5px; color: var(--muted); }
.app .dossier-grid { display: grid; gap: 10px; }
.app .dossier-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.app .sketch-card, .app .glass-card, .app .liquid-glass { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.app .tape-top, .app .sketch-grid-bg, .app .notebook-spiral { display: none !important; }
.app .remain-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line-strong); }
.app .remain-ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.app .remain-urgent, .app .remain-soon { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.app .remain-dead, .app .remain-expired { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.app .plan-select-input { min-height: 36px; padding: 4px 12px; padding-inline-end: 32px; font-size: 13px; border-radius: 10px; }
.app .btn-sketch, .app .btn-primary, .app .btn-coral, .app .btn-yellow, .app .btn-emerald, .app .btn-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 34px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 13.5px; font-weight: 500; }
.app .btn-primary, .app .btn-emerald { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.app .btn-coral { background: var(--text); color: var(--bg); border-color: transparent; font-weight: 600; }
.app .btn-yellow { background: var(--accent-soft); color: var(--text); border-color: transparent; }

/* ============================ modals ============================ */
.app .modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--overlay); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); overflow-y: auto; }
.app .modal.hidden { display: none !important; }
.app .sheet { position: relative; width: 100%; max-width: 480px; margin: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 22px; padding: 24px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.6); animation: pop .22s cubic-bezier(.2,.8,.2,1); max-height: calc(100vh - 32px); overflow-y: auto; }
.app .sheet.wide { max-width: 640px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.app .sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.app .sheet-head h3 { font-size: 18px; font-weight: 700; }
.app .sheet-head p { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.app .sheet-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ============================ auth ============================ */
.app .auth-wrap { max-width: 440px; margin: 24px auto 0; width: 100%; }
.app .auth-hero { text-align: center; margin-bottom: 22px; }
.app .auth-hero h1 { font-size: 26px; font-weight: 700; margin-top: 12px; }
.app .auth-hero p { font-size: 14px; color: var(--muted); margin-top: 6px; }
.app .or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; margin: 18px 0 12px; }
.app .or::before, .app .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.app .gbtn { width: 100%; height: 46px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 14px; font-weight: 500; }
.app .gbtn svg { width: 18px; height: 18px; }
.app #authTabsNav { display: flex !important; }
.app #authTabsNav button { flex: 1; }

/* loading */
.app .spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.app .animate-spin { animation: spin 1s linear infinite; }

/* toast (panel/admin JS: #toast + #toastMsg + .show) */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 14px; transition: opacity .2s, transform .2s; z-index: 120; max-width: calc(100vw - 32px); white-space: pre-line; text-align: center; line-height: 1.7; box-shadow: 0 20px 40px -20px rgba(0,0,0,.6); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.app .foot { max-width: 1200px; margin: 0 auto; padding: 24px 16px 40px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--faint); border-top: 1px solid var(--line); }
@media (min-width: 720px) { .app .foot { padding: 24px 28px 40px; } }
.app .foot a:hover { color: var(--text); }

/* ================= tailwind colour utilities → semantic palette =================
   Page scripts set states with tailwind colours (emerald=ok, amber=warn, red=danger,
   sky/violet=info). Mapped here so JS-rendered fragments match the design. */
.app [class*="text-white"], .app [class*="text-slate-1"], .app [class*="text-slate-2"], .app [class*="text-gray-1"], .app [class*="text-gray-2"] { color: var(--text); }
.app [class*="text-slate-3"], .app [class*="text-gray-3"] { color: var(--text-2); }
.app [class*="text-slate-4"], .app [class*="text-slate-5"], .app [class*="text-slate-6"], .app [class*="text-gray-4"], .app [class*="text-gray-5"], .app [class*="text-[#c4bfdb]"] { color: var(--muted); }
.app [class*="text-[#C7F0DB]"], .app [class*="text-[#c7f0db]"] { color: var(--text); }
.app [class*="text-sky-"], .app [class*="text-blue-"], .app [class*="text-cyan-"], .app [class*="text-indigo-"], .app [class*="text-purple-"], .app [class*="text-violet-"], .app [class*="text-fuchsia-"], .app [class*="text-pink-"] { color: var(--info); }
.app [class*="text-emerald-"], .app [class*="text-green-"], .app [class*="text-teal-"], .app [class*="text-lime-"] { color: var(--ok); }
.app [class*="text-amber-"], .app [class*="text-yellow-"], .app [class*="text-orange-"] { color: var(--warn); }
.app [class*="text-red-"], .app [class*="text-rose-"] { color: var(--danger); }

.app [class*="bg-slate-9"], .app [class*="bg-[#090514]"], .app [class*="bg-[#160e33]"], .app [class*="bg-gray-9"] { background-color: var(--surface-2); }
.app [class*="bg-slate-8"], .app [class*="bg-slate-7"], .app [class*="bg-gray-8"] { background-color: var(--surface-3); }
.app [class*="bg-slate-5"], .app [class*="bg-slate-6"] { background-color: var(--faint); }
.app [class*="bg-emerald-"], .app [class*="bg-green-"], .app [class*="bg-teal-"] { background-color: var(--ok-soft); }
.app [class*="bg-amber-"], .app [class*="bg-yellow-"], .app [class*="bg-orange-"] { background-color: var(--warn-soft); }
.app [class*="bg-red-"], .app [class*="bg-rose-"] { background-color: var(--danger-soft); }
.app [class*="bg-sky-"], .app [class*="bg-blue-"], .app [class*="bg-cyan-"], .app [class*="bg-indigo-"], .app [class*="bg-purple-"], .app [class*="bg-violet-"], .app [class*="bg-[#6247AA]"] { background-color: var(--info-soft); }
/* solid fills (exact tokens) */
.app [class~="bg-emerald-600"], .app [class~="bg-emerald-500"], .app [class~="bg-emerald-400"], .app [class~="bg-green-600"] { background-color: var(--accent); color: var(--accent-ink) !important; }
.app [class~="bg-red-500"], .app [class~="bg-red-600"] { background-color: var(--danger); color: #fff !important; }
.app [class~="bg-sky-500"], .app [class~="bg-sky-600"], .app [class~="bg-blue-600"] { background-color: var(--text); color: var(--bg) !important; }
.app [class~="bg-amber-500"], .app [class~="bg-amber-400"] { background-color: var(--warn); color: #1a1200 !important; }
.app [class*="bg-emerald-400"][class*="rounded-full"], .app [class*="bg-emerald-500"][class*="rounded-full"][class*="w-2"] { background-color: var(--accent); }
/* gradients → one solid per intent */
.app [class*="bg-gradient-to-"] { background-image: none !important; }
.app [class*="bg-gradient-to-"][class*="from-emerald-"], .app [class*="bg-gradient-to-"][class*="from-teal-"], .app [class*="bg-gradient-to-"][class*="from-green-"] { background-color: var(--accent) !important; color: var(--accent-ink) !important; border-color: transparent !important; }
.app [class*="bg-gradient-to-"][class*="from-sky-"], .app [class*="bg-gradient-to-"][class*="from-blue-"], .app [class*="bg-gradient-to-"][class*="from-violet-"], .app [class*="bg-gradient-to-"][class*="from-purple-"], .app [class*="bg-gradient-to-"][class*="from-indigo-"] { background-color: var(--text) !important; color: var(--bg) !important; border-color: transparent !important; }
.app [class*="bg-gradient-to-"][class*="from-red-"], .app [class*="bg-gradient-to-"][class*="from-rose-"] { background-color: var(--danger) !important; color: #fff !important; border-color: transparent !important; }
.app [class*="bg-gradient-to-"][class*="from-amber-"], .app [class*="bg-gradient-to-"][class*="from-orange-"], .app [class*="bg-gradient-to-"][class*="from-yellow-"] { background-color: var(--warn) !important; color: #1a1200 !important; border-color: transparent !important; }
.app [class*="bg-gradient-to-"] * { color: inherit !important; }

.app [class*="border-slate-"], .app [class*="border-gray-"], .app [class*="border-[#"], .app [class*="border-white/"] { border-color: var(--line); }
.app [class*="border-emerald-"], .app [class*="border-green-"], .app [class*="border-teal-"] { border-color: var(--ok-line); }
.app [class*="border-amber-"], .app [class*="border-yellow-"], .app [class*="border-orange-"] { border-color: var(--warn-line); }
.app [class*="border-red-"], .app [class*="border-rose-"] { border-color: var(--danger-line); }
.app [class*="border-sky-"], .app [class*="border-blue-"], .app [class*="border-purple-"], .app [class*="border-violet-"], .app [class*="border-indigo-"] { border-color: var(--info-line); }
.app [class*="ring-sky-"], .app [class*="ring-amber-"] { --tw-ring-color: var(--accent); }
.app [class*="shadow-emerald"], .app [class*="shadow-sky"], .app [class*="shadow-red"], .app [class*="shadow-amber"], .app [class*="shadow-violet"], .app [class*="shadow-xl"], .app [class*="shadow-2xl"] { box-shadow: none; }
.app .text-3xl { font-size: 26px; }

@media (prefers-reduced-motion: reduce) { .app *, .app *::before, .app *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }
.app .tile span[id] { font-size: 15px !important; font-weight: 600 !important; display: block; }
.app .panel-plan-ips { direction: ltr; unicode-bidi: isolate; }
.app .btn-block { white-space: normal; height: auto; min-height: 44px; padding-top: 8px; padding-bottom: 8px; text-align: center; line-height: 1.5; }
.app .sheet { overflow-x: hidden; }
.app .sheet .kv { flex-wrap: wrap; }
.app .sheet .kv > span:last-child { min-width: 0; overflow-wrap: anywhere; }

/* ============================ admin ============================ */
.app .modal-backdrop { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 16px; background: var(--overlay); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); overflow-y: auto; }
.app .modal-backdrop.active { display: flex; }
.app .modal-box, .app .dossier-sheet { position: relative; width: 100%; max-width: 480px; margin: auto; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 22px; padding: 24px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.6); max-height: calc(100vh - 32px); overflow-y: auto; animation: pop .22s cubic-bezier(.2,.8,.2,1); }
.app .dossier-sheet { max-width: 820px; }
.app .dossier-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .app .dossier-grid { grid-template-columns: 1fr; } }
.app .dossier-ip { margin-bottom: 8px; }
.app .dossier-table { width: 100%; border: 0; }
.app .tmpl-pill { height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--text-2); font-size: 13px; }
.app .tmpl-pill:hover { border-color: var(--text); }
.app .tmpl-pill.active { background: var(--text); color: var(--bg); border-color: transparent; font-weight: 600; }
.app .remain-soon { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.app .kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1000px) { .app .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.app .kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.app button.kpi { text-align: start; cursor: pointer; }
.app button.kpi:hover { border-color: var(--line-strong); }
.app .kpi .lbl { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.app .kpi .num { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.app .kpi .unit { font-size: 12.5px; color: var(--muted); }
.app .card.kpi-note { padding: 16px 18px; }
.app .toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.app .side .tab-badge { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; display: inline-grid; place-items: center; }
@media (max-width: 1039px) {
  .app .admin-side { display: block; position: static; margin: -6px -16px 0; }
  .app .admin-side nav { flex-direction: row; overflow-x: auto; gap: 6px; padding: 0 16px 6px; scrollbar-width: none; }
  .app .admin-side nav::-webkit-scrollbar { display: none; }
  .app .admin-side nav button { flex: none; width: auto; white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; background: var(--surface); }
  .app .admin-side .side-foot { display: none; }
}
.app .custom-scrollbar { scrollbar-width: thin; }
.app iframe#mailPreviewIframe { background: #fff; border-color: var(--line) !important; }
.app .side .side-foot a { display: inline; padding: 0; width: auto; background: none; box-shadow: none; font-size: 12px; color: var(--faint); }
.app .side .side-foot a:hover { color: var(--text); background: none; }
.app .main > *, .app .split > *, .app .kpis > * { min-width: 0; }
.app .dossier-actions { margin-top: 14px; }
.app #userDetailBody h4, .app #userDetailBody .dossier-kicker + * { margin-top: 2px; }
.app .shell > * { min-width: 0; }
@media (max-width: 640px) { .app .main .flex:not(.flex-col) { flex-wrap: wrap; } }
.app #previewContainer, .app #mailPreviewIframe { max-width: 100% !important; }
/* no section nav until there is something to navigate */
.app .shell:has(#panelDashboard.hidden) > .side, .app .shell:has(#adminContent.hidden) > .side { display: none !important; }
.app .shell.has-side:has(#panelDashboard.hidden), .app .shell.has-side:has(#adminContent.hidden) { grid-template-columns: minmax(0, 1fr); }

/* ============================ dns live status orb (panel) ============================ */
.app .dns-live { --c: var(--info); --c-soft: var(--info-soft); position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 18px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); transition: border-color .6s ease, background-color .6s ease; }
.app .dns-live::before { content: ""; position: absolute; z-index: -1; inset-inline-start: -70px; top: 50%; width: 240px; height: 240px; margin-top: -120px; border-radius: 50%; background: radial-gradient(closest-side, var(--c-soft), transparent); opacity: 0; transition: opacity .8s ease; }
.app .dns-live::after { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--c) 12%, transparent) 50%, transparent 70%); transform: translateX(-100%); opacity: 0; }
.app .dns-live[data-state="on"] { --c: var(--ok); --c-soft: color-mix(in srgb, var(--ok) 22%, transparent); border-color: var(--ok-line); }
.app .dns-live[data-state="on"]::before { opacity: 1; animation: dnsAura 4.8s ease-in-out infinite; }
.app .dns-live[data-state="off"] { --c: var(--muted); --c-soft: var(--surface-3); }
.app .dns-live.is-probing::after { opacity: 1; animation: dnsSweep 1.3s ease-in-out infinite; }

.app .dns-orb { position: relative; width: 60px; height: 60px; display: grid; place-items: center; flex: none; transition: transform .8s cubic-bezier(.2,.8,.2,1), opacity .6s; }
.app .dns-orb .core { position: relative; z-index: 2; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--c); background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 28%, transparent), var(--c-soft) 72%); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); transition: background .7s ease, box-shadow .7s ease, color .5s, border-color .6s; }
.app .dns-orb .ic { position: absolute; width: 20px; height: 20px; opacity: 0; transform: scale(.4); transition: opacity .35s, transform .5s cubic-bezier(.3,1.6,.5,1); }
.app .dns-live[data-state="checking"] .ic-wait, .app .dns-live[data-state="on"] .ic-on, .app .dns-live[data-state="off"] .ic-off { opacity: 1; transform: none; }
.app .dns-orb .ring { position: absolute; inset: 9px; border-radius: 50%; border: 1.5px solid var(--c); opacity: 0; pointer-events: none; }
.app .dns-orb .orbit { position: absolute; inset: 0; border-radius: 50%; border: 1px dashed color-mix(in srgb, var(--c) 30%, transparent); opacity: 0; transition: opacity .6s; }
.app .dns-orb .orbit i { position: absolute; top: -3px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px 2px color-mix(in srgb, var(--c) 70%, transparent); }
.app .dns-orb .scan { position: absolute; inset: 3px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--c); border-inline-end-color: color-mix(in srgb, var(--c) 40%, transparent); opacity: 0; transition: opacity .3s; }
.app .dns-orb .zzz { position: absolute; top: -2px; inset-inline-end: -2px; z-index: 3; pointer-events: none; }
.app .dns-orb .zzz b { position: absolute; top: 0; inset-inline-end: 0; font: 700 11px/1 var(--mono); color: var(--muted); opacity: 0; }

/* checking: scanning ring + soft pulse */
.app .dns-live[data-state="checking"] .scan, .app .dns-live.is-probing .scan { opacity: 1; animation: spin 1.1s linear infinite; }
.app .dns-live[data-state="checking"] .core { animation: dnsBreathe 1.6s ease-in-out infinite; }

/* on: glowing core, ripples, orbiting spark, floating */
.app .dns-live[data-state="on"] .dns-orb { animation: dnsFloat 3.6s ease-in-out infinite; }
.app .dns-live[data-state="on"] .core { color: var(--accent-ink); border-color: transparent; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--ok) 70%, #fff), var(--ok) 58%, color-mix(in srgb, var(--ok) 75%, #000)); animation: dnsGlow 2.4s ease-in-out infinite; }
.app .dns-live[data-state="on"] .ring { animation: dnsRipple 2.4s cubic-bezier(.2,.6,.3,1) infinite; }
.app .dns-live[data-state="on"] .ring:nth-child(2) { animation-delay: .8s; }
.app .dns-live[data-state="on"] .ring:nth-child(3) { animation-delay: 1.6s; }
.app .dns-live[data-state="on"] .orbit { opacity: 1; animation: spin 3.4s linear infinite; }
.app .dns-live[data-state="on"] .ic-on path { stroke-dasharray: 22; stroke-dashoffset: 0; }
.app .dns-live.flip[data-state="on"] .ic-on path { animation: dnsDraw .7s .15s cubic-bezier(.6,0,.2,1) backwards; }

/* off: asleep: dimmed, sunk, slow breath, drifting z's */
.app .dns-live[data-state="off"] .dns-orb { transform: translateY(3px); }
.app .dns-live[data-state="off"] .core { color: var(--muted); background: var(--surface-3); border-color: var(--line-strong); animation: dnsSleep 5s ease-in-out infinite; }
.app .dns-live[data-state="off"] .zzz b { animation: dnsZ 3.6s ease-out infinite; }
.app .dns-live[data-state="off"] .zzz b:nth-child(2) { animation-delay: 1.2s; font-size: 13px; }
.app .dns-live[data-state="off"] .zzz b:nth-child(3) { animation-delay: 2.4s; font-size: 15px; }

.app .dns-live-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.app .dns-live-text .lbl { font-size: 12px; }
.app .dns-live-state { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: var(--text); transition: color .5s; }
.app .dns-live[data-state="on"] .dns-live-state { color: var(--ok); }
.app .dns-live-state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.app .dns-live[data-state="on"] .dns-live-state .dot { animation: dnsDot 1.8s ease-out infinite; }
.app .dns-live[data-state="off"] .dns-live-state .dot { background: var(--warn); }
.app .dns-live .sub { margin-top: 0; }

@keyframes dnsFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes dnsGlow { 0%, 100% { box-shadow: 0 0 14px 1px color-mix(in srgb, var(--ok) 45%, transparent), 0 0 34px 4px color-mix(in srgb, var(--ok) 18%, transparent); } 50% { box-shadow: 0 0 22px 4px color-mix(in srgb, var(--ok) 65%, transparent), 0 0 52px 10px color-mix(in srgb, var(--ok) 28%, transparent); } }
@keyframes dnsRipple { 0% { transform: scale(.95); opacity: .6; } 100% { transform: scale(1.95); opacity: 0; } }
@keyframes dnsAura { 0%, 100% { transform: scale(1); opacity: .75; } 50% { transform: scale(1.15); opacity: 1; } }
@keyframes dnsBreathe { 0%, 100% { transform: scale(.94); opacity: .75; } 50% { transform: scale(1); opacity: 1; } }
@keyframes dnsSleep { 0%, 100% { transform: scale(.95); opacity: .65; } 50% { transform: scale(1); opacity: .9; } }
@keyframes dnsZ { 0% { opacity: 0; transform: translate(0, 8px) scale(.6); } 20% { opacity: .9; } 100% { opacity: 0; transform: translate(-16px, -24px) scale(1.1) rotate(-14deg); } }
@keyframes dnsDot { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
@keyframes dnsDraw { from { stroke-dashoffset: 22; } }
@keyframes dnsSweep { to { transform: translateX(100%); } }

@media (max-width: 560px) {
  .app .dns-live { grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding: 14px; }
  .app .dns-live > .btn { grid-column: 1 / -1; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .app .dns-live *, .app .dns-live::before, .app .dns-live::after { animation: none !important; }
  .app .dns-live[data-state="on"] .core { box-shadow: 0 0 18px 3px color-mix(in srgb, var(--ok) 50%, transparent); }
  .app .dns-live[data-state="off"] .zzz b:first-child { opacity: .7; }
}

/* ============================ DoH + IP sync (panel) ============================ */
.app .doh-card { gap: 14px; }
.app .doh-card .copyrow .v, .app #sec-sync .copyrow .v { display: block; }
.app .doh-card > *, .app #sec-sync .stack > * { min-width: 0; }
.app .doh-pane[hidden] { display: none; }
.app .doh-pane { display: grid; gap: 12px; }
.app .steps { margin: 0; padding: 0; list-style: none; counter-reset: st; display: grid; gap: 8px; }
.app .steps li { counter-increment: st; position: relative; padding-inline-start: 30px; font-size: 13.5px; color: var(--text-2); line-height: 1.8; }
.app .steps li::before { content: counter(st); position: absolute; inset-inline-start: 0; top: 2px; width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.app .doh-tabs > button, .app .sync-tabs > button { height: 32px; padding: 0 10px; font-size: 13px; }
.app .codebox { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); min-width: 0; }
.app .codebox pre { flex: 1; min-width: 0; margin: 0; font: 12px/1.65 var(--mono); color: var(--text-2); white-space: pre-wrap; word-break: break-all; text-align: left; }
.app .sync-status { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); }
.app .sync-status .dot { width: 10px; height: 10px; margin-top: 7px; border-radius: 50%; flex: none; background: var(--faint); }
.app .sync-status .sub { margin-top: 2px; }
.app .sync-status[data-state="ok"] { border-color: var(--ok-line); background: var(--ok-soft); }
.app .sync-status[data-state="ok"] .dot { background: var(--ok); animation: dnsDot 1.8s ease-out infinite; }
.app .sync-status[data-state="warn"] { border-color: var(--warn-line); background: var(--warn-soft); }
.app .sync-status[data-state="warn"] .dot { background: var(--warn); }
.app button:disabled { opacity: .6; cursor: progress; }
@media (max-width: 560px) {
  .app .doh-tabs > button, .app .sync-tabs > button { flex: 1 1 45%; }
}

/* ============================ equal-height card pairs ============================ */
@media (min-width: 900px) { .app .split.eq { align-items: stretch; } }
.app .split.eq > .card { display: flex; flex-direction: column; }
.app .split.eq > .card > .stack { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.app .split.eq > .card > .card-foot, .app .split.eq .stack > .card-foot { margin-top: auto; }
.app .split.eq > .card > #ticketsList { flex: 1; display: flex; flex-direction: column; gap: 0; }
.app .split.eq > .card > #ticketsList > .tk-more { margin-top: auto; }
.app #ticketsList > .tk-list:first-child { margin-bottom: 8px; }
.app .ref-steps { margin: 2px 0 0; }

/* sync flow: your internet -> XCR9 -> 2 resolvers, packets travel right to left */
.app .sync-flow { --fc: var(--faint); --fspeed: 3.2s; display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center; gap: 8px; padding: 14px 12px 10px; border-radius: 14px; border: 1px solid var(--line); background: radial-gradient(120% 140% at 50% 0%, color-mix(in srgb, var(--fc) 9%, transparent), transparent 70%), var(--surface-2); transition: background .6s; }
.app #sec-sync[data-sync="ok"] .sync-flow { --fc: var(--ok); --fspeed: 1.7s; }
.app #sec-sync[data-sync="warn"] .sync-flow { --fc: var(--warn); --fspeed: 2.6s; }
.app .sf-node { display: grid; justify-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.app .sf-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--fc); background: var(--surface); border: 1px solid color-mix(in srgb, var(--fc) 35%, var(--line)); transition: color .5s, border-color .5s, box-shadow .5s; }
.app .sf-hub .sf-ico { width: 46px; height: 46px; border-radius: 50%; box-shadow: 0 0 0 4px color-mix(in srgb, var(--fc) 10%, transparent); }
.app #sec-sync[data-sync="ok"] .sf-hub .sf-ico { animation: sfHub 2.4s ease-in-out infinite; }
.app #sec-sync[data-sync="ok"] .sf-hub .sf-ico svg { animation: spin 5s linear infinite; }
.app .sf-wire { position: relative; height: 2px; margin-bottom: 20px; border-radius: 2px; background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--fc) 40%, transparent) 0 6px, transparent 6px 11px); }
.app .sf-wire i { position: absolute; top: 50%; right: 0; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--fc); box-shadow: 0 0 10px 2px color-mix(in srgb, var(--fc) 60%, transparent); opacity: 0; animation: sfPacket var(--fspeed) linear infinite; }
.app .sf-wire i:nth-child(2) { animation-delay: calc(var(--fspeed) / -3); }
.app .sf-wire i:nth-child(3) { animation-delay: calc(var(--fspeed) / -1.5); }
@keyframes sfPacket { 0% { right: 0; opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { right: calc(100% - 7px); opacity: 0; } }
@keyframes sfHub { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--fc) 14%, transparent), 0 0 24px color-mix(in srgb, var(--fc) 30%, transparent); } }

/* referral: floating gift, hot tile, shimmering invite link, confetti */
.app .ico-gift svg { animation: giftFloat 3.2s ease-in-out infinite; transform-origin: 50% 80%; }
.app .ref-tiles { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.app .ref-tiles .tile { transition: transform .25s cubic-bezier(.2,.8,.2,1), border-color .25s, box-shadow .25s; }
.app .ref-tiles .tile:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: 0 10px 24px -16px color-mix(in srgb, var(--accent) 60%, transparent); }
.app .ref-tiles .tile-hot { position: relative; overflow: hidden; border-color: var(--accent-line); background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface-2); }
.app .ref-tiles .tile-hot .val { color: var(--accent); }
.app .ref-tiles .tile-hot::after { content: ""; position: absolute; top: -60%; left: -40%; width: 40%; height: 220%; transform: rotate(20deg); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 22%, transparent), transparent); animation: tileShine 4.5s ease-in-out infinite; }
.app .copyrow.shine { position: relative; overflow: hidden; border-color: var(--accent-line); }
.app .copyrow.shine::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 35%, color-mix(in srgb, var(--accent) 14%, transparent) 50%, transparent 65%); transform: translateX(-100%); animation: rowShine 5s ease-in-out 1s infinite; pointer-events: none; }
.app .copyrow.shine .v { color: var(--accent); }
.confetti { position: fixed; z-index: 9999; width: 7px; height: 10px; margin: -5px 0 0 -3.5px; border-radius: 2px; pointer-events: none; animation: confettiPop .95s cubic-bezier(.15,.7,.3,1) forwards; }
@keyframes confettiPop { 0% { transform: translate(0, 0) rotate(0) scale(.6); opacity: 1; } 100% { transform: translate(var(--dx), calc(var(--dy) + 40px)) rotate(var(--r)) scale(1); opacity: 0; } }
@keyframes giftFloat { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-2px) rotate(-8deg); } 50% { transform: translateY(0) rotate(0); } 75% { transform: translateY(-2px) rotate(8deg); } }
@keyframes tileShine { 0%, 60% { left: -40%; } 100% { left: 120%; } }
@keyframes rowShine { 0%, 70% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* domain request: 3 steps lit in sequence */
.app .flow-steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; position: relative; }
.app .flow-steps li { position: relative; display: grid; justify-items: center; gap: 8px; padding: 12px 6px; text-align: center; font-size: 12px; line-height: 1.6; color: var(--muted); border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); animation: stepLit 6s ease-in-out infinite; }
.app .flow-steps li:nth-child(2) { animation-delay: 2s; }
.app .flow-steps li:nth-child(3) { animation-delay: 4s; }
.app .flow-steps .fs-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); }
@keyframes stepLit { 0%, 30% { border-color: var(--accent-line); color: var(--text); box-shadow: 0 8px 22px -14px color-mix(in srgb, var(--accent) 70%, transparent); transform: translateY(-2px); } 40%, 100% { border-color: var(--line); color: var(--muted); box-shadow: none; transform: none; } }

/* tickets */
.app .tk-list { display: grid; gap: 8px; }
.app .tk-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: inherit; text-align: start; cursor: pointer; transition: border-color .2s, transform .2s, background-color .2s; animation: tkIn .45s cubic-bezier(.2,.8,.2,1) backwards; animation-delay: calc(var(--i, 0) * 60ms); }
.app .tk-row:hover { border-color: var(--line-strong); transform: translateX(-3px); }
.app .tk-row.is-new { border-color: var(--accent-line); background: linear-gradient(90deg, transparent, var(--accent-soft)), var(--surface-2); }
.app .tk-row.is-closed { opacity: .7; }
.app .tk-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.app .tk-subject { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app .tk-meta { font-size: 11.5px; color: var(--muted); }
.app .tk-new { flex: none; font-size: 11px; font-weight: 700; color: var(--accent-ink); background: var(--accent); padding: 2px 8px; border-radius: 999px; animation: pulse 1.8s ease-out infinite; box-shadow: 0 0 0 0 var(--accent-line); }
.app .tk-more { width: 100%; margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; border-radius: 12px; border: 1px dashed var(--line-strong); background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; transition: color .2s, border-color .2s; }
.app .tk-more:hover { color: var(--text); border-color: var(--accent-line); }
.app .tk-more svg { transition: transform .3s; }
.app .tk-more.open svg { transform: rotate(180deg); }
.app .tk-older { margin-top: 8px; max-height: 260px; overflow-y: auto; padding-inline-end: 2px; }
.app .tk-empty { display: grid; justify-items: center; gap: 6px; padding: 26px 12px; text-align: center; border-radius: 14px; border: 1px dashed var(--line-strong); }
.app .tk-empty-ico { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); animation: dnsFloat 3.6s ease-in-out infinite; }
@keyframes tkIn { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 560px) {
  .app .sf-node { font-size: 10.5px; }
  .app .sf-ico { width: 34px; height: 34px; }
  .app .sf-hub .sf-ico { width: 40px; height: 40px; }
  .app .flow-steps li { font-size: 11px; padding: 10px 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .app .sync-flow *, .app .ico-gift svg, .app .ref-tiles *, .app .copyrow.shine::before, .app .flow-steps li, .app .tk-row, .app .tk-new, .app .tk-empty-ico { animation: none !important; }
  .app .sf-wire i { opacity: 0; }
}
.app #sec-sync:not([data-sync]) .sf-wire i, .app #sec-sync[data-sync="none"] .sf-wire i { animation-duration: 4.5s; }
