/* ==========================================================================
   Premium theme: loaded after app.css, so it restyles tokens, the admin portal and shared components.
   Light sidebar with a navy active pill, greeting header, navy hero banners, soft cards, Inter type.
   ========================================================================== */
:root {
  --bg-1: #f4f6fc;
  --bg-2: #eceffa;
  --brand: #2f5be3;
  --brand-dark: #1e3a9e;
  --focus: #2f5be3;
  --navy: #17164f;
  --navy-2: #222b8f;
  --ink: #161b33;
  --ink-soft: #626a86;
  --muted: #7a829c;
  --line: #e4e8f3;
  --radius: 20px;
  --shadow: 0 10px 30px rgba(24, 33, 92, .07), 0 2px 6px rgba(24, 33, 92, .04);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --m0: #2f5be3; --m1: #5b7cf0; --m5: #1e3a9e;
  --espresso: #17164f; --espresso-2: #2f5be3; --cream: #f4f6fc;
  --edge: #e8ecf6;
  --hero: linear-gradient(110deg, #17164f 0%, #222b8f 52%, #2f5be3 100%);
}

body { font-size: 14.5px; letter-spacing: -.005em; }
h2 { font-weight: 700; letter-spacing: -.02em; }
h3 { font-weight: 650; letter-spacing: -.01em; }

/* ---------- Shared components ---------- */
.card { border: 1px solid var(--edge); box-shadow: 0 8px 28px rgba(24, 33, 92, .06); }
.btn { border-radius: 12px; letter-spacing: 0; font-weight: 600; padding: 10px 20px; }
.btn-sm { padding: 6px 12px; }
.btn-primary { background: linear-gradient(135deg, #3a66ee 0%, #2447c9 100%); box-shadow: 0 6px 16px rgba(47, 91, 227, .30); }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(47, 91, 227, .42); }
.btn-outline { border-color: #d6dcee; color: var(--ink); background: #fff; }
.btn-outline:hover { background: #f4f6fc; border-color: #c3cbe6; }
.btn-ghost { border-color: #d6dcee; background: #fff; }
.btn-ghost:hover { background: #f4f6fc; }
.btn-light { background: linear-gradient(135deg, #3a66ee, #2447c9); border-radius: 12px; }
.btn-light:hover { background: linear-gradient(135deg, #4a73f3, #2b50d6); }
input:focus, select:focus, textarea:focus { outline-color: var(--brand); }

/* ---------- Top bar ---------- */
.topbar { background: rgba(244, 246, 252, .92); box-shadow: 0 1px 0 var(--edge); }
.topbar-title { font-family: var(--font); font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.top-switch { background: #fff; border: 1px solid var(--edge); }
.top-switch a { color: var(--ink-soft); font-weight: 600; }
.top-switch a.on { background: linear-gradient(135deg, var(--navy), var(--navy-2)); box-shadow: 0 6px 14px rgba(34, 43, 143, .30); }
.user-chip { border: 1px solid var(--edge); box-shadow: 0 2px 10px rgba(24, 33, 92, .06); }
.avatar { background: linear-gradient(135deg, #3a66ee, #6a4be0); }
.uc-out { background: #f1f3fa; color: var(--ink-soft); }
.topbar-greet { display: none; flex: 1; line-height: 1.25; }
.topbar-greet b { display: block; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.topbar-greet small { color: var(--ink-soft); font-weight: 500; font-size: 13px; }

/* ---------- Admin portal shell ---------- */
body.admin-mode { background: #f4f6fc; }
body.admin-mode .bg-decor { display: none; }
body.admin-mode .topbar { margin-left: 248px; padding: 16px 40px 10px; background: rgba(244, 246, 252, .92); box-shadow: none; }
body.admin-mode .topbar .brand, body.admin-mode .topbar-title { display: none; }
body.admin-mode .topbar-greet { display: block; }

.admin-nav {
  top: 0; width: 248px; padding: 20px 16px 16px; gap: 3px;
  background: #fff; box-shadow: 1px 0 0 var(--edge);
}
.admin-nav::after { display: none; }
.admin-nav-brand { display: block; padding: 2px 8px 20px; margin: 0 0 4px; border: 0; }
.admin-nav-brand img { display: block; height: 52px; width: auto; max-width: 100%; }
.admin-nav-head { color: #8b93ab; font-size: 10.5px; letter-spacing: .14em; padding: 16px 10px 6px; }
.admin-nav-item { color: #1d2442; font-weight: 600; font-size: 14px; padding: 7px 10px; border-radius: 14px; border: 1px solid transparent; }
.ani-ic { flex: 0 0 36px; height: 36px; border-radius: 12px; background: #f1f3fa; color: #4b5476; }
.admin-nav-item:hover { background: #f4f6fc; color: var(--ink); transform: none; }
.admin-nav-item:hover .ani-ic { background: #e8ecf8; }
.admin-nav-item.active {
  background: linear-gradient(135deg, var(--navy) 0%, #2433a8 100%); color: #fff; border-color: #6d8cff;
  box-shadow: 0 0 0 3px rgba(47, 91, 227, .28), 0 10px 22px rgba(34, 43, 143, .28);
}
.admin-nav-item.active .ani-ic { background: rgba(255, 255, 255, .16); color: #fff; }
.admin-nav-item:focus-visible { outline: 3px solid rgba(47, 91, 227, .35); outline-offset: 1px; }
.ani-badge { background: #ff7a45; box-shadow: 0 2px 8px rgba(255, 122, 69, .4); }
.admin-nav-foot { background: #f6f8fd; border: 1px solid var(--edge); color: var(--ink); }
.admin-nav-foot .who-av { color: #fff; background: linear-gradient(135deg, #3a66ee, #6a4be0); }
.anf-text small { color: var(--ink-soft); }

.admin-content { margin-left: 248px; padding: 10px 40px 60px; max-width: none; } /* fills the screen on wide monitors */

/* ---------- Hero banners (page headers) ---------- */
.dash-hero, .admin-section-head {
  position: relative; overflow: hidden; color: #fff; border: 0; border-radius: 22px;
  background: var(--hero); padding: 28px 34px; margin-bottom: 24px;
  box-shadow: 0 18px 40px rgba(34, 43, 143, .22);
}
.dash-hero::before, .admin-section-head::before, .dash-hero::after, .admin-section-head::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .15) 0 8px, transparent 8px 17px);
}
.dash-hero::before, .admin-section-head::before { width: 300px; height: 300px; right: 150px; top: -150px; }
.dash-hero::after, .admin-section-head::after { width: 340px; height: 340px; right: -90px; top: -60px; left: auto; }
.dash-hero > *, .admin-section-head > * { position: relative; z-index: 1; }
.dash-hero h2, .admin-section-head h2, .dash-title { color: #fff; font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; }
.dash-hero p, .admin-section-head .muted, .admin-section-head .small { color: rgba(255, 255, 255, .78); }
.dash-hero p { margin: 0; max-width: 560px; }
.hero-tag, .admin-section-head > :first-child::before {
  content: "ADMIN"; display: block; width: max-content; padding: 4px 11px; margin-bottom: 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22);
  font-size: 11px; font-weight: 700; letter-spacing: .12em; color: #fff;
}
.admin-section-head > :first-child { display: block; }
.dash-hero .btn-primary, .admin-section-head .btn-primary { background: #fff; color: var(--navy); box-shadow: 0 8px 20px rgba(0, 0, 0, .18); }
.dash-hero .btn-primary:hover, .admin-section-head .btn-primary:hover { background: #f1f4ff; }
.admin-section-head .btn-outline, .admin-section-head .btn-ghost { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .3); color: #fff; }
.admin-section-head .btn-outline:hover, .admin-section-head .btn-ghost:hover { background: rgba(255, 255, 255, .2); }
.dash-clear { background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .25); }
.admin-section-head .search { background: #fff; border-color: transparent; color: var(--brand); box-shadow: 0 6px 18px rgba(0, 0, 0, .14); }
.admin-section-head .seg { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .25); }
.admin-section-head .seg button { color: rgba(255, 255, 255, .85); }
.admin-section-head .seg button.on { background: #fff; color: var(--navy); }

/* Applicant dashboard header uses the same banner */
.dash-head {
  position: relative; overflow: hidden; color: #fff; border-radius: 22px; background: var(--hero);
  padding: 28px 34px; margin-bottom: 24px; box-shadow: 0 18px 40px rgba(34, 43, 143, .22);
}
.dash-head::before, .dash-head::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .15) 0 8px, transparent 8px 17px);
}
.dash-head::before { width: 300px; height: 300px; right: 150px; top: -150px; }
.dash-head::after { width: 340px; height: 340px; right: -90px; top: -60px; }
.dash-head > * { position: relative; z-index: 1; }
.dash-head h2 { color: #fff; font-size: 28px; font-weight: 800; margin: 0 0 4px; }
.dash-head .muted, .dash-head p { color: rgba(255, 255, 255, .8); }
.dash-head .btn-primary { background: #fff; color: var(--navy); box-shadow: 0 8px 20px rgba(0, 0, 0, .18); }
.dash-head .btn-primary:hover { background: #f1f4ff; }

/* ---------- Dashboard, KPIs, filters ---------- */
.dash-label { color: #4b5476; }
.dash-label::after { background: linear-gradient(90deg, #d5dbef, transparent); }
.dash-card { border: 1px solid var(--edge); }
.kpi-tile { border-radius: 18px; border: 1px solid var(--edge); box-shadow: 0 6px 20px rgba(24, 33, 92, .05); }
.kpi-tile::before { width: 0; }
.kt-ic { border-radius: 14px; }
.kt-val { font-weight: 800; letter-spacing: -.02em; }
.inv-total { background: linear-gradient(135deg, #eef2ff, #e0e7ff); }
.inv-total b { color: var(--navy-2); }
.ql:hover { background: #f1f4ff; color: var(--brand-dark); }
.chipbar { background: #fff; border: 1px solid var(--edge); border-radius: 18px; }
.chip.on { box-shadow: 0 3px 10px color-mix(in srgb, var(--c) 20%, transparent); }
.seg { background: #fff; border-color: var(--edge); }
.seg button.on { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; box-shadow: 0 4px 12px rgba(34, 43, 143, .3); }

/* ---------- Tables ---------- */
.admin-table-wrap { border-radius: 20px; border: 1px solid var(--edge); box-shadow: 0 8px 28px rgba(24, 33, 92, .06); }
.admin-table th { background: #f7f8fd; color: #6b7391; border-bottom: 1px solid var(--edge); font-size: 11px; letter-spacing: .08em; padding: 13px 12px; }
.admin-table td { padding: 12px; border-bottom: 1px solid #eff2f9; }
.admin-table tbody tr:hover td { background: #f8f9fe; }
.app-no { color: var(--navy-2); }
.who-av { background: linear-gradient(135deg, #e7ecff, #d0daff); color: var(--navy-2); }
.badge { font-weight: 650; }

/* ---------- Forms in the portal ---------- */
.search { border: 1px solid var(--edge); }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(47, 91, 227, .14); }

/* ---------- Documents first and the fill-in choice ---------- */
.docs-first, .task-page { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.docs-first > .btn, .task-page > .btn { align-self: flex-start; }
.df-head { margin: 22px 0 12px; font-size: 15px; }
.df-head:first-child { margin-top: 0; }
.df-toggle, .df-consent { display: flex; align-items: flex-start; gap: 10px; margin: 18px 0 4px; font-weight: 600; cursor: pointer; }
.df-toggle input, .df-consent input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--brand); flex: 0 0 auto; }
.df-consent { margin: 4px 0 14px; font-weight: 500; font-size: 13.5px; }
.fill-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.fill-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 20px; border-radius: 18px;
  border: 1px solid var(--edge); background: #fff; box-shadow: 0 6px 20px rgba(24, 33, 92, .05); }
.fill-opt[data-mode="AUTO"] { border-color: #c9d5fb; background: linear-gradient(160deg, #f5f7ff, #fff 60%); }
.fill-opt b { font-size: 15.5px; }
.fill-opt p { margin: 0 0 6px; }
.fill-opt .btn { margin-top: auto; }
.fo-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: #eef2ff; color: var(--brand); }

.df-child { display: flex; flex-direction: column; gap: 4px; }
.df-child .btn-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-size: 12.5px; }
.df-add { margin-top: 14px; }

/* ---------- Inventory ---------- */
.inv-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.inv-size { margin-bottom: 14px; }
.inv-size:last-child { margin-bottom: 0; }
.inv-size .inv-row { align-items: center; margin-bottom: 8px; }
.inv-avail { font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #e9f9ef; color: #15803d; white-space: nowrap; }
.inv-avail.low { background: #fef3c7; color: #92400e; }
.inv-avail.short { background: #fdecec; color: #b91c1c; }
.inv-stack { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: #edf0f8; }
.inv-stack span { display: block; height: 100%; transition: width .6s cubic-bezier(.6, .1, .2, 1); }
.seg-handed { background: #7c3aed; }
.seg-alloc { background: #f59e0b; }
.seg-avail { background: #16a34a; }
.inv-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; color: var(--ink-soft); }
.inv-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.inv-break { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 16px 0 0; }
.inv-break div { padding: 10px; border-radius: 12px; background: #f6f8fd; border: 1px solid var(--edge); }
.inv-break dt { font-size: 11px; color: var(--ink-soft); font-weight: 600; }
.inv-break dd { margin: 2px 0 0; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.inv-cards .note { margin-top: 12px; }

/* ---------- More-information task ---------- */
.task-need { padding: 16px 18px; border-radius: 14px; background: #fff8eb; border: 1px solid #fde3b0; margin-bottom: 18px; }
.task-need small, .task-block small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #9a6b10; margin-bottom: 4px; }
.task-need p, .task-block p { margin: 0; white-space: normal; }
.task-files { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.task-file, .task-files li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: #f6f8fd; border: 1px solid var(--edge); }
.task-file a, .task-files li a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
#task-attach.busy { opacity: .6; pointer-events: none; }
.task-item { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--edge); margin-bottom: 12px; background: #fff; }
.task-item.done { border-color: #bfe8cf; background: linear-gradient(160deg, #f3fbf6, #fff 60%); }
.task-item.open { border-color: #fde3b0; background: linear-gradient(160deg, #fffaf0, #fff 60%); }
.task-item.old { opacity: .7; }
.task-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.task-block { margin-top: 8px; }
.task-block.answer small { color: #15803d; }

/* Upload check: the file looks like the wrong document, or is hard to read (advisory, never blocks) */
.type-warn { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 8px; border-radius: 10px;
  background: #fff8eb; border: 1px solid #fcd38d; color: #8a5a0b; font-size: 13.5px; font-weight: 500; animation: fadeUp .25s ease both; }
.type-warn > svg { flex: 0 0 auto; color: #d97706; }
.type-warn > span { flex: 1; min-width: 180px; }
.type-warn .btn { margin-left: auto; }
.file-chip.warned { border-color: #fcd38d; }
.file-chip.warned .meta small { color: #b45309; }
.task-file.warned { flex-wrap: wrap; border-color: #fcd38d; background: #fffcf5; }
.task-file .type-warn { flex-basis: 100%; margin: 4px 0 0; }
.dr-more .type-warn { margin: 6px 0; }

/* Applicant: answering a request for more information, one point at a time */
.task-card { padding: 0; overflow: hidden; }
.task-hero { display: flex; align-items: center; gap: 14px; padding: 20px 22px 16px; background: linear-gradient(120deg, #fff8eb, #fff 70%); }
.task-hero h2 { margin: 0; font-size: 21px; }
.task-hero .ph-ic { flex: 0 0 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 8px 18px rgba(217,119,6,.25); }
.tp-progress { margin-left: auto; font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.tp-progress b { font-size: 20px; color: var(--ink); }
.tp-bar { height: 4px; background: #f3e6cc; }
.tp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f59e0b, #16a34a); transition: width .35s ease; }
.tp-list { list-style: none; margin: 0; padding: 8px 22px; counter-reset: none; }
.tp { display: flex; gap: 14px; padding: 14px 0; }
.tp + .tp { border-top: 1px solid var(--edge); }
.tp-num { flex: 0 0 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800;
  color: #b45309; background: #fff3db; box-shadow: inset 0 0 0 1.5px #fcd38d; transition: background .2s; }
.tp.done .tp-num { color: #fff; background: #16a34a; box-shadow: none; }
.tp-num svg { stroke-width: 3; }
.tp-body { flex: 1; min-width: 0; display: grid; gap: 8px; }
.tp-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 3px; }
.tp-title b { font-size: 15px; }
.tp-hint { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #fff3db; color: #b45309; }
.tp.done .tp-hint { background: #dcfce7; color: #15803d; }
.tp-q { margin: 0; padding: 8px 12px; border-radius: 10px; background: #f6f8fd; color: var(--ink); }
.tp-answer { margin: 0; padding: 8px 12px; border-left: 3px solid #86efac; background: #f3fbf6; border-radius: 0 10px 10px 0; }
.tp textarea { width: 100%; resize: vertical; font: inherit; }
.tp .task-files { margin: 0; }
.tp-attach { justify-self: start; }
/* A requested document: name on the left, upload on the right, its files underneath */
.tp.doc .tp-body { grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; }
.tp.doc .tp-title { grid-column: 1; grid-row: 1; padding-top: 0; }
.tp.doc .tp-attach { grid-column: 2; grid-row: 1; }
.tp.doc .task-files { grid-column: 1 / -1; grid-row: 2; }
.tp.doc .tp-num { align-self: center; }
.tp.doc:has(.task-files) .tp-num { align-self: flex-start; margin-top: 3px; }
.tp-attach.busy { opacity: .6; pointer-events: none; }
.task-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 22px 18px; border-top: 1px solid var(--edge); background: #fafbfe; }
.task-card > .note { margin: 0 22px 20px; }
@media (max-width: 560px) {
  .task-hero { flex-wrap: wrap; padding: 16px; }
  .tp-progress { margin-left: 60px; }
  .tp-list { padding: 4px 16px; }
  .task-foot { padding: 12px 16px 16px; }
  .task-foot .btn { width: 100%; }
}

/* ---------- Phones ---------- */
.tb-apps { gap: 6px; }
.admin-tabbar { display: none; }

/* Admin on phones and small tablets: bottom tab bar instead of the sidebar */
@media (max-width: 900px) {
  .admin-nav { display: none !important; }
  .admin-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 2px;
    background: rgba(255, 255, 255, .97); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-top: 1px solid var(--edge); box-shadow: 0 -6px 24px rgba(24, 33, 92, .08);
  }
  .tab-item {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 4px 2px; border: 0; background: none; color: #5b6380; text-decoration: none; cursor: pointer;
    font: inherit; font-size: 11px; font-weight: 600; -webkit-tap-highlight-color: transparent;
  }
  .tab-ic { position: relative; width: 46px; height: 30px; border-radius: 999px; display: grid; place-items: center; transition: background .18s, color .18s; }
  .tab-label { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tab-item.active { color: var(--navy); }
  .tab-item.active .tab-ic { background: linear-gradient(135deg, var(--navy), #2433a8); color: #fff; box-shadow: 0 4px 12px rgba(34, 43, 143, .3); }
  .tab-item:focus-visible { outline: 3px solid rgba(47, 91, 227, .35); outline-offset: 1px; border-radius: 12px; }
  .tab-badge { position: absolute; top: -4px; right: 2px; min-width: 18px; height: 18px; font-size: 10px; padding: 0 5px; }
  .tab-sheet {
    position: absolute; right: 8px; bottom: calc(100% + 8px); min-width: 210px; padding: 6px;
    background: #fff; border: 1px solid var(--edge); border-radius: 16px; box-shadow: 0 16px 40px rgba(24, 33, 92, .18);
  }
  .tab-sheet-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; color: var(--ink); font-weight: 600; text-decoration: none; }
  .tab-sheet-item:hover, .tab-sheet-item.active { background: #f1f4ff; color: var(--navy); }
  body.admin-mode .admin-content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  body.admin-mode #toast-root { bottom: calc(84px + env(safe-area-inset-bottom)); }

  /* Reasonable grids */
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dash-row, .review-hero { grid-template-columns: 1fr; }
  .chipbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .chipbar::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }
  .admin-section-head { flex-direction: column; align-items: stretch; }
  .admin-section-head > :first-child { margin-right: 0; }
  .admin-section-head .search { min-width: 0; width: 100%; }
  .admin-section-head .btn { width: 100%; }
  .dash-hero { flex-direction: column; align-items: stretch; }
}

@media (max-width: 680px) {
  .kpi-tile { padding: 14px 12px; gap: 10px; }
  .kt-ic { flex-basis: 36px; height: 36px; border-radius: 11px; }
  .kt-val { font-size: 22px; }
  .kt-label { font-size: 12px; line-height: 1.3; }
  .kt-go { display: none; }
  .dash-hero h2, .admin-section-head h2, .dash-title, .dash-head h2 { font-size: 24px; }
  .dash-hero, .admin-section-head, .dash-head { padding: 20px 18px; border-radius: 18px; }
  .dash-hero::before, .admin-section-head::before, .dash-head::before { right: 40px; }
  .dash-head { flex-direction: column; align-items: stretch; }
  .dash-head .btn { width: 100%; }
  .dash-card { padding: 16px; }
  .admin-table th, .admin-table td { padding: 10px; }
  .inv-break { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-break div:last-child { grid-column: span 2; }

  /* Application form on phones */
  .wizard { grid-template-columns: minmax(0, 1fr); }
  .wizard > *, .panel, .rail { min-width: 0; }
  .panel-head h2 { font-size: 21px; overflow-wrap: anywhere; }
  .panel-head .ph-ic { flex-basis: 42px; height: 42px; border-radius: 13px; }
  .milestones { gap: 4px; }
  .ms { min-width: 0; }
  .ms-dot { width: 34px; height: 34px; }
  .fill-opt { padding: 16px; }
  .fill-opt .btn, .task-page .card-actions .btn { width: 100%; }
  .modal { width: calc(100vw - 24px); max-height: calc(100vh - 24px); overflow-y: auto; }
  /* Applications list: keep App #, applicant, status and the open button; the rest is on the review page */
  .apps-table th:nth-child(n+3):nth-child(-n+7), .apps-table td:nth-child(n+3):nth-child(-n+7) { display: none; }
  .apps-table th:last-child, .apps-table td:last-child { display: none; } /* the whole row opens the review */
  .apps-table th, .apps-table td { padding: 10px 8px; }
  .apps-table .app-no { font-size: 12px; }
  .apps-table .who > span:last-child { max-width: 130px; }
  .apps-table .badge { white-space: normal; font-size: 11px; padding: 3px 8px; }
  .apps-table .who small, .apps-table .who .muted { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .apps-table .who-av { display: none; }
  /* Status tracker: the after-approval steps get the full width on a phone */
  .tr-sub { margin-left: 0 !important; padding: 10px 6px !important; }
  .tr-step small, .tr-sub .tr-step small { font-size: 10.5px; overflow-wrap: anywhere; hyphens: auto; }
}
@media (max-width: 680px) {
  .topbar { gap: 8px; }
  .brand-logo { height: 36px; }
  .topbar-title { display: none; }
  .topbar-user { margin-left: auto; gap: 6px; }
  .ts-label { display: none; }
  .tb-apps { padding: 9px 11px; }
  .user-chip { gap: 4px; padding: 3px; }
  .avatar, .uc-out { width: 34px; height: 34px; flex-basis: 34px; }
  body.admin-mode .topbar-greet { min-width: 0; }
  body.admin-mode .topbar-greet b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.admin-mode .topbar-greet small { font-size: 11.5px; }
}

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  body.admin-mode .topbar { margin-left: 0; padding: 12px 16px; }
  .admin-nav { top: var(--topbar-h, 62px); width: 100%; padding: 8px 12px; background: #fff; }
  .admin-nav-brand { display: none; }
  .admin-nav-item { padding: 5px 10px 5px 6px; }
  .admin-content { margin-left: 0; padding: 16px; }
  .dash-hero, .admin-section-head { padding: 22px 20px; }
  .fill-options, .docs-first .grid-2, .inv-cards { grid-template-columns: 1fr; }
  .inv-break { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Applicant dashboard: pickup place/time with the pass, or tracking */
.ho-card { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; margin-top: 10px; border-radius: 10px;
  background: #f1f6ff; border: 1px solid #d6e2fb; font-size: 13.5px; }
.ho-card > svg { color: var(--brand); flex: 0 0 auto; }
.ho-card > span { flex: 1; min-width: 160px; }
.ho-card.warn { background: #fff8eb; border-color: #fcd38d; }
.ho-card.warn > svg { color: #d97706; }

/* Shipment page (shipping label QR code) */
.ship-page { max-width: 640px; margin: 0 auto; }
.ship-card { padding: 20px 22px; display: grid; gap: 16px; }
.ship-head { display: flex; align-items: center; gap: 12px; }
.ship-head h2 { margin: 0; font-size: 20px; }
.ship-head .badge { margin-left: auto; }
.ship-head .ph-ic { flex: 0 0 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #0891b2, #2f5be3); }
.ship-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ship-inv { padding: 10px 12px; border-radius: 10px; background: #f6f8fd; font-size: 14px; }
.ship-docs { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 560px) { .ship-facts { grid-template-columns: 1fr; } }

/* ---------- Files: one plain file icon (no coloured file-type badges) ---------- */
.file-chip .thumb, .file-chip button.thumb, .doc-item .thumb, .up-thumb { background: #eef2ff; color: var(--brand); }
.file-chip .thumb:has(img) { background: #f1f3fa; }
.doc-item.missing .thumb { background: #fdecec; color: var(--err); }
.up-thumb::after { background: rgba(31, 52, 99, .18); }
.up-thumb .spinner { color: var(--brand); border-color: rgba(47, 91, 227, .25); border-top-color: var(--brand); }

/* ---------- Applicant side: bigger, easier-to-read type ---------- */
body:not(.admin-mode) { font-size: 16px; line-height: 1.55; }
body:not(.admin-mode) .small { font-size: 14.5px; }
body:not(.admin-mode) .field > label:not(.checkbox), body:not(.admin-mode) .field-label { font-size: 16px; margin-bottom: 8px; }
body:not(.admin-mode) .opt { font-size: 14px; }
body:not(.admin-mode) .control input, body:not(.admin-mode) .control select, body:not(.admin-mode) .control textarea { font-size: 17px; padding-top: 14px; padding-bottom: 14px; }
body:not(.admin-mode) .hint { font-size: 14.5px; }
body:not(.admin-mode) .field .msg { font-size: 14.5px; }
body:not(.admin-mode) .note { font-size: 15.5px; line-height: 1.5; }
body:not(.admin-mode) .section-title { font-size: 18px; margin: 30px 0 16px; }
body:not(.admin-mode) .panel-head h2 { font-size: 26px; }
body:not(.admin-mode) .panel-head .muted { font-size: 16px; }
body:not(.admin-mode) .panel-head .step-of { font-size: 14px; }
body:not(.admin-mode) .btn { font-size: 16px; padding: 12px 22px; }
body:not(.admin-mode) .btn-sm { font-size: 14.5px; padding: 8px 14px; }
body:not(.admin-mode) .btn-link { font-size: 15px; }
body:not(.admin-mode) .dropzone { padding-top: 22px; padding-bottom: 22px; }
body:not(.admin-mode) .dropzone .dz-text b { font-size: 17px; }
body:not(.admin-mode) .dropzone .dz-text small { font-size: 14.5px; }
body:not(.admin-mode) .file-chip .meta b { font-size: 16px; }
body:not(.admin-mode) .file-chip .meta small { font-size: 14.5px; }
body:not(.admin-mode) .checkbox { font-size: 16px; }
body:not(.admin-mode) .kv dt { font-size: 15px; }
body:not(.admin-mode) .kv dd { font-size: 16px; }
body:not(.admin-mode) .doc-item .meta b { font-size: 15px; }
body:not(.admin-mode) .doc-item .meta small { font-size: 13.5px; }
body:not(.admin-mode) .rv-head h3 { font-size: 18px; }
body:not(.admin-mode) .stat small { font-size: 13px; }
body:not(.admin-mode) .stat b { font-size: 22px; }
body:not(.admin-mode) .ms-text b { font-size: 15px; }
body:not(.admin-mode) .ms-text small { font-size: 13.5px; }
body:not(.admin-mode) .opt-body b { font-size: 17px; }
body:not(.admin-mode) .toast { font-size: 15.5px; }
.btn-lg, body:not(.admin-mode) .btn-lg { padding: 14px 26px; font-size: 17px; border-radius: 14px; }

/* Documents first, then the boxes they fill in */
.doc-first { margin-bottom: 18px; }
.grid.doc-first { margin-bottom: 4px; }
.child-card .doc-first { margin: 4px 0 16px; }

/* ---------- Guided papers: one paper per screen ---------- */
.guide { max-width: 860px; }
.gd-dots { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.gd-dots li { flex: 1; min-width: 0; position: relative; }
.gd-dots li + li::before { content: ""; position: absolute; top: 19px; right: calc(50% + 22px); left: calc(-50% + 22px); height: 3px; border-radius: 3px; background: #dfe4f2; }
.gd-dots li.done + li::before { background: var(--ok); }
.gd-dots button { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--ink-soft); }
.gd-dot { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 16px; background: #fff; color: var(--ink-soft); box-shadow: inset 0 0 0 2px #d6dcee; transition: background .2s, box-shadow .2s; }
.gd-dots small { font-size: 13.5px; font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.gd-dots li.done .gd-dot { background: var(--ok); color: #fff; box-shadow: none; }
.gd-dots li.cur .gd-dot { background: var(--brand); color: #fff; box-shadow: 0 0 0 5px rgba(47, 91, 227, .18); }
.gd-dots li.cur small { color: var(--ink); font-weight: 750; }
.gd-dots button:focus-visible .gd-dot { outline: 3px solid rgba(47, 91, 227, .4); outline-offset: 2px; }
.gd-fields:empty { display: none; }
.gd-fields { margin-top: 18px; }
.gd-filled { padding: 18px 20px 6px; border-radius: 16px; border: 1.5px solid #c9d5fb; background: linear-gradient(160deg, #f5f7ff, #fff 65%); animation: fadeUp .3s ease both; }
.gd-intro { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; font-size: 16.5px; }
.gd-intro svg { flex: 0 0 auto; margin-top: 3px; color: var(--ok); }
.gd-filled .grid { margin-bottom: 12px; }
.gd-sub { margin: 6px 0 12px; font-size: 16.5px; }
.gd-offer { margin-bottom: 14px; flex-wrap: wrap; }
.gd-reading { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-radius: 16px; background: #f6f8fd; border: 1px dashed #c9d5fb; font-size: 16px; }
.gd-reading .spinner { width: 26px; height: 26px; border-width: 3px; color: var(--brand); flex: 0 0 auto; }
.gd-kid { padding: 16px; border-radius: 16px; border: 1px solid var(--edge); background: #fff; margin-bottom: 14px; }
.gd-kid-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 17px; }
.gd-kid-head .child-num { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--m2); color: #fff; font-weight: 700; }
.gd-kid-head .btn-link { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.gd-kids-found { display: grid; gap: 6px; align-content: start; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--edge); }
.gd-kids-found small { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.gd-kids-found span { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.gd-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 28px 20px; border-top: 1px solid var(--edge); background: #fafbfe; }
.gd-foot .spacer { flex: 1; }
.fill-opt b { font-size: 19px; }
.fill-opt p { font-size: 16px; }
.fill-opt .df-consent { font-size: 16px; }
.df-head { font-size: 19px; }
@media (max-width: 680px) {
  .gd-dots small { display: none; }
  .gd-dots li.cur small { display: block; position: absolute; top: 46px; left: 50%; transform: translateX(-50%); }
  .gd-dots { margin-bottom: 18px; }
  .gd-dot { width: 34px; height: 34px; font-size: 14px; }
  .gd-dots li + li::before { top: 16px; right: calc(50% + 19px); left: calc(-50% + 19px); }
  .gd-foot { padding: 14px 16px 18px; }
  .gd-foot #gd-next { width: 100%; order: 3; }
  .gd-filled { padding: 14px 14px 4px; }
}

/* ---------- Admin review: application on the left, a sticky review panel on the right ---------- */
.rv-top { margin-bottom: 14px; }
.rv-title h2 { font-size: 24px; }
.rv-track { padding: 12px 10px; margin-bottom: 16px; }
.rv-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 22vw, 440px); gap: 20px; align-items: start; }
.rv-main { min-width: 0; }
.rv-main > .rv-section, .rv-main > .note, .rv-main > .decision-bar { margin: 0 0 14px; }
.rv-side { position: sticky; top: 84px; display: grid; gap: 14px; max-height: calc(100vh - 100px); overflow-y: auto; padding-bottom: 4px; scrollbar-width: thin; }

/* Facts: label over value, three to a row */
.rv-section .facts { gap: 12px 24px; }
.rv-section .fact dt { font-size: 10.5px; margin-bottom: 3px; }
.rv-section .fact dd { font-size: 14px; line-height: 1.4; }
.rv-section .fact.addr dd { flex-wrap: wrap; gap: 4px 8px; }
.rv-section .fact.addr .addr-warn { margin: 0; }
.rv-section .fact.total dd { font-size: 15px; font-weight: 750; }
.rv-section .facts + .dr-list { margin-top: 14px; }
.rv-section .rv-head .status { margin-left: auto; }
.rv-section .rv-head .badge { display: inline-flex; align-items: center; gap: 4px; }
.rv-section .rv-sig { max-width: 220px; height: 56px; }

/* Document rows */
.dr-list { border-radius: 12px; }
.dr-row { gap: 12px; padding: 10px 12px; align-items: center; }
.dr-ic { flex: 0 0 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: #eef2ff; color: var(--brand); }
.dr.is-ok .dr-ic { background: #e9f9ef; color: #15803d; }
.dr.is-bad { background: #fffafa; }
.dr.is-bad .dr-ic { background: #fdecec; color: #b91c1c; }
.dr-main { flex: 1 1 auto; display: grid; gap: 1px; }
.dr-main b { font-size: 13.5px; }
.dr-main small { display: block; }
.dr-file { border: 0; background: none; padding: 0; font: inherit; color: var(--ink-soft); cursor: pointer; text-decoration: underline; text-decoration-color: #c9d0e4; text-underline-offset: 2px; }
.dr-file:hover { color: var(--brand); text-decoration-color: currentColor; }
.dr-find { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-top: 2px; }
.dr-find.good { color: #15803d; } .dr-find.warn { color: #b45309; } .dr-find.bad { color: #b91c1c; }
.ai-chip { flex: 0 0 auto; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.ai-chip.ok { background: #e9f9ef; color: #15803d; }
.ai-chip.warn { background: #fef3c7; color: #92400e; }
.ai-chip.err { background: #fdecec; color: #b91c1c; }
.ai-chip.none { background: #f1f3fa; color: #6b7391; }
.dr-acts { gap: 0; }
.dr-acts .icon-btn { width: 30px; height: 30px; background: transparent; color: #6b7391; }
.dr-acts .icon-btn:hover { background: #eef2ff; color: var(--brand); }
.dr-seg { flex: 0 0 auto; display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.dr-seg button { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 6px 10px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); cursor: pointer; }
.dr-seg button + button { border-left: 1px solid var(--line); }
.dr-seg button.ok:hover { background: #effaf3; color: #15803d; }
.dr-seg button.err:hover { background: #fdf2f2; color: #b91c1c; }
.dr-seg button.ok.on { background: #16a34a; color: #fff; }
.dr-seg button.err.on { background: #dc2626; color: #fff; }
.dr-seg button:disabled { opacity: .5; cursor: wait; }
.dr-verdict { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; }
.dr-verdict.ok { color: #15803d; } .dr-verdict.err { color: #b91c1c; } .dr-verdict.none { color: var(--muted); }
.dr-more { padding: 0 12px 12px 54px; }

/* Children */
.kid { padding: 12px 14px; }
.kid .dr-list { margin-top: 2px; }

/* Side panel */
.side-card { background: #fff; border: 1px solid var(--edge); border-radius: 16px; padding: 14px 16px; box-shadow: 0 6px 20px rgba(24, 33, 92, .05); }
.side-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14.5px; }
.side-head .rv-count { margin-left: 0; }
.attn-card > summary { cursor: pointer; list-style: none; }
.attn-card > summary::-webkit-details-marker { display: none; }
.attn-card > summary > svg:last-child { margin-left: auto; color: var(--muted, #8a90a6); transition: transform .15s; }
.attn-card[open] > summary > svg:last-child { transform: rotate(90deg); }
.attn-card:not([open]) > summary { margin-bottom: 0; }
.attn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.attn-list button { width: 100%; display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border: 0; border-radius: 10px; font: inherit; font-size: 13px; line-height: 1.35; text-align: left; cursor: pointer; transition: filter .15s; }
.attn-list button > svg:first-child { flex: 0 0 auto; margin-top: 1px; }
.attn-list button > svg:last-child { flex: 0 0 auto; margin: 1px 0 0 auto; opacity: .45; }
.attn-list button:hover { filter: brightness(.97); }
.attn-list li.err button { background: #fdf2f2; color: #991b1b; }
.attn-list li.warn button { background: #fff8eb; color: #92400e; }
.attn-list li.todo button { background: #f4f6fc; color: #3b4466; }
.attn-none { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 10px; background: #effaf3; color: #15803d; font-size: 13.5px; font-weight: 600; }
.sum { margin: 0; display: grid; }
.sum > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-top: 1px dashed var(--line); font-size: 13.5px; }
.sum > div:first-child { border-top: 0; padding-top: 0; }
.sum dt { color: var(--ink-soft); flex: 0 0 auto; }
.sum dd { margin: 0; text-align: right; }
.sum .link-btn { margin-left: 4px; }
.decision-bar.side { margin: 0; padding: 16px; border-radius: 16px; }
.decision-bar.side .db-head { margin-bottom: 10px; }
.decision-bar.side .db-head h3 { font-size: 16px; }
.decision-bar.side .db-head .muted { display: none; }
.decision-bar.side .db-options { grid-template-columns: 1fr; gap: 8px; }
.decision-bar.side .db-opt { justify-content: flex-start; padding: 10px 12px; }
.decision-bar.side .db-ic { width: 26px; height: 26px; }
.decision-bar.side .db-hint { margin: 10px 0 8px; font-size: 13px; }
.decision-bar.side .rq-grid { grid-template-columns: 1fr; gap: 4px; }
.decision-bar.side .rq-opt { padding: 6px 10px; font-size: 12.5px; line-height: 1.3; }
.decision-bar.side .rq-head .small { display: none; }
.decision-bar.side .db-actions .btn { flex: 1; }

/* Jumped-to item */
@keyframes rv-flash { 0%, 60% { box-shadow: 0 0 0 3px rgba(47, 91, 227, .45); } 100% { box-shadow: 0 0 0 3px transparent; } }
.flash { animation: rv-flash 1.6s ease; border-radius: 12px; }

/* Narrower screens: attention and summary side by side above the application, the decision below it */
@media (max-width: 1200px) {
  .rv-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .rv-main, .rv-side > .decision-bar.side { grid-column: 1 / -1; }
  .rv-side { display: contents; }
  .rv-side > .side-card { order: -1; }
  .rv-side > .decision-bar.side { order: 1; }
}
@media (max-width: 760px) {
  .rv-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .dr-row { flex-wrap: wrap; }
  .dr-main { flex-basis: calc(100% - 42px); }
  .ai-chip { margin-left: 42px; }
  .dr-acts { margin-left: auto; width: auto; }
  .dr-more { padding-left: 12px; }
}

/* ==========================================================================================================
 * Admin pages: neat and clean. One plain page header (title, one-line description, actions on the right) instead
 * of the dark banner; compact KPI tiles, filter chips and tables with the same spacing on every page.
 * ======================================================================================================== */
.admin-portal .admin-content { padding: 6px 32px 48px; }
.admin-portal .admin-section-head, .admin-portal .dash-hero {
  background: none; box-shadow: none; border: 0; border-radius: 0; padding: 0 0 14px; margin: 0 0 18px;
  border-bottom: 1px solid var(--edge); color: var(--ink); overflow: visible; min-height: 0;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.admin-portal .admin-section-head::before, .admin-portal .admin-section-head::after,
.admin-portal .dash-hero::before, .admin-portal .dash-hero::after,
.admin-portal .admin-section-head > :first-child::before { content: none; display: none; }
.admin-portal .hero-tag { display: none; }
.admin-portal .admin-section-head > :first-child, .admin-portal .dash-hero > :first-child { margin-right: auto; }
.admin-portal .admin-section-head h2, .admin-portal .dash-hero h2, .admin-portal .dash-title {
  color: var(--ink); font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 2px;
}
.admin-portal .admin-section-head .muted, .admin-portal .admin-section-head .small, .admin-portal .dash-hero p {
  color: var(--muted); font-size: 13.5px; margin: 0;
}
.admin-portal .admin-section-head .btn-primary, .admin-portal .dash-hero .btn-primary { background: var(--brand); color: #fff; box-shadow: none; }
.admin-portal .admin-section-head .btn-primary:hover, .admin-portal .dash-hero .btn-primary:hover { background: var(--brand-dark); }
.admin-portal .admin-section-head .btn-outline, .admin-portal .admin-section-head .btn-ghost {
  background: #fff; border-color: var(--edge); color: var(--ink);
}
.admin-portal .admin-section-head .btn-outline:hover, .admin-portal .admin-section-head .btn-ghost:hover { background: #f6f8fd; }
.admin-portal .admin-section-head .search { background: #fff; border: 1px solid var(--edge); color: var(--muted); box-shadow: none; min-width: 240px; }
.admin-portal .admin-section-head .seg { background: #f1f4fb; border-color: var(--edge); }
.admin-portal .admin-section-head .seg button { color: var(--ink-soft); }
.admin-portal .admin-section-head .seg button.on { background: #fff; color: var(--ink); }
.admin-portal .dash-clear { color: #15803d; }

/* KPI tiles */
.admin-portal .kpi-grid { gap: 12px; margin-bottom: 16px; }
.admin-portal .kpi-tile { padding: 14px 16px; border-radius: 14px; box-shadow: none; border: 1px solid var(--edge); }
.admin-portal .kpi-tile:hover { border-color: #c9d6f2; }
.admin-portal .kt-ic { width: 38px; height: 38px; border-radius: 11px; }
.admin-portal .kt-val { font-size: 22px; }
.admin-portal .kt-label { font-size: 12.5px; }

/* Cards and section labels */
.admin-portal .card { border-radius: 14px; box-shadow: none; }
.admin-portal .dash-block { margin-bottom: 18px; }

/* Filter chips: wrap onto a second row on wide screens; on phones swipe sideways, without a visible scrollbar */
.admin-portal .chipbar { flex-wrap: wrap; overflow: visible; gap: 6px; padding: 6px; margin-bottom: 12px; }
@media (max-width: 760px) {
  .admin-portal .chipbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .admin-portal .chipbar::-webkit-scrollbar { display: none; }
}
.admin-portal .chipbar .chip { flex: 0 0 auto; padding: 6px 11px; font-size: 13px; white-space: nowrap; }

/* Tables: compact cells so they fit without sideways scrolling */
.admin-portal .admin-table-wrap { border-radius: 14px; box-shadow: none; }
.admin-portal .admin-table th { padding: 10px 12px; font-size: 10.5px; }
.admin-portal .admin-table td { padding: 9px 12px; }
.admin-portal .admin-table .who-av { width: 28px; height: 28px; font-size: 11px; }
.admin-portal .admin-table .small { font-size: 12px; }
.admin-portal .admin-table .badge { white-space: nowrap; }

@media (max-width: 900px) {
  .admin-portal .admin-content { padding: 12px 16px 96px; }
  .admin-portal .admin-section-head .search { min-width: 0; flex: 1 1 100%; }
}
/* Long emails and names: shorten with "…" (full text on hover) instead of widening the table */
.admin-portal .admin-table .who { min-width: 0; }
.admin-portal .admin-table .who > span:last-child { min-width: 0; display: grid; }
.admin-portal .admin-table .who > span:last-child > *, .admin-portal .admin-table td > a[href^="mailto:"] {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 210px; display: block;
}
.admin-portal #log-rows td:nth-child(4) { white-space: normal; max-width: 170px; }
.admin-portal #log-rows td:nth-child(5) { min-width: 140px; }

/* Donut charts: thin ring, 2px gaps between segments, headline in the middle, legend with counts beside it */
.donut { display: flex; align-items: center; gap: 22px; margin: 0; flex-wrap: wrap; }
.donut svg { flex: 0 0 auto; overflow: visible; }
.dn-seg { fill: none; stroke-width: 14; transition: stroke-width .15s; cursor: default; }
.dn-seg:hover { stroke-width: 18; }
.dn-track { fill: none; stroke: #eef1f7; stroke-width: 14; }
.dn-val { text-anchor: middle; font-size: 24px; font-weight: 800; fill: var(--ink); font-family: inherit; }
.dn-val.bad { fill: #b91c1c; }
.dn-lbl { text-anchor: middle; font-size: 8.5px; fill: var(--muted); font-family: inherit; text-transform: uppercase; letter-spacing: .03em; }
.dn-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; flex: 1; min-width: 180px; font-size: 13.5px; }
.dn-legend .dn-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 38px; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.dn-legend a.dn-row { padding: 3px 6px; margin: 0 -6px; border-radius: 8px; }
.dn-legend a.dn-row:hover { background: #f4f6fc; }
.dn-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.dn-legend b { font-variant-numeric: tabular-nums; text-align: right; }
.dn-legend small { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.dn-legend li.zero .dn-row { color: var(--muted); }
.dn-legend li.zero i { opacity: .35; }
.dn-card { padding: 16px 18px; }
.dn-card .card-head { margin-bottom: 12px; }
.dn-card-sub { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.dn-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; }
.dn-pair .donut { flex-direction: column; align-items: flex-start; gap: 10px; }
.dn-pair .dn-legend { width: 100%; min-width: 0; }
.dn-warn { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12.5px; font-weight: 600; color: #b91c1c; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.dash-grid .quick { display: grid; gap: 2px; align-content: start; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .dn-pair { grid-template-columns: minmax(0, 1fr); } .donut { justify-content: center; } }
.dn-legend { max-width: 380px; }
.dn-link { cursor: pointer; outline: none; }
.dn-link:hover .dn-seg, .dn-link:focus-visible .dn-seg { stroke-width: 18; }
.dn-link:focus-visible .dn-seg { stroke: var(--ink); }

/* No visible scrollbars anywhere: pages, tables, panels and tabs still scroll (wheel, trackpad, touch, keyboard). */
html, body, * { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar, *::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* Applicant form stays plain: filled boxes look like empty ones (no green border or tick); only errors are coloured. */
.field.is-valid .control input, .field.is-valid .control select { border-color: var(--line); background: #fcfdff; }
.field.is-valid .state-icon { display: none; }
.file-chip .meta small { color: var(--muted); }

/* Papers-first form: notices one under the other, and what was read from each paper. */
.noa-stack { display: flex; flex-direction: column; gap: 18px; }
.read-line { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; padding: 9px 12px; border-radius: 10px; background: #f6f8fd; color: var(--ink-soft, #475569); font-size: 14px; }
.read-line svg { flex: 0 0 auto; margin-top: 2px; }




/* Application form: the question tile, then Back / Save for later / Next as their own row under it. */
.wizard-main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.actionbar.in-form { position: static; z-index: auto; background: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 0; box-shadow: none; }
.actionbar.in-form .actionbar-inner { max-width: none; padding: 0; }
/* The button row sits at the bottom of the screen (the column fills the screen height); on long pages it stays
   pinned to the bottom while scrolling, over a soft fade so it never sits on top of text. */
.wizard-main { min-height: calc(100vh - 140px); }
.actionbar.in-form { margin-top: auto; position: sticky; bottom: 0; z-index: 5; padding: 18px 0 16px;
  background: linear-gradient(to bottom, transparent, var(--bg-1) 45%); }
@media (max-width: 760px) { .wizard-main { min-height: auto; } }

/* The top bar shows no page title: each page has its own heading. The element stays as the spacer that pushes the
   top-bar buttons to the right, and still sets the browser tab title. */
.topbar-title { visibility: hidden; }
