/* =========================================================================
   MEI design system v2 — rich, colorful and harmonious.
   Brand core from the logo: navy #08408A + red #D1060F, extended with a full
   institutional palette (gold, emerald, teal, sky, purple, orange, rose).
   ========================================================================= */

:root {
  --navy-950: #031634;
  --navy-900: #062a5e;
  --navy-800: #0a357a;
  --navy-700: #08408a;
  --navy-600: #1557b8;
  --navy-100: #e3ecfb;
  --navy-50: #f1f5fd;
  --red-700: #a3050d;
  --red-600: #d1060f;
  --red-500: #e8323b;
  --red-50: #fdeeee;

  --t-navy: #0b4aa8;    --t-navy-soft: #e5eefc;    --t-navy-ink: #083a85;
  --t-red: #dc1e2d;     --t-red-soft: #fde8ea;     --t-red-ink: #a8121e;
  --t-gold: #d99a06;    --t-gold-soft: #fdf3dc;    --t-gold-ink: #8f6200;
  --t-emerald: #0e9f6e; --t-emerald-soft: #e2f6ee; --t-emerald-ink: #08734e;
  --t-teal: #0b9aa8;    --t-teal-soft: #ddf4f6;    --t-teal-ink: #08707a;
  --t-sky: #2196f3;     --t-sky-soft: #e3f1fe;     --t-sky-ink: #0d6cbd;
  --t-purple: #7c4ddb;  --t-purple-soft: #efe8fc;  --t-purple-ink: #5a31b3;
  --t-orange: #f06a1f;  --t-orange-soft: #fdeee4;  --t-orange-ink: #b44a0d;
  --t-rose: #e0457b;    --t-rose-soft: #fce8f0;    --t-rose-ink: #b02a5b;
  --t-slate: #55627a;   --t-slate-soft: #eef1f6;   --t-slate-ink: #3a4559;

  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-sunken: #edf1f7;
  --line: #e3e8f0;
  --line-strong: #cdd6e3;
  --ink: #0d1a2f;
  --ink-2: #34425a;
  --muted: #66738a;
  --faint: #97a2b4;

  --brand: var(--navy-700);
  --brand-strong: var(--navy-900);
  --brand-soft: var(--navy-50);
  --brand-tint: var(--navy-100);
  --accent: var(--red-600);
  --accent-soft: var(--red-50);
  --ok: #0b8a5d;  --ok-soft: #e1f5ec;
  --warn: #b26b00; --warn-soft: #fdf2dc;
  --danger: #d1060f; --danger-soft: #fdecec;
  --info: #1557b8; --info-soft: #e8f0fc;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(13, 26, 47, 0.05);
  --shadow: 0 2px 6px rgba(13, 26, 47, 0.04), 0 10px 28px rgba(13, 26, 47, 0.07);
  --shadow-lg: 0 24px 60px rgba(6, 42, 94, 0.22);
  --shadow-color: 0 14px 30px -12px var(--c, rgba(8, 64, 138, 0.45));
  --focus: 0 0 0 3px rgba(21, 87, 184, 0.28);

  --rail-w: 284px;
  --topbar-h: 68px;
  --font: "Cairo", "Segoe UI", Tahoma, system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1120; --surface: #111a2c; --surface-2: #16213a; --surface-sunken: #0d1526; --line: #23314c; --line-strong: #31415f;
    --ink: #e8eef8; --ink-2: #c4cfe0; --muted: #8f9cb4; --faint: #66748e;
    --brand: #6ea0f5; --brand-strong: #b4cdf8; --brand-soft: #15233f; --brand-tint: #1b2d50; --accent: #ff5a62; --accent-soft: #2c161c;
    --ok: #3fcf96; --ok-soft: #10291f; --warn: #f0b04a; --warn-soft: #2b210f; --danger: #ff5a62; --danger-soft: #2c161c; --info: #6ea0f5; --info-soft: #15233f;
    --t-navy-soft: #142544; --t-red-soft: #2e1519; --t-gold-soft: #2c2410; --t-emerald-soft: #0f2a21; --t-teal-soft: #0e2a2d; --t-sky-soft: #10263d;
    --t-purple-soft: #221a3a; --t-orange-soft: #2d1c12; --t-rose-soft: #2d1622; --t-slate-soft: #1a2333;
    --t-navy-ink: #8fb4f7; --t-red-ink: #ff8a91; --t-gold-ink: #f3c461; --t-emerald-ink: #5ddba8; --t-teal-ink: #5fd3dd; --t-sky-ink: #7cc0fb;
    --t-purple-ink: #b79cf5; --t-orange-ink: #ffa36b; --t-rose-ink: #f59bbd; --t-slate-ink: #b4c0d4;
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 12px 30px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1120; --surface: #111a2c; --surface-2: #16213a; --surface-sunken: #0d1526; --line: #23314c; --line-strong: #31415f;
  --ink: #e8eef8; --ink-2: #c4cfe0; --muted: #8f9cb4; --faint: #66748e;
  --brand: #6ea0f5; --brand-strong: #b4cdf8; --brand-soft: #15233f; --brand-tint: #1b2d50; --accent: #ff5a62; --accent-soft: #2c161c;
  --ok: #3fcf96; --ok-soft: #10291f; --warn: #f0b04a; --warn-soft: #2b210f; --danger: #ff5a62; --danger-soft: #2c161c; --info: #6ea0f5; --info-soft: #15233f;
  --t-navy-soft: #142544; --t-red-soft: #2e1519; --t-gold-soft: #2c2410; --t-emerald-soft: #0f2a21; --t-teal-soft: #0e2a2d; --t-sky-soft: #10263d;
  --t-purple-soft: #221a3a; --t-orange-soft: #2d1c12; --t-rose-soft: #2d1622; --t-slate-soft: #1a2333;
  --t-navy-ink: #8fb4f7; --t-red-ink: #ff8a91; --t-gold-ink: #f3c461; --t-emerald-ink: #5ddba8; --t-teal-ink: #5fd3dd; --t-sky-ink: #7cc0fb;
  --t-purple-ink: #b79cf5; --t-orange-ink: #ffa36b; --t-rose-ink: #f59bbd; --t-slate-ink: #b4c0d4;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 12px 30px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

.tone-navy { --c: var(--t-navy); --c-soft: var(--t-navy-soft); --c-ink: var(--t-navy-ink); --c2: #2b7cf0; }
.tone-red { --c: var(--t-red); --c-soft: var(--t-red-soft); --c-ink: var(--t-red-ink); --c2: #ff5a5f; }
.tone-gold { --c: var(--t-gold); --c-soft: var(--t-gold-soft); --c-ink: var(--t-gold-ink); --c2: #f6c445; }
.tone-emerald { --c: var(--t-emerald); --c-soft: var(--t-emerald-soft); --c-ink: var(--t-emerald-ink); --c2: #34d399; }
.tone-teal { --c: var(--t-teal); --c-soft: var(--t-teal-soft); --c-ink: var(--t-teal-ink); --c2: #2dd4cf; }
.tone-sky { --c: var(--t-sky); --c-soft: var(--t-sky-soft); --c-ink: var(--t-sky-ink); --c2: #5ec4ff; }
.tone-purple { --c: var(--t-purple); --c-soft: var(--t-purple-soft); --c-ink: var(--t-purple-ink); --c2: #a78bfa; }
.tone-orange { --c: var(--t-orange); --c-soft: var(--t-orange-soft); --c-ink: var(--t-orange-ink); --c2: #ffa057; }
.tone-rose { --c: var(--t-rose); --c-soft: var(--t-rose-soft); --c-ink: var(--t-rose-ink); --c2: #ff8fb6; }
.tone-slate { --c: var(--t-slate); --c-soft: var(--t-slate-soft); --c-ink: var(--t-slate-ink); --c2: #8a97ad; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.65; color: var(--ink);
  background:
    radial-gradient(900px 500px at 100% -10%, rgba(43, 124, 240, 0.08), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(209, 6, 15, 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 800; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
svg:not(.dome):not(.chart):not(.qr):not(.deco) { width: 18px; height: 18px; flex: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; white-space: nowrap; }
.pre { white-space: pre-wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.split-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: grid; gap: 18px; align-content: start; }
.print-only { display: none; }

.boot { min-height: 100vh; display: grid; place-content: center; gap: 12px; justify-items: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--brand-tint); border-top-color: var(--brand); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== Login ===================== */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; position: relative; overflow: hidden;
  background:
    radial-gradient(1100px 620px at 85% -10%, rgba(232, 50, 59, 0.28), transparent 60%),
    radial-gradient(900px 700px at -10% 110%, rgba(43, 124, 240, 0.45), transparent 60%),
    linear-gradient(150deg, #0a357a 0%, #062a5e 45%, #031634 100%);
}
.auth svg.dome { position: absolute; width: min(1100px, 140vw); inset-inline-end: -18%; top: -22%; opacity: 0.5; pointer-events: none; }
.auth .glow { position: absolute; width: 520px; height: 520px; border-radius: 50%; filter: blur(80px); pointer-events: none; }
.auth .glow.a { background: #d99a06; inset-inline-start: -160px; top: 30%; opacity: 0.18; }
.auth .glow.b { background: #0b9aa8; inset-inline-end: 10%; bottom: -220px; opacity: 0.22; }
.auth-wrap { position: relative; width: min(1100px, 100%); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 36px; align-items: center; }
.auth-intro { color: #fff; padding: 12px 8px; }
.auth-intro .badge-line { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.18); font-size: 13px; font-weight: 700; color: #dfe9fb; }
.auth-intro .badge-line i { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.25); }
.auth-intro h1 { font-size: clamp(30px, 3.6vw, 46px); line-height: 1.25; margin: 18px 0 14px; }
.auth-intro h1 span { background: linear-gradient(90deg, #ffd166, #ff8a91); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-intro p { color: #cbd9f2; font-size: 16.5px; max-width: 520px; }
.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 26px; max-width: 560px; }
.feature { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12); backdrop-filter: blur(6px); }
.feature .fi { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; background: linear-gradient(135deg, var(--c), var(--c2)); color: #fff; box-shadow: 0 8px 18px -8px var(--c); }
.feature b { display: block; font-size: 14.5px; }
.feature span { font-size: 12.5px; color: #b9c9e6; }
.auth-card { overflow: hidden; background: var(--surface); border-radius: 28px; padding: clamp(24px, 4vw, 40px); box-shadow: 0 40px 80px -24px rgba(0, 0, 0, 0.55); position: relative; }
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; border-radius: 28px 28px 0 0; background: linear-gradient(90deg, var(--red-600) 0 28%, #d99a06 28% 40%, var(--navy-700) 40%); }
.auth-card .logo { width: min(250px, 80%); margin: 6px auto 18px; }
.auth-card h2 { font-size: 24px; text-align: center; }
.auth-card .lead { text-align: center; color: var(--muted); margin: 6px 0 22px; font-size: 14.5px; }
.auth-form { display: grid; gap: 16px; }
.auth-foot { margin-top: 18px; display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.auth-foot a { font-weight: 800; }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; inset-inline-start: 14px; top: 15px; color: var(--faint); pointer-events: none; }
.input-icon .input { padding-inline-start: 44px; height: 50px; border-radius: 14px; }
.input-icon .reveal { position: absolute; inset-inline-end: 7px; top: 7px; height: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-weight: 800; font-size: 12.5px; cursor: pointer; }
.input-icon.has-reveal .input { padding-inline-end: 84px; }

/* ===================== Shell ===================== */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: none; background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 16px; }
.rail::-webkit-scrollbar { display: none; }
.rail-brand { display: flex; align-items: center; justify-content: center; padding: 6px 6px 18px; border-bottom: 1px dashed var(--line); margin-bottom: 8px; }
.rail-brand img { width: 190px; }
:root[data-theme="dark"] .rail-brand img, :root[data-theme="dark"] .auth-card .logo { background: #fff; border-radius: 12px; padding: 6px 10px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rail-brand img, :root:not([data-theme="light"]) .auth-card .logo { background: #fff; border-radius: 12px; padding: 6px 10px; } }
.rail-group { margin-top: 14px; }
.rail-group-title { font-size: 11.5px; font-weight: 800; color: var(--faint); padding: 0 10px 6px; }
.rail a { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 14px; color: var(--ink-2); font-weight: 700; font-size: 14.5px; position: relative; transition: background 0.15s, color 0.15s; }
.rail a .ri { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--c-soft); color: var(--c); flex: none; transition: transform 0.15s; }
.rail a .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.rail a:hover .ri { transform: scale(1.06); }
.rail a.active { background: linear-gradient(135deg, var(--c), var(--c2)); color: #fff; box-shadow: var(--shadow-color); }
.rail a.active .ri { background: rgba(255, 255, 255, 0.22); color: #fff; }
.rail a .count { margin-inline-start: auto; font-size: 11px; background: var(--red-600); color: #fff; border-radius: 999px; padding: 0 8px; line-height: 20px; font-weight: 800; }
.rail a.active .count { background: #fff; color: var(--c-ink); }
.rail-foot { margin-top: auto; padding: 16px 8px 4px; font-size: 12px; color: var(--faint); text-align: center; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 clamp(16px, 3vw, 32px); background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: saturate(1.5) blur(14px); border-bottom: 1px solid var(--line); }
.topbar .crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 14px; }
.topbar .crumbs b { color: var(--ink); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.icon-btn { position: relative; width: 42px; height: 42px; display: inline-grid; place-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 13px; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.menu-toggle { display: none; }
.icon-btn .dot { position: absolute; top: -5px; inset-inline-end: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--red-600); color: #fff; font-size: 11px; font-weight: 800; line-height: 20px; text-align: center; border: 2px solid var(--surface); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.user-chip .meta { display: grid; line-height: 1.25; text-align: start; }
.user-chip .meta b { font-size: 13.5px; }
.user-chip .meta span { font-size: 11.5px; color: var(--muted); }
.content { padding: clamp(16px, 3vw, 32px); width: 100%; max-width: 1440px; margin: 0 auto; flex: 1; }
.impersonation-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px 16px; flex-wrap: wrap; background: repeating-linear-gradient(135deg, #d99a06 0 18px, #e9ad1c 18px 36px); color: #2b1d00; font-weight: 800; }
.impersonation-bar .btn { height: 34px; background: #2b1d00; color: #fff; border-color: #2b1d00; }

.avatar { --size: 42px; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 800; font-size: calc(var(--size) * 0.36); color: #fff; background: linear-gradient(135deg, var(--c, #0b4aa8), var(--c2, #2b7cf0)); box-shadow: 0 6px 14px -6px var(--c, #0b4aa8); }
.avatar.lg { --size: 84px; border: 4px solid rgba(255, 255, 255, 0.85); }
.avatar.md { --size: 56px; }
.avatar.sm { --size: 32px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { --size: 30px; border: 2px solid var(--surface); margin-inline-start: -8px; }
.avatar-stack .avatar:first-child { margin-inline-start: 0; }

.popover { position: absolute; z-index: 40; top: calc(var(--topbar-h) - 4px); inset-inline-end: clamp(16px, 3vw, 32px); width: min(420px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop 0.15s ease; }
.popover header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.popover .list { max-height: 460px; overflow-y: auto; }
.popover .menu-item { display: flex; width: 100%; gap: 12px; align-items: center; padding: 11px 16px; background: none; border: 0; cursor: pointer; text-align: start; color: var(--ink); font-weight: 700; }
.popover .menu-item:hover { background: var(--surface-2); text-decoration: none; }

/* ===================== Page building blocks ===================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; font-weight: 800; margin-bottom: 10px; }

.hero { position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 26px 28px; margin-bottom: 22px; color: #fff; background: radial-gradient(600px 300px at 0% 0%, rgba(255, 255, 255, 0.16), transparent 60%), linear-gradient(135deg, var(--c, #0b4aa8), var(--hero-to, #062a5e)); box-shadow: 0 22px 48px -24px var(--c, #0b4aa8); }
.hero.tone-navy { --hero-to: #031634; } .hero.tone-red { --hero-to: #5e0a14; } .hero.tone-gold { --hero-to: #7a4a00; } .hero.tone-emerald { --hero-to: #04432e; }
.hero.tone-teal { --hero-to: #053f46; } .hero.tone-sky { --hero-to: #0a3a72; } .hero.tone-purple { --hero-to: #2c1566; } .hero.tone-orange { --hero-to: #6b2405; } .hero.tone-rose { --hero-to: #5d1030; }
.hero svg.dome { position: absolute; inset-inline-end: -50px; top: -70px; width: 440px; opacity: 0.45; pointer-events: none; }
.hero .hero-top { display: flex; align-items: center; gap: 18px; position: relative; flex-wrap: wrap; }
.hero .hello { font-size: 14px; color: rgba(255, 255, 255, 0.82); font-weight: 700; }
.hero h1 { font-size: clamp(22px, 2.4vw, 30px); margin-top: 2px; }
.hero p { color: rgba(255, 255, 255, 0.86); margin-top: 6px; max-width: 780px; position: relative; }
.hero .hero-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; position: relative; }
.hero .hero-stats { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; position: relative; }
.hero .hstat { padding: 10px 16px; border-radius: 14px; background: rgba(255, 255, 255, 0.13); border: 1px solid rgba(255, 255, 255, 0.18); backdrop-filter: blur(4px); min-width: 120px; }
.hero .hstat b { display: block; font-size: 22px; line-height: 1.2; }
.hero .hstat span { font-size: 12.5px; color: rgba(255, 255, 255, 0.82); }
.hero .btn { border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.14); color: #fff; }
.hero .btn:hover { background: rgba(255, 255, 255, 0.24); }
.hero .btn.solid { background: #fff; color: var(--c-ink, #083a85); border-color: #fff; }
.hero .chip, .hero .badge { background: rgba(255, 255, 255, 0.16); color: #fff; }
.hero .chips { position: relative; }

.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid.split-r { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
.cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.cards.sm { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.cards.lg { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card > header h2, .card > header h3 { font-size: 16px; display: flex; align-items: center; gap: 10px; }
.card > header .hi { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--c-soft, var(--brand-soft)); color: var(--c, var(--brand)); flex: none; }
.card > header .hint { color: var(--muted); font-size: 13px; font-weight: 700; }
.card .body { padding: 18px 20px; }
.card.pad { padding: 20px; }

.ecard { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; color: inherit; transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s; min-width: 0; text-align: start; }
a.ecard, button.ecard, .ecard.clickable { cursor: pointer; }
a.ecard:hover, button.ecard:hover, .ecard.clickable:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow), var(--shadow-color); border-color: color-mix(in srgb, var(--c, #0b4aa8) 35%, var(--line)); }
button.ecard { font: inherit; padding: 0; }
.ecard .ecover { height: 90px; position: relative; background: linear-gradient(135deg, var(--c), var(--c2)); overflow: hidden; flex: none; }
.ecard .ecover svg.dome { position: absolute; width: 260px; inset-inline-end: -40px; top: -40px; opacity: 0.45; }
.ecard .ecover .tag { position: absolute; top: 12px; inset-inline-start: 14px; padding: 3px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.94); color: var(--c-ink); font-size: 12px; font-weight: 800; }
.ecard .ecover .tag2 { position: absolute; top: 12px; inset-inline-end: 14px; padding: 3px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.2); color: #fff; font-size: 12px; font-weight: 800; }
.ecard .eicon { width: 60px; height: 60px; border-radius: 18px; margin: -32px 18px 0; position: relative; display: grid; place-items: center; background: var(--surface); color: var(--c); border: 4px solid var(--surface); box-shadow: 0 10px 22px -10px var(--c); flex: none; }
.ecard .eicon svg { width: 26px; height: 26px; }
.ecard .eavatar { margin: -34px 18px 0; position: relative; }
.ecard .eavatar .avatar { --size: 64px; border: 4px solid var(--surface); }
.ecard .ebody { padding: 12px 18px 16px; display: grid; gap: 8px; flex: 1; align-content: start; }
.ecard .etitle { font-size: 17px; font-weight: 800; line-height: 1.35; }
.ecard .esub { font-size: 13px; color: var(--muted); }
.ecard .estats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.ecard .estat { padding: 8px 6px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.ecard .estat b { display: block; font-size: 17px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ecard .estat span { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.ecard .efoot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); background: var(--surface-2); }
.ecard .efoot .go { display: inline-flex; align-items: center; gap: 4px; color: var(--c-ink); font-weight: 800; }
.ecard.flat .ecover { height: 8px; }
.ecard.flat .ebody { padding-top: 16px; }
.ecard.add { border: 2px dashed var(--line-strong); background: transparent; display: grid; place-items: center; align-content: center; gap: 10px; min-height: 220px; color: var(--muted); font-weight: 800; }
.ecard.add .qi { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(135deg, var(--c), var(--c2)); color: #fff; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { position: relative; overflow: hidden; display: grid; gap: 4px; padding: 18px 18px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); text-align: start; color: inherit; min-width: 0; }
.kpi::after { content: ""; position: absolute; inset-inline-end: -30px; bottom: -40px; width: 130px; height: 130px; border-radius: 50%; background: var(--c-soft); z-index: 0; }
.kpi > * { position: relative; z-index: 1; }
a.kpi:hover { text-decoration: none; box-shadow: var(--shadow), var(--shadow-color); transform: translateY(-2px); transition: 0.15s; }
.kpi .kicon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, var(--c), var(--c2)); color: #fff; box-shadow: 0 10px 20px -10px var(--c); margin-bottom: 6px; }
.kpi .kicon svg { width: 22px; height: 22px; }
.kpi .label { font-size: 13.5px; color: var(--muted); font-weight: 700; }
.kpi .value { font-size: 30px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--ink); }
.kpi .value small { font-size: 15px; color: var(--muted); font-weight: 700; }
.kpi .foot { font-size: 12.5px; color: var(--muted); }
.kpi.alert { border-color: color-mix(in srgb, var(--t-red) 40%, var(--line)); }
.kpi.alert .value { color: var(--t-red); }
.kpi.solid { background: linear-gradient(135deg, var(--c), var(--c2)); color: #fff; border: 0; box-shadow: var(--shadow-color); }
.kpi.solid .label, .kpi.solid .foot, .kpi.solid .value small { color: rgba(255, 255, 255, 0.86); }
.kpi.solid .value { color: #fff; }
.kpi.solid .kicon { background: rgba(255, 255, 255, 0.2); box-shadow: none; }
.kpi.solid::after { background: rgba(255, 255, 255, 0.1); }

.qactions { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.qa { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 800; font-size: 14px; cursor: pointer; text-align: start; }
.qa:hover { text-decoration: none; border-color: color-mix(in srgb, var(--c) 40%, var(--line)); background: var(--c-soft); }
.qa .qi { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: linear-gradient(135deg, var(--c), var(--c2)); color: #fff; flex: none; }
.qa small { display: block; font-weight: 600; color: var(--muted); font-size: 12px; }

.steps { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.step { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; padding: 4px 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.step .dotn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-sunken); color: var(--muted); font-weight: 800; position: relative; z-index: 1; border: 3px solid var(--surface); }
.step::before { content: ""; position: absolute; top: 22px; inset-inline-start: 50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.step:last-child::before { display: none; }
.step.done .dotn { background: var(--t-emerald); color: #fff; }
.step.done::before { background: var(--t-emerald); }
.step.current .dotn { background: linear-gradient(135deg, var(--t-navy), #2b7cf0); color: #fff; box-shadow: 0 0 0 5px var(--t-navy-soft); }
.step.current { color: var(--ink); }
.step.blocked .dotn { background: var(--t-red-soft); color: var(--t-red); }
.checklist { display: grid; gap: 8px; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.check-item .ci { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-sunken); color: var(--faint); }
.check-item.ok .ci { background: var(--t-emerald); color: #fff; }
.check-item.bad .ci { background: var(--t-red-soft); color: var(--t-red); }
.check-item b { display: block; font-size: 14px; }
.check-item span { font-size: 12.5px; color: var(--muted); }

.meter { height: 9px; border-radius: 999px; background: var(--surface-sunken); overflow: hidden; }
.meter > i { display: block; height: 100%; width: var(--pct, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--c, #0b4aa8), var(--c2, #2b7cf0)); transition: width 0.5s ease; }
.meter.ok > i { background: linear-gradient(90deg, #0e9f6e, #34d399); }
.meter.warn > i { background: linear-gradient(90deg, #d99a06, #f6c445); }
.meter.bad > i { background: linear-gradient(90deg, #dc1e2d, #ff5a5f); }
.meter.thin { height: 6px; }
.ring { --size: 74px; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center; flex: none; background: conic-gradient(var(--ring-color, var(--c, var(--t-navy))) calc(var(--pct, 0) * 1%), var(--surface-sunken) 0); }
.ring > span { width: calc(var(--size) - 14px); height: calc(var(--size) - 14px); border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.ring.sm { --size: 54px; }
.ring.sm > span { font-size: 12.5px; width: calc(var(--size) - 10px); height: calc(var(--size) - 10px); }
.ring.ok { --ring-color: var(--t-emerald); } .ring.warn { --ring-color: var(--t-gold); } .ring.bad { --ring-color: var(--t-red); }

svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart text { font-family: var(--font); fill: var(--muted); font-size: 11px; }
svg.chart .grid-line { stroke: var(--line); stroke-dasharray: 3 4; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--ink-2); font-weight: 700; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-inline-end: 6px; vertical-align: -1px; background: var(--c); }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-wrap svg.chart { width: 170px; flex: none; }
.donut-center { font-size: 22px; font-weight: 800; fill: var(--ink) !important; }

.list { display: grid; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
a.list-row { color: inherit; }
a.list-row:hover { background: var(--surface-2); text-decoration: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .meta { font-size: 13px; color: var(--muted); }
.list-row > svg { color: var(--faint); }
.time-pill { display: grid; place-items: center; min-width: 64px; padding: 7px 8px; border-radius: 14px; background: var(--c-soft, var(--brand-soft)); color: var(--c-ink, var(--brand-strong)); font-weight: 800; font-size: 14px; line-height: 1.2; text-align: center; }
.time-pill small { font-size: 11px; font-weight: 700; opacity: 0.8; }
.ico-chip { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--c-soft, var(--brand-soft)); color: var(--c, var(--brand)); flex: none; }

.timeline { display: grid; padding: 6px 0; }
.timeline .t { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; padding: 10px 20px; position: relative; align-items: start; }
.timeline .t::before { content: ""; position: absolute; inset-inline-start: 40px; top: 50px; bottom: -10px; width: 2px; background: var(--line); }
.timeline .t:last-child::before { display: none; }
.timeline .t .tic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--c-soft, var(--brand-soft)); color: var(--c, var(--brand)); position: relative; z-index: 1; }
.timeline .t b { font-weight: 700; font-size: 14px; display: block; }
.timeline .t .meta { font-size: 12.5px; color: var(--muted); }
.timeline .t time { font-size: 12px; color: var(--faint); white-space: nowrap; }
.day-sep { padding: 14px 20px 4px; font-size: 12.5px; font-weight: 800; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--surface-sunken); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.muted { color: var(--muted); }
.badge.tone { background: var(--c-soft); color: var(--c-ink); }
.badge.live { background: var(--t-red); color: #fff; }
.badge.live::before { background: #fff; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--surface-sunken); font-size: 12.5px; font-weight: 700; color: var(--ink-2); border: 0; }
.chip.primary { background: var(--brand-soft); color: var(--brand-strong); }
.chip.tone { background: var(--c-soft); color: var(--c-ink); }
button.chip { cursor: pointer; }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chips button { border: 1px solid var(--line); background: var(--surface); padding: 8px 15px; border-radius: 999px; font-weight: 800; font-size: 13px; color: var(--ink-2); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.filter-chips button .n { background: var(--surface-sunken); border-radius: 999px; padding: 0 8px; font-size: 11.5px; }
.filter-chips button.active { background: linear-gradient(135deg, var(--c, var(--t-navy)), var(--c2, #2b7cf0)); border-color: transparent; color: #fff; box-shadow: var(--shadow-color); }
.filter-chips button.active .n { background: rgba(255, 255, 255, 0.25); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 13px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 800; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: transform 0.1s, box-shadow 0.15s, background 0.15s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, #0b4aa8, #1f6fe0); border-color: transparent; color: #fff; box-shadow: 0 10px 22px -12px #0b4aa8; }
.btn.primary:hover { background: linear-gradient(135deg, #083a85, #1557b8); }
.btn.accent { background: linear-gradient(135deg, #d1060f, #f0343c); border-color: transparent; color: #fff; box-shadow: 0 10px 22px -12px #d1060f; }
.btn.gold { background: linear-gradient(135deg, #c78b00, #f2b62b); border-color: transparent; color: #2b1d00; box-shadow: 0 10px 22px -12px #c78b00; }
.btn.success { background: linear-gradient(135deg, #0b8a5d, #22c08a); border-color: transparent; color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.lg { height: 52px; font-size: 16px; border-radius: 15px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: #fff; animation: spin 0.7s linear infinite; }
.btn:not(.primary):not(.accent):not(.success).loading::after { border-color: var(--brand-tint); border-top-color: var(--brand); }

.field { display: grid; gap: 6px; min-width: 0; }
.field > label { font-size: 13.5px; font-weight: 800; color: var(--ink-2); }
.field > label .req { color: var(--accent); margin-inline-start: 3px; }
.field .help { font-size: 12.5px; color: var(--muted); }
.field .error, .error { font-size: 12.5px; color: var(--danger); font-weight: 700; }
.input, select.input, textarea.input { width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); transition: border-color 0.15s, box-shadow 0.15s; }
textarea.input { height: auto; min-height: 96px; padding: 10px 14px; resize: vertical; }
.input:focus { outline: none; border-color: #1557b8; box-shadow: var(--focus); }
.input.invalid { border-color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full, .form-grid > .full { grid-column: 1 / -1; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--navy-700); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }
.input-wrap { position: relative; }
.input-wrap .input { padding-left: 72px; }
.input-wrap .reveal { position: absolute; inset-inline-end: 4px; top: 4px; height: 36px; padding: 0 10px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 8px; font-size: 13px; font-weight: 700; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 14px; font-size: 14px; border: 1px solid transparent; }
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert.bad { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert ul { margin: 4px 0 0; padding-inline-start: 18px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.toolbar .input { height: 40px; width: auto; min-width: 160px; }
.toolbar .search { position: relative; flex: 1; min-width: 220px; max-width: 440px; }
.toolbar .search .input { width: 100%; padding-inline-start: 40px; }
.toolbar .search svg { position: absolute; inset-inline-start: 13px; top: 11px; color: var(--faint); }
.toolbar.bare { padding: 0 0 18px; border: 0; }
.toolbar.bare .input { background: var(--surface); }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-size: 12.5px; color: var(--muted); font-weight: 800; padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th button { background: none; border: 0; padding: 0; color: inherit; font-weight: inherit; cursor: pointer; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--surface-2); }
.table .strong { font-weight: 800; }
.table .muted { color: var(--muted); font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.pager .btns { display: flex; gap: 6px; }

.state { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 44px 20px; color: var(--muted); }
.state .ico { width: 66px; height: 66px; border-radius: 20px; display: grid; place-items: center; background: linear-gradient(135deg, var(--t-navy-soft), var(--t-sky-soft)); color: var(--t-navy); }
.state .ico svg { width: 28px; height: 28px; }
.state.error .ico { background: var(--danger-soft); color: var(--danger); }
.state b { color: var(--ink); font-size: 16px; }
.state p { max-width: 460px; font-size: 14px; }
.skeleton { display: grid; gap: 12px; padding: 20px; }
.skeleton i { display: block; height: 16px; border-radius: 8px; background: linear-gradient(90deg, var(--surface-sunken), var(--surface-2), var(--surface-sunken)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton i:nth-child(2n) { width: 70%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.tabs { display: flex; gap: 6px; margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; width: fit-content; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { padding: 9px 16px; border: 0; background: none; color: var(--muted); font-weight: 800; cursor: pointer; white-space: nowrap; border-radius: 11px; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.tabs a:hover, .tabs button:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.tabs .active { background: linear-gradient(135deg, var(--c, #0b4aa8), var(--c2, #2b7cf0)) !important; color: #fff !important; box-shadow: var(--shadow-color); }
.tabs .n { background: rgba(127, 127, 127, 0.16); border-radius: 999px; padding: 0 8px; font-size: 11.5px; }

.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 24px; }
.dl div { min-width: 0; }
.dl dt { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.dl dd { margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }

/* dialogs — centered (no side drawers) */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(3, 22, 52, 0.55); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade 0.15s ease; }
@keyframes fade { from { opacity: 0; } }
.drawer, .modal { width: min(660px, 100%); max-height: calc(100vh - 40px); background: var(--surface); display: flex; flex-direction: column; border-radius: 24px; box-shadow: var(--shadow-lg); animation: pop 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2); overflow: hidden; }
.drawer.wide, .modal.wide { width: min(960px, 100%); }
.modal { width: min(520px, 100%); }
@keyframes pop { from { transform: translateY(14px) scale(0.97); opacity: 0; } }
.drawer > header, .modal > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); position: relative; }
.drawer > header::before, .modal > header::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, var(--red-600) 0 25%, #d99a06 25% 38%, var(--navy-700) 38%); }
.drawer > header h2, .modal > header h2 { font-size: 19px; }
.drawer .drawer-body { flex: 1; overflow-y: auto; padding: 22px; display: grid; gap: 16px; align-content: start; }
.drawer > footer, .modal > footer { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.modal .modal-body { padding: 22px; display: grid; gap: 14px; overflow-y: auto; }
.secret { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-radius: 14px; border: 2px dashed var(--line-strong); background: var(--surface-2); font-family: Consolas, "Courier New", monospace; font-size: 20px; letter-spacing: 0.06em; direction: ltr; }

.toasts { position: fixed; z-index: 80; bottom: 22px; inset-inline-start: 50%; transform: translateX(50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 13px 16px; border-radius: 14px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow-lg); font-weight: 700; font-size: 14px; animation: pop 0.15s ease; }
.toast.bad { background: linear-gradient(135deg, #a3050d, #d1060f); color: #fff; }
.toast.ok { background: linear-gradient(135deg, #087a52, #0e9f6e); color: #fff; }

.mark-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.mark-row .who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark-row .who b { display: block; }
.mark-row .who span { font-size: 12.5px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 8px 14px; font-weight: 800; font-size: 13px; cursor: pointer; color: var(--muted); border-inline-start: 1px solid var(--line); }
.seg button:first-child { border-inline-start: 0; }
.seg button[aria-pressed="true"]:not([data-v]) { background: linear-gradient(135deg, #0b4aa8, #2b7cf0); color: #fff; }
.seg button[aria-pressed="true"][data-v="present"] { background: var(--t-emerald); color: #fff; }
.seg button[aria-pressed="true"][data-v="late"] { background: var(--t-gold); color: #fff; }
.seg button[aria-pressed="true"][data-v="absent"] { background: var(--t-red); color: #fff; }
.seg button[aria-pressed="true"][data-v="excused"] { background: var(--t-sky); color: #fff; }
.mark-extra { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.mark-extra .input { height: 36px; max-width: 260px; }
.sticky-bar { position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 20px; background: var(--surface); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }

.code-display { display: grid; justify-items: center; gap: 8px; padding: 26px; border-radius: 22px; background: linear-gradient(135deg, #062a5e, #0b4aa8); color: #fff; text-align: center; position: relative; overflow: hidden; }
.code-display svg.dome { position: absolute; width: 360px; inset-inline-end: -60px; top: -60px; opacity: 0.35; }
.code-display .code { font-size: clamp(44px, 8vw, 76px); font-weight: 800; letter-spacing: 0.18em; direction: ltr; font-variant-numeric: tabular-nums; line-height: 1; position: relative; }
.code-display span { color: #cbd9f2; font-size: 14px; position: relative; }
.code-input { font-size: 30px; letter-spacing: 0.4em; text-align: center; height: 66px; font-weight: 800; direction: ltr; }
.arrival { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.arrival time { font-weight: 800; font-variant-numeric: tabular-nums; }

.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cal-head .range { font-weight: 800; font-size: 16px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.week .day { border-inline-start: 1px solid var(--line); min-height: 300px; display: flex; flex-direction: column; min-width: 0; }
.week .day:first-child { border-inline-start: 0; }
.week .day > header { padding: 10px; border-bottom: 1px solid var(--line); text-align: center; background: var(--surface-2); }
.week .day > header b { display: block; font-size: 13px; }
.week .day > header span { font-size: 12px; color: var(--muted); }
.week .day.today > header { background: linear-gradient(135deg, #0b4aa8, #2b7cf0); }
.week .day.today > header b, .week .day.today > header span { color: #fff; }
.week .day .slots { padding: 8px; display: grid; gap: 6px; align-content: start; }
.event { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--c-soft, var(--t-navy-soft)); border-inline-start: 4px solid var(--c, var(--t-navy)); font-size: 12.5px; text-align: start; cursor: pointer; width: 100%; border-top: 0; border-bottom: 0; border-inline-end: 0; color: var(--ink); }
.event:hover { filter: brightness(0.97); }
.event b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event.cancelled { background: var(--surface-sunken); border-color: var(--faint); text-decoration: line-through; opacity: 0.7; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month .dow { padding: 8px; text-align: center; font-size: 12px; color: var(--muted); font-weight: 800; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.month .cell { min-height: 110px; border-inline-start: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: grid; gap: 4px; align-content: start; min-width: 0; }
.month .cell:nth-child(7n + 1) { border-inline-start: 0; }
.month .cell .d { font-size: 12px; font-weight: 800; color: var(--muted); }
.month .cell.out { background: var(--surface-2); }
.month .cell.today .d { color: #fff; background: var(--red-600); border-radius: 999px; width: 24px; height: 24px; display: grid; place-items: center; }
.month .cell .more { display: none; font-size: 11px; color: var(--brand); font-weight: 800; }
.conflicts { display: grid; gap: 8px; }
.conflicts .c { padding: 10px 12px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-size: 13.5px; }
.conflicts .c b { display: block; color: var(--ink); }

.perm-group { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--surface); }
.perm-group > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; background: var(--c-soft); }
.perm-group > header b { color: var(--c-ink); font-size: 15px; display: flex; gap: 10px; align-items: center; }
.perm { display: flex; align-items: flex-start; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); }
.perm .pt b { display: block; font-size: 14px; }
.perm .pt span { font-size: 12.5px; color: var(--muted); }
.perm .pt code { font-size: 11px; color: var(--faint); direction: ltr; display: inline-block; }
.switch { position: relative; width: 50px; height: 28px; flex: none; margin-top: 2px; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; inset: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: 0.2s; }
.switch i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: 0.2s; }
.switch input:checked + i { background: linear-gradient(135deg, var(--c, #0e9f6e), var(--c2, #34d399)); }
.switch input:checked + i::after { inset-inline-start: 25px; }
.switch input:disabled + i { opacity: 0.55; }
.matrix { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.matrix th, .matrix td { padding: 10px; border-bottom: 1px solid var(--line); text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: start; position: sticky; inset-inline-start: 0; background: var(--surface); min-width: 240px; }
.matrix thead th { background: var(--surface-2); font-size: 12.5px; }
.matrix .grp td { background: var(--surface-2); font-weight: 800; color: var(--brand-strong); text-align: start; }
.matrix .on { color: var(--t-emerald); font-weight: 800; }
.matrix .off { color: var(--faint); }

.unit-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 20px; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.unit-head b { font-size: 14px; color: var(--brand-strong); }
.unit-empty { padding: 10px 20px; }
.player { width: 100%; max-height: 70vh; border-radius: 14px; background: #000; }
audio.player { background: transparent; }
.modal:has(.player) { width: min(980px, 100%); }
.done-check { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: transparent; flex: none; }
.done-check[aria-pressed="true"] { background: var(--t-emerald); border-color: var(--t-emerald); color: #fff; }
.exam-shell { max-width: 880px; margin: 0 auto; }
.exam-bar { position: sticky; top: var(--topbar-h); z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; flex-wrap: wrap; }
.timer { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; direction: ltr; color: var(--brand-strong); }
.timer.low { color: var(--accent); }
.q-card { padding: 20px; }
.q-card .q-text { font-weight: 800; font-size: 16px; white-space: pre-wrap; }
.q-card .q-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.choice { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; margin-top: 8px; }
.choice:hover { background: var(--surface-2); }
.choice input { width: 18px; height: 18px; accent-color: var(--navy-700); }
.choice.right { border-color: var(--ok); background: var(--ok-soft); }
.choice.wrong { border-color: var(--danger); background: var(--danger-soft); }
.save-state { font-size: 12.5px; color: var(--muted); }

/* ===================== Certificates (A4 landscape) ===================== */
.cert-stage { overflow-x: auto; padding: 8px; }
.cert { width: 1123px; height: 794px; margin: 0 auto; position: relative; background: #fff; color: #0d1a2f; overflow: hidden; box-shadow: 0 30px 70px -30px rgba(3, 22, 52, 0.55); font-family: var(--font); }
.cert .frame { position: absolute; inset: 22px; border: 3px solid #b8860b; }
.cert .frame::after { content: ""; position: absolute; inset: 8px; border: 1px solid #e8c766; }
.cert svg.corner { position: absolute; width: 130px; height: 130px; }
.cert .corner.tl { top: 12px; right: 12px; } .cert .corner.tr { top: 12px; left: 12px; transform: scaleX(-1); }
.cert .corner.bl { bottom: 12px; right: 12px; transform: scaleY(-1); } .cert .corner.br { bottom: 12px; left: 12px; transform: scale(-1); }
.cert svg.dome { position: absolute; width: 560px; opacity: 0.08; left: -140px; bottom: -170px; }
.cert svg.dome.top { left: auto; right: -170px; bottom: auto; top: -190px; opacity: 0.06; }
.cert .inner { position: absolute; inset: 54px 80px 60px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.cert .clogo { height: 82px; width: auto; }
.cert .ctitle { font-size: 48px; font-weight: 800; margin-top: 10px; background: linear-gradient(90deg, #8a6100, #d4a017, #8a6100); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.3; }
.cert .cen { font-size: 14px; letter-spacing: 0.34em; color: #5c6a82; font-weight: 700; direction: ltr; }
.cert .lead { font-size: 18px; color: #4a5872; margin-top: 16px; }
.cert .name { font-size: 50px; font-weight: 800; color: #08408a; margin: 2px 0; line-height: 1.3; }
.cert .ribbon { width: 400px; height: 3px; background: linear-gradient(90deg, transparent, #d1060f, #d4a017, #08408a, transparent); margin: 4px 0 12px; }
.cert .text { font-size: 18px; color: #2e3b52; max-width: 820px; line-height: 1.85; }
.cert .program { font-size: 28px; font-weight: 800; color: #0d1a2f; margin: 4px 0; }
.cert .facts { display: flex; gap: 12px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.cert .fact { padding: 6px 16px; border-radius: 999px; background: #f7f1df; color: #6b4d00; font-weight: 800; font-size: 14px; border: 1px solid #ead9a8; }
.cert .bottom { margin-top: auto; width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 20px; }
.cert .sig { display: grid; justify-items: center; gap: 2px; font-size: 14px; color: #34425a; }
.cert .sig .line { width: 210px; height: 1px; background: #8f9bb0; margin-bottom: 6px; }
.cert .sig b { font-size: 15px; color: #0d1a2f; }
.cert .seal { width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center; text-align: center; color: #fff; font-weight: 800; font-size: 13px; line-height: 1.35; background: radial-gradient(circle at 35% 30%, #f3d27a, #b8860b 60%, #8a6100); box-shadow: 0 0 0 6px #fff, 0 0 0 8px #d4a017, 0 12px 24px -8px rgba(138, 97, 0, 0.6); }
.cert .seal small { display: block; font-size: 10.5px; opacity: 0.9; }
.cert .verify { position: absolute; bottom: 40px; left: 52px; display: flex; align-items: center; gap: 12px; text-align: start; font-size: 11.5px; color: #4a5872; direction: rtl; }
.cert .verify svg.qr { width: 96px; height: 96px; }
.cert .serial { position: absolute; bottom: 44px; right: 60px; font-size: 12px; color: #4a5872; text-align: start; direction: ltr; line-height: 1.6; }
.cert.void::after { content: "ملغاة"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 160px; font-weight: 800; color: rgba(209, 6, 15, 0.16); transform: rotate(-22deg); }
.cert.modern .frame { border: 0; inset: 0; background: linear-gradient(270deg, #062a5e 0 30px, transparent 30px), linear-gradient(90deg, #d1060f 0 12px, transparent 12px); }
.cert.modern .frame::after { display: none; }
.cert.modern .corner { display: none; }
.cert.modern .ctitle { background: linear-gradient(90deg, #062a5e, #1557b8); -webkit-background-clip: text; background-clip: text; }
.cert.modern .fact { background: #e8f0fc; color: #08408a; border-color: #c9daf6; }
.cert.modern .seal { background: radial-gradient(circle at 35% 30%, #4d8ef0, #08408a 60%, #062a5e); box-shadow: 0 0 0 6px #fff, 0 0 0 8px #08408a; }
.cert.modern svg.dome { opacity: 0.14; }
.cert.heritage { background: radial-gradient(circle at 50% 40%, #fffdf6, #f8efd7); }
.cert.heritage .frame { border-color: #a3050d; border-width: 4px; }
.cert.heritage .frame::after { border-color: #d4a017; border-width: 2px; }
.cert.heritage .name { color: #a3050d; }
.cert.heritage .seal { background: radial-gradient(circle at 35% 30%, #ff7b80, #d1060f 60%, #7a040a); box-shadow: 0 0 0 6px #fff, 0 0 0 8px #d4a017; }
.cert-mini { width: 100%; aspect-ratio: 1123 / 794; overflow: hidden; border-radius: 12px; position: relative; background: var(--surface-2); }
.cert-mini .cert { transform-origin: top right; position: absolute; top: 0; right: 0; box-shadow: none; }

/* ===================== Public pages ===================== */
.public-shell { min-height: 100vh; display: flex; flex-direction: column; }
.public-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px clamp(16px, 4vw, 40px); background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.public-top img { height: 46px; width: auto; }
.public-main { width: 100%; max-width: 1140px; margin: 0 auto; padding: clamp(16px, 3vw, 32px); flex: 1; }
.public-foot { text-align: center; color: var(--faint); font-size: 13px; padding: 20px; }
.program-card h2 { font-size: 18px; }
.program-card .body { height: 100%; }
h3 { font-size: 15.5px; color: var(--brand-strong); }

.letter { background: #fff; color: #10203a; max-width: 800px; margin: 0 auto; padding: 48px 56px; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.letter .lh { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 3px solid #08408a; padding-bottom: 16px; }
.letter .lh img { height: 64px; width: auto; }
.letter .lh .meta { text-align: left; font-size: 13px; color: #4a5872; line-height: 1.8; }
.letter .stripe { height: 4px; background: linear-gradient(90deg, #d1060f 0 30%, #d4a017 30% 40%, #08408a 40%); margin-top: 3px; }
.letter h1 { text-align: center; font-size: 24px; margin: 28px 0 8px; color: #08408a; }
.letter .to { font-weight: 700; margin: 18px 0; }
.letter p { font-size: 16.5px; line-height: 2.1; }
.letter table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 15px; }
.letter td { border: 1px solid #d5dce8; padding: 8px 12px; }
.letter td:first-child { background: #f2f6fc; font-weight: 700; width: 34%; }
.letter .sign { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 40px; gap: 16px; }
.letter .verify { font-size: 12.5px; color: #4a5872; border: 1px dashed #b9c6da; border-radius: 8px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; }
.letter .verify svg.qr { width: 84px; height: 84px; }
.letter .void { position: absolute; inset: 0; display: grid; place-items: center; font-size: 96px; font-weight: 800; color: rgba(209, 6, 15, 0.16); transform: rotate(-24deg); pointer-events: none; }
.letter-meta { margin-top: 14px; }

/* ===================== Responsive ===================== */
@media (max-width: 1240px) {
  .grid.split, .grid.split-r { grid-template-columns: minmax(0, 1fr); }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .auth-wrap { grid-template-columns: 1fr; max-width: 560px; gap: 20px; }
  .auth-intro { text-align: center; padding: 0; }
  .auth-intro p { margin: 0 auto; }
  .feature-grid { display: none; }
  .auth-intro h1 { font-size: 28px; margin: 12px 0 6px; }
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 70; inset-block: 0; inset-inline-start: 0; width: 292px; transform: translateX(110%); transition: transform 0.22s ease; box-shadow: var(--shadow-lg); }
  .shell.nav-open .rail { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 65; background: rgba(3, 22, 52, 0.45); }
  .icon-btn.menu-toggle { display: inline-grid; }
  .user-chip .meta { display: none; }
  .user-chip { padding: 4px; }
  .week { grid-template-columns: 1fr; }
  .week .day { border-inline-start: 0; border-bottom: 1px solid var(--line); min-height: 0; }
  .week .day > header { text-align: start; display: flex; gap: 8px; align-items: baseline; }
  .steps { grid-auto-flow: row; grid-auto-columns: auto; gap: 8px; }
  .step { grid-template-columns: auto 1fr; justify-items: start; text-align: start; align-items: center; }
  .step::before { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .value { font-size: 23px; }
  .kpi .kicon { width: 38px; height: 38px; }
  .hero { padding: 20px; }
  .page-head h1 { font-size: 22px; }
  .mark-row { grid-template-columns: 1fr; }
  .seg button { padding: 8px 10px; }
  .toolbar .input, .toolbar .search { min-width: 0; max-width: none; width: 100%; }
  .month .cell .event { display: none; }
  .month .cell .more { display: block; }
  .overlay { padding: 0; align-items: flex-end; }
  .drawer, .modal { width: 100%; border-radius: 22px 22px 0 0; max-height: 92vh; }
  .table-wrap table.table { min-width: 640px; }
  .cards, .cards.lg { grid-template-columns: minmax(0, 1fr); }
  .tabs { width: 100%; }
  .auth-card { border-radius: 22px; }
}

@media print {
  .rail, .topbar, .no-print, .toolbar, .pager, .page-head .actions, .impersonation-bar, .tabs { display: none !important; }
  .shell { display: block; }
  body { background: #fff; color: #000; }
  .card, .ecard { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  .content { padding: 0; max-width: none; }
  .print-only { display: block !important; }
  .hero, .kpi, .cert, .letter { -webkit-print-color-adjust: exact; print-color-adjust: exact; box-shadow: none; }
  .cert-stage { padding: 0; overflow: visible; }
  body.print-cert { margin: 0; }
  body.print-cert .content > *:not(.cert-stage) { display: none !important; }
}
@page { margin: 12mm; }

.donut-wrap .legend { flex-direction: column; gap: 8px; }
.mt-xs { margin-top: 6px; }
.hbars { gap: 14px; }


.center { text-align: center; }


/* notifications */
.notif { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; background: none; border-inline: 0; border-top: 0; width: 100%; text-align: start; align-items: start; color: var(--ink); }
.notif:hover { background: var(--surface-2); }
.notif .nic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--c-soft); color: var(--c); }
.notif b { display: block; font-size: 14px; }
.notif p { font-size: 13px; color: var(--ink-2); }
.notif time { font-size: 12px; color: var(--faint); white-space: nowrap; }
.notif.unread { background: linear-gradient(90deg, transparent, var(--c-soft)); }
.notif.unread b::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red-600); margin-inline-start: 8px; vertical-align: middle; }
.ncard { display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: start; padding: 16px 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; text-align: start; width: 100%; color: var(--ink); font: inherit; }
.ncard:hover { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--c) 35%, var(--line)); }
.ncard .nic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--c), var(--c2)); color: #fff; }
.ncard .nic svg { width: 22px; height: 22px; }
.ncard b { display: block; font-size: 15px; }
.ncard p { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.ncard .when { font-size: 12px; color: var(--faint); white-space: nowrap; text-align: end; }
.ncard.unread { border-color: color-mix(in srgb, var(--c) 45%, var(--line)); box-shadow: inset 4px 0 0 var(--c); }
.ncard .newdot { display: inline-block; margin-top: 6px; padding: 1px 8px; border-radius: 999px; background: var(--red-600); color: #fff; font-size: 11px; font-weight: 800; }

.ecard.selected { border-color: var(--c); box-shadow: 0 0 0 3px var(--c-soft), var(--shadow-color); }
@page cert { size: A4 landscape; margin: 0; }
@media print {
  body.print-cert .rail, body.print-cert .topbar { display: none !important; }
  body.print-cert .cert-print { page: cert; }
  body.print-cert .cert { width: 297mm; height: 210mm; zoom: 1; }
  body.print-cert .content > :not(.cert-print) { display: none !important; }
}

.code-display .code.small-code { font-size: 40px; letter-spacing: 0.12em; }


.qrow { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: start; cursor: pointer; color: var(--ink); font: inherit; }
.qrow:hover { background: var(--surface-2); }


.list-row.col-row { flex-direction: column; align-items: stretch; }


/* text tones from rateTone() and small status text */
b.ok, .value.ok, span.ok:not(.badge):not(.chip), .txt-ok, .small.success { color: var(--ok); }
b.warn, .value.warn, span.warn:not(.badge):not(.chip) { color: var(--warn); }
b.bad, .value.bad, span.bad:not(.badge):not(.chip) { color: var(--danger); }
.ring.lg { --size: 108px; }
.ring.lg > span { font-size: 21px; width: calc(var(--size) - 18px); height: calc(var(--size) - 18px); }
.ring small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 700; text-align: center; }

.meter-inline { width: 120px; flex: none; }
.meter-inline .meter { margin: 0; }

.chart .bar-val { font-weight: 800; fill: var(--ink-2); }

[hidden] { display: none !important; }

.row.wrap { flex-wrap: wrap; }
.row.center { justify-content: center; }

/* audit timeline */
.audit-tl { padding-bottom: 6px; }
.audit-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 20px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; text-align: start; cursor: pointer; }
.audit-row:hover { background: var(--c-soft, var(--surface-2)); }
.audit-row b { display: block; font-size: 14px; }
.audit-row .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.audit-row .when { display: grid; justify-items: end; gap: 3px; font-size: 12px; color: var(--faint); white-space: nowrap; }
.avatar.xs { --size: 22px; font-size: 10px; }
button.list-row { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; color: var(--ink); text-align: start; cursor: pointer; }
.list-row.selected { background: var(--c-soft, var(--brand-soft)); box-shadow: inset 4px 0 0 var(--c, var(--brand)); }
.table.diff tr.changed td { background: var(--warn-soft); }
.table.diff td.old { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.table.diff tr:not(.changed) td.old { text-decoration: none; }
.table.diff td.new { font-weight: 700; }
.pad { padding: 16px; }

.letter .letter-verify { display: flex; gap: 12px; align-items: center; }
.letter .letter-verify .qr { width: 92px; height: 92px; flex: none; }

/* Legacy .page-head headers (detail and secondary pages) share the hero banner look */
.page-head { position: relative; overflow: hidden; align-items: center; padding: 22px 26px; border-radius: var(--radius-lg); color: #fff;
  background: radial-gradient(520px 260px at 0% 0%, rgba(255, 255, 255, 0.16), transparent 60%), radial-gradient(circle at 92% 20%, rgba(255, 209, 102, 0.22) 0 2px, transparent 3px) 0 0 / 22px 22px, linear-gradient(135deg, #0b4aa8, #031634);
  box-shadow: 0 22px 48px -24px #0b4aa8; }
.page-head h1 { font-size: clamp(21px, 2.2vw, 27px); color: #fff; }
.page-head .sub { color: rgba(255, 255, 255, 0.85); max-width: 780px; }
.page-head .sub a { color: #ffd166; }
.page-head .btn { border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.14); color: #fff; }
.page-head .btn:hover { background: rgba(255, 255, 255, 0.24); }
.page-head .btn.primary { background: #fff; color: #083a85; border-color: #fff; }
.page-head .btn.danger { background: rgba(209, 6, 15, 0.85); border-color: transparent; }
.page-head .chip, .page-head .badge { background: rgba(255, 255, 255, 0.16); color: #fff; border-color: transparent; }
.page-head .badge.ok { background: rgba(14, 159, 110, 0.9); }
.page-head .badge.warn { background: rgba(217, 154, 6, 0.9); }
.page-head .badge.bad { background: rgba(209, 6, 15, 0.9); }
.page-head .alert { color: var(--ink); }
@media print { .page-head { background: none; color: #000; box-shadow: none; padding: 0; } .page-head h1, .page-head .sub { color: #000; } }

/* .kpi.alert must not inherit the message-box .alert layout */
.kpi.alert { display: grid; gap: 4px; align-items: stretch; padding: 18px 18px 16px; border-radius: 20px; font-size: inherit; border: 1px solid color-mix(in srgb, var(--t-red) 40%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--t-red) 12%, transparent); }
.kpi.solid.alert { border: 0; }

/* status landing cards (programs home) */
.status-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.ecard.scard .ecover { height: 104px; }
.ecard.scard .ecover .count { position: absolute; inset-inline-end: 20px; bottom: 10px; font-size: 44px; font-weight: 800; line-height: 1; color: #fff; text-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); font-variant-numeric: tabular-nums; }
.ecard.scard:hover { transform: translateY(-3px); box-shadow: var(--shadow-color, var(--shadow)); }
.list.compact .list-row { padding: 7px 0; border: 0; border-bottom: 1px dashed var(--line); gap: 8px; font-size: 13.5px; font-weight: 700; }
.list.compact .list-row:last-child { border-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: linear-gradient(135deg, var(--c, #0b4aa8), var(--c2, #2b7cf0)); }
.ecard .estats { grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); }
.hero .filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- category tiles (small, used on every section's first page and as a switcher) ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-align: start; font: inherit; cursor: pointer; min-width: 0; position: relative; overflow: hidden; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.tile::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--c), var(--c2)); }
.tile:hover { text-decoration: none; transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 40%, var(--line)); box-shadow: 0 10px 22px -16px var(--c); }
.tile .ti { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--c-soft); color: var(--c); }
.tile .ti svg { width: 20px; height: 20px; }
.tile .tt { flex: 1; min-width: 0; display: grid; }
.tile .tt b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .tt small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .tc { font-size: 22px; font-weight: 800; color: var(--c-ink, var(--c)); font-variant-numeric: tabular-nums; }
.tile.active { background: linear-gradient(135deg, var(--c), var(--c2)); color: #fff; border-color: transparent; box-shadow: 0 10px 22px -12px var(--c); }
.tile.active .ti { background: rgba(255, 255, 255, 0.2); color: #fff; }
.tile.active .tt small, .tile.active .tc { color: #fff; }
.tiles.mini { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tiles.mini .tile { padding: 8px 10px; gap: 8px; border-radius: 12px; }
.tiles.mini .ti { width: 30px; height: 30px; border-radius: 9px; }
.tiles.mini .ti svg { width: 16px; height: 16px; }
.tiles.mini .tt b { font-size: 13px; }
.tiles.mini .tc { font-size: 16px; }
.section-label { font-size: 13px; font-weight: 800; color: var(--muted); margin: 4px 2px 10px; }

/* lighter overall weight: smaller heroes and entity cards */
.hero { padding: 20px 24px; margin-bottom: 18px; }
.hero h1 { font-size: clamp(20px, 2vw, 25px); }
.hero .hero-stats { margin-top: 14px; }
.hero .hstat { padding: 8px 14px; min-width: 100px; }
.hero .hstat b { font-size: 18px; }
.hero .hero-actions { margin-top: 14px; }
.hero svg.dome { width: 340px; }
.ecard .ecover { height: 62px; }
.ecard .eicon { width: 48px; height: 48px; border-radius: 14px; margin-top: -26px; }
.ecard .eicon svg { width: 22px; height: 22px; }
.ecard .eavatar { margin-top: -28px; }
.ecard .eavatar .avatar { --size: 52px; }
.ecard .etitle { font-size: 15.5px; }
.ecard .ebody { padding: 10px 16px 14px; gap: 6px; }
.ecard .efoot { padding: 10px 16px; }
.ecard .estat { padding: 6px 4px; }
.ecard .estat b { font-size: 15px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.kpi { padding: 14px 16px 12px; }
.kpi .kicon { width: 38px; height: 38px; border-radius: 12px; }
.kpi .kicon svg { width: 18px; height: 18px; }
.kpi .value { font-size: 25px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }

.tile .tt b, .tile .tt small { unicode-bidi: plaintext; text-align: start; }

/* tiles: one comfortable medium size everywhere (mini == normal, the active tile marks the current page) */
.tiles, .tiles.mini { grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 14px; }
.tile, .tiles.mini .tile { padding: 16px 16px; gap: 14px; border-radius: 18px; min-height: 84px; }
.tile .ti, .tiles.mini .ti { width: 50px; height: 50px; border-radius: 15px; }
.tile .ti svg, .tiles.mini .ti svg { width: 23px; height: 23px; }
.tile .tt b, .tiles.mini .tt b { font-size: 15.5px; }
.tile .tt small { font-size: 12.5px; margin-top: 2px; }
.tile .tc, .tiles.mini .tc { font-size: 28px; }
.page-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-bar .back-link { margin: 0; }
.page-bar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.section-title { font-size: 19px; margin: 2px 2px 12px; }
.page-actions .btn.solid { background: var(--brand, #0b4aa8); color: #fff; border-color: transparent; }

/* accounts: wide rows grouped by user type */
.user-section > header .chip { margin-inline-start: 8px; font-size: 12.5px; }
.user-rows { display: grid; }
.user-row { display: grid; grid-template-columns: auto minmax(180px, 1.4fr) minmax(140px, 1fr) minmax(130px, auto) auto; align-items: center; gap: 16px; padding: 14px 20px; border-top: 1px solid var(--line); }
.user-row:hover { background: var(--c-soft, var(--surface-2)); }
.user-row.off { opacity: 0.72; }
.user-row .u-main { min-width: 0; display: grid; gap: 2px; }
.user-row .u-main b { font-size: 15px; }
.user-row .u-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-row .u-roles { display: flex; flex-wrap: wrap; gap: 6px; }
.user-row .u-state { display: grid; gap: 4px; justify-items: start; }
.user-row .u-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 1100px) {
  .user-row { grid-template-columns: auto 1fr; }
  .user-row .u-roles, .user-row .u-state, .user-row .u-actions { grid-column: 2; justify-content: flex-start; }
}

/* ===================== Rich forms ===================== */
.drawer.wide.has-aside { width: min(1180px, 96vw); }
.drawer .drawer-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; color: #fff; border-bottom: 0;
  background: radial-gradient(420px 180px at 0% 0%, rgba(255, 255, 255, 0.18), transparent 60%), linear-gradient(135deg, var(--c, #0b4aa8), var(--c2, #2b7cf0)); }
.drawer .drawer-head h2 { color: #fff; font-size: 19px; }
.drawer .drawer-head small { display: block; color: rgba(255, 255, 255, 0.85); font-size: 13px; margin-top: 2px; }
.drawer .drawer-head .dh-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.2); flex: none; }
.drawer .drawer-head .dh-ic svg { width: 22px; height: 22px; }
.drawer .drawer-head .icon-btn { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.3); color: #fff; }
.drawer-body { background: var(--surface-2); }
.drawer-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.drawer-aside { position: sticky; top: 0; display: grid; gap: 14px; }
@media (max-width: 900px) { .drawer-grid { grid-template-columns: 1fr; } .drawer-aside { position: static; } }

.fsec { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); padding: 16px 18px 18px; margin: 0 0 16px; min-width: 0; }
.fsec legend { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; padding: 0 8px; color: var(--ink); }
.fsec legend small { font-weight: 600; color: var(--muted); font-size: 12.5px; }
.fsec-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--c-soft, var(--brand-soft)); color: var(--c, var(--brand)); }
.fsec-ic svg { width: 17px; height: 17px; }
.fsec .form-grid { margin-top: 6px; }

.switch-field { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; }
.switch-field:hover { border-color: var(--line-strong); }
.switch-field .sf-text { display: grid; gap: 2px; }
.switch-field .sf-text b { font-size: 14px; }
.switch-field .sf-text small { font-size: 12.5px; color: var(--muted); }
.switch-field .switch { margin-top: 0; }

.choice-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.choice { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; transition: 0.15s; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .ch-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--c-soft); color: var(--c); flex: none; }
.choice .ch-t { display: grid; min-width: 0; }
.choice .ch-t b { font-size: 14px; }
.choice .ch-t small { font-size: 11.5px; color: var(--muted); }
.choice:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.choice:has(input:checked) { border-color: var(--c); background: var(--c-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.choice:has(input:checked) .ch-ic { background: linear-gradient(135deg, var(--c), var(--c2)); color: #fff; }
.choice:has(input:focus-visible) { outline: 2px solid var(--c); outline-offset: 2px; }

.dropzone { position: relative; display: grid; justify-items: center; text-align: center; gap: 6px; padding: 22px 16px; border: 2px dashed var(--line-strong); border-radius: 16px; background: var(--surface); cursor: pointer; transition: 0.15s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand, #0b4aa8); background: var(--brand-soft, #eef4ff); }
.dropzone .dz-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone .dz-info { display: grid; justify-items: center; gap: 6px; pointer-events: none; }
.dropzone .dz-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft, #eef4ff); color: var(--brand, #0b4aa8); }
.dropzone .dz-ic.ok { background: var(--ok-soft); color: var(--ok); }
.dropzone .dz-files { display: grid; gap: 4px; }
.dropzone .dz-file { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

/* live preview / tips panels beside forms */
.pv-card { border-radius: 18px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.pv-card > header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 12.5px; font-weight: 800; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.pv-card .pv-body { padding: 14px; display: grid; gap: 8px; }
.pv-card .pv-title { font-size: 16px; font-weight: 800; }
.pv-card .pv-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-card .pv-text { font-size: 13px; color: var(--ink-2); white-space: pre-wrap; max-height: 140px; overflow: hidden; }
.pv-tips { border-radius: 18px; padding: 14px 16px; background: var(--c-soft, var(--brand-soft)); display: grid; gap: 8px; font-size: 13px; }
.pv-tips b { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--c-ink, var(--brand-strong)); }
.pv-tips ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; color: var(--ink-2); }

/* virtual classes */
.vclass.live { border-color: color-mix(in srgb, var(--t-red) 45%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--t-red) 14%, transparent); }
.vclass .vactions { flex-wrap: wrap; justify-content: flex-end; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--t-red); margin-inline-end: 6px; animation: blink 1.2s infinite; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.small.ok, div.ok { color: var(--ok); }

/* ===================== Grades ===================== */
.weight-bar { display: flex; height: 16px; border-radius: 999px; overflow: hidden; background: var(--surface-sunken); gap: 2px; }
.weight-bar i { width: calc(var(--pct, 0) * 1%); background: linear-gradient(90deg, var(--c), var(--c2)); }
.comp-row { gap: 10px; }
.comp-row.off { opacity: 0.55; }
.table.gradebook th { vertical-align: bottom; white-space: nowrap; }
.table.gradebook th small { display: block; font-weight: 600; color: var(--muted); }
.th-comp { display: inline-flex; align-items: center; gap: 5px; color: var(--c-ink, var(--ink)); }
.th-comp svg { width: 15px; height: 15px; color: var(--c); }
.table.gradebook td.center { text-align: center; min-width: 86px; }
.table.gradebook td .meter { margin-top: 4px; }
.table.gradebook tr.fail-row td:first-child { box-shadow: inset 4px 0 0 var(--t-red); }
.score-input { width: 86px; text-align: center; font-weight: 800; background: color-mix(in srgb, var(--t-gold) 10%, var(--surface)); border-color: color-mix(in srgb, var(--t-gold) 45%, var(--line)); }
.score-input.empty { background: color-mix(in srgb, var(--t-gold) 22%, var(--surface)); }
.total-cell .ring { margin-inline: auto; }
.warn-text { color: var(--warn); }
.scheme-row { display: grid; grid-template-columns: auto 1fr 190px 110px auto; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: var(--c-soft); }
.scheme-row .ico-chip { background: var(--surface); }
.weight-input { position: relative; }
.weight-input input { padding-inline-end: 26px; text-align: center; font-weight: 800; }
.weight-input span { position: absolute; inset-inline-end: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 800; }
.sum-line { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 14px; font-size: 14px; }
.sum-line.ok { background: var(--ok-soft); color: var(--ok); }
.sum-line.bad { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 700px) { .scheme-row { grid-template-columns: auto 1fr; } }
.result-grid { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: center; }
.result-grid .full { grid-column: 1 / -1; }
.result-main { display: flex; align-items: center; gap: 18px; }
.result-label { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
@media (max-width: 800px) { .result-grid { grid-template-columns: 1fr; } }

/* ===================== Finance ===================== */
.sum-strip { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px 16px; margin-bottom: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.sum-strip b { color: var(--ink); margin-inline-start: 4px; }
.fin-rows { display: grid; }
.fin-row { display: grid; grid-template-columns: auto minmax(200px, 1.6fr) minmax(150px, 1fr) minmax(130px, auto) auto; gap: 16px; align-items: center; padding: 13px 18px; border-top: 1px solid var(--line); color: var(--ink); }
.fin-row:first-child { border-top: 0; }
a.fin-row:hover { background: var(--surface-2); text-decoration: none; }
.fin-row.off { opacity: 0.55; }
.fin-row .fr-main { display: grid; gap: 2px; min-width: 0; }
.fin-row .fr-amount { display: grid; justify-items: end; text-align: end; }
.fin-row .fr-amount b { font-size: 16px; font-variant-numeric: tabular-nums; }
.fin-row .fr-progress { display: grid; gap: 4px; }
.fin-row .fr-status { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 900px) { .fin-row { grid-template-columns: auto 1fr; } .fin-row .fr-progress, .fin-row .fr-amount, .fin-row .fr-status { grid-column: 2; justify-items: start; text-align: start; justify-content: flex-start; } }
.inst-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.inst-strip .inst { display: grid; justify-items: center; padding: 6px 10px; border-radius: 12px; background: var(--c-soft); color: var(--c-ink); min-width: 74px; }
.inst-strip .inst small { font-size: 11px; }
.picked { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--brand-soft, #eef4ff); }
.pick-list { display: grid; gap: 4px; margin-top: 6px; }
.pick { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; text-align: start; }
.pick:hover { border-color: var(--brand, #0b4aa8); }
.adj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.choice input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none; }
.line-row { display: flex; gap: 8px; align-items: center; }
.line-row input[data-l=amount] { width: 140px; }
.pv-lines { display: grid; gap: 4px; }
.pv-total { padding-top: 8px; border-top: 1px dashed var(--line); font-size: 16px; }
.tone-text-emerald { color: var(--t-emerald); } .tone-text-red { color: var(--t-red); } .tone-text-gold { color: var(--t-gold); } .tone-text-slate { color: var(--muted); }

/* printable documents (invoice / receipt) */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .doc-layout { grid-template-columns: 1fr; } }
.doc-side { display: grid; gap: 14px; position: sticky; top: 12px; }
.doc-a4 { position: relative; background: #fff; color: #172036; border-radius: 18px; padding: 34px 38px; box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; max-width: 900px; }
.doc-a4.receipt { max-width: 760px; margin-inline: auto; }
.doc-head { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; }
.doc-head img { height: 64px; }
.doc-inst { display: grid; font-size: 12.5px; color: #4b5872; }
.doc-inst b { font-size: 16px; color: #08408a; }
.doc-title { text-align: end; display: grid; gap: 2px; }
.doc-title h1 { font-size: 26px; color: #08408a; margin: 0; }
.doc-title b { font-size: 15px; }
.doc-title span { font-size: 12.5px; color: #4b5872; }
.doc-stripe { height: 6px; margin: 16px 0 20px; border-radius: 99px; background: linear-gradient(90deg, #d1060f 0 22%, #d99a06 22% 30%, #08408a 30%); }
.doc-parties { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.doc-parties > div { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; background: #f4f7fc; font-size: 13px; }
.doc-parties small { color: #6b7790; font-weight: 700; }
.doc-parties b { font-size: 15px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-bottom: 14px; }
.doc-table th, .doc-table td { padding: 9px 12px; border-bottom: 1px solid #e3e8f1; text-align: start; }
.doc-table th { background: #08408a; color: #fff; font-weight: 700; }
.doc-table td.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-table tr.neg td { color: #0b8a5d; }
.doc-table tfoot td { font-weight: 700; }
.doc-table tfoot tr.grand td { font-size: 15px; background: #f4f7fc; }
.doc-table tfoot tr.grand.due td { color: #d1060f; }
.doc-sub { font-size: 15px; color: #08408a; margin: 18px 0 8px; }
.doc-note { font-size: 12.5px; color: #4b5872; border-inline-start: 3px solid #d99a06; padding-inline-start: 10px; }
.doc-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12px; color: #6b7790; margin-top: 18px; padding-top: 12px; border-top: 1px dashed #d4dbe7; }
.doc-a4 .badge { font-size: 11.5px; }
.void-stamp { position: absolute; top: 40%; inset-inline-start: 50%; transform: translate(-50%, -50%) rotate(-18deg); font-size: 90px; font-weight: 900; color: rgba(209, 6, 15, 0.18); border: 8px solid rgba(209, 6, 15, 0.18); padding: 0 40px; border-radius: 20px; pointer-events: none; }
.receipt-amount { display: grid; justify-items: center; gap: 4px; padding: 18px; margin-bottom: 16px; border-radius: 16px; background: linear-gradient(135deg, #e7f7ef, #f4fbf8); border: 1px solid #bfe7d3; }
.receipt-amount small { color: #0b8a5d; font-weight: 800; }
.receipt-amount b { font-size: 34px; color: #08643f; font-variant-numeric: tabular-nums; }
.doc-dl { display: grid; gap: 10px; margin: 0 0 18px; }
.doc-dl > div { display: grid; grid-template-columns: 200px 1fr; gap: 10px; padding-bottom: 8px; border-bottom: 1px dashed #e3e8f1; }
.doc-dl dt { color: #6b7790; font-weight: 700; font-size: 13px; }
.doc-dl dd { margin: 0; font-weight: 700; }
.doc-sign { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 16px; font-size: 13px; }
.doc-sign .qr { width: 96px; height: 96px; }
@media print {
  .doc-layout { display: block; }
  .doc-a4 { box-shadow: none; border: 0; border-radius: 0; padding: 0; max-width: none; }
  .doc-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-stripe, .receipt-amount, .doc-parties > div { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
