/* ETQAAN External Review System — RTL, Arabic-first.
   Visual identity = accredit.etqaan.eg (ETQAAN's public verification site): Egyptian flag bands
   (red / white / black) as framing only, Eagle-of-Saladin gold as the action colour, warm canvas,
   Cairo type. Red is never a content surface. No inline styles anywhere (CSP style-src 'self'). */

@font-face { font-family: "Cairo"; font-weight: 400; font-display: swap; src: url("../fonts/cairo-arabic-400-normal.fc3b3abf178d.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Cairo"; font-weight: 500; font-display: swap; src: url("../fonts/cairo-arabic-500-normal.afed8901323d.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Cairo"; font-weight: 600; font-display: swap; src: url("../fonts/cairo-arabic-600-normal.465686e677fb.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Cairo"; font-weight: 700; font-display: swap; src: url("../fonts/cairo-arabic-700-normal.640128b2707a.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Cairo"; font-weight: 400; font-display: swap; src: url("../fonts/cairo-latin-400-normal.1f8775699abb.woff2") format("woff2"); unicode-range: U+0000-00FF; }
@font-face { font-family: "Cairo"; font-weight: 500; font-display: swap; src: url("../fonts/cairo-latin-500-normal.5a301c940c86.woff2") format("woff2"); unicode-range: U+0000-00FF; }
@font-face { font-family: "Cairo"; font-weight: 600; font-display: swap; src: url("../fonts/cairo-latin-600-normal.997d30a32100.woff2") format("woff2"); unicode-range: U+0000-00FF; }
@font-face { font-family: "Cairo"; font-weight: 700; font-display: swap; src: url("../fonts/cairo-latin-700-normal.398907c63229.woff2") format("woff2"); unicode-range: U+0000-00FF; }

:root {
  /* flag primitives (accredit.etqaan.eg theme.css) */
  --eg-red: #CE1126;
  --eg-white: #FFFFFF;
  --eg-black: #0A0A0A;
  --eg-gold: #C09300;

  --bg: #F4F2ED;
  --surface: #FFFFFF;
  --surface-2: #FAF8F4;
  --ink: #141110;
  --ink-2: #544D45;
  --muted: #645C52;
  --line: #E5E0D7;
  --line-strong: #D9D3C9;
  --brand: #8F6E00;          /* gold-strong: text / edges on light, white text passes AA */
  --brand-2: #C09300;        /* gold: buttons, accents */
  --brand-soft: #F6EED6;     /* gold tint */
  --btn-fg: #141110;         /* dark ink on gold */
  --side: #FFFFFF;
  --side-ink: #2A2420;
  --side-muted: #645C52;
  --auth-muted: #645C52;
  --shadow-card: 0 22px 48px -24px rgba(20, 17, 16, .32);
  --ok: #1C5C24;   --ok-soft: #E4F1E4;   --ok-line: #C2E0C2;
  --wr: #7A5810;   --wr-soft: #FBF0D6;   --wr-line: #EDDAAB;
  --or: #A3410C;   --or-soft: #FCE9DD;
  --rk: #7F1420;   --rk-soft: #F8DDDF;   --rk-line: #EBBDC2;
  --ac: #645C52;   --ac-soft: #EFECE6;
  --radius: 14px;
  --radius-sm: 10px;
  --side-w: 290px;
  --head-h: 92px;
  --font: "Cairo", system-ui, "Segoe UI", Tahoma, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 17px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.85 var(--font); }
h1, h2, h3 { line-height: 1.45; margin: 0 0 .5rem; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 1.55rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 600; }
p { margin: 0 0 .6rem; }
a { color: var(--brand); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 6px; }

table, .nowrap, .result-line, .pill { font-variant-numeric: tabular-nums; }

.skip { position: absolute; inset-inline-start: 1rem; top: -100px; background: var(--brand); color: #fff; padding: .5rem 1rem; border-radius: var(--radius-sm); z-index: 100; }
.skip:focus { top: 1rem; }

/* --- shell: "national frame" — black header with a red rule, white sidebar, warm workspace --- */
.page { min-height: 100vh; display: flex; flex-direction: column; }
/* header = the Egyptian flag: red band, white band (seal + names live here), black band */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--head-h); display: flex; align-items: center; gap: 1rem; padding: 0 1.6rem;
  background: #FFFFFF; color: var(--ink); border-top: 12px solid var(--eg-red); border-bottom: 12px solid var(--eg-black); }
.brand { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.brand-disc { flex: none; width: 52px; height: 52px; border-radius: 50%; background: #FFFFFF; display: grid; place-items: center; box-shadow: 0 0 0 1.5px #E6D59F; }
.brand-logo { width: 48px; height: 48px; border-radius: 50%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.4; min-width: 0; }
.brand-text strong { font-size: 1.05rem; font-weight: 700; color: var(--ink); white-space: nowrap; }
.brand-text small { color: var(--muted); font-size: .84rem; white-space: nowrap; }
.topbar-end { margin-inline-start: auto; display: flex; align-items: center; gap: 1rem; }
.visit-switch { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.visit-switch label { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.visit-switch select { max-width: 340px; min-width: 220px; min-height: 2.4rem; padding: .3rem .8rem; font-weight: 600; }
.user-block { display: flex; flex-direction: column; line-height: 1.35; text-align: start; }
.user-name { font-weight: 600; color: var(--ink); font-size: .92rem; }
.user-role { color: var(--brand); font-size: .8rem; font-weight: 600; }
.topbar .btn-logout { background: #FFFFFF; color: var(--ink-2); border: 1px solid var(--line-strong); padding: .35rem .95rem; font-size: .9rem; }
.topbar .btn-logout:hover { border-color: var(--brand-2); color: var(--ink); }

.shell { flex: 1; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.sidebar { background: var(--side); color: var(--side-ink); border-inline-end: 1px solid var(--line); position: sticky; top: calc(var(--head-h)); height: calc(100vh - var(--head-h)); overflow-y: auto; padding: 1.2rem .9rem 2rem; }
.main-col { min-width: 0; display: flex; flex-direction: column; }

.nav-group { margin-top: .9rem; }
.nav-group:first-child { margin-top: 0; }
.nav-title { margin: 0 .7rem .3rem; font-size: .8rem; font-weight: 700; color: var(--muted); }
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-link { display: flex; align-items: center; gap: .7rem; padding: .5rem .75rem; font-size: 1rem; margin: 1px 0; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.nav-link:hover { background: #F7F5F0; color: var(--ink); }
.nav-link.is-active { background: #F7F1DE; color: var(--ink); font-weight: 700; }
.nav-icon { display: inline-flex; color: var(--muted); }
.nav-link.is-active .nav-icon { color: var(--brand); }

.content { padding: 2rem 2.4rem 3rem; width: 100%; max-width: 1280px; counter-reset: sec; }
.muted { color: var(--muted); }
.sub { color: var(--muted); margin-bottom: 1rem; }

/* --- page header: plain title + one line, no banner ------------------------------- */
.page-head { margin-bottom: 1.6rem; }
.eyebrow { margin: 0 0 .1rem; font-size: .88rem; font-weight: 600; color: var(--brand); }
.eyebrow-sep { margin: 0 .45rem; color: var(--line-strong); }
.page-title-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.page-title-row h1, .page-head > h1 { margin: 0; font-size: 1.8rem; }
.page-intro { margin: .35rem 0 0; max-width: 80ch; color: var(--ink-2); font-size: .98rem; }

/* --- surfaces: white, one hairline, small radius, no shadow ----------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem 1.4rem; margin-bottom: 1.2rem; }
/* section titles are numbered like an official form: gold-ringed Arabic numerals */
.card > h2:first-child { counter-increment: sec; display: flex; align-items: center; gap: .7rem; padding-bottom: .6rem; margin-bottom: .85rem; border-bottom: 1px solid var(--line); }
.card > h2:first-child::before { content: counter(sec, arabic-indic); flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 1.5px solid var(--brand-2);
  color: var(--brand); display: grid; place-items: center; font-size: .88rem; font-weight: 700; }
.card.empty { color: var(--ink-2); text-align: center; padding: 2.4rem 1.3rem; background: var(--surface-2); border-style: dashed; }
.card-danger { border-color: var(--rk-line); }

/* --- controls ----------------------------------------------------------------- */
.btn { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.2rem; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; text-decoration: none; font-weight: 600; line-height: 1.45;
  transition: background .2s, color .2s, border-color .2s, box-shadow .2s, transform .18s cubic-bezier(.2, .8, .2, 1); }
.btn-primary { background: var(--brand-2); color: var(--btn-fg); font-weight: 700; box-shadow: 0 8px 20px -12px var(--brand-2); }
.btn-primary:hover { background: var(--brand); color: #fff; transform: translateY(-1px); box-shadow: 0 12px 24px -12px var(--brand-2); }
.btn-primary:active { transform: none; }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-block { width: 100%; }
.btn-sm { padding: .35rem .8rem; font-size: .93rem; }
.btn-xs { padding: .16rem .6rem; font-size: .88rem; }
.btn-danger { background: var(--rk); color: #fff; }
.btn-danger:hover { background: #5E0E17; }
.btn-link-danger { background: none; border: 0; color: var(--rk); padding: .2rem 0; cursor: pointer; font: inherit; font-size: .9rem; }
.btn-link-danger:hover { text-decoration: underline; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }

.pill { display: inline-flex; align-items: center; padding: .1rem .58rem; border-radius: 999px; font-size: .86rem; font-weight: 500; background: var(--ac-soft); color: var(--ac); white-space: nowrap; }
.pill-quiet { background: var(--surface); border: 1px solid var(--line-strong); color: var(--muted); }
.pill-role { background: var(--brand-soft); color: var(--brand); }
.pill-warn { background: var(--wr-soft); color: var(--wr); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-wr { background: var(--wr-soft); color: var(--wr); }
.pill-rk { background: var(--rk-soft); color: var(--rk); }
.pill-ac { background: var(--ac-soft); color: var(--ac); }
.ok { color: var(--ok); } .wr { color: var(--wr); } .or { color: var(--or); } .rk { color: var(--rk); } .ac { color: var(--ac); }

input[type="text"], input[type="password"], input[type="date"], input[type="time"], input[type="number"], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); padding: .55rem .85rem; width: 100%; min-height: 2.75rem; transition: border-color .2s, box-shadow .2s; }
select { width: auto; }
textarea { resize: vertical; min-height: 4.4rem; line-height: 1.7; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); outline: none; box-shadow: 0 0 0 4px rgba(192, 147, 0, .14); }
textarea[readonly], input[readonly] { background: var(--surface-2); color: var(--ink-2); }
::placeholder { color: var(--muted); }

/* --- forms ------------------------------------------------------------------ */
.form .field { margin-bottom: .95rem; }
.form label { display: block; font-weight: 500; margin-bottom: .3rem; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: .1rem 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { margin-bottom: .8rem; min-width: 0; }
.field label { display: block; font-weight: 500; margin-bottom: .32rem; font-size: .95rem; color: var(--ink-2); }
.field-check label, label.field-check { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; }
.field-check input { width: auto; accent-color: var(--brand); }
.field select { width: 100%; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--rk); }
.field-error { color: var(--rk); font-size: .9rem; margin: .25rem 0 0; }
.hint { color: var(--muted); font-size: .92rem; margin: .7rem 0; max-width: 80ch; }
.label-sm { font-weight: 700; color: var(--ink-2); margin: 1rem 0 .45rem; font-size: .93rem; }
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form select { width: auto; max-width: 260px; }

.msg { padding: .65rem .9rem; border-radius: var(--radius-sm); margin-bottom: 1rem; background: var(--ac-soft); border-inline-start: 3px solid var(--ac); }
.msg p { margin: 0; }
.msg-error { background: var(--rk-soft); color: var(--rk); border-inline-start-color: var(--rk); }
.msg-success { background: var(--ok-soft); color: var(--ok); border-inline-start-color: var(--ok); }
.msg-warning { background: var(--wr-soft); color: var(--wr); border-inline-start-color: var(--wr); }

/* --- tables ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .97rem; }
.table th, .table td { padding: .75rem .85rem; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 500; font-size: .9rem; border-bottom-color: var(--line-strong); white-space: nowrap; }
.table tbody tr:hover { background: var(--surface-2); }
.table td:first-child { min-width: 9rem; }
.cell-center { text-align: center !important; }
.nowrap { white-space: nowrap; }
.row-break td { color: var(--muted); background: var(--surface-2); }
.row-sub td { color: var(--muted); font-size: .92rem; border-top: 0; padding-top: 0; }
.table td div + div { margin-top: .2rem; }

/* --- disclosure --------------------------------------------------------------- */
.details > summary, .element-details > summary { cursor: pointer; list-style: none; font-weight: 700; display: flex; align-items: center; gap: .45rem; }
.details > summary::-webkit-details-marker, .element-details > summary::-webkit-details-marker { display: none; }
.details > summary::before, .element-details > summary::before { content: ""; width: .45rem; height: .45rem; border-inline-start: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(135deg); transition: transform .15s; color: var(--muted); margin-top: -.1rem; }  /* closed: points left (RTL) */
.details[open] > summary::before, .element-details[open] > summary::before { transform: rotate(45deg); margin-top: -.3rem; }  /* open: points down */
.details[open] > summary { margin-bottom: .9rem; }
.details h3 { margin-top: 1.3rem; }

/* --- visits ------------------------------------------------------------------ */
.visit-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.visit-card { display: block; color: inherit; text-decoration: none; margin: 0; transition: border-color .15s; }
.visit-card:hover { border-color: var(--brand-2); }
.visit-card.is-current { box-shadow: inset -3px 0 0 var(--brand); }
.visit-card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .3rem; }
.visit-card p { margin: 0; font-size: .9rem; }

.roster-row { display: grid; grid-template-columns: 1.3fr 1fr 1.6fr .7fr .7fr .8fr 1.1fr auto; gap: 0 .6rem; align-items: end; padding: .8rem 0 0; border-top: 1px solid var(--line); }
.roster-row .field { margin-bottom: .5rem; }
.roster-row .field label { font-size: .86rem; color: var(--muted); }
.roster-row .field-check { padding-bottom: .55rem; }
.roster-actions { padding-bottom: .55rem; }
.roster-remove { margin: 0 0 .4rem; }

/* --- assessment: shared -------------------------------------------------------- */
.tabs { display: flex; flex-wrap: wrap; gap: 0 1.5rem; margin: -.4rem 0 1.25rem; border-bottom: 1px solid var(--line); }
.tab { padding: .55rem .1rem; margin-bottom: -1px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }

.autofield { position: relative; margin-bottom: .5rem; }
.autofield textarea, .autofield input[type="text"] { display: block; }
.save-state { display: block; font-size: .84rem; color: var(--muted); min-height: 1.15em; margin-top: .15rem; }
.save-state[data-state="saved"] { color: var(--ok); }
.save-state[data-state="failed"] { color: var(--rk); }
.save-banner { background: var(--rk-soft); color: var(--rk); padding: .6rem 1.75rem; font-weight: 500; border-bottom: 1px solid var(--rk-line); }

.actions-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: -.15rem 0 .6rem; }
.draft-box { background: var(--brand-soft); border-inline-start: 3px solid var(--brand-2); border-radius: var(--radius-sm); padding: .75rem .95rem; margin: .2rem 0 .9rem; }
.draft-title { font-weight: 700; color: var(--brand); margin: 0 0 .35rem; font-size: .92rem; }
.draft-text { white-space: pre-wrap; margin-bottom: .6rem; }
.draft-actions { display: flex; gap: .4rem; }
.result-line { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .55rem .85rem; margin: .9rem 0 .7rem; font-size: .93rem; }

/* --- data collection ------------------------------------------------------------- */
.picker { display: flex; align-items: center; gap: .75rem; margin-bottom: .65rem; }
.picker label { font-weight: 700; min-width: 3.6rem; color: var(--ink-2); }
.picker select { flex: 1; width: 100%; min-width: 0; }
.pills { display: flex; flex-wrap: wrap; gap: .4rem; margin: .7rem 0 0; }
.indicator-text { margin: .8rem 0 0; padding-top: .8rem; border-top: 1px solid var(--line); color: var(--ink-2); }
.element-card h3 { color: var(--brand); font-size: .92rem; margin-bottom: .35rem; }
.element-card > p:first-of-type { font-size: 1rem; }
.methods { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-items: center; margin: .5rem 0 .75rem; }
.methods .save-state { display: inline; margin: 0; }
.label-inline { color: var(--muted); font-weight: 500; }

/* --- review report ---------------------------------------------------------------- */
.report-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.std-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .5rem; }
.std-nav .hint { grid-column: 1 / -1; margin: .2rem 0 0; }
.std-link { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .55rem .75rem; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.std-link:hover { border-color: var(--line-strong); }
.std-link span:first-child { display: flex; flex-direction: column; line-height: 1.5; font-size: .97rem; }
.std-link small { color: var(--muted); font-size: .86rem; }
.std-link.is-active { border-color: var(--brand); box-shadow: inset -3px 0 0 var(--brand); }
.indicator > h3 { line-height: 1.7; padding-bottom: .6rem; margin-bottom: .2rem; border-bottom: 1px solid var(--line); }

.element-row { padding: .75rem .8rem .3rem; margin: 0 -.8rem; border-inline-start: 3px solid transparent; border-bottom: 1px solid var(--line); }
.element-row:last-of-type { border-bottom: 0; }
.element-head { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 1rem; align-items: start; }
.element-text { line-height: 1.9; font-size: 1.02rem; }
.el-num { display: inline-grid; place-items: center; min-width: 1.55rem; height: 1.55rem; margin-inline-end: .5rem; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--muted); font-size: .85rem; font-weight: 700; vertical-align: 1px; }
.level-cell select { width: 100%; font-weight: 500; }
.level-cell .save-state { text-align: center; }
.element-details > summary { color: var(--brand-2); font-size: .93rem; font-weight: 500; margin: .35rem 0; }
.element-details[open] { padding-bottom: .3rem; }

/* level feedback without JS: edge + tinted selector follow the chosen value */
.element-row:has(option[value="4"]:checked) { border-inline-start-color: var(--ok); }
.element-row:has(option[value="3"]:checked) { border-inline-start-color: var(--wr); }
.element-row:has(option[value="2"]:checked), .element-row:has(option[value="1"]:checked) { border-inline-start-color: var(--rk); }
.element-row:has(option[value="0"]:checked) { border-inline-start-color: var(--line-strong); }
.level-cell select:has(option[value="4"]:checked) { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.level-cell select:has(option[value="3"]:checked) { background: var(--wr-soft); color: var(--wr); border-color: var(--wr-line); }
.level-cell select:has(option[value="2"]:checked), .level-cell select:has(option[value="1"]:checked) { background: var(--rk-soft); color: var(--rk); border-color: var(--rk-line); }
.level-cell select:has(option[value="0"]:checked) { background: var(--ac-soft); color: var(--ac); }

/* --- comparison / engine / alerts -------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; display: flex; flex-direction: column; }
.stat b { font-size: 1.75rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .92rem; }
.stat-ok b { color: var(--ok); } .stat-wr b { color: var(--wr); } .stat-rk b { color: var(--rk); }
.filter-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .6rem; }
.pair-line + .pair-line { margin-top: .35rem; padding-top: .35rem; border-top: 1px dashed var(--line); }
.decision-cell { min-width: 15rem; }
.decision-form { display: grid; gap: .35rem; }
.plain-list { margin: 0; padding-inline-start: 1.2rem; }
.plain-list li { margin-bottom: .35rem; }

.engine-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.engine-el { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 1rem; align-items: start; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.engine-el:last-of-type { border-bottom: 0; }
.engine-el .field-check { margin-top: .3rem; font-size: .93rem; }
.engine-el select { width: 100%; }
.engine-run { margin: .8rem 0 0; }
.h2-spaced { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.finding { display: flex; gap: .75rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.finding .pill { margin-top: .2rem; }
.send-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); }

.alerts-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 1rem; align-items: start; margin-bottom: 1rem; }
.alert-list { display: flex; flex-direction: column; gap: .3rem; max-height: 70vh; overflow-y: auto; }
.alert-item { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .7rem; border-radius: var(--radius-sm); background: var(--surface);
  border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.alert-item.is-active { border-color: var(--brand); box-shadow: inset -3px 0 0 var(--brand); }
.alert-item.is-closed { opacity: .6; }
.alert-item-text { display: flex; flex-direction: column; line-height: 1.45; font-size: .9rem; }
.alert-item-text small { color: var(--muted); }
.trace { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem 1rem; margin: 1rem 0; padding: .8rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.trace dt { color: var(--muted); font-size: .88rem; }
.trace dd { margin: 0; }
.decide-form { display: grid; gap: .6rem; margin-top: .6rem; }
.decide-actions { display: flex; flex-wrap: wrap; gap: .4rem; }

/* --- overview / tracking / quality ------------------------------------------------ */
.gap-cards { gap: 0 1rem; }
.status-line { margin: .35rem 0; }
.bar-row { display: grid; grid-template-columns: minmax(9rem, 1.1fr) minmax(0, 2fr) 2.6rem; gap: .75rem; align-items: center; margin: .45rem 0; }
.bar-label { font-size: .9rem; color: var(--ink-2); }
.bar-value { text-align: start; font-variant-numeric: tabular-nums; }
progress.bar { -webkit-appearance: none; appearance: none; width: 100%; height: .55rem; border: 0; border-radius: 999px; background: var(--ac-soft); overflow: hidden; }
progress.bar::-webkit-progress-bar { background: var(--ac-soft); border-radius: 999px; }
progress.bar::-webkit-progress-value { border-radius: 999px; background: var(--ac); }
progress.bar::-moz-progress-bar { border-radius: 999px; background: var(--ac); }
progress.bar-ok::-webkit-progress-value { background: var(--ok); } progress.bar-ok::-moz-progress-bar { background: var(--ok); }
progress.bar-wr::-webkit-progress-value { background: var(--wr); } progress.bar-wr::-moz-progress-bar { background: var(--wr); }
progress.bar-rk::-webkit-progress-value { background: var(--rk); } progress.bar-rk::-moz-progress-bar { background: var(--rk); }
.track-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.track-head h2 { margin: 0; }
.stepper { list-style: none; display: flex; padding: 0; margin: 0 0 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.stepper li { flex: 1 1 0; text-align: center; padding: .45rem .4rem; font-size: .88rem; color: var(--muted); border-inline-start: 1px solid var(--line); white-space: nowrap; }
.stepper li:first-child { border-inline-start: 0; }
.stepper li.is-done { background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.review-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.review-row .hint { margin: 0; }
.std-list { margin: 0; padding-inline-start: 1.3rem; }
.std-list li { margin-bottom: .3rem; }
.need { margin: .5rem 0 .8rem; }

.export-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: 0 0 1rem; }
.export-row .hint { margin: 0; }

/* --- footer ------------------------------------------------------------------ */
.site-footer { margin-top: auto; padding: 1.1rem 1.75rem 1.4rem; border-top: 1px solid var(--line); text-align: center; line-height: 1.7; }
.site-footer p { margin: 0; }
.footer-org { font-weight: 700; color: var(--ink-2); font-size: .92rem; }
.footer-sep { margin: 0 .4rem; color: var(--muted); }
.footer-sup { color: var(--muted); font-size: .92rem; }
.footer-sup a { color: var(--brand); font-weight: 700; font-size: .98rem; text-decoration: none; margin-inline-start: .3rem; }
.footer-sup a:hover { text-decoration: underline; }
/* --- auth: "official card" — one card, identity column (cream) + form column, flag on top edge --- */
.auth-body { min-height: 100vh; background: var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.6rem 1.6rem 1.2rem; }
.auth-card { position: relative; overflow: hidden; width: 100%; max-width: 1320px; min-height: calc(100vh - 8.5rem); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 2px 4px rgba(20, 17, 16, .04), 0 40px 70px -40px rgba(20, 17, 16, .5); }
/* the flag: red / white / black stacked along the top edge */
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 12px; z-index: 2;
  background: linear-gradient(180deg, var(--eg-red) 0 4px, #FFFFFF 4px 8px, var(--eg-black) 8px 12px); }
.auth-id { background: #FAF6EC; border-inline-end: 1px solid #EFE6CF; padding: 3.4rem 2rem 2.6rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.auth-seal { width: min(260px, 34vh); height: auto; aspect-ratio: 1; border-radius: 50%;
  box-shadow: 0 0 0 9px #FFFFFF, 0 0 0 10px #E6D59F, 0 26px 50px -18px rgba(143, 110, 0, .6); }
.auth-org { color: var(--brand); font-weight: 600; font-size: 1.05rem; margin: 2rem 0 .35rem; }
.auth-system { font-size: 1.9rem; font-weight: 700; margin: 0; line-height: 1.5; text-wrap: balance; }
.auth-rule { display: block; width: 56px; height: 3px; background: var(--brand-2); border-radius: 3px; margin-top: 1.2rem; }
.auth-form { padding: 3.4rem clamp(2rem, 6vw, 6rem) 2.4rem; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.auth-form > * { width: 100%; max-width: 440px; }
.auth-title { font-size: 1.7rem; font-weight: 700; margin: 0 0 .2rem; }
.auth-lead { color: var(--muted); margin: 0 0 1.5rem; }
.auth-card input[type="text"], .auth-card input[type="password"] { min-height: 3rem; background: #FCFBF8; }
.auth-card input:focus { background: #FFFFFF; }
.auth-card input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px #FCFBF8 inset; -webkit-text-fill-color: var(--ink); }
.auth-card .btn-primary { margin-top: .3rem; padding: .85rem 1.5rem; font-size: 1.04rem; }
.auth-note { color: var(--muted); font-size: .9rem; margin: 1.2rem 0 0; text-align: center; text-wrap: balance; }
.auth-wrap .site-footer { margin-top: 1.1rem; padding: 0; background: none; }

/* --- national frame details ---------------------------------------------------- */
/* key figures: one plain row of big numbers under a hairline, no tiles */
.stats { display: flex; flex-wrap: wrap; gap: 1rem 3rem; padding: .4rem 0 1.4rem; margin-bottom: 1.6rem; border-bottom: 1px solid var(--line); }
.stat { background: none; border: 0; border-radius: 0; padding: 0; display: flex; flex-direction: column; }
.stat b { font-size: 2.6rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; color: var(--ink); }
.stat span { color: var(--ink-2); font-size: .9rem; }
.stat-ok b { color: var(--ok); } .stat-wr b { color: var(--wr); } .stat-rk b { color: #9E1424; }

/* tables: quiet header, hairline rows */
.table thead th { background: #FAF8F4; color: var(--muted); font-weight: 600; font-size: .85rem; border-bottom: 1px solid var(--line); }
.table tbody tr:hover { background: #FBF9F4; }

/* small parts */
.pill-role { background: #F7F1DE; color: var(--brand); }
.btn-ghost:hover { border-color: var(--brand-2); color: var(--ink); background: #FFFDF6; }
.tab.is-active { color: var(--ink); border-bottom: 2px solid var(--brand-2); font-weight: 700; }
.stepper li.is-done { background: #F7F1DE; color: var(--brand); }
.draft-box { background: #FBF6E6; border-inline-start-color: var(--brand-2); }
.visit-card:hover, .std-link:hover { border-color: #DCC88A; }
.visit-card.is-current { border-color: var(--brand-2); box-shadow: inset -3px 0 0 var(--brand-2); }
.btn-primary { box-shadow: none; }
.btn-primary:hover { transform: none; box-shadow: none; }
.site-footer { border-top: 1px solid var(--line); }

/* --- responsive ----------------------------------------------------------- */
.only-mobile { display: none; }
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(84vw, var(--side-w)); z-index: 50; transform: translateX(100%); transition: transform .2s ease; }
  .nav-open .sidebar { transform: none; }
  .only-mobile { display: inline-grid; }
  .sidebar { top: 0; height: 100vh; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(20, 17, 16, .4); z-index: 40; }
  .nav-open .scrim { display: block; }
  .topbar { padding: 0 .8rem; gap: .6rem; }
  .brand-text small, .visit-switch label, .user-block { display: none; }
  .brand-text strong { font-size: .9rem; white-space: normal; }
  .visit-switch select { min-width: 0; max-width: 34vw; }
  .stats { gap: 1rem 2rem; }
  .content { padding: 1.1rem 1rem 2rem; }
  .grid-2, .grid-3, .grid-4, .roster-row, .element-head, .engine-grid, .engine-el, .alerts-layout { grid-template-columns: minmax(0, 1fr); }
  .stepper { flex-wrap: wrap; } .stepper li { flex: 1 1 33%; border-top: 1px solid var(--line); }
  .bar-row { grid-template-columns: minmax(0, 1fr) 2.6rem; } .bar-row progress { grid-column: 1 / -1; order: 3; }
}
@media (max-width: 600px) {
  .brand-text { display: none; }
  .brand { flex: none; }
  .topbar-end { min-width: 0; gap: .5rem; }
  .visit-switch select { width: 100%; max-width: 44vw; }
}
@media (max-width: 760px) {
  .auth-wrap { justify-content: flex-start; padding: 1.2rem .9rem 1.4rem; }
  .auth-card { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .auth-id { border-inline-end: 0; border-bottom: 1px solid #EFE6CF; padding: 2.4rem 1.2rem 1.8rem; }
  .auth-seal { width: 150px; }
  .auth-org { margin-top: 1.2rem; }
  .auth-system { font-size: 1.25rem; }
  .auth-form { padding: 1.8rem 1.3rem 1.6rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .sidebar, .topbar, .scrim, .save-banner, .actions-row, .save-state { display: none !important; }
  .shell { display: block; } .content { max-width: none; } .card { break-inside: avoid; }
}
