/* Student Rotation Platform: shared design system.
   Tenant colors arrive as --brand / --accent from /brand/theme.css; everything else derives from them. */

:root {
  --brand: #1b3665;
  --accent: #e8b018;
  --brand-deep: color-mix(in srgb, var(--brand) 60%, #000);
  --brand-tint: color-mix(in srgb, var(--brand) 9%, #fff);
  --accent-tint: color-mix(in srgb, var(--accent) 22%, #fff);

  --ink: #0f1f3a;
  --ink-2: #3b4a64;
  --ink-3: #56637c;
  --line: #dfe4ec;
  --line-2: #c9d1de;
  --control-border: #7f8ba0;

  --page: #f4f6fa;
  --surface: #fff;
  --surface-2: #fafbfd;
  --surface-sunk: #eef1f6;
  --surface-head: #f6f8fb;

  --shadow-1: 0 1px 2px rgba(17, 32, 58, 0.05);
  --shadow-2: 0 2px 6px -2px rgba(17, 32, 58, 0.1);
  --shadow-3: 0 12px 28px -12px rgba(11, 24, 46, 0.3);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-control: 8px;
  --gutter: clamp(14px, 2.2vw, 28px);

  /* Widths in rem so the whole layout tracks the root size set below. */
  --container: 72rem;
  --container-form: 50rem;
  --container-wide: 80rem;
  --sidebar-w: 17rem;

  --accent-ink: #6b4a00;    /* gold-family text on white, 8.1:1 */
  --accent-line: #b07f00;   /* gold-family rule on white, 3.6:1 */

  --danger: #b3342e;
  --danger-ink: #8a2a24;

  /* Request status colors (validated as an adjacent set; always paired with icon + label). */
  --status-pending: #d18f00;
  --status-approved: #1e8a4f;
  --status-completed: #2f64b8;
  --status-denied: #c9433c;
  --status-cancelled: #7b8497;
  --series-1: var(--brand);
  --chart-grid: #e1e5ee;
  --chart-axis: #a9b2c3;

  --font-sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-serif: "Source Serif 4", Georgia, Cambria, "Times New Roman", serif;
}

/* ---------- Base ---------- */

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

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

/* Laptops get a slightly smaller root so a 1366px screen shows as much as a desktop.
   Percent + rem keeps the browser's own font-size setting in play. */
@media (min-width: 900px) {
  html { font-size: clamp(0.97rem, 0.84rem + 0.16vw, 1.03rem); }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--page);
}

/* Public form and sign-in are read by students and parents, so they keep full size. */
body.public, body.auth { font-size: 1.0625rem; }

img { max-width: 100%; }

a { color: var(--brand); text-underline-offset: 0.18em; }
a:hover { color: var(--brand-deep); }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { line-height: 1.2; }

p { margin: 0 0 0.75rem; }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.18em; }

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

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200; padding: 0.6rem 1rem; border-radius: 10px;
  background: var(--ink); color: #fff; font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 12px; color: #fff; outline-color: var(--accent); }

main:focus { outline: none; }

.muted { color: var(--ink-3); }
.small { font-size: 0.88rem; }
.nowrap { white-space: nowrap; }
.num, .tabular { font-variant-numeric: tabular-nums; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem; margin: 0;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brand);
}
.eyebrow::before { content: ""; width: 18px; height: 3px; border-radius: 2px; background: var(--accent-line); }

.page-title {
  margin: 0.2rem 0 0.4rem;
  font-family: var(--font-serif); font-weight: 700; letter-spacing: -0.01em;
  font-size: clamp(1.45rem, 1.15rem + 0.9vw, 1.85rem); color: var(--ink);
}

.lead { margin: 0.25rem 0 0; max-width: 64ch; font-size: 1.05rem; color: var(--ink-2); }

.prose p { max-width: 70ch; margin: 0 0 1rem; }
.prose h2 { margin: 1.5rem 0 0.5rem; font-size: 1.1rem; }

/* ---------- Layout primitives ---------- */

.container { width: 100%; max-width: var(--container); margin: 0 auto; }
.container--form { max-width: var(--container-form); }
.container--wide { max-width: var(--container-wide); padding: clamp(20px, 3vw, 40px) var(--gutter); }

.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.stack--lg { gap: 1.5rem; }
.stack--sm { gap: 0.5rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.row--between { justify-content: space-between; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.6rem; }
.actions--start { justify-content: flex-start; }

.grid { display: grid; gap: 1.25rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.grid--main { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .grid--main { grid-template-columns: minmax(0, 1fr); } }

.page-header {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1rem 1.5rem; margin-bottom: 1.25rem;
}
.page-header .lead { font-size: 1rem; }
.page-header__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.page-intro { margin-bottom: 1.5rem; }

.back-link {
  display: inline-flex; align-items: center; gap: 0.35rem; margin-bottom: 0.5rem;
  color: var(--ink-2); font-weight: 600; text-decoration: none;
}
.back-link:hover { color: var(--brand); text-decoration: underline; }

/* ---------- Surfaces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.card--pad { padding: clamp(18px, 2.4vw, 26px); }
.card--flush { overflow: hidden; }

.card__header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.card__title { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.card__subtitle { margin: 0.1rem 0 0; font-size: 0.88rem; color: var(--ink-3); }
.card__body { padding: 14px 16px; }
.card__footer { padding: 10px 16px; border-top: 1px solid var(--line); }

.section-title { margin: 0 0 0.75rem; font-size: 1.05rem; font-weight: 700; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 40px; padding: 0.5rem 1rem; border: 1px solid transparent; border-radius: var(--radius-control);
  font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s, color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 1.1em; height: 1.1em; }

.btn--primary {
  color: #fff; background: var(--brand); box-shadow: var(--shadow-1);
}
.btn--primary:hover { color: #fff; background: var(--brand-deep); }

.btn--accent { color: var(--ink); background: var(--accent); box-shadow: var(--shadow-1); }
.btn--accent:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 85%, #fff); }

.btn--ghost {
  color: var(--ink); background: #fff; border-color: var(--control-border);
}
.btn--ghost:hover { color: var(--ink); background: #fff; border-color: color-mix(in srgb, var(--brand) 40%, transparent); }

.btn--danger { color: #fff; background: var(--danger); }
.btn--danger:hover { color: #fff; background: var(--danger-ink); }

.btn--quiet { color: var(--brand); background: transparent; padding-inline: 0.6rem; }
.btn--quiet:hover { background: var(--brand-tint); color: var(--brand-deep); }

.btn--sm { min-height: 34px; padding: 0.3rem 0.7rem; border-radius: var(--radius-sm); font-size: 0.9rem; }
.btn--lg { min-height: 46px; padding: 0.65rem 1.3rem; font-size: 1.05rem; }
.btn--block { width: 100%; }
.btn--icon { min-width: 40px; padding: 0.5rem; }
.btn--sm.btn--icon { min-width: 34px; }

/* The public form and sign-in keep 44px touch targets. */
body.public .btn, body.auth .btn, body.public .input, body.auth .input { min-height: 44px; }

.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }

/* Card buttons: whole-card targets, used sparingly. */
.action-cards { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.action-card {
  display: flex; align-items: center; gap: 0.85rem; width: 100%; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
  box-shadow: var(--shadow-1); color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
  transition: box-shadow 0.15s, background-color 0.15s, border-color 0.15s;
}
.action-card:hover { color: var(--ink); background: var(--surface-2); border-color: var(--control-border); box-shadow: var(--shadow-2); }
.action-card__title { display: block; font-weight: 700; }
.action-card__meta { display: block; font-size: 0.88rem; color: var(--ink-3); }
.action-card__arrow { margin-left: auto; color: var(--ink-3); }

.icon-tile {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: var(--brand-tint); color: var(--brand);
}
.icon-tile .icon { width: 20px; height: 20px; }
.icon-tile--accent { background: var(--accent-tint); color: var(--accent-ink); }
.icon-tile--green { background: #e3f4ea; color: #14583a; }
.icon-tile--blue { background: #e5edfa; color: #1d427c; }
.icon-tile--red { background: #fbe7e5; color: var(--danger-ink); }

/* ---------- Forms ---------- */

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; }

.field { display: grid; gap: 0.35rem; min-width: 0; align-content: start; }
.field__label { font-weight: 600; color: var(--ink); }
.field__legend { margin-bottom: 0.5rem; font-weight: 700; color: var(--ink); }
.field__hint { margin: 0; font-size: 0.92rem; color: var(--ink-3); }
.field__error { display: flex; align-items: center; gap: 0.35rem; margin: 0; font-size: 0.95rem; font-weight: 600; color: var(--danger-ink); }
.req { margin-left: 0.15rem; color: var(--danger); }

.input {
  width: 100%; min-height: 40px; padding: 0.5rem 0.8rem;
  border: 1px solid var(--control-border); border-radius: var(--radius-control); background: #fff;
  color: var(--ink); font: inherit; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:hover { border-color: #5f6b80; }
.input:focus-visible { outline: 3px solid var(--brand); outline-offset: 1px; border-color: var(--brand); border-radius: var(--radius-control); }
.input[aria-invalid="true"], .field--invalid .input { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.input:disabled { background: var(--surface-sunk); color: var(--ink-3); }
textarea.input { min-height: 110px; resize: vertical; }
select.input {
  appearance: none; padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b4a64' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.8rem center; background-size: 18px;
}
input[type="color"].input { width: 56px; padding: 4px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: 1.15rem; height: 1.15rem; margin: 0.18rem 0 0; accent-color: var(--brand); flex: none; }

.check { display: flex; align-items: flex-start; gap: 0.6rem; }
.check label { cursor: pointer; }
.check__hint { display: block; font-size: 0.9rem; color: var(--ink-3); }
.check-grid { display: grid; gap: 0.6rem 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }

.form-grid { display: grid; gap: 1rem 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.form-grid .span-all { grid-column: 1 / -1; }

.error-summary {
  padding: 14px 18px; border: 2px solid var(--danger); border-radius: var(--radius-sm); background: #fff5f4; color: #6f1f1a;
}
.error-summary__title { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 1rem; }
.error-summary ul { margin: 0.4rem 0 0; padding-left: 1.6rem; }
.error-summary a { color: var(--danger-ink); font-weight: 600; }

.notice {
  display: flex; gap: 0.7rem; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface-2);
}
.notice p { margin: 0; }
.notice > .icon { margin-top: 0.15rem; }
.notice--info { background: #eef4fd; border-color: #bcd0f0; color: #1d3f73; }
.notice--success { background: #eaf7ef; border-color: #a9d9bd; color: #14583a; }
.notice--warning { background: #fff7e3; border-color: #efd28a; color: #5e4200; }

/* ---------- Choice cards (radio card buttons) ---------- */

.choices { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.choices--compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }

.choice {
  position: relative; display: flex; align-items: flex-start; gap: 0.8rem; padding: 12px 14px;
  border: 1px solid var(--control-border); border-radius: var(--radius-sm); background: #fff;
  box-shadow: var(--shadow-1); cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.choice:hover { border-color: var(--brand); box-shadow: var(--shadow-2); }
.choice:has(input:focus-visible) { outline: 3px solid var(--brand); outline-offset: 2px; }
.choice:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-tint);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.choice:has(input:disabled) { cursor: not-allowed; background: var(--surface-sunk); box-shadow: none; border-style: dashed; }

.choice__mark {
  display: grid; place-items: center; flex: none; width: 22px; height: 22px; margin-top: 1px;
  border: 2px solid var(--control-border); border-radius: 50%; background: #fff; color: transparent;
}
.choice__mark .icon { width: 13px; height: 13px; }
.choice:has(input:checked) .choice__mark { border-color: var(--brand); background: var(--brand); color: #fff; }
.choice__body { display: grid; gap: 0.15rem; min-width: 0; }
.choice__title { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.choice__meta { font-size: 0.9rem; color: var(--ink-3); }
.choice:has(input:disabled) .choice__title { color: var(--ink-3); }

.meter { height: 6px; margin-top: 0.4rem; border-radius: 2px; background: color-mix(in srgb, var(--brand) 14%, #fff); overflow: hidden; }
.meter__fill { height: 100%; border-radius: 2px; background: var(--brand); }

/* ---------- Wizard ---------- */

.stepper { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.25rem; margin: 0 0 1.25rem; padding: 0; list-style: none; }
.stepper__item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; text-align: center; font-size: 0.88rem; color: var(--ink-3); }
.stepper__item + .stepper__item::before {
  content: ""; position: absolute; top: 17px; right: calc(50% + 24px); left: calc(-50% + 24px); height: 2px; background: var(--line-2);
}
.stepper__dot {
  position: relative; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--control-border); background: #fff; color: var(--ink-2); font-weight: 700;
}
.stepper__dot .icon { width: 16px; height: 16px; }
.stepper__item--done { color: var(--ink-2); }
.stepper__item--done .stepper__dot { border-color: var(--brand); background: var(--brand); color: #fff; }
.stepper__item--done + .stepper__item::before, .stepper__item--current::before { background: var(--brand); }
.stepper__item--current { color: var(--ink); font-weight: 700; }
.stepper__item--current .stepper__dot {
  border-color: var(--accent-line); background: var(--accent); color: var(--ink);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 24%, transparent);
}
@media (max-width: 600px) { .stepper__label { display: none; } }

.wizard__header { padding: clamp(20px, 3vw, 28px) clamp(20px, 3vw, 32px) 0; }
.wizard__step { margin: 0; font-size: 0.85rem; font-weight: 700; color: var(--ink-3); }
.wizard__title { margin: 0.2rem 0 0.25rem; font-size: 1.35rem; }
.wizard__body { padding: 1.25rem clamp(20px, 3vw, 32px); }
.wizard__footer {
  display: flex; flex-wrap: wrap-reverse; justify-content: space-between; gap: 0.75rem;
  padding: 1rem clamp(20px, 3vw, 32px) clamp(20px, 3vw, 28px); border-top: 1px solid var(--line);
}
.wizard__footer .btn--primary { margin-left: auto; }

.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.slot-notice { display: flex; align-items: center; gap: 0.4rem; margin: 0 0 0.75rem; }
.week-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.week-nav__label { margin: 0; font-weight: 700; }
.day-group { margin: 0 0 1.1rem; }
.day-group__title { margin: 0 0 0.5rem; font-size: 0.95rem; font-weight: 700; color: var(--ink-2); }

.confirmation { text-align: center; }
.confirmation .reference {
  display: inline-block; margin: 0.5rem 0 1rem; padding: 0.5rem 1.1rem; border-radius: 12px;
  background: var(--accent-tint); border: 1px dashed var(--accent-line);
  font-size: 1.5rem; font-weight: 700; letter-spacing: 0.06em;
}
.confirmation .steps { display: grid; gap: 0.5rem; max-width: 520px; margin: 1rem auto 1.5rem; padding: 0; list-style: none; text-align: left; }
.confirmation .steps li { display: flex; gap: 0.6rem; align-items: flex-start; }

/* ---------- Details, results, timeline ---------- */

.details { display: grid; margin: 0; border-top: 1px solid var(--line); }
.details__row { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); gap: 1rem; padding: 0.65rem 0; border-bottom: 1px solid var(--line); }
.details dt { font-weight: 600; color: var(--ink-3); }
.details dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.details--compact .details__row { padding: 0.45rem 0; }
@media (max-width: 480px) { .details__row { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; } }

.decision .details { margin: 1rem 0 1.5rem; }

.result { text-align: center; }
.result .lead { margin-inline: auto; }
.result .details { text-align: left; margin: 1.25rem 0; }
.result__icon { display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: 0.5rem; border-radius: 50%; }
.result__icon .icon { width: 32px; height: 32px; }
.result--success .result__icon { background: #e3f4ea; color: #14583a; }
.result--neutral .result__icon { background: var(--brand-tint); color: var(--brand); }
.result--warning .result__icon { background: #fff3d6; color: #6b4a00; }

.timeline { display: grid; margin: 0; padding: 0; list-style: none; }
.timeline__item { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 0.75rem; padding-bottom: 1rem; }
.timeline__item:not(:last-child)::before { content: ""; position: absolute; top: 30px; bottom: 0; left: 14px; width: 2px; background: var(--line-2); }
.timeline__dot { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-2); background: #fff; color: var(--ink-2); }
.timeline__dot .icon { width: 15px; height: 15px; }
.timeline__title { margin: 0.2rem 0 0; font-weight: 600; }
.timeline__meta { margin: 0; font-size: 0.86rem; color: var(--ink-3); }
.timeline__note { margin: 0.35rem 0 0; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); background: var(--surface-sunk); font-size: 0.93rem; overflow-wrap: anywhere; }

/* ---------- Status flags (icon + label, never color alone) ----------
   A squared flag with a colored left rule. The word and the icon carry the meaning;
   the rule is decorative, and solid vs dashed separates denied from cancelled. */

.badge {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.45rem 0.15rem 0.4rem;
  border: 1px solid var(--st-line, var(--line-2)); border-left: 3px solid var(--st-key, var(--ink-3));
  border-radius: 3px; background: var(--st-bg, var(--surface-sunk)); color: var(--st-ink, var(--ink-2));
  font-size: 0.8125rem; font-weight: 700; line-height: 1.35; white-space: nowrap;
}
.badge .icon { width: 13px; height: 13px; }
.badge--pending, .badge--warning { --st-key: #d18f00; --st-bg: #fdf6e6; --st-line: #e8d4a0; --st-ink: #6b4a00; }
.badge--approved, .badge--success { --st-key: #1e8a4f; --st-bg: #eaf5ef; --st-line: #b4d9c4; --st-ink: #12583a; }
.badge--completed, .badge--info { --st-key: #2f64b8; --st-bg: #eaf0fa; --st-line: #bccfee; --st-ink: #1d427c; }
.badge--denied, .badge--danger { --st-key: #c9433c; --st-bg: #fbeceb; --st-line: #efbdb8; --st-ink: #8a2a24; }
.badge--cancelled, .badge--neutral { --st-key: #6f7a8d; --st-bg: #f1f3f7; --st-line: #d3d9e2; --st-ink: #414a5a; border-left-style: dashed; }

/* ---------- Filters (one uniform row above the content they scope) ---------- */

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; margin-bottom: 1rem; padding: 14px 16px; }
.filter { display: grid; gap: 0.25rem; flex: 1 1 150px; min-width: 0; max-width: 230px; }
.filter--search { flex: 2 1 220px; max-width: 320px; }
.filter--range { flex: 1 1 200px; max-width: 420px; }
.filter__label { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em; color: var(--ink-2); }
.filter .input { min-height: 38px; padding-block: 0.4rem; border-radius: var(--radius-control); }
.filter__search { position: relative; }
.filter__search .icon { position: absolute; top: 50%; left: 0.75rem; width: 18px; height: 18px; color: var(--ink-3); transform: translateY(-50%); pointer-events: none; }
.filter__search .input { padding-left: 2.3rem; }
.filter__range { display: flex; gap: 0.5rem; }
.filter__range > * { flex: 1 1 0; min-width: 0; }
.filters__actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
@media (max-width: 680px) {
  .filter, .filter--search, .filter--range { flex-basis: 100%; max-width: none; }
  .filter__range { flex-wrap: wrap; }
  .filter__range > * { flex-basis: 140px; }
  .filters__actions { margin-left: 0; }
}

/* ---------- Tables ---------- */

.table-wrap { position: relative; overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.95rem; }
.table th, .table td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-head);
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; color: var(--ink-2);
}
.table tbody tr { transition: background-color 0.12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody th { font-weight: 600; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table__primary { font-weight: 700; color: var(--ink); text-decoration: none; }
a.table__primary:hover { color: var(--brand); text-decoration: underline; }
.table__sub { display: block; font-size: 0.86rem; font-weight: 400; color: var(--ink-3); }
.table__actions { text-align: right; white-space: nowrap; }
.table--compact th, .table--compact td { padding: 0.4rem 0.6rem; }

.sort {
  display: inline-flex; align-items: center; gap: 0.25rem; padding: 0; border: 0; border-radius: 6px;
  background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer;
}
.sort .icon { width: 14px; height: 14px; }
.sort:hover { color: var(--ink); }

.is-refreshing { opacity: 0.55; transition: opacity 0.15s; }

.pager {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.7rem 1rem; border-top: 1px solid var(--line); font-size: 0.92rem; color: var(--ink-2);
}
.pager__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.pager select.input { width: auto; min-height: 36px; padding-block: 0.25rem; }

.empty { display: grid; justify-items: center; gap: 0.4rem; padding: 2.5rem 1rem; text-align: center; color: var(--ink-3); }
.empty__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--surface-sunk); color: var(--ink-2); }
.empty__title { margin: 0; font-weight: 700; color: var(--ink); }

.page-loading { padding: 3rem 1rem; text-align: center; color: var(--ink-3); }

/* ---------- KPI tiles ---------- */

.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); margin-bottom: 1.25rem; }
.kpi { display: grid; gap: 0.15rem; padding: 14px 16px; }
.kpi__top { display: flex; align-items: center; gap: 0.65rem; }
.kpi__label { margin: 0; font-size: 0.92rem; font-weight: 600; color: var(--ink-2); }
.kpi__value { margin: 0.3rem 0 0; font-size: clamp(1.5rem, 1.2rem + 0.8vw, 1.95rem); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; color: var(--ink); }
.kpi__meta { margin: 0; font-size: 0.86rem; color: var(--ink-3); }

/* ---------- Segmented controls and tabs ---------- */

.segmented { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-sunk); }
.segmented button {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 34px; padding: 0.35rem 0.8rem;
  border: 0; border-radius: 5px; background: transparent; color: var(--ink-2); font: inherit; font-size: 0.92rem; font-weight: 600; cursor: pointer;
}
.segmented button:hover { color: var(--ink); background: #fff; }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------- Menus and multi-select ---------- */

.menu { position: relative; display: inline-flex; }
.menu__panel {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 40; display: grid; gap: 1px;
  min-width: 13rem; max-width: min(20rem, calc(100vw - 32px)); padding: 4px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow-3);
}
.menu__panel[hidden] { display: none; }
.menu__panel--start { right: auto; left: 0; }
.menu__item {
  display: flex; align-items: center; gap: 0.55rem; width: 100%; min-height: 36px; padding: 0.4rem 0.6rem;
  border: 0; border-radius: 5px; background: none; color: var(--ink); font: inherit; font-weight: 600;
  text-align: left; text-decoration: none; cursor: pointer;
}
.menu__item:hover { color: var(--ink); background: var(--surface-sunk); }
.menu__item .icon { color: var(--ink-3); }
.menu__item--danger { color: var(--danger-ink); }
.menu__item--danger:hover { color: var(--danger-ink); background: #fbeceb; }
.menu__item--danger .icon { color: var(--danger-ink); }
.menu__item:disabled { opacity: 0.5; cursor: not-allowed; }

.multiselect__trigger { justify-content: space-between; width: 100%; font-weight: 400; }
.multiselect__summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-grid--scroll { max-height: min(22rem, 45vh); overflow-y: auto; padding-right: 0.25rem; }

/* ---------- Charts ---------- */

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart__grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart__axis { stroke: var(--chart-axis); stroke-width: 1; }
.chart__tick { fill: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart__bar { fill: var(--series-1); transition: opacity 0.12s; }
.chart__hit { fill: transparent; cursor: default; }
.chart svg:focus-visible { outline: 3px solid var(--brand); outline-offset: 4px; }
.chart--active .chart__bar:not(.is-active) { opacity: 0.45; }

.chart-tooltip {
  position: absolute; z-index: 5; min-width: 160px; padding: 0.5rem 0.7rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: #fff; box-shadow: var(--shadow-3); font-size: 0.86rem; pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
}
.chart-tooltip__title { margin: 0 0 0.2rem; color: var(--ink-3); }
.chart-tooltip__value { margin: 0 0 0.25rem; font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.chart-tooltip__row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.chart-tooltip__row span:first-child { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--ink-2); }
.line-key { display: inline-block; width: 12px; height: 3px; border-radius: 2px; }

.bar-list { display: grid; gap: 0.45rem; margin: 0; padding: 0; list-style: none; }
.bar-list__row { display: grid; grid-template-columns: minmax(120px, 36%) minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; padding: 4px 6px; border-radius: 8px; font-size: 0.93rem; }
.bar-list__row:hover { background: var(--surface-2); }
.bar-list__label { overflow-wrap: anywhere; color: var(--ink); }
.bar-list__track { height: 14px; }
.bar-list__fill { height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--series-1); }
.bar-list__value { min-width: 3ch; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) {
  .bar-list__row { grid-template-columns: minmax(0, 1fr) auto; }
  .bar-list__track { grid-column: 1 / -1; grid-row: 2; }
}

.stack-bar { display: flex; gap: 2px; height: 20px; }
.stack-bar__seg { height: 100%; min-width: 4px; }
.stack-bar__seg:first-child { border-radius: 5px 0 0 5px; }
.stack-bar__seg:last-child { border-radius: 0 5px 5px 0; }
.stack-bar__seg:only-child { border-radius: 5px; }

.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin: 0.9rem 0 0; padding: 0; list-style: none; font-size: 0.92rem; }
.legend__item { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--ink-2); }
.legend__swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend__value { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Dialog ---------- */

dialog.modal {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line-2);
  border-radius: var(--radius); background: #fff; color: var(--ink); box-shadow: var(--shadow-3);
}
dialog.modal[open] { display: flex; flex-direction: column; }
dialog.modal--wide { width: min(900px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(8, 21, 40, 0.5); }
.modal__form { display: flex; flex-direction: column; min-height: 0; flex: 1; margin: 0; }
.modal__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 20px 24px 14px; border-bottom: 1px solid var(--line); }
.modal__title { margin: 0; font-family: var(--font-serif); font-size: 1.3rem; }
.modal__body { display: grid; gap: 1rem; padding: 18px 24px; overflow-y: auto; }
.modal__footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.6rem; padding: 14px 24px 18px; border-top: 1px solid var(--line); background: var(--surface-head); }
@media (prefers-reduced-motion: no-preference) {
  dialog.modal[open] { animation: modal-in 0.18s ease-out; }
  @keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
}

/* ---------- Toasts ---------- */

.toasts { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 300; display: grid; gap: 0.5rem; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 0.6rem; padding: 12px 14px; border-radius: var(--radius-sm);
  background: #0c1d38; color: #fff; box-shadow: var(--shadow-3);
}
.toast .icon { margin-top: 0.1rem; color: var(--accent); }
.toast--error { background: #7f241f; }
.toast--error .icon { color: #fff; }
.toast p { margin: 0; }

/* ---------- Public site ---------- */

.site-header {
  position: sticky; top: 0; z-index: 20; color: #fff;
  background: var(--brand);
  border-bottom: 3px solid var(--accent);
}
.site-header__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; max-width: var(--container); margin: 0 auto; padding: 0.5rem var(--gutter); }
.site-header :focus-visible, .site-footer :focus-visible { outline-color: var(--accent); }
.brand { display: flex; align-items: center; gap: 0.9rem; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand__logo { height: 2.75rem; width: auto; }
.brand__logo--plate { padding: 4px 8px; border-radius: var(--radius-sm); background: #fff; }
.brand__text { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 700; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.site-nav a {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 44px; padding: 0.5rem 0.8rem; border-radius: 10px;
  color: #e6edf7; font-weight: 600; text-decoration: none;
}
.site-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.site-nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.12); box-shadow: inset 0 -3px 0 var(--accent); }
.site-main { padding: clamp(20px, 3.5vw, 44px) var(--gutter) 48px; }
.site-footer { color: #d3dbe8; background: color-mix(in srgb, var(--brand) 55%, #000); border-top: 3px solid var(--accent); }
.site-footer__inner { max-width: var(--container); margin: 0 auto; padding: 1.1rem var(--gutter); font-size: 0.92rem; }
.site-footer__links { margin-top: 0.6rem; }
.site-footer__links a { font-weight: 600; }
.site-footer p { margin: 0.2rem 0; }
.site-footer a { color: #fff; }

/* ---------- Auth ---------- */

.auth__main { display: grid; place-items: center; align-content: center; gap: 1rem; min-height: 100vh; padding: 28px var(--gutter); }
.auth__card { width: min(100%, 27rem); overflow: hidden; }
.auth__brand {
  display: grid; justify-items: center; gap: 0.5rem; padding: 1.25rem 1.25rem 1.1rem; text-align: center;
  background: var(--brand); border-bottom: 3px solid var(--accent);
}
.auth__brand--plate { background: #fff; border-bottom: 1px solid var(--line); }
.auth__logo { height: 3.5rem; width: auto; }
.auth__program { margin: 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #dbe4f2; }
.auth__brand--plate .auth__program { color: var(--brand); }
.auth__body { padding: clamp(18px, 2.4vw, 26px); }
.auth__links { margin: 1.1rem 0 0; }
.auth__back { text-align: center; }
.auth__back a { color: var(--ink-2); }
.platform .kpis { margin-top: 0.5rem; }

/* ---------- Portal shell ---------- */

.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; overflow-y: auto; color: #d5deeb;
  background: var(--brand);
  border-right: 1px solid var(--brand-deep);
}
.sidebar :focus-visible { outline-color: var(--accent); }
.sidebar__top { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 14px 16px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.sidebar__brand { display: block; padding: 2px 0; }
.sidebar__brand--plate { padding: 5px 9px; border-radius: var(--radius-sm); background: #fff; }
.sidebar__logo { display: block; height: 2.6rem; width: auto; max-width: 11rem; }
.sidebar__name { display: block; padding: 0.25rem; font-weight: 700; color: var(--ink); }
.sidebar__toggle { display: none; color: #fff; background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.18); }
.sidebar__toggle:hover { color: #fff; background: rgba(255, 255, 255, 0.16); }

.nav { flex: 1; padding: 12px 12px 20px; }
.nav__group + .nav__group { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.nav__title { margin: 0 10px 6px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: #a8b7cc; }
.nav__list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav__link {
  display: flex; align-items: center; gap: 0.7rem; min-height: 36px; padding: 0.45rem 0.7rem; border-radius: var(--radius-sm);
  color: #dbe3ef; font-weight: 600; text-decoration: none; transition: background-color 0.12s, color 0.12s;
}
.nav__link .icon { width: 19px; height: 19px; opacity: 0.85; }
.nav__link:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.nav__link[aria-current="page"] {
  color: #fff; background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav__link[aria-current="page"] .icon { color: var(--accent); opacity: 1; }

.sidebar__credit { display: flex; align-items: center; gap: 0.6rem; margin: 0; padding: 14px 18px 18px; border-top: 1px solid rgba(255, 255, 255, 0.07); font-size: 0.78rem; line-height: 1.35; color: #b3c0d3; }

.workspace { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.5rem var(--gutter); border-bottom: 1px solid var(--line); background: #fff;
}
.topbar__program { margin: 0; font-family: var(--font-serif); font-weight: 700; color: var(--ink-2); }
.topbar__user { display: flex; align-items: center; gap: 0.75rem; }
.topbar__user form { margin: 0; }
.topbar__who { display: grid; line-height: 1.2; }
.topbar__who strong { font-size: 0.95rem; }
.topbar__who span { font-size: 0.82rem; color: var(--ink-3); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--ink); font-size: 0.88rem; font-weight: 700; }

.main { flex: 1; padding: clamp(16px, 2.2vw, 26px) var(--gutter) 32px; }
.portal-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1.5rem; padding: 14px var(--gutter) 22px; border-top: 1px solid var(--line); font-size: 0.88rem; color: var(--ink-3); }
.portal-footer p { margin: 0; }

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: relative; height: auto; overflow: visible; }
  .sidebar__toggle { display: inline-flex; }
  .sidebar .nav, .sidebar .sidebar__credit { display: none; }
  .sidebar.is-open .nav { display: block; }
  .sidebar.is-open .sidebar__credit { display: flex; }
  .topbar__program { display: none; }
  .topbar { justify-content: flex-end; }
}
@media (max-width: 520px) {
  .topbar__who { display: none; }
}

/* ---------- Page pieces ---------- */

.stack > .page-header, .stack > .filters, .stack > .kpis { margin-bottom: 0; }
.wizard__title, .page-title, .error-summary { scroll-margin-top: 96px; }
.card__toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.card__note { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1rem; font-size: 0.9rem; color: var(--ink-3); }
.card__body > .notice { margin-bottom: 1rem; }
.card__body > form + .list { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.pager p { margin: 0; }
.modal__body .section-title { margin: 0.5rem 0 0; }

button.table__primary {
  padding: 0; border: 0; border-radius: 4px; background: none; font: inherit; font-weight: 700;
  color: var(--ink); text-align: left; cursor: pointer;
}
button.table__primary:hover { color: var(--brand); text-decoration: underline; }

.list { margin: 0; padding: 0; list-style: none; }
.list__item { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.list__item:first-child { padding-top: 0; }
.list__item:last-child { padding-bottom: 0; border-bottom: 0; }
.list__main { display: grid; flex: 1; gap: 0.1rem; min-width: 0; }
.list__title { font-weight: 700; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
a.list__title:hover { color: var(--brand); text-decoration: underline; }
.list__meta { font-size: 0.88rem; color: var(--ink-3); overflow-wrap: anywhere; }
.list__body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.list__side { display: grid; justify-items: end; gap: 0.25rem; }
.list__arrow { color: var(--ink-3); }

.timeline__dot--pending { border-color: var(--status-pending); color: #6b4a00; }
.timeline__dot--approved { border-color: var(--status-approved); color: #14583a; }
.timeline__dot--completed { border-color: var(--status-completed); color: #1d427c; }
.timeline__dot--denied { border-color: var(--status-denied); color: var(--danger-ink); }
.timeline__dot--cancelled { border-color: var(--status-cancelled); color: #464e5f; }

.seats { display: grid; gap: 0.3rem; min-width: 96px; }
.seats .meter { margin-top: 0; }
.meter, .meter__fill, .bar-list__track, .bar-list__fill { display: block; }
.bar-list__fill--other { opacity: 0.45; }
.stack-bar__seg--empty { flex: 1; background: var(--surface-sunk); }

.form-grid--pair { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.modal__footer-start { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-right: auto; }

.assignment {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto auto; align-items: end; gap: 0.6rem 0.75rem;
  padding: 0.75rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface-2);
}
.assignment .check { padding-bottom: 0.7rem; }
@media (max-width: 640px) { .assignment { grid-template-columns: minmax(0, 1fr); } }

.role-groups { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.role-groups .check-grid { grid-template-columns: minmax(0, 1fr); }

.color-field { display: flex; gap: 0.5rem; }
.color-field input[type="color"] { flex: none; width: 52px; padding: 4px; }
.logo-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.logo-preview img { height: 3.5rem; width: auto; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--brand); }
.logo-preview img.is-plate { background: #fff; }
.logo-preview__icon { height: 3.5rem; width: 3.5rem; object-fit: contain; }
input[type="file"] { width: 100%; max-width: 100%; font: inherit; }

.code-list { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.25rem 0 0; padding: 0; list-style: none; }
.code-list code, .code-cell { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.84rem; }
.code-list code { padding: 0.15rem 0.45rem; border-radius: 6px; background: var(--surface-sunk); }
.code-cell { overflow-wrap: anywhere; }

.review-section + .review-section { margin-top: 1.25rem; }
.review-section__header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.35rem; }
.review-section__title { margin: 0 0 0.35rem; font-size: 1.02rem; }
.review-section .check { margin-top: 0.75rem; }

.confirmation .details { max-width: 520px; margin-inline: auto; }
.confirmation .steps .icon { margin-top: 0.2rem; color: var(--brand); }

@media (max-width: 600px) {
  .stepper__label {
    display: block; position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}

.page-header .back-link { display: flex; width: fit-content; }
.card__header > :first-child { flex: 1 1 10rem; min-width: 0; }
.card__body > .details { border-top: 0; }
.card__body > .details .details__row:first-child { padding-top: 0; }
.card__body > .details .details__row:last-child { padding-bottom: 0; border-bottom: 0; }
@media (max-width: 720px) { .site-header { position: static; } }

html { -webkit-tap-highlight-color: transparent; }
.color-field .input:not([type="color"]) { flex: 1; min-width: 0; }
.table-wrap > .table { min-width: 36rem; }
@media (max-width: 520px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .kpi { padding: 14px; }
  .kpi__top { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
}

/* Short laptop screens (1366x768 and friends) get tighter chrome so more rows fit. */
@media (min-width: 900px) and (max-height: 820px) {
  :root { --gutter: 16px; }
  .main { padding: 14px var(--gutter) 28px; }
  .site-main { padding: 22px var(--gutter) 36px; }
  .card--pad, .auth__body { padding: 18px 20px; }
  .topbar { padding: 0.4rem var(--gutter); }
  .kpi { padding: 12px 14px; }
  .auth__main { min-height: auto; padding-block: 24px; }
}

/* ---------- Accessibility modes ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .card, .choice, .btn, .badge, .input, .action-card { border: 1px solid CanvasText; }
  .stack-bar__seg, .bar-list__fill, .chart__bar, .meter__fill { forced-color-adjust: none; }
}

@media print {
  .sidebar, .topbar, .portal-footer, .site-header, .site-footer, .filters, .pager, .toasts { display: none !important; }
  .shell { display: block; }
  .card { box-shadow: none; border-color: #ccc; }
  body { background: #fff; }
}
