/* ==========================================================================
   ICAB Portal — design system
   One dark, glass-surfaced theme replacing the four divergent looks of the
   legacy projects. Everything is driven by the tokens in :root so a rebrand
   is a single-block edit.
   ========================================================================== */

/* --- Tokens ------------------------------------------------------------- */
:root {
  --bg-base:      #05070d;
  --bg-deep:      #030509;
  --surface:      rgba(17, 24, 40, 0.62);
  --surface-2:    rgba(24, 33, 54, 0.55);
  --surface-solid:#111828;
  --line:         rgba(148, 163, 200, 0.16);
  --line-strong:  rgba(148, 163, 200, 0.28);

  --text:         #e9edf7;
  --text-muted:   #93a0bd;
  --text-faint:   #66738f;

  --accent:       #4f8ef7;
  --accent-soft:  rgba(79, 142, 247, 0.14);
  --accent-line:  rgba(79, 142, 247, 0.42);
  --violet:       #8b7bf0;
  --cyan:         #38bdf8;

  --ok:           #34d399;
  --ok-soft:      rgba(52, 211, 153, 0.13);
  --warn:         #fbbf24;
  --warn-soft:    rgba(251, 191, 36, 0.13);
  --danger:       #f4726a;
  --danger-soft:  rgba(244, 114, 106, 0.13);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.45);

  --sidebar-w: 252px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* --- Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-base);
  background-image:
    radial-gradient(900px 620px at 12% -8%,  rgba(79, 142, 247, 0.13), transparent 60%),
    radial-gradient(760px 520px at 92% 4%,   rgba(139, 123, 240, 0.11), transparent 62%),
    radial-gradient(680px 680px at 60% 108%, rgba(56, 189, 248, 0.07),  transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; top: -100px; left: 12px; z-index: 999;
  padding: 10px 16px; border-radius: var(--r-md);
  background: var(--accent); color: #fff; font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* --- App shell ---------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  background: rgba(9, 13, 23, 0.86);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--line);
  transition: transform 0.28s var(--ease);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 20px; }
.brand__mark {
  width: 36px; height: 36px; flex: 0 0 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--accent), var(--violet));
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: 0.02em;
  box-shadow: 0 6px 18px rgba(79, 142, 247, 0.32);
}
.brand__text { min-width: 0; }
.brand__name { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.brand__sub { font-size: 11px; color: var(--text-faint); }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav__label {
  padding: 16px 10px 7px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-faint);
}
.nav__link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-md);
  color: var(--text-muted); font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.nav__link:hover { background: rgba(148, 163, 200, 0.07); color: var(--text); text-decoration: none; }
.nav__link[aria-current="page"] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: #cfe0ff;
}
.nav__link svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: 0.85; }

.sidebar__foot { padding-top: 14px; border-top: 1px solid var(--line); margin-top: 10px; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px;
  background: rgba(5, 7, 13, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { font-size: 15px; font-weight: 600; }
.topbar__spacer { flex: 1; }

.menu-toggle {
  display: none; width: 38px; height: 38px;
  align-items: center; justify-content: center;
  border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer;
}

.content { padding: 26px; max-width: 1440px; width: 100%; }

.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 25px; }
.page-head p { margin-top: 6px; color: var(--text-muted); max-width: 68ch; }

/* --- Surfaces ----------------------------------------------------------- */
.card {
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
}
.card__head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 17px 20px; border-bottom: 1px solid var(--line);
}
.card__title { font-size: 14.5px; font-weight: 600; }
.card__sub { font-size: 12.5px; color: var(--text-muted); }
.card__body { padding: 20px; }
.card__foot { padding: 14px 20px; border-top: 1px solid var(--line); }

.grid { display: grid; gap: 18px; }
.grid--stats  { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid--tools  { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--split  { grid-template-columns: minmax(300px, 360px) 1fr; align-items: start; }
.grid--info   { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* --- Stat tiles --------------------------------------------------------- */
.stat { padding: 18px 20px; }
.stat__label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-faint);
}
.stat__value { margin-top: 7px; font-size: 27px; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat__hint { margin-top: 3px; font-size: 12px; color: var(--text-muted); }

/* --- Forms -------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.field__label { font-size: 12.5px; font-weight: 550; color: var(--text-muted); }
.field__hint { font-size: 11.5px; color: var(--text-faint); }

.input, .select, .textarea {
  width: 100%;
  padding: 10px 13px;
  font: inherit; color: var(--text);
  background: rgba(6, 10, 20, 0.62);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 132px; resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.6; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2393a0bd'%3E%3Cpath d='M4.2 6.2 8 10l3.8-3.8H4.2Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 15px;
  padding-right: 34px;
}
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 17px;
  font: inherit; font-weight: 550; font-size: 13.5px;
  color: var(--text); cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: transform 0.12s var(--ease), background 0.16s var(--ease), border-color 0.16s var(--ease);
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: rgba(148, 163, 200, 0.13); transform: translateY(-1px); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary {
  background: linear-gradient(140deg, var(--accent), #3f6fd8);
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px rgba(79, 142, 247, 0.28);
}
.btn--primary:hover:not(:disabled) { background: linear-gradient(140deg, #5f9bff, #4a7ce4); }
.btn--danger { color: var(--danger); border-color: rgba(244, 114, 106, 0.34); background: var(--danger-soft); }
.btn--ghost { background: transparent; }
.btn--sm { padding: 6px 12px; font-size: 12.5px; }
.btn--block { width: 100%; }
.btn__spinner {
  width: 14px; height: 14px; flex: 0 0 14px;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-row { display: flex; gap: 9px; flex-wrap: wrap; }

/* --- Badges & pills ----------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
}
.badge--ok      { background: var(--ok-soft);     color: var(--ok);     border-color: rgba(52, 211, 153, 0.3); }
.badge--warn    { background: var(--warn-soft);   color: var(--warn);   border-color: rgba(251, 191, 36, 0.3); }
.badge--danger  { background: var(--danger-soft); color: var(--danger); border-color: rgba(244, 114, 106, 0.3); }
.badge--info    { background: var(--accent-soft); color: #9dc0ff;       border-color: var(--accent-line); }
.badge--neutral { background: rgba(148, 163, 200, 0.1); color: var(--text-muted); border-color: var(--line); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 7px; }

/* --- Grades ------------------------------------------------------------- */
/*
   Hues follow the ICAB grading chart so the portal reads the same way as the
   official key. Rendered as tinted chips rather than solid blocks, which is
   what the rest of this dark UI does and what keeps the text legible.
*/
.grade {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; padding: 3px 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.03em;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  text-transform: uppercase;
}
.grade--a  { background: rgba(67, 160, 71, 0.16);  color: #6ee79a; border-color: rgba(67, 160, 71, 0.42); }
.grade--b  { background: rgba(33, 150, 243, 0.16); color: #7cc4ff; border-color: rgba(33, 150, 243, 0.42); }
.grade--c  { background: rgba(243, 156, 18, 0.16); color: #ffc457; border-color: rgba(243, 156, 18, 0.44); }
.grade--d  { background: rgba(229, 57, 53, 0.16);  color: #ff8a84; border-color: rgba(229, 57, 53, 0.44); }
.grade--e  { background: rgba(142, 68, 173, 0.20); color: #cda2e8; border-color: rgba(142, 68, 173, 0.48); }
.grade--ep { background: rgba(22, 137, 127, 0.20); color: #5fd6c8; border-color: rgba(22, 137, 127, 0.48); }
.grade--ex { background: rgba(168, 118, 62, 0.20); color: #e0b078; border-color: rgba(168, 118, 62, 0.48); }
.grade--f  { background: rgba(148, 163, 200, 0.12); color: #9aa6c0; border-color: rgba(148, 163, 200, 0.30); }
.grade--cn { background: rgba(236, 64, 122, 0.16); color: #ff8fb4; border-color: rgba(236, 64, 122, 0.44); }
.grade--unknown { background: rgba(148, 163, 200, 0.12); color: var(--text-muted); border-color: var(--line-strong); }

/* Legend: the official key, reproduced so the colours are self-explanatory. */
.legend { display: grid; gap: 7px; }
.legend__row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-muted); }
.legend__row .grade { flex: 0 0 auto; }

/* --- Data display ------------------------------------------------------- */
.info-item {
  padding: 12px 14px;
  background: rgba(6, 10, 20, 0.42);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.info-item__label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-faint);
}
.info-item__value { margin-top: 4px; font-size: 14px; word-break: break-word; }
.info-item__value--mono { font-family: var(--mono); font-size: 13px; }

.section-title {
  display: flex; align-items: center; gap: 9px;
  margin: 24px 0 13px;
  font-size: 12px; font-weight: 650; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-muted);
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-title:first-child { margin-top: 0; }

.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  padding: 11px 14px; text-align: left;
  font-size: 11px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-faint);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap; background: rgba(6, 10, 20, 0.5);
  position: sticky; top: 0; z-index: 2;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background 0.13s var(--ease); }
.table tbody tr:hover { background: rgba(79, 142, 247, 0.06); }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  object-fit: cover; background: var(--surface-2);
  border: 1px solid var(--line-strong);
}
.avatar--lg { width: 108px; height: 108px; border-radius: var(--r-lg); }
.avatar--clickable { cursor: zoom-in; transition: transform 0.16s var(--ease); }
.avatar--clickable:hover { transform: scale(1.08); border-color: var(--accent); }

.photo-frame { display: flex; flex-direction: column; align-items: center; gap: 9px; }
.photo-placeholder {
  width: 108px; height: 108px;
  display: grid; place-items: center; text-align: center;
  padding: 8px; border-radius: var(--r-lg);
  border: 1px dashed var(--line-strong);
  background: rgba(6, 10, 20, 0.42);
  color: var(--text-faint); font-size: 11px;
}

/* --- Feedback ----------------------------------------------------------- */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 15px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 13.5px;
}
.alert--error { background: var(--danger-soft); border-color: rgba(244, 114, 106, 0.3); color: #ffb3ad; }
.alert--warn  { background: var(--warn-soft);   border-color: rgba(251, 191, 36, 0.3);  color: #ffd88a; }
.alert--ok    { background: var(--ok-soft);     border-color: rgba(52, 211, 153, 0.3);  color: #8ef0c8; }
.alert--info  { background: var(--accent-soft); border-color: var(--accent-line);       color: #b6d1ff; }
.alert svg { width: 17px; height: 17px; flex: 0 0 17px; margin-top: 1px; }

.empty { padding: 46px 22px; text-align: center; }
.empty__icon {
  width: 46px; height: 46px; margin: 0 auto 13px;
  display: grid; place-items: center; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-faint);
}
.empty__title { font-size: 14.5px; font-weight: 600; }
.empty__text { margin-top: 5px; font-size: 13px; color: var(--text-muted); }

/* Skeletons — shown while data is in flight. */
.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, rgba(148,163,200,0.07) 25%, rgba(148,163,200,0.15) 37%, rgba(148,163,200,0.07) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skeleton--line { height: 12px; margin-bottom: 9px; }
.skeleton--title { height: 19px; width: 42%; margin-bottom: 15px; }

.progress {
  height: 5px; border-radius: var(--r-pill);
  background: rgba(148, 163, 200, 0.13); overflow: hidden;
}
.progress__bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: var(--r-pill);
  transition: width 0.3s var(--ease);
}

/* Toasts */
.toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 200;
  display: flex; flex-direction: column-reverse; gap: 9px;
  max-width: min(380px, calc(100vw - 36px));
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 15px;
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-left-width: 3px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  animation: toast-in 0.25s var(--ease);
}
.toast--ok    { border-left-color: var(--ok); }
.toast--error { border-left-color: var(--danger); }
.toast--info  { border-left-color: var(--accent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* --- Result cards (bulk runs) ------------------------------------------- */
.result-list { display: flex; flex-direction: column; gap: 11px; max-height: 68vh; overflow-y: auto; padding-right: 4px; }
.result {
  padding: 15px 17px;
  background: rgba(6, 10, 20, 0.46);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--r-lg);
  animation: rise 0.28s var(--ease);
}
.result--ok    { border-left-color: var(--ok); }
.result--error { border-left-color: var(--danger); }
.result--pending { border-left-color: var(--text-faint); opacity: 0.72; }
.result__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.result__id { font-family: var(--mono); font-size: 13px; font-weight: 600; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --- Pagination --------------------------------------------------------- */
.pagination { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; justify-content: center; }
.pagination__btn {
  min-width: 34px; height: 34px; padding: 0 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-variant-numeric: tabular-nums;
  color: var(--text-muted); cursor: pointer;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}
.pagination__btn:hover:not(:disabled) { background: rgba(148, 163, 200, 0.1); color: var(--text); }
.pagination__btn[aria-current="page"] {
  background: var(--accent-soft); border-color: var(--accent-line); color: #cfe0ff; font-weight: 600;
}
.pagination__btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pagination__gap { padding: 0 4px; color: var(--text-faint); }

/* --- Code / output ------------------------------------------------------ */
.output {
  margin: 0; padding: 14px 16px;
  max-height: 300px; overflow: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
  color: #9fe6c4;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  white-space: pre-wrap; word-break: break-all;
}

/* --- Modal -------------------------------------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 300;
  display: none; place-items: center; padding: 26px;
  background: rgba(3, 5, 9, 0.86);
  backdrop-filter: blur(6px);
}
.modal[open], .modal.is-open { display: grid; }
.modal__img { max-width: min(90vw, 720px); max-height: 86vh; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }

/* --- Auth screen -------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.auth__card { width: 100%; max-width: 396px; }
.auth__head { text-align: center; padding: 30px 24px 6px; }
.auth__head h1 { font-size: 20px; margin-top: 14px; }
.auth__head p { margin-top: 6px; color: var(--text-muted); font-size: 13px; }
.auth .brand__mark { width: 46px; height: 46px; margin: 0 auto; font-size: 15px; }

/* --- Utilities ---------------------------------------------------------- */
.stack   { display: flex; flex-direction: column; gap: 18px; }
.row     { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.muted   { color: var(--text-muted); }
.faint   { color: var(--text-faint); }
.mono    { font-family: var(--mono); }
.nowrap  { white-space: nowrap; }
.tabnum  { font-variant-numeric: tabular-nums; }
.hidden  { display: none !important; }
.text-sm { font-size: 12.5px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 1080px) {
  .grid--split { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.is-open { transform: none; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 18px 15px; }
  .topbar { padding: 12px 15px; }
  .page-head h1 { font-size: 21px; }
  .card__body { padding: 16px; }

  /* Tables reflow into stacked key/value cards. */
  .table--responsive thead { display: none; }
  .table--responsive tbody tr {
    display: block; margin-bottom: 11px; padding: 12px;
    background: rgba(6, 10, 20, 0.42);
    border: 1px solid var(--line); border-radius: var(--r-md);
  }
  .table--responsive td {
    display: flex; justify-content: space-between; gap: 14px;
    padding: 6px 0; border: none; text-align: right;
  }
  .table--responsive td::before {
    content: attr(data-label);
    font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--text-faint);
    text-align: left; flex: 0 0 auto;
  }
}

.scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(3, 5, 9, 0.6);
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s var(--ease);
}
.scrim.is-visible { opacity: 1; pointer-events: auto; }
@media (min-width: 861px) { .scrim { display: none; } }

/* --- Motion & contrast preferences -------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: more) {
  :root { --line: rgba(190, 205, 235, 0.4); --line-strong: rgba(190, 205, 235, 0.6); --text-muted: #b9c4dc; }
}

@media print {
  .sidebar, .topbar, .btn, .toasts, .scrim { display: none !important; }
  body { background: #fff; color: #000; }
  .main { margin-left: 0; }
  .card { border: 1px solid #ccc; box-shadow: none; background: #fff; }
  .info-item { border: 1px solid #ddd; background: #fff; }
}
