/* DPDP Consent Manager: one stylesheet, light + dark themes.
   Theme choice: <html data-theme="light|dark">, or no attribute = follow the device.
   Dark tokens are declared twice on purpose: under the media query (device is dark and the
   user did not pick light) and under [data-theme="dark"] (user picked dark). */

/* ---------- fonts (served from /static/fonts) ---------- */
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+20B9, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("/static/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Noto Sans Devanagari"; font-style: normal; font-display: swap; font-weight: 400;
  src: url("/static/fonts/noto-devanagari-400.woff2") format("woff2"); unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FF; }
@font-face { font-family: "Noto Sans Devanagari"; font-style: normal; font-display: swap; font-weight: 600 700;
  src: url("/static/fonts/noto-devanagari-600.woff2") format("woff2"); unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FF; }

/* ---------- tokens: light ---------- */
:root {
  color-scheme: light;
  --font: "Inter", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #f8f9fb; --sunken: #eef1f5;
  --text: #141a23; --muted: #5b6575; --faint: #8a93a3;
  --border: #e2e6ec; --border-strong: #cdd3dc;
  --primary: #1d4ed8; --primary-text: #fff; --link: #1d4ed8; --brand: #1d4ed8; --brand-text: #fff;
  --ok: #157a3b; --ok-bg: #e6f5ec; --warn: #9a5800; --warn-bg: #fff3dd; --danger: #b42318; --danger-bg: #fdecea;
  --info: #2459b3; --info-bg: #e8f0fd;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 6px 16px -4px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18);
  --radius: 14px; --radius-sm: 9px;
  --il-paper: #ffffff; --il-line: #dfe4ec; --il-shadow: rgba(20, 30, 50, .08); --il-ink: #33415c;
  /* charts (dataviz palette, light) */
  --grid: #e6e8ec; --axis: #c9ced6; --tick: #6b7280;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4;
}

/* ---------- tokens: dark (device dark and no explicit light choice) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1117; --surface: #161b22; --surface-2: #1b212a; --sunken: #11161d;
    --text: #e6ebf2; --muted: #9ba6b6; --faint: #6e7889;
    --border: #262d37; --border-strong: #353e4a;
    --ok: #4ccf82; --ok-bg: #11301f; --warn: #f2b453; --warn-bg: #352610; --danger: #ff7a70; --danger-bg: #3b1715;
    --info: #79a8f5; --info-bg: #15243d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 20px -6px rgba(0, 0, 0, .5);
    --shadow-lg: 0 16px 40px -10px rgba(0, 0, 0, .7);
    --il-paper: #222a35; --il-line: #374150; --il-shadow: rgba(0, 0, 0, .35); --il-ink: #c3ccda;
    --grid: #2a2f37; --axis: #3b414b; --tick: #9ba6b6;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181;
  }
}
/* ---------- tokens: dark (picked explicitly) ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117; --surface: #161b22; --surface-2: #1b212a; --sunken: #11161d;
  --text: #e6ebf2; --muted: #9ba6b6; --faint: #6e7889;
  --border: #262d37; --border-strong: #353e4a;
  --ok: #4ccf82; --ok-bg: #11301f; --warn: #f2b453; --warn-bg: #352610; --danger: #ff7a70; --danger-bg: #3b1715;
  --info: #79a8f5; --info-bg: #15243d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 20px -6px rgba(0, 0, 0, .5);
  --shadow-lg: 0 16px 40px -10px rgba(0, 0, 0, .7);
  --il-paper: #222a35; --il-line: #374150; --il-shadow: rgba(0, 0, 0, .35); --il-ink: #c3ccda;
  --grid: #2a2f37; --axis: #3b414b; --tick: #9ba6b6;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181;
}
:root { --primary-soft: color-mix(in srgb, var(--primary) 13%, var(--surface)); --primary-softer: color-mix(in srgb, var(--primary) 7%, var(--surface)); }

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15.5px/1.6 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { letter-spacing: -.015em; }
h1 { font-size: 1.65rem; line-height: 1.2; margin: 0 0 10px; font-weight: 700; }
h2 { font-size: 1.08rem; margin: 20px 0 8px; font-weight: 650; }
h3 { font-size: 1rem; margin: 18px 0 6px; font-weight: 650; }
a { color: var(--link); text-underline-offset: 2px; }
.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.wrap { max-width: 780px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1200px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.mono { font-family: var(--mono); word-break: break-all; }
.eyebrow { color: var(--primary); font-size: .78rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 6px; }
.lead { font-size: 1.04rem; color: var(--muted); }
code { font-family: var(--mono); font-size: .88em; background: var(--sunken); padding: 1px 5px; border-radius: 5px; }
pre.code { background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; overflow-x: auto; font-size: .82rem; }
pre.mail { white-space: pre-wrap; word-break: break-word; font: inherit; margin: 0; }
details summary { cursor: pointer; font-weight: 600; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card > h2:first-child, .card > .row-between:first-child h2 { margin-top: 0; }
details.card > summary { font-size: 1.05rem; }
details.card[open] > summary { margin-bottom: 12px; }
.icon-chip { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); flex: none; }
.icon-chip .icon { width: 19px; height: 19px; }
.icon-chip.ok { background: var(--ok-bg); color: var(--ok); }
.icon-chip.warn { background: var(--warn-bg); color: var(--warn); }
.icon-chip.info { background: var(--info-bg); color: var(--info); }
.icon-chip.danger { background: var(--danger-bg); color: var(--danger); }

/* ---------- buttons ---------- */
button, .button {
  font: inherit; font-weight: 550; font-size: .93rem; padding: 9px 15px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; box-shadow: var(--shadow-sm);
  transition: background-color .15s, border-color .15s, box-shadow .15s, transform .05s;
}
button:hover, .button:hover { background: var(--surface-2); border-color: var(--faint); }
button:active, .button:active { transform: translateY(1px); }
button .icon, .button .icon { width: 17px; height: 17px; }
button.small { padding: 4px 10px; font-size: .84rem; border-radius: 8px; }
button.big, .button.big { padding: 12px 20px; font-size: 1rem; border-radius: 12px; }
.primary, button.primary, .button.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); box-shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 4px 12px -4px color-mix(in srgb, var(--primary) 60%, transparent); }
.primary:hover, .button.primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); border-color: color-mix(in srgb, var(--primary) 88%, #000); }
.danger, button.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: var(--surface); }
.danger:hover { background: var(--danger-bg); border-color: var(--danger); }
button.link { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; font: inherit; box-shadow: none; }
.icon-btn { padding: 7px; border-radius: 9px; background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.icon-btn:hover { background: var(--sunken); color: var(--text); border-color: transparent; }
.wide-btn { width: 100%; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; align-items: center; }

/* ---------- flash / badges / tags ---------- */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid transparent; margin: 0 0 16px; }
.flash .icon { margin-top: 2px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.error { color: var(--danger); font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--sunken); color: var(--muted); white-space: nowrap; }
.badge .icon { width: 13px; height: 13px; stroke-width: 2.5; }
.badge.s-granted { background: var(--ok-bg); color: var(--ok); }
.badge.s-denied, .badge.s-withdrawn { background: var(--danger-bg); color: var(--danger); }
.badge.s-expired, .badge.s-pending { background: var(--warn-bg); color: var(--warn); }
.badge.s-sent, .badge.s-viewed { background: var(--info-bg); color: var(--info); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--sunken); font-size: .82rem; color: var(--muted); }

/* ---------- forms ---------- */
.form label { display: block; margin-bottom: 15px; font-weight: 600; font-size: .93rem; }
.form input, .form select, .form textarea, .filters input, .filters select, .inline-form select {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-weight: 400; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form input:focus, .form select:focus, .form textarea:focus, .filters input:focus, .filters select:focus, .inline-edit input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}
.form small { display: block; font-weight: 400; color: var(--muted); margin-top: 5px; font-size: .84rem; }
.form textarea { resize: vertical; }
.form textarea.mono-area { font-family: var(--mono); font-size: .86rem; line-height: 1.5; }
.form input.color { width: 72px; height: 42px; padding: 3px; }
.form input[type="file"] { padding: 8px; background: var(--surface-2); }
.form h2 { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); }
.form h2:first-of-type { border-top: 0; padding-top: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 20px 0 12px; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--primary); }
.form label.check, .checks label.check { font-weight: 400; display: flex; margin: 8px 0; }
.form label.check input, .checks label.check input { display: inline-block; width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.form label.check span { font-weight: 400; }
fieldset.checks { border: 0; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; color: var(--muted); }
label.inline input, label.inline select { width: auto; margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.filters input { flex: 1 1 240px; margin: 0; }
.filters select { flex: 0 1 180px; margin: 0; width: auto; }
.filters label.inline input { flex: 0 0 auto; padding: 8px 10px; }
.inline-form { margin-top: 16px; display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { flex: 1 1 220px; }
.inline-edit { display: flex; gap: 6px; align-items: center; margin: 0; }
.inline-edit input, .inline-edit select { font: inherit; padding: 5px 9px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); min-width: 0; flex: 1 1 auto; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }
.sticky-actions { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); padding: 12px 0; z-index: 2; }
.key { font-size: 1rem; background: var(--surface); padding: 8px; border-radius: 8px; user-select: all; }
.logo-preview { max-height: 80px; max-width: 280px; background: #fff; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }

/* ---------- layout helpers ---------- */
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 18px; }
.grid > .card { margin-bottom: 0; }
.grid + .card, .grid + section { margin-top: 18px; }
.narrow { max-width: 660px; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 10px 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; word-break: break-word; font-weight: 500; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions form, .wrap-actions form { margin: 0; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 18px 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin-bottom: 4px; }
.page-head p { margin: 0; }
.page-head .actions { margin: 0; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card .table-wrap { box-shadow: none; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; background: transparent; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: .76rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); }
tbody tr:hover td { background: var(--primary-softer); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td a { font-weight: 550; }

/* ---------- theme switch ---------- */
.theme-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--sunken); border: 1px solid var(--border); margin: 0; }
.theme-switch button { padding: 5px 8px; border: 0; background: transparent; box-shadow: none; color: var(--muted); border-radius: 8px; }
.theme-switch button:hover { color: var(--text); background: transparent; }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.theme-switch .icon { width: 16px; height: 16px; }

/* ---------- brand mark ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo { max-height: 34px; max-width: 150px; border-radius: 6px; }
.brand-badge { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 60%, #000)); color: var(--brand-text); font-weight: 700; font-size: .9rem; letter-spacing: .02em; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text small { color: var(--muted); font-size: .76rem; }

/* ========== admin shell ========== */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 16px 12px; background: var(--surface); border-inline-end: 1px solid var(--border); overflow-y: auto; }
.side-head { padding: 4px 8px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.brand-link { text-decoration: none; color: var(--text); display: block; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.nav-group { margin: 14px 10px 4px; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 650; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 550; font-size: .93rem; }
.side-nav a:hover { background: var(--sunken); color: var(--text); }
.side-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.side-nav a[aria-current="page"] .icon { color: var(--primary); }
.side-foot { display: flex; flex-direction: column; gap: 12px; padding: 12px 6px 4px; border-top: 1px solid var(--border); }
.side-foot .theme-switch { align-self: flex-start; }
.user-card { display: flex; align-items: center; gap: 6px; }
.user-card form { margin: 0; }
.user-link { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; text-decoration: none; color: var(--text); padding: 6px; border-radius: 10px; }
.user-link:hover, .user-link[aria-current="page"] { background: var(--sunken); }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-meta strong { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: var(--muted); font-size: .76rem; text-transform: capitalize; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .82rem; flex: none; }
.avatar.sm { width: 30px; height: 30px; font-size: .8rem; }
.content { padding: 28px 32px 56px; max-width: 1280px; width: 100%; }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: column; padding: 10px 12px; border-inline-end: 0; border-bottom: 1px solid var(--border); }
  .side-head { border: 0; padding: 2px 4px 6px; margin: 0; }
  .side-nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; scrollbar-width: thin; }
  .side-nav a { white-space: nowrap; padding: 7px 10px; }
  .nav-group { display: none; }
  .side-foot { flex-direction: row; align-items: center; justify-content: space-between; border-top: 0; padding: 4px 0 0; }
  .side-foot .theme-switch { align-self: center; }
  .user-card { flex: 0 1 auto; }
  .content { padding: 20px 16px 48px; }
}

/* ========== auth (login, setup, reset) ========== */
.auth-layout { display: grid; grid-template-columns: minmax(340px, 46%) 1fr; min-height: 100vh; }
.auth-panel {
  position: relative; overflow: hidden; padding: 40px 48px; display: flex; flex-direction: column; justify-content: center; gap: 18px;
  color: var(--brand-text);
  background:
    radial-gradient(ellipse 70% 55% at 85% 10%, color-mix(in srgb, #fff 22%, transparent), transparent 70%),
    radial-gradient(ellipse 60% 50% at 0% 100%, color-mix(in srgb, #000 30%, transparent), transparent 70%),
    linear-gradient(150deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #0b1020));
}
.auth-panel::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(color-mix(in srgb, #fff 14%, transparent) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(180deg, #000, transparent 75%); pointer-events: none; }
.auth-panel > * { position: relative; z-index: 1; }
.auth-panel .brand { position: absolute; top: 32px; left: 48px; }
[dir="rtl"] .auth-panel .brand { left: auto; right: 48px; }
.auth-panel .brand-badge { background: color-mix(in srgb, #fff 20%, transparent); color: var(--brand-text); }
.auth-panel .brand-text strong { font-size: 1.05rem; }
.auth-panel .logo { background: #fff; padding: 4px; }
.auth-panel h2 { font-size: 1.7rem; line-height: 1.2; margin: 0; max-width: 24ch; letter-spacing: -.02em; }
.auth-panel ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.auth-panel li { display: flex; gap: 10px; align-items: center; opacity: .92; }
.auth-panel li .icon { width: 20px; height: 20px; }
.auth-panel-art { max-width: 360px; }
.auth-panel-art .illus { width: 100%; height: auto; }
/* on the brand panel the illustration uses light-on-colour tones */
.auth-panel .il-bg { fill: color-mix(in srgb, #fff 12%, transparent); }
.auth-panel .il-paper { fill: #fff; }
.auth-panel .il-line { fill: #dfe5ef; }
.auth-panel .il-ink { stroke: #2a3550; }
.auth-panel .il-primary { fill: var(--brand); stroke: #fff; stroke-width: 3; }
.auth-panel .il-ring { stroke: color-mix(in srgb, #fff 55%, transparent); }
.auth-panel .il-spark { stroke: color-mix(in srgb, #fff 70%, transparent); }
.auth-panel .il-shadow { fill: rgba(0, 0, 0, .18); }
.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 64px 24px 32px; position: relative; }
.auth-top { position: absolute; top: 20px; right: 24px; }
[dir="rtl"] .auth-top { right: auto; left: 24px; }
.auth-box { width: 100%; max-width: 440px; }
.auth-box .card { padding: 30px; box-shadow: var(--shadow-lg); }
.auth-footer { margin-top: 24px; text-align: center; }
@media (max-width: 860px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-panel { padding: 22px 20px; gap: 10px; min-height: 0; }
  .auth-panel .brand { position: static; }
  .auth-panel h2, .auth-panel ul, .auth-panel-art { display: none; }
  .auth-main { padding: 20px 16px 32px; justify-content: flex-start; }
  .auth-top { position: static; align-self: flex-end; margin-bottom: 12px; }
}

/* ========== public consent pages ========== */
body.public { background: var(--bg); }
.site-header { position: relative; z-index: 2; }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 68px; flex-wrap: wrap; color: var(--brand-text); }
.site-header .brand-text small { color: inherit; opacity: .8; }
.site-header .brand-badge { background: color-mix(in srgb, #fff 22%, transparent); }
.site-header .logo { background: #fff; padding: 3px; }
.header-tools { display: flex; align-items: center; gap: 14px; margin-inline-start: auto; flex-wrap: wrap; }
.site-header .theme-switch { background: color-mix(in srgb, #000 18%, transparent); border-color: color-mix(in srgb, #fff 18%, transparent); }
.site-header .theme-switch button { color: color-mix(in srgb, var(--brand-text) 75%, transparent); }
.site-header .theme-switch button[aria-pressed="true"] { background: color-mix(in srgb, #fff 92%, transparent); color: #1b2330; }
.hero-band {
  position: absolute; top: 0; left: 0; right: 0; height: 250px; z-index: 0;
  background:
    radial-gradient(ellipse 50% 80% at 90% 0%, color-mix(in srgb, #fff 18%, transparent), transparent 70%),
    linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 60%, #0b1020));
}
.hero-band::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(color-mix(in srgb, #fff 14%, transparent) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(180deg, #000, transparent); }
body.public > main { position: relative; z-index: 1; padding-top: 18px; padding-bottom: 32px; }
.langs { display: flex; gap: 4px; flex-wrap: wrap; font-size: .88rem; }
.langs a, .langs strong { padding: 4px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
.langs a { opacity: .85; }
.langs a:hover { opacity: 1; background: color-mix(in srgb, #fff 14%, transparent); }
.langs strong { background: color-mix(in srgb, #fff 92%, transparent); color: #1b2330; }
.site-footer { padding-bottom: 32px; text-align: center; }
.secure-note { display: inline-flex; align-items: center; gap: 6px; }
.secure-note .icon { width: 14px; height: 14px; }

.consent-card { padding: 28px; box-shadow: var(--shadow-lg); }
.consent-head { display: flex; gap: 20px; align-items: center; justify-content: space-between; }
.consent-head .illus { width: 170px; flex: none; height: auto; }
.consent-head h1 { font-size: 1.8rem; }
@media (max-width: 600px) { .consent-head .illus { display: none; } .consent-card { padding: 20px; } }
.step-h { display: flex; align-items: center; gap: 10px; margin-top: 24px; }
.step-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: var(--primary-text); font-size: .8rem; font-weight: 700; flex: none; }
.consent-card .details { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.notice { position: relative; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 22px; padding: 6px 20px 10px; background: var(--surface-2); }
.notice-n { position: absolute; top: -13px; left: 16px; box-shadow: 0 0 0 4px var(--surface); }
[dir="rtl"] .notice-n { left: auto; right: 16px; }
.notice ul { padding-inline-start: 20px; margin: 4px 0; }
.notice h2, .notice h3 { color: var(--text); }
form.decide { margin-top: 22px; padding: 16px 18px; border-radius: var(--radius-sm); background: var(--primary-softer); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border)); }
form.decide .check { margin: 0 0 6px; }
form.decide .actions .big { flex: 1 1 200px; }

.result { text-align: center; padding: 34px 26px; box-shadow: var(--shadow-lg); }
.result .illus { width: 200px; max-width: 70%; height: auto; display: block; margin: 0 auto 8px; }
.result h1 { font-size: 1.55rem; }
.result p { max-width: 52ch; margin-inline: auto; }
.result .actions { justify-content: center; }
.id-chip { display: inline-flex !important; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--sunken); font-family: var(--mono); font-size: .86rem; max-width: 100%; }
.id-chip .icon { width: 16px; height: 16px; color: var(--primary); }

/* ---------- illustrations ---------- */
.illus { display: block; }
.il-bg { fill: var(--primary-soft); }
.il-paper { fill: var(--il-paper); stroke: var(--border); stroke-width: 1; }
.il-shadow { fill: var(--il-shadow); }
.il-line { fill: var(--il-line); }
.il-soft { fill: var(--primary-soft); }
.il-ink { stroke: var(--il-ink); }
.il-primary { fill: var(--primary); }
.il-ok { fill: var(--ok); }
.il-warn { fill: var(--warn); }
.il-muted { fill: var(--faint); }
.il-ring { stroke: color-mix(in srgb, #fff 55%, transparent); }
.il-on { stroke: #fff; }
.il-on-fill { fill: #fff; }
.il-warn-stroke { stroke: var(--warn); }
.il-spark { stroke: var(--primary); opacity: .55; }
:root[data-theme="dark"] .il-on-fill { fill: var(--surface); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .il-on-fill { fill: var(--surface); } }

.empty-state { text-align: center; padding: 26px 16px 18px; }
.empty-state .illus { width: 170px; height: auto; margin: 0 auto 6px; }
.empty-state h3 { margin: 6px 0 4px; }
.empty-state p { margin: 0 auto; max-width: 46ch; }
.empty-state .actions { justify-content: center; }

/* ========== settings ========== */
.settings-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 26px; align-items: start; }
.subnav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.subnav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 500; }
.subnav a .icon { width: 16px; height: 16px; }
.subnav a:hover { background: var(--sunken); color: var(--text); }
.subnav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.settings-body { min-width: 0; }
.section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.section-link { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text); margin: 0; transition: border-color .15s, transform .15s, box-shadow .15s; }
.section-link .icon-chip { margin-bottom: 6px; }
.section-link:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 5px 0; }
.checklist li.done span { color: var(--ok); font-weight: 700; }
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: 1fr; }
  .subnav { position: static; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; }
  .subnav a { white-space: nowrap; }
}

/* ========== dashboard ========== */
.filter-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow-sm); flex-wrap: wrap; }
.segmented a { padding: 5px 12px; color: var(--muted); text-decoration: none; font-size: .87rem; font-weight: 550; border-radius: 8px; }
.segmented a:hover { color: var(--text); background: var(--sunken); }
.segmented a[aria-current="true"] { background: var(--primary); color: var(--primary-text); }
.attention { display: flex; gap: 14px; align-items: flex-start; border-inline-start: 4px solid var(--warn); }
.attention h2 { margin: 4px 0 6px; }
.attention ul { margin: 0; padding-inline-start: 18px; }
.attention li { margin: 3px 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 14px; }
.tile { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); overflow: hidden; }
.tile-top { display: flex; align-items: center; gap: 10px; }
.tile-label { color: var(--muted); font-size: .86rem; font-weight: 550; }
.tile-value { font-size: 1.9rem; font-weight: 700; line-height: 1.15; margin: 10px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile-sub { color: var(--muted); font-size: .82rem; }
.tile-warn { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); }
.tile-warn .icon-chip { background: var(--warn-bg); color: var(--warn); }
.tiles.minis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 18px; }
.tiles.minis .tile { padding: 12px 14px; box-shadow: var(--shadow-sm); display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; }
.tiles.minis .tile-top { display: contents; }
.tiles.minis .icon-chip { grid-row: 1 / span 2; width: 34px; height: 34px; background: var(--sunken); color: var(--muted); }
.tiles.minis .tile-warn .icon-chip { background: var(--warn-bg); color: var(--warn); }
.tiles.minis .tile-label { grid-column: 2; grid-row: 2; font-size: .8rem; }
.tiles.minis .tile-value { grid-column: 2; grid-row: 1; font-size: 1.3rem; margin: 0; }
.tiles.minis .tile-sub { grid-column: 1 / -1; margin-top: 4px; }
svg.spark { display: block; width: 100%; height: 34px; margin-top: 10px; overflow: visible; }
.spark.tone-1 { color: var(--series-1); } .spark.tone-2 { color: var(--series-2); } .spark.tone-3 { color: var(--series-3); }
.spark.tone-4 { color: var(--series-4); } .spark.tone-5 { color: var(--series-5); }
.spark-line { fill: none; stroke: currentColor; stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: currentColor; fill-opacity: .12; stroke: none; }
.spark-dot { fill: currentColor; stroke: var(--surface); stroke-width: 1.5px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 18px; margin-bottom: 18px; }
.dash-grid > .card { margin: 0; }
.dash-grid > .card:only-child { grid-column: 1 / -1; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
.ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.ring { position: relative; width: 190px; max-width: 100%; aspect-ratio: 1; }
.ring svg { width: 100%; height: 100%; display: block; }
.ring-track { fill: none; stroke: var(--sunken); stroke-width: 6; }
svg circle.arc { fill: none; stroke-width: 6; transition: stroke-width .15s; }
svg circle.arc:hover { stroke-width: 7.2; }
svg circle.arc.s1 { stroke: var(--series-1); } svg circle.arc.s2 { stroke: var(--series-2); } svg circle.arc.s3 { stroke: var(--series-3); }
svg circle.arc.s4 { stroke: var(--series-4); } svg circle.arc.s5 { stroke: var(--series-5); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.ring-center strong { font-size: 1.8rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-center small { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.ring-legend { list-style: none; padding: 0; margin: 0; width: 100%; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; }
.ring-legend li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.ring-legend strong { font-variant-numeric: tabular-nums; }
.recent { list-style: none; padding: 0; margin: 4px 0 0; }
.recent li + li { border-top: 1px solid var(--border); }
.recent a { display: flex; align-items: center; gap: 12px; padding: 10px 6px; text-decoration: none; color: var(--text); border-radius: 10px; }
.recent a:hover { background: var(--primary-softer); }
.recent-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.recent-main strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-main small { color: var(--muted); font-size: .78rem; }
.recent-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.recent-side small { font-size: .76rem; }
@media (max-width: 560px) { .recent-side small { display: none; } }

/* charts */
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; font-size: .84rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.swatch.s1 { background: var(--series-1); } .swatch.s2 { background: var(--series-2); } .swatch.s3 { background: var(--series-3); }
.swatch.s4 { background: var(--series-4); } .swatch.s5 { background: var(--series-5); }
.chart-scroll { overflow-x: auto; margin-top: 8px; }
svg.chart { display: block; width: 100%; min-width: 560px; height: auto; }
svg .s1 { fill: var(--series-1); } svg .s2 { fill: var(--series-2); } svg .s3 { fill: var(--series-3); }
svg .s4 { fill: var(--series-4); } svg .s5 { fill: var(--series-5); }
svg .seg { stroke: var(--surface); stroke-width: 1px; }
svg .grid { stroke: var(--grid); stroke-width: 1px; }
svg .axis { stroke: var(--axis); stroke-width: 1px; }
svg .tick { fill: var(--tick); font: 11px var(--font); }
svg .hit { fill: transparent; }
svg .col:hover .seg { opacity: .85; }
svg .col:hover .hit { fill: var(--text); fill-opacity: .05; }
.table-view { margin-top: 10px; font-size: .9rem; }
.table-view summary { color: var(--muted); font-size: .86rem; font-weight: 550; }
.hbars { display: flex; flex-direction: column; gap: 11px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 42%) 1fr auto; gap: 10px; align-items: center; font-size: .9rem; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
svg.hbar { width: 100%; height: 12px; display: block; }
svg.hbar .track { fill: var(--sunken); }
.hbar-value { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .84rem; }
@media (max-width: 520px) {
  .hbar-row { grid-template-columns: 1fr auto; }
  .hbar-row svg.hbar { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- motion preference ---------- */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* dark: calmer brand band so the page does not glare */
:root[data-theme="dark"] .hero-band, :root[data-theme="dark"] .auth-panel { filter: saturate(.8) brightness(.72); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero-band, :root:not([data-theme="light"]) .auth-panel { filter: saturate(.8) brightness(.72); } }

/* license banner (staff pages) */
.lic-banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius-sm); margin: 0 0 18px; border: 1px solid transparent; font-size: .92rem; }
.lic-banner span { flex: 1 1 240px; }
.lic-banner a { font-weight: 600; white-space: nowrap; }
.lic-banner.info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 22%, transparent); }
.lic-banner.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.lic-banner.error { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.lic-banner a { color: inherit; }
.status-card { display: flex; gap: 16px; align-items: flex-start; }
.status-card .icon-chip { width: 48px; height: 48px; border-radius: 14px; }
.status-card .icon-chip .icon { width: 24px; height: 24px; }
.status-card h2 { margin: 2px 0 4px; }
.fingerprint { font-family: var(--mono); font-size: 1.15rem; letter-spacing: .05em; padding: 8px 14px; background: var(--sunken); border-radius: 10px; display: inline-block; }
.translit { color: var(--muted); font-weight: 400; }
.progress { height: 8px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); }
