/* SHAHOOSH LINK — design system.
   Tokens follow the SHAHOOSH platform (app/css/tokens.css): brand #431EAB,
   accent #6C3AE1, gold #FBCF2E, YekanBakh. RTL-first: logical properties only. */

@font-face { font-family: "YekanBakh"; src: url("../fonts/YekanBakh-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "YekanBakh"; src: url("../fonts/YekanBakh-SemiBold.woff2") format("woff2"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "YekanBakh"; src: url("../fonts/YekanBakh-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "YekanBakh"; src: url("../fonts/YekanBakh-ExtraBold.woff2") format("woff2"); font-weight: 800 900; font-display: swap; }

:root {
  --brand: #431EAB;
  --brand-hover: #3A189A;
  --brand-active: #33148A;
  --accent: #6C3AE1;
  --gold: #FBCF2E;
  --gold-strong: #FFD62E;
  --on-gold: #2A1A00;
  --on-brand: #FFFFFF;

  --bg: #F6F2FE;
  --surface: #FFFFFF;
  --surface-2: #F7F3FF;
  --surface-3: #EFE8FD;
  --text: #1B1033;
  --text-muted: #5D5577;
  --text-faint: #6A6280;
  --brand-text: #431EAB;
  --border: #E7E0F6;
  --border-strong: #D5CBEE;
  --focus: #6C3AE1;
  --ring: rgba(108, 58, 225, .22);

  --ok: #1F7A55; --ok-bg: #E8F7F0; --ok-border: #BFE6D5;
  --warn: #8A5F00; --warn-bg: #FFF6E0; --warn-border: #F0DCA8;
  --danger: #B42B44; --danger-bg: #FDEDF0; --danger-border: #F3C7D0;
  --info: #3651B8; --info-bg: #EEF1FD; --info-border: #CBD4F5;

  --side-bg: linear-gradient(180deg, #23043A 0%, #1C022A 55%, #160122 100%);
  --side-text: #EDE6FB;
  --side-muted: #B6A9D6;
  --side-hover: rgba(255, 255, 255, .07);
  --side-active: rgba(181, 154, 255, .16);

  --chart-bar: #6C3AE1;
  --chart-today: #FBCF2E;
  --chart-grid: #ECE6F8;

  --shadow-sm: 0 1px 2px rgba(27, 16, 51, .05);
  --shadow: 0 1px 2px rgba(27, 16, 51, .04), 0 10px 30px rgba(27, 16, 51, .06);
  --shadow-pop: 0 18px 50px rgba(27, 16, 51, .18);

  --r-card: 20px;
  --r-field: 14px;
  --r-sm: 10px;
  --r-pill: 999px;

  --font: "YekanBakh", system-ui, "Segoe UI", Tahoma, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.4, 0, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14011F; --surface: #22023A; --surface-2: #26033F; --surface-3: #31044F;
    --text: #F3EEFB; --text-muted: #BDB2D6; --text-faint: #A094BF; --brand-text: #C4ADFF;
    --border: #3A1657; --border-strong: #4E2475; --focus: #A98BFF; --ring: rgba(169, 139, 255, .3);
    --ok: #6FE0B0; --ok-bg: #0D3A2A; --ok-border: #1C5C45;
    --warn: #FFD06B; --warn-bg: #3A2A06; --warn-border: #5E4713;
    --danger: #FF8FA3; --danger-bg: #3A0E1C; --danger-border: #632134;
    --info: #A9B8FF; --info-bg: #17204A; --info-border: #2B3A78;
    --side-bg: linear-gradient(180deg, #1A022B 0%, #120119 100%);
    --chart-bar: #9C7BFF; --chart-grid: #341652;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .35);
    --shadow-pop: 0 18px 50px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14011F; --surface: #22023A; --surface-2: #26033F; --surface-3: #31044F;
  --text: #F3EEFB; --text-muted: #BDB2D6; --text-faint: #A094BF; --brand-text: #C4ADFF;
  --border: #3A1657; --border-strong: #4E2475; --focus: #A98BFF; --ring: rgba(169, 139, 255, .3);
  --ok: #6FE0B0; --ok-bg: #0D3A2A; --ok-border: #1C5C45;
  --warn: #FFD06B; --warn-bg: #3A2A06; --warn-border: #5E4713;
  --danger: #FF8FA3; --danger-bg: #3A0E1C; --danger-border: #632134;
  --info: #A9B8FF; --info-bg: #17204A; --info-border: #2B3A78;
  --side-bg: linear-gradient(180deg, #1A022B 0%, #120119 100%);
  --chart-bar: #9C7BFF; --chart-grid: #341652;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-pop: 0 18px 50px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--font); font-size: 15px; line-height: 1.75;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { line-height: 1.4; margin: 0; color: var(--text); }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.2px; }
h2 { font-size: 17px; font-weight: 700; }
p { margin: 0 0 .6em; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; height: auto; }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(108, 58, 225, .25); }
.latin { font-family: system-ui, "Segoe UI", sans-serif; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.text-warn { color: var(--warn); }
.inline { display: inline; margin: 0; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: var(--r-sm); }
.skip-link:focus { top: 12px; }

.icon { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.only-dark { display: none; }
:root[data-theme="dark"] .only-dark { display: inline-block; }
:root[data-theme="dark"] .only-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .only-dark { display: inline-block; }
  :root:not([data-theme="light"]) .only-light { display: none; }
}

.wordmark { font-family: "Segoe UI", system-ui, sans-serif; font-weight: 800; letter-spacing: 2.2px; font-size: 15px; color: inherit; white-space: nowrap; }
.wordmark b { color: var(--gold); margin-inline-start: 6px; font-weight: 900; }

/* --------------------------------------------------------------- buttons */
.btn {
  --h: 42px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--h); padding: 0 18px; border-radius: var(--r-pill);
  font: inherit; font-weight: 700; font-size: 14.5px; line-height: 1; white-space: nowrap;
  border: 1.5px solid transparent; cursor: pointer; text-decoration: none !important;
  transition: background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), transform .12s var(--ease), box-shadow .18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 18px; height: 18px; }
.btn-sm { --h: 34px; padding: 0 13px; font-size: 13.5px; }
.btn-lg { --h: 50px; padding: 0 24px; font-size: 15.5px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: 0 6px 18px rgba(67, 30, 171, .28); }
.btn-primary:hover { background: var(--brand-hover); box-shadow: 0 8px 22px rgba(67, 30, 171, .34); }
.btn-primary:active { background: var(--brand-active); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--accent); color: var(--brand-text); background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #2A0010; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { color: #2A0010; } }
.btn-danger:hover { filter: brightness(1.06); }
.btn.danger, .icon-btn.danger { color: var(--danger); }
.btn.danger:hover, .icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-gold { background: var(--gold); color: var(--on-gold); box-shadow: 0 8px 22px rgba(251, 207, 46, .35); }
.btn-gold:hover { background: var(--gold-strong); }
.btn.is-copied { background: var(--ok); color: #fff; box-shadow: none; }
.btn.is-disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; box-shadow: none; }
.btn.is-busy { opacity: .75; pointer-events: none; }
.btn.is-busy::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
.btn-row.center { justify-content: center; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-text); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.link-btn:hover { text-decoration: underline; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: transparent; border: 1px solid transparent; color: var(--text-muted); cursor: pointer; padding: 0;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; }
.icon-btn.sm .icon { width: 17px; height: 17px; }
.icon-btn.is-copied { color: var(--ok); background: var(--ok-bg); }

/* ---------------------------------------------------------------- forms */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; margin: 0; padding: 0; border: 0; }
.field > label, .field > legend, .field-label { font-weight: 700; font-size: 14px; color: var(--text); padding: 0; }
.field .opt { font-weight: 400; color: var(--text-muted); font-size: 12.5px; }
.field .req { color: var(--danger); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.grow { flex: 1 1 auto; }
input[type="text"], input[type="url"], input[type="search"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  font: inherit; font-size: 16px; line-height: 1.5; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--r-field);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
  appearance: none; -webkit-appearance: none;
}
textarea { min-height: 90px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-faint); opacity: .8; font-family: var(--font); letter-spacing: 0; }
input:hover, select:hover, textarea:hover { border-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px var(--ring); }
input[dir="ltr"] { text-align: left; }
select {
  padding-inline-end: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237E72A3' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6.5 9.5 5.5 5.5 5.5-5.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 18px; background-position: left 14px center;
}
.has-error input, .has-error select, .has-error textarea, [aria-invalid="true"] { border-color: var(--danger) !important; }
.has-error input:focus { box-shadow: 0 0 0 4px rgba(180, 43, 68, .18); }
.field-error { color: var(--danger); font-size: 13.5px; margin: 0; display: flex; gap: 6px; align-items: flex-start; }
.field-error .icon { width: 16px; height: 16px; margin-top: 3px; }
.hint { color: var(--text-muted); font-size: 13px; margin: 0; }
.hint code { font-size: 12px; }

.input-prefix { display: flex; align-items: stretch; border: 1.5px solid var(--border-strong); border-radius: var(--r-field); background: var(--surface); overflow: hidden; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.input-prefix:hover { border-color: var(--accent); }
.input-prefix:focus-within { border-color: var(--focus); box-shadow: 0 0 0 4px var(--ring); }
.input-prefix > span { display: flex; align-items: center; padding: 0 4px 0 14px; color: var(--text-muted); font-family: var(--mono); font-size: 14px; background: var(--surface-2); border-inline-start: 0; white-space: nowrap; }
.input-prefix input { border: 0 !important; box-shadow: none !important; border-radius: 0; min-width: 0; font-family: var(--mono); padding-inline-start: 4px; }
.has-error .input-prefix { border-color: var(--danger); }
.input-group { position: relative; }
.input-group input { padding-inline-end: 48px; }
.input-addon { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; width: 40px; height: 40px; border-radius: 10px; color: var(--text-muted); cursor: pointer; display: grid; place-items: center; }
.input-addon:hover { background: var(--surface-3); color: var(--text); }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.input-icon input { padding-inline-start: 42px; }

.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14.5px; line-height: 1.6; }
.check input, .switch-label input { margin: 4px 0 0; width: 18px; height: 18px; accent-color: var(--brand); flex: none; cursor: pointer; }
.check.has-error { color: var(--danger); }
.switch-label { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch-label input { margin: 0; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--surface-3); border: 1px solid var(--border); width: max-content; max-width: 100%; }
.seg label, .seg a { position: relative; display: inline-flex; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.seg label span, .seg a { display: inline-flex; gap: 6px; align-items: center; padding: 6px 14px; border-radius: var(--r-pill); color: var(--text-muted); font-weight: 600; font-size: 14px; text-decoration: none; transition: background-color .15s var(--ease), color .15s var(--ease); }
.seg label span .icon { width: 16px; height: 16px; }
.seg input:checked + span, .seg a.is-active { background: var(--surface); color: var(--brand-text); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { outline: 2.5px solid var(--focus); outline-offset: 1px; }
.seg a:hover { color: var(--text); }
.seg-sm a { padding: 3px 12px; font-size: 13px; }

/* ---------------------------------------------------------------- cards */
.card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.grid-2 > .card, .grid-3 > .card, .grid-side > .card { margin-top: 0; }
.card + .card, .card + .grid-2, .grid-2 + .card, .stats-grid + .card, .card + .stats-grid, .grid-3 + .privacy-note, .grid-2 + .grid-2 { margin-top: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { display: flex; gap: 8px; align-items: center; }
.card-title { margin-bottom: 14px; font-size: 16px; }
.muted-link { color: var(--text-muted); font-size: 13.5px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 18px; align-items: start; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; border: 1px solid; font-size: 14.5px; line-height: 1.7; margin-bottom: 14px; }
.alert .icon { margin-top: 3px; }
.alert > span { flex: 1; }
.alert-ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.alert-error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.alert-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.alert-close { background: none; border: 0; padding: 2px; color: inherit; opacity: .7; cursor: pointer; border-radius: 8px; display: grid; place-items: center; }
.alert-close:hover { opacity: 1; background: rgba(0, 0, 0, .06); }
.alert-close .icon { width: 16px; height: 16px; margin: 0; }
.flash-stack { margin-bottom: 4px; }
.alert.is-leaving { opacity: 0; transform: translateY(-4px); transition: opacity .25s var(--ease), transform .25s var(--ease); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.badge-disabled { color: var(--text-muted); background: var(--surface-3); border-color: var(--border); }
.badge-expired { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.badge-deleted { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-ok { background: #2FBF85; } .dot-warn { background: #E8A90B; } .dot-muted { background: #A79DC2; }

.cat { display: inline-block; padding: 2px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.cat-violet { background: #EFE8FD; color: #4A22B5; } .cat-gold { background: #FFF4CC; color: #7A5600; }
.cat-green { background: #E3F6EC; color: #1C6B4A; } .cat-blue { background: #E6EEFF; color: #2846A8; }
.cat-pink { background: #FDE7F1; color: #A12464; } .cat-slate { background: #EEEDF3; color: #4B4762; }
.cat-orange { background: #FFEBDD; color: #A44A10; } .cat-teal { background: #DFF5F3; color: #11685F; }
:root[data-theme="dark"] .cat { filter: saturate(1.1); }
:root[data-theme="dark"] .cat-violet { background: #34175F; color: #D3C2FF; } :root[data-theme="dark"] .cat-gold { background: #3D3006; color: #FFD66B; }
:root[data-theme="dark"] .cat-green { background: #0F3A2A; color: #86E5B9; } :root[data-theme="dark"] .cat-blue { background: #172A5C; color: #AFC2FF; }
:root[data-theme="dark"] .cat-pink { background: #4A1430; color: #FFB1D4; } :root[data-theme="dark"] .cat-slate { background: #2E2742; color: #CFC8E2; }
:root[data-theme="dark"] .cat-orange { background: #46230B; color: #FFBF8F; } :root[data-theme="dark"] .cat-teal { background: #0C3835; color: #84E3D9; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cat-violet { background: #34175F; color: #D3C2FF; } :root:not([data-theme="light"]) .cat-gold { background: #3D3006; color: #FFD66B; }
  :root:not([data-theme="light"]) .cat-green { background: #0F3A2A; color: #86E5B9; } :root:not([data-theme="light"]) .cat-blue { background: #172A5C; color: #AFC2FF; }
  :root:not([data-theme="light"]) .cat-pink { background: #4A1430; color: #FFB1D4; } :root:not([data-theme="light"]) .cat-slate { background: #2E2742; color: #CFC8E2; }
  :root:not([data-theme="light"]) .cat-orange { background: #46230B; color: #FFBF8F; } :root:not([data-theme="light"]) .cat-teal { background: #0C3835; color: #84E3D9; }
}

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column;
  background: var(--side-bg); color: var(--side-text); padding: 18px 14px; overflow-y: auto;
  border-inline-end: 1px solid rgba(255, 255, 255, .04);
}
.sidebar::after { content: ""; position: absolute; inset: auto 0 0 0; height: 220px; pointer-events: none; background: radial-gradient(120% 80% at 50% 100%, rgba(108, 58, 225, .22), transparent 70%); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none !important; }
.brand img { filter: drop-shadow(0 4px 10px rgba(251, 207, 46, .25)); }
.brand-text { display: grid; line-height: 1.25; }
.brand-text small { color: var(--side-muted); font-size: 12px; }
.nav { display: grid; gap: 3px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--side-muted); font-weight: 600; font-size: 14.5px; text-decoration: none !important;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-item.is-active { background: var(--side-active); color: #fff; }
.nav-item.is-active::before { content: ""; position: absolute; inset-inline-start: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }
.nav-item.is-active .icon { color: var(--gold); }
.nav-item.small { font-size: 13.5px; padding: 8px 12px; }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 2px; position: relative; z-index: 1; }
.sidebar .icon-btn { color: var(--side-muted); }
.sidebar .icon-btn:hover { background: var(--side-hover); color: #fff; }
.nav-close { display: none !important; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  height: 66px; padding: 0 28px; background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-open { display: none !important; }
.top-search { flex: 1; max-width: 460px; position: relative; }
.top-search .icon { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.top-search input { min-height: 42px; border-radius: var(--r-pill); padding-inline-start: 44px; background: var(--surface); border-width: 1px; font-size: 14.5px; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.user-chip:hover { border-color: var(--border-strong); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--brand)); color: #fff; font-weight: 800; font-family: var(--mono); font-size: 14px; }
.user-name { font-weight: 700; font-size: 14px; }
.caret { width: 16px; height: 16px; color: var(--text-faint); }
.menu-pop { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-pop); padding: 6px; z-index: 30; }
.menu-pop a, .menu-pop button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); font: inherit; font-size: 14.5px; font-weight: 600; background: none; border: 0; cursor: pointer; text-align: start; text-decoration: none; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-3); }
.menu-pop .danger { color: var(--danger); }
.menu-pop form { margin: 0; }

.content { padding: 26px 28px 60px; width: 100%; max-width: 1320px; margin-inline: auto; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: 13.5px; color: var(--text-muted); margin-bottom: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--text-muted); font-weight: 600; }
.crumbs .icon { width: 15px; height: 15px; }

/* ------------------------------------------------------------ dashboard */
.quick-create { display: grid; grid-template-columns: minmax(0, 250px) minmax(0, 1fr); gap: 22px; align-items: center; margin-bottom: 18px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%); border-color: var(--border-strong); }
.qc-intro h2 { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.qc-intro h2 .icon { color: var(--accent); }
.qc-intro p { margin: 0; font-size: 13.5px; }
.qc-form { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.qc-form .field label { font-size: 13px; }
.qc-submit { min-height: 46px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stats-grid + .card { margin-top: 18px; }
.stat { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow); overflow: hidden; min-width: 0; }
.stat-label { display: flex; gap: 8px; align-items: center; color: var(--text-muted); font-size: 13.5px; font-weight: 600; }
.stat-label .icon { width: 18px; height: 18px; }
.stat-value { font-size: 32px; font-weight: 800; line-height: 1.35; letter-spacing: -.5px; color: var(--text); }
.stat-value-sm { font-size: 22px; }
.stat-foot { font-size: 12.5px; margin-top: auto; display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
a.stat-foot { color: var(--text-muted); font-weight: 600; }
.stat-foot .icon { width: 15px; height: 15px; }
.stat-hero { background: linear-gradient(140deg, #5A2FD0 0%, #431EAB 45%, #2C0F78 100%); border-color: transparent; color: #fff; }
.stat-hero::after { content: ""; position: absolute; inset-inline-end: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, rgba(251, 207, 46, .35), transparent 70%); }
.stat-hero .stat-label, .stat-hero .stat-foot, .stat-hero .stat-foot a { color: rgba(255, 255, 255, .82); }
.stat-hero .stat-value { color: #fff; }
.stat-hero .stat-foot a { font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.stat-accent { background: linear-gradient(140deg, var(--surface) 0%, var(--surface-2) 100%); border-color: var(--border-strong); }
.stat-accent .stat-label .icon { color: var(--accent); }
.spark { width: 84px; height: 24px; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }

.chart-wrap { position: relative; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; margin-inline: -6px; padding-inline: 6px; }
.chart { display: block; width: 100%; min-width: 560px; height: auto; direction: ltr; }
.chart-grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-base { stroke: var(--border-strong); stroke-width: 1.2; }
.chart-axis { fill: var(--text-faint); font-family: var(--font); font-size: 11.5px; }
.chart-bar { fill: var(--chart-bar); opacity: .9; transition: opacity .15s var(--ease); }
.chart-bar.is-today { fill: var(--chart-today); opacity: 1; }
.chart-hit { fill: transparent; }
.chart-col:hover .chart-bar { opacity: 1; fill: var(--brand); }
:root[data-theme="dark"] .chart-col:hover .chart-bar { fill: #C4ADFF; }
.chart-col:hover .chart-bar.is-today { fill: var(--gold-strong); }

.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rank-list li { display: grid; grid-template-columns: minmax(0, 1fr) 90px auto; gap: 12px; align-items: center; padding: 8px 6px; border-radius: 12px; }
.rank-list li:hover { background: var(--surface-2); }
.rank-main { display: grid; min-width: 0; color: var(--text); text-decoration: none !important; }
.rank-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-alias { font-size: 12.5px; color: var(--text-muted); text-align: end; }
.rank-bar, .bars-track { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: block; }
.rank-bar i, .bars-track i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--brand)); transition: width .5s var(--ease); }
.rank-count { font-weight: 800; min-width: 40px; text-align: end; }

.mini-list { list-style: none; margin: 0; padding: 0; display: grid; }
.mini-list li { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.mini-list li:last-child { border-bottom: 0; }
.mini-main { flex: 1; display: grid; min-width: 0; color: var(--text); text-decoration: none !important; }
.mini-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-sub { font-size: 12.5px; color: var(--text-muted); text-align: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { display: flex; align-items: baseline; gap: 12px; padding: 9px 2px; border-bottom: 1px dashed var(--border); }
.timeline li:last-child { border-bottom: 0; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; transform: translateY(-1px); }
.tl-deleted, .tl-purged, .tl-disabled { background: #E25B74; }
.tl-created, .tl-restored, .tl-enabled { background: #2FBF85; }
.tl-text { flex: 1; min-width: 0; }
.tl-text .mono { margin-inline-start: 4px; }
.timeline time { font-size: 12.5px; white-space: nowrap; }

.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 48px 20px; color: var(--text-muted); }
.empty > .icon { width: 44px; height: 44px; color: var(--accent); background: var(--surface-3); padding: 10px; border-radius: 16px; box-sizing: content-box; }
.empty h1, .empty h2 { font-size: 18px; color: var(--text); }
.empty.small { padding: 28px 12px; }
.empty.small > .icon { width: 28px; height: 28px; padding: 8px; border-radius: 12px; }
.empty p { margin: 0; max-width: 420px; }

/* --------------------------------------------------------------- tables */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px; margin-bottom: 16px; }
.filters .field { flex: 0 1 auto; }
.filters .field.grow { flex: 1 1 280px; }
.filters select { min-width: 160px; }
.table-card { padding: 0; overflow: hidden; }
.table-scroll { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
.table th { text-align: start; font-size: 12.5px; font-weight: 700; color: var(--text-muted); background: var(--surface-2); padding: 12px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .12s var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }
.table .row-warn td { background: var(--warn-bg); }
.cell-title { min-width: 200px; max-width: 340px; }
.cell-status { white-space: nowrap; }
.cell-status .expiry { display: block; font-size: 12px; color: var(--text-muted); margin-top: 3px; }
@media (max-width: 1599px) { .links-table .short-cell .host { display: none; } }
@media (max-width: 1399px) and (min-width: 901px) { .links-table .col-created { display: none; } }
.cell-title a { font-weight: 700; color: var(--text); display: block; line-height: 1.5; }
.cell-title .dest { display: block; max-width: 300px; margin-top: 2px; }
@media (max-width: 1399px) { .cell-title .dest { max-width: 230px; } }
.short-cell a .host { color: var(--text-faint); font-weight: 400; }
.nowrap { white-space: nowrap; }
.cell-title a:hover { color: var(--brand-text); }
.short-cell { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.short-cell a { color: var(--text-muted); font-size: 13.5px; }
.short-cell a b { color: var(--brand-text); }
.dest { color: var(--text-muted); font-size: 13px; display: inline-block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.col-actions { width: 1%; white-space: nowrap; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; align-items: center; }
.row-actions.wide { gap: 8px; }
.sort { color: inherit; display: inline-flex; align-items: center; gap: 2px; text-decoration: none !important; }
.sort:hover { color: var(--text); }
.sort-ic { width: 14px; height: 14px; opacity: .35; }
.sort.is-active { color: var(--brand-text); }
.sort.is-active .sort-ic { opacity: 1; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.pager-btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px; border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; text-decoration: none !important; }
.pager-btn:hover { border-color: var(--accent); color: var(--brand-text); }
.pager-btn.is-disabled { opacity: .45; pointer-events: none; }
.pager-btn .icon { width: 16px; height: 16px; }
.pager-info { color: var(--text-muted); font-size: 14px; }
.ua { display: inline-block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; font-size: 13px; color: var(--text-muted); }
.audit-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13.5px; }
.change { display: block; width: 100%; font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.purge, .inline-edit, .sub-action { position: relative; }
.purge summary, .inline-edit summary, .sub-action summary { list-style: none; }
.purge summary::-webkit-details-marker, .inline-edit summary::-webkit-details-marker, .sub-action summary::-webkit-details-marker { display: none; }
.purge-form, .inline-form { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 10; width: 300px; display: grid; gap: 8px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-pop); white-space: normal; font-size: 13.5px; }
.inline-form { width: 280px; }
.sub-action { margin-top: 12px; }
.sub-action[open] > summary { margin-bottom: 12px; }
.sub-action .form { padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }

/* ----------------------------------------------------------- link form */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.form-main { display: grid; gap: 18px; min-width: 0; }
.form-section { display: grid; gap: 16px; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 16.5px; }
.section-title .icon { color: var(--accent); }
.step-num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--surface-3); color: var(--brand-text); font-size: 14px; font-weight: 800; }
.form-side { position: sticky; top: 86px; }
.preview-card { display: grid; gap: 12px; background: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 100%); }
.preview-short, .preview-dest { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.preview-short span, .preview-dest span.muted { font-size: 12.5px; }
.preview-short strong { color: var(--brand-text); font-size: 15px; overflow-wrap: anywhere; text-align: left; }
.preview-short em { font-style: normal; color: var(--text-faint); font-family: var(--font); }
.preview-dest .mono { font-size: 13px; overflow-wrap: anywhere; color: var(--text-muted); text-align: left; max-height: 6.5em; overflow: hidden; }
.preview-arrow { display: grid; place-items: center; color: var(--accent); margin: -6px 0; }
.form-submit { display: grid; gap: 8px; margin-top: 4px; }
.warn-list { list-style: none; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn); font-size: 13.5px; display: grid; gap: 6px; }
.warn-list .icon { width: 16px; height: 16px; }
.dest-check { font-size: 13.5px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); display: grid; gap: 4px; }
.dest-check.is-ok { border-color: var(--ok-border); background: var(--ok-bg); color: var(--ok); }
.dest-check.is-warn { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn); }
.dest-check.is-error { border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger); }
.dest-check .row { display: flex; gap: 6px; align-items: flex-start; }
.dest-check .icon { width: 16px; height: 16px; margin-top: 3px; }
.alias-status { font-size: 13.5px; margin: 0; min-height: 1.4em; display: flex; gap: 6px; align-items: center; }
.alias-status.is-ok { color: var(--ok); }
.alias-status.is-error { color: var(--danger); }
.alias-status .icon { width: 16px; height: 16px; }
.alias-current { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.alias-current .mono b { color: var(--brand-text); }
.alias-change { display: grid; gap: 14px; }
.approve-box { padding: 12px 14px; border-radius: 14px; border: 1.5px dashed var(--warn-border); background: var(--warn-bg); color: var(--warn); }
.ref-helper { border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.ref-helper summary { cursor: pointer; padding: 10px 14px; font-weight: 700; font-size: 14px; display: flex; gap: 8px; align-items: center; color: var(--brand-text); }
.ref-helper-body { padding: 0 14px 14px; display: grid; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: var(--r-pill); padding: 5px 14px; font-family: var(--mono); font-size: 13.5px; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--brand-text); }
.expiry-custom { padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.form-actions-bar { display: flex; justify-content: flex-end; margin: 18px 0; }
.settings-form { gap: 18px; }

/* -------------------------------------------------------- link details */
.success-panel {
  display: flex; gap: 20px; align-items: flex-start; padding: 26px; margin-bottom: 18px; border-radius: var(--r-card);
  background: linear-gradient(135deg, #2C0F78 0%, #431EAB 50%, #5A2FD0 100%); color: #fff; box-shadow: 0 18px 40px rgba(67, 30, 171, .3);
  position: relative; overflow: hidden; animation: pop-in .45s var(--ease) both;
}
.success-panel::after { content: ""; position: absolute; inset-inline-end: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(251, 207, 46, .28), transparent 70%); pointer-events: none; }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.success-icon { flex: none; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--gold); color: var(--on-gold); }
.success-icon .icon { width: 28px; height: 28px; }
.success-body { flex: 1; min-width: 0; position: relative; z-index: 1; }
.success-body h1 { color: #fff; font-size: 22px; }
.success-body .muted { color: rgba(255, 255, 255, .8); }
.result-url { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0 6px; padding: 10px 10px 10px 18px; border-radius: 18px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); }
.result-url a { flex: 1; min-width: 0; color: #fff; font-size: 20px; font-weight: 700; overflow-wrap: anywhere; text-align: left; }
.success-panel .btn-secondary { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .25); }
.success-panel .btn-secondary:hover { background: rgba(255, 255, 255, .2); }
.success-panel .btn-ghost { color: rgba(255, 255, 255, .85); }
.success-panel .btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.link-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; margin-bottom: 18px; }
.link-hero-main { min-width: 0; }
.link-hero-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 6px; }
.link-hero-title h1, .link-hero-title h2 { font-size: 22px; }
.link-hero-side { display: grid; justify-items: center; gap: 6px; }
.link-hero-side .qr { border-radius: 14px; border: 1px solid var(--border); background: #fff; padding: 4px; }
.link-hero-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 22px; margin: 14px 0 0; }
.kv > div { min-width: 0; }
.kv > div:nth-child(1), .kv > div:nth-child(2) { grid-column: 1 / -1; }
.kv dt { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.kv dd { margin: 2px 0 0; min-width: 0; }
.copy-field { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.copy-field a { font-weight: 700; font-size: 15.5px; overflow-wrap: anywhere; }
.dest-full { overflow-wrap: anywhere; font-size: 13.5px; color: var(--text); display: block; text-align: left; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.stats-4 { margin-bottom: 0; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: minmax(80px, 1fr) minmax(60px, 1.2fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.bars-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars-val { font-weight: 800; min-width: 28px; text-align: end; }
.host-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.host-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; }
.host-chip bdi { color: var(--text-muted); }
.host-chip span { background: var(--surface-3); border-radius: 999px; padding: 0 8px; font-weight: 700; }
.privacy-note { display: flex; gap: 10px; align-items: flex-start; color: var(--text-muted); font-size: 13px; padding: 12px 16px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--border-strong); margin: 18px 0; }
.privacy-note .icon { color: var(--accent); margin-top: 2px; }
.confirm-card { max-width: 560px; margin: 20px auto; text-align: center; display: grid; gap: 10px; justify-items: center; padding: 32px; }
.confirm-icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--danger-bg); color: var(--danger); }
.confirm-icon .icon { width: 28px; height: 28px; }
.confirm-card h1 { font-size: 21px; }
.plain-list { text-align: start; color: var(--text-muted); font-size: 14.5px; margin: 6px 0; padding-inline-start: 20px; display: grid; gap: 4px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch .cat { padding: 5px 12px; border: 2px solid transparent; cursor: pointer; }
.swatch input:checked + .cat { border-color: currentColor; }
.swatch input:focus-visible + .cat { outline: 2.5px solid var(--focus); outline-offset: 2px; }
.info-box { display: flex; gap: 10px; margin-top: 18px; padding: 12px 14px; border-radius: 14px; background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); font-size: 13.5px; }
.info-box p { margin: 0; }
.info-box .icon { margin-top: 2px; }

/* ----------------------------------------------------------------- auth */
body.auth, body.public, body.plain { background: var(--bg); }
.pub-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 50% at 85% 0%, rgba(108, 58, 225, .20), transparent 70%),
    radial-gradient(40% 40% at 10% 90%, rgba(251, 207, 46, .14), transparent 70%),
    radial-gradient(50% 50% at 0% 10%, rgba(67, 30, 171, .10), transparent 70%); }
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; align-content: center; gap: 16px; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--border); border-radius: 26px; padding: 32px 30px; box-shadow: var(--shadow-pop); }
.auth-head { display: grid; justify-items: center; gap: 4px; margin-bottom: 18px; }
.auth-head .wordmark { font-size: 17px; color: var(--text); }
.auth-sub { color: var(--text-muted); font-size: 13px; }
.auth-title { font-size: 21px; text-align: center; margin-bottom: 14px; }
.auth-card .muted { text-align: center; }
.auth-note { display: flex; gap: 8px; justify-content: center; align-items: center; font-size: 12.5px; color: var(--text-muted); margin: 18px 0 0; text-align: center; }
.auth-note .icon { width: 15px; height: 15px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; font-size: 13.5px; }
.auth-foot { display: flex; gap: 10px; align-items: center; color: var(--text-muted); font-size: 13.5px; }
.auth-foot a, .auth-foot .link-btn { color: var(--text-muted); }
.code-input { text-align: center !important; font-size: 26px !important; letter-spacing: 8px; font-weight: 700; min-height: 58px !important; }
.steps { margin: 0 0 14px; padding-inline-start: 22px; color: var(--text-muted); font-size: 14px; display: grid; gap: 4px; }
.qr-box { display: grid; place-items: center; padding: 12px; margin: 0 auto 12px; width: max-content; border-radius: 18px; background: #fff; border: 1px solid var(--border); }
.qr-box img { display: block; width: 200px; height: 200px; }
.secret-box { margin-bottom: 16px; font-size: 14px; }
.secret-box summary { cursor: pointer; color: var(--brand-text); font-weight: 600; text-align: center; }
.secret-box .copy-field { justify-content: center; margin-top: 10px; }
.secret-box code { font-size: 15px; letter-spacing: 1px; padding: 6px 10px; }
.secret-box .hint { text-align: center; margin-top: 6px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; padding: 14px; list-style: none; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); counter-reset: c; }
.codes li { counter-increment: c; display: flex; gap: 8px; align-items: center; }
.codes li::before { content: counter(c); color: var(--text-faint); font-size: 12px; min-width: 16px; font-family: var(--mono); }
.codes code { background: transparent; font-size: 15px; padding: 0; letter-spacing: .5px; }

/* --------------------------------------------------------------- public */
.pub-header { display: flex; justify-content: space-between; align-items: center; max-width: 1160px; margin: 0 auto; padding: 22px 24px; }
.pub-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; }
.pub-brand .wordmark { font-size: 16px; }
.pub-brand.small .wordmark { font-size: 14px; }
.public .wordmark b, .auth .wordmark b, .status-page .wordmark b { color: #D9A400; }
:root[data-theme="dark"] .public .wordmark b, :root[data-theme="dark"] .auth .wordmark b { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .public .wordmark b, :root:not([data-theme="light"]) .auth .wordmark b { color: var(--gold); } }
.pub-main { max-width: 1160px; margin: 0 auto; padding: 0 24px 40px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 40px; align-items: center; padding: 40px 0 56px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--brand-text); font-weight: 700; font-size: 13px; margin-bottom: 18px; }
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(251, 207, 46, .25); }
.hero h1 { font-size: clamp(32px, 5vw, 54px); line-height: 1.3; font-weight: 900; letter-spacing: -.5px; margin-bottom: 18px;
  background: linear-gradient(135deg, var(--text) 30%, var(--accent) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
@supports not ((-webkit-background-clip: text) or (background-clip: text)) { .hero h1 { color: var(--text); background: none; } }
.lead { font-size: 17px; line-height: 2; color: var(--text-muted); max-width: 560px; }
.hero-actions { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.hero-art { position: relative; display: grid; place-items: center; min-height: 360px; }
.hero-art::before { content: ""; position: absolute; width: 78%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 45%, rgba(108, 58, 225, .35), rgba(67, 30, 171, .08) 60%, transparent 72%); }
.owl { position: relative; width: min(280px, 70%); filter: drop-shadow(0 26px 40px rgba(46, 16, 101, .35)); animation: float 6s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.link-demo { position: absolute; bottom: 6px; inset-inline: 0; margin-inline: auto; width: max-content; max-width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop); font-family: var(--mono); font-size: 14px; direction: ltr; }
.link-demo-short { color: var(--brand-text); font-weight: 700; }
.link-demo-short b { color: #D9A400; }
.link-demo-arrow { color: var(--text-faint); display: grid; transform: scaleX(-1); }
.link-demo-dest { color: var(--text-muted); }
.pub-points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.pub-points article { padding: 24px; border-radius: var(--r-card); background: color-mix(in srgb, var(--surface) 82%, transparent); border: 1px solid var(--border); box-shadow: var(--shadow); }
.pub-points h2 { font-size: 17px; margin: 12px 0 6px; }
.pub-points p { color: var(--text-muted); font-size: 14.5px; margin: 0; }
.point-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(140deg, #5A2FD0, #431EAB); color: var(--gold); }
.pub-footer { max-width: 1160px; margin: 0 auto; padding: 24px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--text-muted); font-size: 13.5px; border-top: 1px solid var(--border); }
.pub-footer a { color: var(--text-muted); }
.status-page { display: grid; place-items: center; padding: 24px 16px; min-height: 100vh; min-height: 100dvh; }
.status-card { width: 100%; max-width: 480px; text-align: center; display: grid; justify-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 26px; padding: 34px 28px; box-shadow: var(--shadow-pop); }
.status-card h1 { font-size: 23px; }
.status-card p { color: var(--text-muted); margin: 0; }
.status-icon { width: 70px; height: 70px; border-radius: 22px; display: grid; place-items: center; margin: 14px 0 6px; background: var(--surface-3); color: var(--accent); }
.status-icon .icon { width: 34px; height: 34px; }
.status-expired { background: var(--warn-bg); color: var(--warn); }
.status-disabled { background: var(--surface-3); color: var(--text-muted); }
.status-alias { font-family: var(--mono); font-size: 14px; padding: 4px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted) !important; margin: 4px 0 10px !important; overflow-wrap: anywhere; }
.plain-card { max-width: 460px; margin: 15vh auto; padding: 30px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.theme-toggle .icon { width: 20px; height: 20px; }
.pub-header .theme-toggle { border: 1px solid var(--border); background: var(--surface); }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .qc-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .qc-form .grow { grid-column: 1 / -1; }
  .qc-submit { grid-column: 1 / -1; }
  .quick-create { grid-template-columns: 1fr; gap: 12px; }
  .form-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(300px, 86vw); z-index: 60; transform: translateX(105%); transition: transform .28s var(--ease); box-shadow: var(--shadow-pop); visibility: hidden; }
  .nav-open-state .sidebar { transform: none; visibility: visible; }
  .nav-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(15, 3, 30, .5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
  .nav-open, .nav-close { display: inline-grid !important; }
  .topbar { padding: 0 16px; gap: 10px; }
  .content { padding: 20px 18px 56px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-layout { grid-template-columns: minmax(0, 1fr); }
  .form-side { position: static; }
  .grid-side { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 10px; padding-top: 16px; }
  .hero-art { min-height: 300px; order: -1; }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  h1 { font-size: 22px; }
  .hide-sm { display: none !important; }
  .top-search { max-width: none; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 26px; }
  .card { padding: 18px 16px; border-radius: 18px; }
  .qc-form { grid-template-columns: minmax(0, 1fr); }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .filters .field, .filters .field.grow, .filters select { flex: 1 1 100%; min-width: 0; }
  .filters .btn { flex: 1; }
  .purge-form, .inline-form { position: fixed; inset-inline: 12px; top: auto; bottom: 12px; width: auto; }
  .link-hero { grid-template-columns: minmax(0, 1fr); }
  .link-hero-side { grid-row: 2; justify-items: start; grid-auto-flow: column; align-items: end; justify-content: start; }
  .link-hero-side .qr { width: 110px; height: 110px; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .link-hero-actions .btn { flex: 1 1 calc(50% - 10px); }
  .success-panel { flex-direction: column; padding: 20px; gap: 12px; }
  .result-url { padding: 10px; }
  .result-url a { font-size: 17px; flex-basis: 100%; }
  .result-url .btn { width: 100%; }
  .rank-list li { grid-template-columns: minmax(0, 1fr) 60px auto; }
  .pub-points { grid-template-columns: minmax(0, 1fr); }
  .pub-header { padding: 16px; }
  .pub-main { padding: 0 16px 32px; }
  .hero-art { min-height: 260px; }
  .owl { width: 190px; }
  .lead { font-size: 15.5px; }
  .auth-card { padding: 26px 20px; border-radius: 22px; }
  .codes { grid-template-columns: minmax(0, 1fr); }
  .user-chip { padding: 3px; }
  .menu-pop { min-width: 190px; }
}
@media (max-width: 900px) {
  /* tables become stacked cards */
  .table-card { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .table-card .table-scroll { overflow: visible; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 8px 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
  .table tbody tr:hover { background: var(--surface); }
  .table td { border: 0; padding: 6px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-width: 0; }
  .table td[data-label]::before { content: attr(data-label); color: var(--text-muted); font-size: 12.5px; font-weight: 600; flex: none; }
  .table td > * { min-width: 0; }
  .table .num { text-align: start; }
  .table td.col-actions { width: 100%; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; justify-content: flex-end; }
  .table td.cell-title { font-size: 15.5px; }
  .links-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 12px 14px 8px; }
  .links-table td { width: auto; padding: 2px 0; display: inline-flex; gap: 6px; }
  .links-table td.cell-title { flex: 1 1 100%; display: block; min-width: 0; max-width: none; }
  .links-table td.cell-short { flex: 1 1 100%; }
  .links-table td.cell-meta[data-label]::before { font-size: 11.5px; }
  .links-table td.col-category::before, .links-table td.cell-status::before { content: none; }
  .links-table .cell-status { display: inline-flex; align-items: center; gap: 8px; }
  .links-table .cell-status .expiry { margin: 0; }
  .links-table .short-cell .host { display: inline; }
  .links-table td.col-actions { flex: 1 1 100%; margin-top: 4px; padding-top: 6px; }
  .dest { max-width: 58vw; }
  .ua { max-width: 52vw; }
  .table .row-warn { background: var(--warn-bg); }
  .table .row-warn td { background: transparent; }
}
@media (max-width: 1180px) and (min-width: 901px) { .links-table .col-category { display: none; } .cell-title { min-width: 170px; } .cell-title .dest { max-width: 170px; } }
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: minmax(0, 1fr); }
  .seg label span, .seg a { padding: 6px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media print {
  .sidebar, .topbar, .page-actions, .row-actions, .btn { display: none !important; }
  .shell { display: block; }
}
