
/* ==================================================================
 * GLOBAL SHELL
 *
 * The sidebar, navigation groups, topbar and drawer. The shell is the one
 * surface on screen at all times, so it must stay calm: brand chrome, current
 * context, and the controls that change presentation. Nothing here competes
 * for attention with the content.
 * ================================================================== */

.shell__sidebar { gap: 0; }

.sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-4) var(--space-4);
}

.sidebar__head .brand { min-width: 0; }
.sidebar__close { display: none; }

.sidebar__nav {
  flex: 1;
  min-height: 0;
  padding: 0 var(--space-3);
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

.nav-group + .nav-group { margin-top: var(--space-5); }

.nav-group__label {
  margin: 0 0 var(--space-2);
  padding-inline: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-micro);
  font-weight: var(--weight-micro);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.nav-group__list { margin: 0; padding: 0; list-style: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 2.5rem;
  margin-bottom: 2px;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  color: var(--text-secondary);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius-button);
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.nav-item:hover { color: var(--text-primary); background: var(--surface-3); }
[data-theme="dark"] .nav-item:hover { background: rgba(148, 180, 230, 0.08); }

.nav-item .fa-solid { flex: none; width: 1.15rem; color: var(--text-muted); transition: color var(--dur-fast) var(--ease-out); }
.nav-item:hover .fa-solid { color: var(--brand-accent); }

.nav-item__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/*
 * Active state: a tinted well plus a gold rail, not a solid block. The brief is
 * explicit that active navigation should not be a giant coloured rectangle, and
 * the previous build made hover and active differ by colour alone, so the two
 * were indistinguishable to a colour-blind reader. The rail and the weight are
 * both non-colour signals.
 */
.nav-item[aria-current="page"] {
  position: relative;
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
  background: var(--surface-3);
}

[data-theme="dark"] .nav-item[aria-current="page"] { background: rgba(148, 180, 230, 0.12); }

/* The active-destination marker: a gold bar on the leading edge.
   This rule was declared with an OPEN brace and never closed, so the browser
   parsed everything after it as nested CSS and dropped it -- including
   .sidebar__foot, which is why the sidebar footer rendered as an unstyled
   block and overlapped the navigation. Found by rendering the app in
   screenshots (Phase 27); no static test could see it, because balanced
   braces elsewhere in the file made the file look well-formed. */
.nav-item[aria-current="page"]::before {
  content: '';
  position: absolute;
  inset-block: 20%;
  inset-inline-start: 0;
  width: 3px;
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
  background: var(--brand-accent);
}

.sidebar__foot {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-nav);
}

.sidebar__collapse {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 2.25rem;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-ui);
  font-size: var(--text-caption);
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-button);
}
.sidebar__collapse:hover { color: var(--text-primary); background: var(--surface-3); }
[data-theme="dark"] .sidebar__collapse:hover { background: rgba(148, 180, 230, 0.08); }

.sidebar__status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-caption);
}

/* --------------------------------------------------- collapsed navigation
 * Icons only. The label is hidden here, so shell.js copies its text into
 * aria-label: hiding it with CSS alone would leave the button unnamed, which is
 * the classic icon-rail accessibility bug. */
.shell[data-sidebar="collapsed"] .nav-item__label,
.shell[data-sidebar="collapsed"] .nav-group__label,
.shell[data-sidebar="collapsed"] .sidebar__collapse span,
.shell[data-sidebar="collapsed"] .brand-text,
.shell[data-sidebar="collapsed"] .sidebar__status span:last-child {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.shell[data-sidebar="collapsed"] .nav-item { justify-content: center; }
.shell[data-sidebar="collapsed"] .nav-group + .nav-group { margin-top: var(--space-4); }
.shell[data-sidebar="collapsed"] .sidebar__head { justify-content: center; }
.shell[data-sidebar="collapsed"] .sidebar__collapse { justify-content: center; }

/* ---------------------------------------------------------------- topbar */
.shell__topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: var(--topbar-height);
  padding: var(--space-3) var(--space-6);
  background: var(--surface-topbar);
  border-bottom: 1px solid var(--border-subtle);
}

.shell__drawer-button { display: none; }

.topbar__context { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar__context .eyebrow { margin: 0; }

.topbar__search {
  position: relative;
  flex: 1;
  max-width: 30rem;
  margin-inline: auto;
}

.topbar__search input {
  width: 100%;
  min-height: 2.5rem;
  padding: var(--space-2) 3rem var(--space-2) var(--space-4);
  color: var(--text-primary);
  background: var(--surface-sunken);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-input);
}

/* The keyboard hint doubles as a legend: a search box with no sign it is the
   primary accelerator is just a text field.

   This rule shipped with an OPEN brace and no close, so every rule after it --
   all eight media queries and roughly sixty component rules -- was parsed as
   nested CSS and discarded. The phone layout, the drawer, the collapsed rail
   and the KPI rows were all silently gone. */
.topbar__kbd {
  position: absolute;
  top: 50%;
  right: var(--space-3);
  padding: 2px var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--text-micro);
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  pointer-events: none;
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 1023px) {
  .shell__drawer-button { display: grid; }
  .sidebar__close { display: grid; }
  .topbar__search { display: none; }
}

@media (max-width: 767px) {
  .shell { grid-template-columns: minmax(0, 1fr); }

  .shell__sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: var(--z-drawer);
    width: min(19rem, 86vw);
    background: var(--surface-nav);
    box-shadow: var(--shadow-overlay);
    transform: translateX(-102%);
    transition: transform var(--dur-slow) var(--ease-out);
  }

  .shell[data-drawer="open"] .shell__sidebar { transform: translateX(0); }

  .shell__topbar { padding-inline: var(--space-4); }
  .account__identity { display: none; }
}

/*
 * On a phone the topbar cannot hold the destination, the search field and the
 * account in one row: at 320px the h1 was squeezed to about four characters
 * and broke mid-word ("Home" rendered as "Ho / me"). The title is the one
 * thing that says where you are, so below 640px it takes the full width and
 * the controls drop to a row underneath.
 */
@media (max-width: 639px) {
  .shell__topbar {
    flex-wrap: wrap;
    row-gap: var(--space-3);
  }

  .topbar__context {
    order: 1;
    flex: 1 0 100%;
    min-width: 0;
  }

  /* The search field keeps its own row and its full width; the account sits
     beside it. Neither is allowed to shrink the destination below a
     readable width. */
  .topbar__search,
  .topbar__actions {
    order: 2;
  }
}

/*
 * The collapsed rail is a desktop affordance. A phone has no room for it, and
 * the labels must come back: they are the only thing naming the destinations
 * on a touch screen, and the icons alone are not a navigation.
 */
@media (max-width: 767px) {
  .shell[data-sidebar="collapsed"] .nav-item__label,
  .shell[data-sidebar="collapsed"] .nav-group__label,
  .shell[data-sidebar="collapsed"] .brand-text,
  .shell[data-sidebar="collapsed"] .sidebar__status span:last-child {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .shell[data-sidebar="collapsed"] .nav-item { justify-content: flex-start; }
  .shell[data-sidebar="collapsed"] .sidebar__head { justify-content: space-between; }
  .shell[data-sidebar="collapsed"] .sidebar__collapse { display: none; }
}

/* A scrim behind the open drawer, so the target to dismiss it is unambiguous. */
body.is-drawer-open::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-drawer) - 1);
  background: rgba(4, 10, 20, 0.6);
}

@media (min-width: 768px) {
  body.is-drawer-open::after { content: none; }
}


.topbar__results {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  z-index: var(--z-popover);
  max-height: 24rem;
  overflow-y: auto;
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
}

.topbar__actions { display: flex; align-items: center; gap: var(--space-3); flex: none; }

.account__identity { display: flex; flex-direction: column; line-height: 1.25; }
.account__identity strong { font-size: var(--text-body); color: var(--text-primary); }
.account__identity small { color: var(--text-muted); font-size: var(--text-micro); letter-spacing: 0.04em; }

/* ------------------------------------------------------------- breadcrumb */
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-caption);
  color: var(--text-muted);
}

.breadcrumb li + li::before { content: "/"; margin-right: var(--space-2); color: var(--border-strong); }
.breadcrumb__root { font-weight: var(--weight-semibold); }
.breadcrumb [aria-current="page"] { color: var(--text-secondary); }

.nav-item[aria-current="page"] .fa-solid { color: var(--brand-accent); }

.nav-empty {
  margin: var(--space-4) var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-caption);
  line-height: 1.5;
}

/*
 * Mamore UI v2 — component layer.
 *
 * Loaded after tokens.css + themes/*.css and after the v1 app.css, so a rule
 * here wins over a v1 rule of equal specificity. That is intentional: the
 * component layer is the new system, and the legacy stylesheet is the thing
 * being retired. Each block below is a component from the contract in
 * docs/ui-v2/COMPONENT_INVENTORY.md, and every one of them consumes semantic
 * tokens only -- no raw hex appears in this file.
 */

/* ------------------------------------------------------------- theme switch
 * A sun/moon toggle plus a radio menu. The two icons are stacked and one is
 * hidden per theme, so the control always shows the state it is in rather than
 * a generic gear. */
.theme-switcher { position: relative; }
.locale-switcher,
.currency-switcher { position: relative; }

/* The language's own short code, so the menu is scannable without reading three
   long names. EN/SW/FR are the codes the brief specifies. */
.locale-code {
  display: inline-grid;
  place-items: center;
  min-width: 1.75rem;
  height: 1.25rem;
  font-size: var(--text-micro);
  font-weight: var(--weight-micro);
  line-height: 1;
  color: var(--text-secondary);
  background: var(--surface-2);
  border-radius: var(--radius-xs);
}

/* Currency selector. The current code sits on the button itself so the operator
 * can see which currency they are reading in without opening the menu. */
.currency-switcher__button { gap: var(--space-1); }

.currency-switcher__code {
  font-size: var(--text-micro);
  font-weight: var(--weight-micro);
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.currency-switcher__name {
  margin-left: auto;
  color: var(--text-muted);
  font-size: var(--text-caption);
}

/* The rate line under the options, and the status the control wears.
 *
 * A rate that is not LIVE is stated, never hidden. The brief requires the
 * freshness of a rate to be visible, and a stale conversion shown with the same
 * confidence as a fresh one is the kind of quiet lie that costs money. */
.currency-switcher__rate {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: var(--text-caption);
  font-variant-numeric: tabular-nums;
}

.currency-switcher[data-rate-status="live"] .currency-switcher__rate { color: var(--tone-success); }
.currency-switcher[data-rate-status="cached"] .currency-switcher__rate { color: var(--tone-warning); }
.currency-switcher[data-rate-status="stale"] .currency-switcher__rate { color: var(--tone-danger); }

/* A non-live rate is marked on the control itself, not only in the menu, so the
 * state is visible while the menu is closed. */
.currency-switcher[data-rate-status="stale"] .currency-switcher__code,
.currency-switcher[data-rate-status="unavailable"] .currency-switcher__code { color: var(--tone-danger); }
.currency-switcher[data-rate-status="cached"] .currency-switcher__code { color: var(--tone-warning); }

.theme-switcher > .icon-button { position: relative; overflow: hidden; }

.theme-switcher [data-theme-icon] {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}

[data-theme-icon="light"] { opacity: 1; }
[data-theme-icon="dark"] { opacity: 0; transform: rotate(-40deg) scale(0.6); }
[data-theme="dark"] [data-theme-icon="light"] { opacity: 0; transform: rotate(40deg) scale(0.6); }
[data-theme="dark"] [data-theme-icon="dark"] { opacity: 1; transform: none; }

.theme-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: var(--z-popover);
  min-width: 11rem;
  padding: var(--space-1);
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
}

.theme-menu button {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font: inherit;
  font-size: var(--text-body);
  color: var(--text-secondary);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.theme-menu button:hover { background: var(--surface-3); color: var(--text-primary); }

/* The selected option is marked by tint, weight AND a check glyph in the
   ::after, so it is not communicated by colour alone (WCAG 1.4.1). */
.theme-menu button.is-active,
.theme-menu button[aria-checked="true"] {
  color: var(--text-primary);
  font-weight: var(--weight-h3);
  background: var(--brand-accent-soft);
}

.theme-menu button[aria-checked="true"]::after {
  content: "\f00c";
  margin-left: auto;
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: var(--brand-accent);
}

.theme-menu button .fa-solid { width: 1rem; text-align: center; color: var(--text-muted); }

/* ==================================================================
 * COMPONENT CONTRACT
 *
 * The classes below implement the contract in
 * docs/ui-v2/COMPONENT_INVENTORY.md. Three rules make this a system
 * rather than a collection of buttons:
 *
 *   1. FIVE button variants, no more. app.css defines seven
 *      (.primary/.secondary/.danger/.row-action/.sos/.sos-confirm/.text),
 *      which is why "which one do I use?" needs a decision every time.
 *   2. Status is SEMANTIC. A domain value (ONLINE, IN_TRANSIT, CRITICAL) is
 *      mapped to a tone by one lookup, never styled per page.
 *   3. Every asynchronous surface has four states: skeleton, empty, error,
 *      ready. They are defined here so a page cannot ship a spinner.
 * ================================================================== */

/* ------------------------------------------------------------------ Button
 * primary    the single main action in a view
 * secondary  supporting actions (Refresh, Export)
 * ghost      tertiary, repeated in a row
 * danger     REQUIRED for destructive operations
 * icon       square, always aria-labeled
 *
 * Destructive actions must use .btn--danger. This is the mechanism behind the
 * audit finding that void-payment and revoke-rescue-code were ordinary buttons:
 * a danger variant that looks unmistakably different makes the mistake visible
 * before the click rather than after it. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.25rem;
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}

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

.btn .fa-solid { font-size: 0.95em; flex: none; }

.btn--primary {
  color: #fff;
  background: var(--brand-action);
  border-color: var(--brand-action);
}
.btn--primary:hover:not(:disabled) { background: var(--brand-action-dark); border-color: var(--brand-action-dark); }

.btn--secondary {
  color: var(--text-primary);
  background: var(--surface-1);
  border-color: var(--border-control);
}
.btn--secondary:hover:not(:disabled) { background: var(--surface-3); }

.btn--ghost {
  color: var(--text-secondary);
  background: transparent;
}
.btn--ghost:hover:not(:disabled) { color: var(--text-primary); background: var(--surface-3); }

.btn--danger {
  color: #fff;
  background: var(--tone-danger);
  border-color: var(--tone-danger);
}
.btn--danger:hover:not(:disabled) { filter: brightness(0.92); }

.btn--icon {
  width: 2.25rem;
  min-height: 2.25rem;
  padding: 0;
  color: var(--text-secondary);
  background: transparent;
  border-color: var(--border-default);
}
.btn--icon:hover:not(:disabled) { color: var(--text-primary); background: var(--surface-3); }

.btn--sm { min-height: 1.75rem; padding: var(--space-1) var(--space-3); font-size: var(--text-body-s); }
.btn--lg { min-height: 2.75rem; padding: var(--space-3) var(--space-5); font-size: var(--text-body-l); }

/* Touch targets are at least 44px on a coarse pointer (WCAG 2.5.8), without

/* ------------------------------------------------------------- StatusPill
 * ONE status component for the whole product. The tone comes from a
 * data-tone attribute that the JS Status module sets from a single lookup
 * table; a page never picks a colour itself.
 *
 * Tone is NEVER the only signal. Every pill carries a visible text label, and
 * where a glyph is added it is aria-hidden so it is not announced twice. This
 * is the WCAG 1.4.1 requirement, and it is also simply more readable. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.15rem var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--text-micro);
  font-weight: var(--weight-micro);
  line-height: 1.6;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid;
  border-radius: var(--radius-pill);
}

.pill--success { color: var(--tone-success); background: var(--tone-success-bg); border-color: var(--tone-success); }
.pill--warning { color: var(--tone-warning); background: var(--tone-warning-bg); border-color: var(--tone-warning); }
.pill--danger  { color: var(--tone-danger);  background: var(--tone-danger-bg);  border-color: var(--tone-danger); }
.pill--info    { color: var(--tone-info);    background: var(--tone-info-bg);    border-color: var(--tone-info); }
.pill--neutral { color: var(--tone-neutral); background: var(--tone-neutral-bg); border-color: var(--tone-neutral); }

/* Rescue-protected assets get the brand gold, because "covered by rescue" is a
 * product state rather than a health state. It is the one place a pill is gold,
 * which keeps the accent meaningful. */
.pill--rescue { color: var(--brand-gold-text); background: var(--brand-accent-soft); border-color: var(--brand-accent); }

/* A pill for a domain value that has no known mapping. It degrades to neutral
 * and still shows the raw value, so a status added to the backend later renders
 * correctly instead of appearing unstyled. */
.pill--unknown { color: var(--tone-neutral); background: var(--tone-neutral-bg); border-color: var(--border-default); text-transform: none; }

/* ------------------------------------------------------------------- Card */
.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

.card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.card__title { font-size: var(--text-h3); font-weight: var(--weight-h3); color: var(--text-primary); }
.card__body { padding: var(--space-5); }
.card__body--flush { padding: 0; }
.card__footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-3);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}

/* ------------------------------------------------------- executive overview
 * The one place the seven-layer contract is implemented end to end. The layout
 * is the grid, not a stack of equal cards: the summary spans the row, the KPIs
 * sit beneath it, and the Action Center is given the widest column because it is
 * the part an executive actually acts on. */
.executive-summary { align-items: flex-start; }
.executive-summary__icon { font-size: 1.15rem; flex: none; margin-top: 0.1rem; }
.executive-summary__text {
  font-size: var(--text-body-l);
  line-height: var(--lh-body-l);
  color: var(--text-primary);
}
.executive-summary__stamp {
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-caption);
}


/* The critical count under an incident KPI is the part that changes a
   decision, so it is not a muted footnote. */
.metric__critical {
  color: var(--tone-danger);
  /* Paired with the type scale's own weight: there is no standalone
     --weight-semibold token in this system, and inventing one here would
     bypass the scale. */
  font: var(--weight-caption) var(--text-caption) / var(--lh-caption) var(--font-ui);
}

.executive-lower { margin-top: var(--space-5); align-items: start; }

/* -- the search palette ------------------------------------------------
 * A result list that floats under the search field. It is a listbox, so the
 * group headings are presentational and the rows are the only options: a
 * screen reader should hear "12 results" and then the references, not a
 * stream of divs. */
.palette__group + .palette__group { border-top: 1px solid var(--border-subtle); }
.palette__group-label {
  padding: var(--space-2) var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-micro);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.palette__row {
  display: flex; align-items: baseline; gap: var(--space-3);
  width: 100%; padding: var(--space-2) var(--space-3);
  font: inherit; text-align: left; background: transparent;
  border: 0; cursor: pointer;
}
/* aria-selected is the state, so the visual and the announced state are the
   same attribute and cannot drift apart. */
.palette__row[aria-selected="true"] { background: var(--surface-raised); }
.palette__row-ref { font-weight: var(--weight-semibold); }
.palette__row-meta { color: var(--text-muted); font-size: var(--text-caption); }
.palette__row-status { margin-left: auto; color: var(--text-muted); font-size: var(--text-micro); }

/* "No matches" and "you cannot search anything" are both legitimate answers
   and neither is an error; a failed request is. */
.palette__message { padding: var(--space-4) var(--space-3); color: var(--text-muted); }
.palette__message--error { color: var(--tone-danger); }

/* -- layer 3, the trend ------------------------------------------------
 * A sparkline is a SHAPE claim, so it is drawn from the declared date spine
 * rather than from the values alone: every point in `dates` gets a dot, and a
 * day with no activity is a dot at the baseline. Skipping the empty days would
 * rescale the axis and make a quiet fortnight look like a spike.
 */
.sparkline { display: flex; align-items: flex-end; gap: 2px; height: 40px; }
.sparkline__bar { flex: 1 1 0; min-width: 2px; border-radius: 2px 2px 0 0; background: var(--chart-1); }
.sparkline__bar[data-zero="true"] { background: var(--border-subtle); }
.sparkline__bar:hover { background: var(--chart-2); }

.trend-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; }
.trend-row + .trend-row { border-top: 1px solid var(--border-subtle); }
.trend-row__label { flex: 0 0 8rem; font-size: var(--text-caption); color: var(--text-muted); }
.trend-row__plot { flex: 1 1 auto; min-width: 0; }
.trend-row__total { flex: none; font-variant-numeric: tabular-nums; font-weight: var(--weight-semibold); }

/* A trend with no history is not a flat line. It is a sentence. */
.trend-empty { font-size: var(--text-caption); color: var(--text-muted); padding: var(--space-3) 0; }

/* -- layer 6, the records behind a count ------------------------------ */
.detail-list { display: flex; flex-direction: column; }
.detail-row {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; padding: var(--space-3) var(--space-4);
  font: inherit; text-align: left; background: transparent;
  border: 0; border-bottom: 1px solid var(--border-subtle); cursor: pointer;
}
.detail-row:last-child { border-bottom: 0; }
.detail-row:hover { background: var(--surface-raised); }
.detail-row__ref { font-weight: var(--weight-semibold); }
.detail-row__meta { color: var(--text-muted); font-size: var(--text-caption); }
.detail-row__when { margin-left: auto; color: var(--text-muted); font-size: var(--text-caption); white-space: nowrap; }

/* "showing 8 of 412" -- the cap is stated, so a short list is never mistaken
   for the whole story. */
.detail-cap { padding: var(--space-2) var(--space-4); color: var(--text-muted); font-size: var(--text-micro); }


/* An Action Center row is a link dressed as a button, so it must read as one:
   the whole row is the target and it shows that on hover. */
.action-center__row { width: 100%; font: inherit; text-align: left; border-left: 0; border-right: 0; border-top: 0; background: transparent; cursor: pointer; }
.action-center__title { display: block; }
.action-center__meta { display: block; margin-top: 2px; }
.action-center__age { color: var(--text-muted); font-size: var(--text-body-s); }

/* ----------------------------------------------------------------- Metric
 * A KPI is never a bare number: label, value, context, and a way in. */
.metric {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-5);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

.metric__label {
  color: var(--text-muted);
  font-size: var(--text-micro);
  font-weight: var(--weight-micro);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.metric__value {
  font-family: var(--font-display);
  font-size: var(--text-display-l);
  line-height: var(--lh-display-l);
  font-weight: var(--weight-display-l);
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  min-width: 0;
  /* A formatted money figure is one unbreakable run: "TZS 1,250,000.00" has no
     break opportunity, so a card in a narrow row pushes the page sideways
     instead of shrinking. `anywhere` lets the figure break INSIDE the card,
     which is the only place it can break at all. `break-word` is not enough --
     it does not affect the intrinsic minimum width a grid track reserves. */
  overflow-wrap: anywhere;
  word-break: break-word;
}




/* ==================================================================
 * THE FOUR-STATE CONTRACT
 *
 * Every asynchronous surface implements all four. These are components, not
 * ad-hoc strings, which is what stops "No Data." and a failed request from
 * looking identical -- the defect the audit recorded as S1.4.
 * ================================================================== */

/* ------------------------------------------------------------- Skeleton
 * Reserves the geometry of the content it stands in for, so replacing it with
 * data does not shift the layout (CLS). Shapes mirror the real components. */
.skeleton {
  background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-sheen) 37%, var(--skeleton-base) 63%);
  background-size: 400% 100%;
  border-radius: var(--radius-sm);
  animation: skeleton-sheen 1.4s ease-in-out infinite;
}

.skeleton--text  { height: 0.75rem; width: 100%; }
/* Metric skeleton widths. These were `style="width:45%"` / `style="width:70%"`
   attributes, which `style-src 'self'` refuses, so both lines rendered at the
   full 100% default and the skeleton no longer matched the metric it stands in
   for. A class is honoured under the same policy, so the geometry survives. */
.skeleton--text-short  { width: 45%; }
.skeleton--text-medium { width: 70%; }
.skeleton--title { height: 1.5rem; }
.skeleton--value { height: 2.5rem; width: 60%; }
.skeleton--block { height: 100%; min-height: 8rem; }
.skeleton--row   { height: 2.75rem; margin-bottom: var(--space-2); }

@keyframes skeleton-sheen {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* base.css kills this animation under prefers-reduced-motion. */

/* ------------------------------------------------------------ EmptyState
 * Three parts, in this order: what this area is, why it is empty, and the
 * action available. "No Data." satisfies none of them. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-10) var(--space-6);
  text-align: center;
}

.empty-state__icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.15rem;
  color: var(--text-muted);
  background: var(--surface-3);
  border-radius: 50%;
}

.empty-state__title { font-size: var(--text-h3); font-weight: var(--weight-h3); color: var(--text-primary); }
.empty-state__body { max-width: 32rem; color: var(--text-secondary); font-size: var(--text-body); }

/* ------------------------------------------------------------- ErrorState
 * The distinction that matters most: a failure is never rendered as a value.
 * Each kind gets its own title, because "Permission denied" and "the server is
 * down" need different actions from the reader. */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  border: 1px solid var(--tone-danger);
  border-radius: var(--radius-card);
  background: var(--tone-danger-bg);
  color: var(--text-primary);
}

/* ----------------------------------------------------------------- Alert */
.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border-default);
  border-left-width: 3px;
  border-radius: var(--radius-card);
  background: var(--surface-2);
}

.alert__body { flex: 1; min-width: 0; }
.alert__title { font-weight: var(--weight-semibold); color: var(--text-primary); }
.alert--success { border-left-color: var(--tone-success); }
.alert--warning { border-left-color: var(--tone-warning); }
.alert--danger  { border-left-color: var(--tone-danger); }
.alert--info    { border-left-color: var(--tone-info); }
.alert--critical { border-left-color: var(--tone-danger); background: var(--tone-danger-bg); }

/* ------------------------------------------------------------ ActionCenter
 * The exception-first surface. Each row links straight into the resolution
 * workflow -- an alert the reader cannot act on is just noise. */
.action-center { display: flex; flex-direction: column; }

.action-center__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--dur-fast) var(--ease-out);
}

.action-center__row:last-child { border-bottom: 0; }
.action-center__row:hover { background: var(--surface-3); }

.action-center__severity {
  padding: 0.1rem var(--space-2);
  font-size: var(--text-micro);
  font-weight: var(--weight-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
}
.action-center__row[data-severity="critical"] .action-center__severity { color: var(--tone-danger); background: var(--tone-danger-bg); }
.action-center__row[data-severity="high"]     .action-center__severity { color: var(--tone-warning); background: var(--tone-warning-bg); }
.action-center__row[data-severity="medium"]   .action-center__severity { color: var(--tone-info); background: var(--tone-info-bg); }
.action-center__row[data-severity="low"]      .action-center__severity { color: var(--tone-neutral); background: var(--tone-neutral-bg); }

/* A critical row is emphasised with a persistent border, never with a flash. */
.action-center__row[data-severity="critical"] { box-shadow: inset 3px 0 0 var(--tone-danger); }

.action-center__title { font-size: var(--text-body); font-weight: var(--weight-semibold); color: var(--text-primary); }
.action-center__meta  { font-size: var(--text-caption); color: var(--text-muted); }
.action-center__age   { font-size: var(--text-caption); color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ------------------------------------------------------- Operations pulse
 * A compact status strip. Each service states what it knows, including when it
 * knows nothing -- "unknown" is a valid and honest value. */
.pulse { display: grid; gap: var(--space-1); }

.pulse__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--text-body-s);
  border-bottom: 1px solid var(--border-subtle);
}
.pulse__row:last-child { border-bottom: 0; }
.pulse__service { color: var(--text-secondary); }
.pulse__value   { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }

.pulse__value[data-state="ok"]       { color: var(--tone-success); }
.pulse__value[data-state="active"]   { color: var(--tone-info); }
.pulse__value[data-state="degraded"] { color: var(--tone-warning); }
.pulse__value[data-state="down"]     { color: var(--tone-danger); }
.pulse__value[data-state="unknown"]  { color: var(--tone-neutral); }

/* ---------------------------------------------------------------------------
 * Activity rows.
 *
 * WHY THIS OVERRIDE EXISTS -- a real 22px horizontal overflow, found by
 * rendering rather than by reading.
 *
 * `app.css` (v1) declares:
 *     .activity-row { grid-template-columns: auto minmax(0, 1fr) auto; }
 *
 * Three columns for a THREE-part row: a state dot, the content, and the
 * actions. But the markup has only TWO children -- a content <div> and a
 * <div class="dialog-actions"> -- because the state dot is drawn by CSS on the
 * content block, not as its own element.
 *
 * So the content <div> landed in column ONE, which is `auto`: it is sized to
 * max-content and cannot shrink. The row's own rule then compounds it --
 * `.activity-row small { white-space: nowrap }` -- so a long
 * "device - masked IP - started timestamp" string could not wrap and pushed the
 * row 22px past the panel. Measured with headless Chrome:
 *
 *     scrollWidth 1148 > clientWidth 1112
 *     30 elements in normal flow (not inside any closed <dialog>)
 *
 * The fix is to declare the columns the markup actually has: content shrinks,
 * actions keep their natural width. `minmax(0, 1fr)` is required rather than a
 * bare `1fr`, because a bare `1fr` still has an automatic minimum size and the
 * nowrap string would set it.
 *
 * `components.css` loads AFTER `app.css`, so this wins without editing the v1
 * stylesheet, which is documented as deliberately untouched.
 * --------------------------------------------------------------------------- */
.activity-row {
  grid-template-columns: minmax(0, 1fr) auto;
}
/* The content block must be allowed to shrink, or the nowrap line sets the
 * column's floor and the row overflows again. */
.activity-row > div:first-child { min-width: 0; }
/* Below the two-column breakpoint the actions drop under the content, matching
 * the v1 mobile intent at app.css:361. */
@media (max-width: 40rem) {
  .activity-row { grid-template-columns: minmax(0, 1fr); }
}

.error-state__title { font-size: var(--text-h3); font-weight: var(--weight-h3); color: var(--tone-danger); }
.error-state__body { max-width: 34rem; color: var(--text-secondary); font-size: var(--text-body); }

/* A stale response is not an error -- the data loaded, it is just old. It gets
   a warning tone and different copy, because "try again" is the wrong advice. */
.error-state[data-kind="stale"] {
  border-color: var(--tone-warning);
  background: var(--tone-warning-bg);
}
.error-state[data-kind="stale"] .error-state__title { color: var(--tone-warning); }

.error-state[data-kind="offline"],
.error-state[data-kind="permission"] {
  border-color: var(--border-default);
  background: var(--surface-3);
}
.error-state[data-kind="offline"] .error-state__title,
.error-state[data-kind="permission"] .error-state__title { color: var(--text-primary); }

.metric__unit { font-size: 0.5em; font-weight: var(--weight-semibold); color: var(--text-muted); }
.metric__context { color: var(--text-secondary); font-size: var(--text-caption); }

/* The comparison line. The period is always stated, because "12.5%" with no
   period is the meaningless growth percentage the brief calls out. */
.metric__trend { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-caption); font-weight: var(--weight-semibold); }
.metric__trend[data-direction="up"]   { color: var(--tone-success); }
.metric__trend[data-direction="down"] { color: var(--tone-danger); }
.metric__trend[data-direction="flat"] { color: var(--text-muted); }

/* For metrics where "up" is bad (open incidents, unpaid invoices, response
   time), the semantic colour inverts. Signalling direction is a property of the
   metric, so it is declared on the element rather than assumed. */
.metric[data-good-direction="down"] .metric__trend[data-direction="up"] { color: var(--tone-danger); }
.metric[data-good-direction="down"] .metric__trend[data-direction="down"] { color: var(--tone-success); }

/* An interactive metric is a link to the filtered list behind it. */
a.metric, button.metric {
  display: flex;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
a.metric:hover, button.metric:hover { border-color: var(--brand-navy-ring); box-shadow: var(--shadow-md); }

/* Touch targets: a pointer-driven control sized for a mouse undershoots the
   minimum comfortable hit area on glass, and a phone user pays for it. The
   touch query, not a width query, because a touch laptop at 1440px wants this
   too -- it is the input device, not the viewport, that matters here. It
   also avoids inflating the visual size of a desktop control. */
@media (pointer: coarse) {
  .btn { min-height: 2.75rem; }
  .btn--sm { min-height: 2.25rem; }
  .btn--icon { width: 2.75rem; min-height: 2.75rem; }
}

.theme-menu button[aria-checked="true"] .fa-solid { color: var(--brand-accent); }

/* Management briefing: narrative and intervention before supporting metrics. */
.management-briefing { padding: clamp(1.25rem, 3vw, 2.5rem); background: var(--surface-raised, var(--surface)); border: 1px solid var(--border-default); border-radius: var(--radius-lg, 12px); }
.management-briefing__heading { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .75rem; font-size: .75rem; }
.management-briefing h2 { font-size: clamp(1.8rem, 3vw, 2.75rem); letter-spacing: -.035em; margin: 1rem 0 .75rem; line-height: 1.15; }
.management-briefing__narrative { font-size: clamp(1rem, 1.35vw, 1.2rem); line-height: 1.85; max-width: 85ch; text-wrap: pretty; font-variant-numeric: tabular-nums; }
.management-briefing__links { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.management-briefing__links kbd { font-size: .7rem; opacity: .65; }
.briefing-incidents { padding: 0 1.25rem; }
.briefing-incident { padding: 1.25rem; margin-bottom: 1rem; border-left: 3px solid var(--tone-warning); background: var(--surface); border-radius: 4px; }
.briefing-incident[data-severity="critical"] { border-left-color: var(--tone-danger); }
.briefing-incident__top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.briefing-incident time { font-variant-numeric: tabular-nums; }
.briefing-incident h3 { margin: .8rem 0 .3rem; }
.briefing-incident p { margin: .35rem 0; overflow-wrap: anywhere; }
.briefing-incident__description { font-weight: 600; }
.briefing-incident .btn { margin-top: 1rem; }
.intelligence-observations { display: grid; }
.intelligence-observations button { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 1.15rem 1.5rem; text-align: left; color: inherit; background: transparent; border: 0; border-top: 1px solid var(--border-default); font: inherit; line-height: 1.65; cursor: pointer; }
.intelligence-observations button:hover { background: var(--surface); }
.briefing-money-source { font-variant-numeric: tabular-nums; font-size: .8rem; margin-top: .5rem; }
#executive-body .metric__value { overflow-wrap: anywhere; }
@media (max-width: 640px) { .management-briefing__links .btn { width: 100%; justify-content: space-between; } .briefing-incidents { padding: 0 .75rem; } }
.operations-coordinate-map { margin-block: var(--space-5); overflow: hidden; }
.operations-coordinate-map svg { width: 100%; max-height: 440px; background: var(--surface-sunken); }
.operations-map-grid { stroke: var(--border-default); stroke-width: 1; fill: none; }
.operations-map-point { fill: var(--brand-primary); stroke: var(--brand-accent); stroke-width: 3; }
.operations-map-label { fill: var(--text-primary); font-size: 12px; }
[data-map-asset] { cursor: pointer; }
[data-map-asset]:focus .operations-map-point { stroke: var(--text-primary); stroke-width: 5; }

/*
 * Multi-domain dashboards inherit their base rules from the legacy app.css file.
 * That file used `minmax(19rem, 1fr)` for the distribution columns, which is a
 * sane desktop card floor but wider than the usable content area on a 320px
 * phone after shell padding. The document itself did not scroll, but the
 * Operations and VIP panels reported self-overflow in the responsive sweep.
 * `min(100%, 19rem)` keeps the readable floor where space exists and lets the
 * column collapse to the panel width where it does not.
 */
.domain-columns { grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.domain-columns > *,
.domain-kpis > div,
.domain-kpi-block,
.domain-bars li > * { min-width: 0; }
.domain-kpis strong,
.domain-bars span,
.domain-bars strong { overflow-wrap: anywhere; }
.domain-bars li { grid-template-columns: minmax(0, 9rem) minmax(3rem, 1fr) auto; }

/* ==================================================================
 * LIVE TRACKING MAP
 *
 * Drawn as SVG from the coordinates the server holds, not from tiles:
 * the CSP allows 'self' only, so an external basemap would leave a
 * grey box with no fleet on it whenever the network is restricted.
 *
 * Every colour is a token, so the map is legible in both themes. The
 * signal states are distinguished by SHAPE and by the legend as well as
 * colour, because a live/stale/no-signal distinction that exists only in
 * hue is invisible to a colourblind operator reading a dispatch screen.
 * ================================================================== */

.tmap__section { margin-top: var(--space-6); }
.tmap__root { display: flex; flex-direction: column; gap: var(--space-5); }

/* Map + side panel. The side panel holds the legend and the route list;
   it moves below the map on a phone rather than squeezing the map. */
.tmap__frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18rem;
  gap: var(--space-5);
  align-items: start;
}
@media (max-width: 1023px) { .tmap__frame { grid-template-columns: minmax(0, 1fr); } }

.tmap__canvas {
  /* The map keeps a height on purpose: an SVG with only a viewBox and no
     box collapses to nothing in a grid, which is how a map ends up
     invisible while the code that drew it reports success. */
  min-height: 24rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--surface-3);
  overflow: hidden;
}
.tmap { display: block; width: 100%; height: auto; }

/* --- graticule ---------------------------------------------------- */
.tmap__graticule line { stroke: var(--border-subtle); stroke-width: 1; }

/* --- routes ------------------------------------------------------- */
/* An idle route is faint but present: "not in use now" is information,
   and hiding it would make the map look emptier than the network is. */
.tmap__route line { fill: none; stroke-linecap: round; }
.tmap__route.is-active line { stroke: var(--brand-primary); stroke-width: 3.5; }
.tmap__route.is-idle  line { stroke: var(--border-strong); stroke-width: 2; stroke-dasharray: 6 5; }
.tmap__route-end { fill: var(--surface-1); stroke-width: 2; }
.tmap__route.is-active .tmap__route-end { stroke: var(--brand-primary); }
.tmap__route.is-idle  .tmap__route-end { stroke: var(--border-strong); }
.tmap__route-label {
  fill: var(--text-muted);
  font-size: 13px;
  font-weight: var(--weight-semibold);
  paint-order: stroke;
  stroke: var(--surface-3);
  stroke-width: 4;
}

/* --- rescue points ------------------------------------------------ */
/* Each type has its own shape, so the map is readable without colour. */
.tmap__point { cursor: pointer; }
.tmap__point path, .tmap__point circle { fill: var(--surface-1); stroke: var(--tone-info); stroke-width: 2; }
.tmap__point--hospital path   { stroke: var(--tone-danger); fill: var(--tone-danger-bg); }
.tmap__point--rescue_base path { stroke: var(--tone-danger); fill: var(--tone-danger-bg); }
.tmap__point--command_station path { stroke: var(--brand-primary); }
.tmap__point--garage path      { stroke: var(--tone-warning); }
.tmap__point--fuel_station path { stroke: var(--tone-info); fill: var(--tone-info-bg); }
.tmap__point:focus path, .tmap__point:focus circle { stroke: var(--text-primary); stroke-width: 3.5; }
.tmap__point-label {
  fill: var(--text-secondary);
  font-size: 12px;
  paint-order: stroke;
  stroke: var(--surface-3);
  stroke-width: 4;
}

/* --- vehicles ----------------------------------------------------- */
/* The arrow carries the reported heading. An asset with no heading is a
   dot, because an arrow pointing north would claim a direction the
   device never sent. */
.tmap__asset { cursor: pointer; }
.tmap__asset-arrow { stroke-width: 1.5; }
.tmap__asset--live     .tmap__asset-arrow, .tmap__asset--live     .tmap__asset-dot { fill: var(--tone-success); stroke: var(--surface-1); }
.tmap__asset--stale    .tmap__asset-arrow, .tmap__asset--stale    .tmap__asset-dot { fill: var(--tone-warning); stroke: var(--surface-1); }
.tmap__asset--no_signal .tmap__asset-dot { fill: var(--tone-neutral); stroke: var(--surface-1); }
.tmap__asset:focus .tmap__asset-arrow, .tmap__asset:focus .tmap__asset-dot { stroke: var(--text-primary); stroke-width: 3; }

/* --- incident layer (§38): painted above the fleet, worst first ---------- */
.tmap__incident { cursor: pointer; }
.tmap__incident path, .tmap__incident circle { fill: var(--tone-neutral); stroke: var(--surface-1); stroke-width: 1.5; }
.tmap__incident--high path { fill: var(--tone-warning); }
.tmap__incident--critical path { fill: var(--tone-danger); }
.tmap__incident-label { font-size: 9px; fill: var(--text-primary); }
.tmap__incident--critical .tmap__incident-label { fill: var(--tone-danger); font-weight: 700; }
.tmap__incident:focus path, .tmap__incident:focus circle { stroke: var(--text-primary); stroke-width: 3; }

/* A CRITICAL incident announces itself: the ring pulses so one SOS can never
 * be visually buried under five hundred healthy markers (§38). */
.tmap__incident-pulse {
  fill: none; stroke: var(--tone-danger); stroke-width: 2;
  transform-origin: center; transform-box: fill-box;
  animation: tmap-pulse 1.6s ease-out infinite;
}
@keyframes tmap-pulse {
  0% { transform: scale(0.55); opacity: 0.9; }
  70% { transform: scale(1.4); opacity: 0; }
  100% { transform: scale(1.4); opacity: 0; }
}
.tmap__asset-label {
  fill: var(--text-primary);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  paint-order: stroke;
  stroke: var(--surface-3);
  stroke-width: 4;
}

/* --- no-signal tray ----------------------------------------------- */
/* An asset with no position is listed, not dropped and not placed at
   (0,0). It is on the network; it just is not reporting. */
.tmap__tray { border-top: 1px solid var(--border-subtle); padding-top: var(--space-4); }
.tmap__tray-title { color: var(--text-muted); font-size: var(--text-caption); text-transform: uppercase; letter-spacing: var(--tracking-wide); margin-bottom: var(--space-2); }
.tmap__tray-list { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; }
.tmap__tray-item {
  display: flex; align-items: center; gap: var(--space-2);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  background: var(--surface-1); padding: var(--space-2) var(--space-3);
  font: inherit; color: inherit; cursor: pointer; text-align: left;
}
.tmap__tray-item:hover { border-color: var(--border-strong); }
.tmap__tray-item:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
.tmap__tray-code { font-weight: var(--weight-semibold); }
.tmap__tray-label { color: var(--text-muted); font-size: var(--text-caption); }

/* --- side panel --------------------------------------------------- */
.tmap__side { display: flex; flex-direction: column; gap: var(--space-5); }
.tmap__legend h3, .tmap__routes-list h3 { font-size: var(--text-body); margin-bottom: var(--space-2); }
.tmap__legend ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.tmap__legend li { display: flex; align-items: center; gap: var(--space-2); color: var(--text-secondary); font-size: var(--text-caption); }
.tmap__key { width: 0.85rem; height: 0.85rem; border-radius: 50%; flex: none; }
.tmap__key--live     { background: var(--tone-success); }
.tmap__key--stale    { background: var(--tone-warning); }
.tmap__key--nosignal { background: var(--tone-neutral); }
.tmap__key--active   { background: var(--brand-primary); height: 0.25rem; width: 1.5rem; border-radius: 0; }
.tmap__key--idle     { background: var(--border-strong); height: 0.25rem; width: 1.5rem; border-radius: 0; }
.tmap__key--incident { background: var(--tone-danger); }

/* --- zoom + decluttering controls (§39) ---------------------------------- */
.tmap__zoom {
  display: flex; align-items: center; gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.tmap__zoom button {
  width: 2rem; height: 2rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font-size: var(--text-body);
  cursor: pointer;
}
.tmap__zoom button:hover { border-color: var(--accent); }
.tmap__zoom-level { color: var(--text-muted); font-size: var(--text-caption); margin-left: var(--space-2); }

/* A clustered cell at the network view: a count, and the codes on hover. */
.tmap__cluster circle { fill: var(--brand-primary); opacity: 0.85; stroke: var(--surface-1); stroke-width: 2; }
.tmap__cluster-count { font-size: 12px; font-weight: 700; fill: var(--text-on-brand, #fff); }

/* --- relationship chain (§40) --------------------------------------------- */
.tmap__rels {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center;
}
.tmap__rels li {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: var(--text-caption);
}
.tmap__rels li:not(:last-child)::after { content: ' →'; color: var(--text-muted); margin-left: var(--space-2); }

.tmap__routes-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tmap__routes-list li { padding: var(--space-3) 0; border-bottom: 1px solid var(--border-subtle); }
.tmap__routes-list li:last-child { border-bottom: 0; }
.tmap__route-meta { color: var(--text-muted); font-size: var(--text-caption); margin-top: var(--space-1); }
.tmap__routes-list li.is-unresolved { opacity: 0.85; }
/* Why a route is not on the map. A route that cannot be drawn says so,
   because silence would read as "this route does not exist". */
.tmap__warn { color: var(--tone-warning); font-size: var(--text-caption); margin-top: var(--space-2); }
.tmap__note { color: var(--text-muted); font-size: var(--text-caption); }

/* --- node detail -------------------------------------------------- */
.tmap__detail { border-top: 1px solid var(--border-subtle); padding-top: var(--space-4); }
.tmap__card { display: flex; flex-direction: column; gap: var(--space-5); }
.tmap__card-head h3 { font-size: var(--text-h3); }
.tmap__card h4 {
  font-size: var(--text-caption); text-transform: uppercase;
  letter-spacing: var(--tracking-wide); color: var(--text-muted);
  margin-bottom: var(--space-2);
}
.tmap__facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: var(--space-3); margin: 0;
}
.tmap__fact dt { color: var(--text-muted); font-size: var(--text-caption); }
.tmap__fact dd { margin: 0; color: var(--text-primary); font-size: var(--text-body-s); overflow-wrap: anywhere; }
.tmap__load { color: var(--text-secondary); font-size: var(--text-caption); margin-bottom: var(--space-2); }

.tmap__pax, .tmap__cargo, .tmap__luggage { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tmap__pax li, .tmap__luggage li {
  display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) auto auto;
  gap: var(--space-2); align-items: center;
  padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-body-s);
}
.tmap__pax li:last-child, .tmap__luggage li:last-child, .tmap__cargo li:last-child { border-bottom: 0; }
.tmap__seat { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tmap__pax-name { color: var(--text-primary); overflow-wrap: anywhere; }
.tmap__pax-status { color: var(--text-muted); font-size: var(--text-caption); }
.tmap__luggage-type {
  color: var(--text-secondary); font-size: var(--text-caption);
  text-transform: uppercase; letter-spacing: var(--tracking-wide);
}
.tmap__cargo li { padding: var(--space-3) 0; border-bottom: 1px solid var(--border-subtle); }
.tmap__cargo-meta { color: var(--text-muted); font-size: var(--text-caption); margin-top: var(--space-1); }

/* ==================================================================
 * CUSTOMER HOME (MY MAMORE)
 *
 * The home screen is a ranked list of modules the SERVER chose. These
 * rules therefore style TONES, not kinds: the server decides that a
 * module is critical, warning or neutral, and a card simply wears the
 * tone it is given. A rule per module kind would put the product's
 * priority order into a stylesheet, where the next person to add a card
 * would quietly break it.
 *
 * Tone colours come from the design tokens, so light and dark both work
 * without a second set of rules here.
 * ================================================================== */

.portal-status { margin-bottom: 1.25rem; }

.portal-status__card {
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--tone-success);
  border-radius: var(--radius-card);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
}

.portal-status__card--critical { border-left-color: var(--tone-danger); background: var(--tone-danger-bg); }
.portal-status__card--attention { border-left-color: var(--tone-warning); background: var(--tone-warning-bg); }

.portal-status__detail {
  margin: .25rem 0 0;
  color: var(--text-secondary);
  font-size: var(--text-body-s);
}

.portal-status__chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .75rem;
  margin: .6rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-muted);
  font-size: var(--text-body-s);
}

.portal-status__chips li + li::before { margin-right: .75rem; content: "\00B7"; color: var(--text-muted); }

/* The action strip. Deliberately a strip: a long list of buttons is a menu,
   and a menu is slower to act on than a screen. */
.portal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.5rem;
}

.portal-action {
  min-height: 2.75rem;
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-ui);
  font-size: var(--text-body-s);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: background var(--dur-base, 180ms) var(--ease-out, ease),
              border-color var(--dur-base, 180ms) var(--ease-out, ease);
}

.portal-action:hover { background: var(--surface-sunken); border-color: var(--border-strong); }
.portal-action--primary { color: var(--text-on-accent); background: var(--accent); border-color: var(--accent); }
.portal-action--critical { color: var(--tone-danger); border-color: var(--tone-danger); }

.portal-home {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.portal-card {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

.portal-card h3 { margin: 0; font-size: var(--text-h3); }
.portal-card p { margin: 0; color: var(--text-secondary); font-size: var(--text-body-s); }
.portal-card .eyebrow { margin: 0; }

.portal-card--critical { border-left-color: var(--tone-danger); }
.portal-card--warning { border-left-color: var(--tone-warning); }
.portal-card--active { border-left-color: var(--tone-success); }
.portal-card--travel { border-left-color: var(--accent); }
.portal-card--upcoming { border-left-color: var(--tone-success); }

.portal-card__note { color: var(--tone-warning); }
.portal-card__price { font-weight: var(--weight-medium); color: var(--text-primary); }

.portal-card .secondary-button,
.portal-card .primary-button,
.portal-card__foot { margin-top: auto; align-self: flex-start; }
.portal-card__foot { padding-top: .5rem; }

/* Marketplace */
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
}

.service-card__benefits {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  margin: .5rem 0;
  padding: 0;
  list-style: none;
  color: var(--text-secondary);
  font-size: var(--text-body-s);
}

.service-card__benefits li { display: flex; align-items: flex-start; gap: .4rem; }
.service-card__benefits .fa-solid { margin-top: .15rem; color: var(--tone-success); }

@media (max-width: 767px) {
  .portal-status__card { padding: .85rem 1rem; }
  /* One column of cards on a phone, whatever the viewport, so a card is never
     squeezed narrow enough to wrap its own registration number. */
  .portal-home, .service-grid { grid-template-columns: 1fr; }
  .portal-actions .portal-action { flex: 1 1 100%; }
}


/* Shared experience components (October 2026). */
/* Application-wide presentation. Legacy aliases retain existing workflows. */

body { color: var(--text-primary); font-family: var(--font-ui); }
.shell { min-height: 100dvh; }
.shell__sidebar { height: 100dvh; padding: 0; }
.shell[data-sidebar="expanded"] { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.shell[data-sidebar="collapsed"] { grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr); }
.sidebar-brand { padding: 0; }
.sidebar__head { padding: 22px 20px; border-bottom: 1px solid var(--border-nav); margin-bottom: 16px; }
.sidebar__nav { padding: 0 12px 16px; }
.sidebar .nav-item { color: var(--text-inverse); font-size: 13px; font-weight: 500; padding: 10px 12px; border-left: 0; }
.sidebar .nav-item .fa-solid { color: var(--text-inverse); margin-right: 0; opacity: .8; }
.sidebar .nav-group__label, .sidebar .sidebar__status, .sidebar .sidebar__collapse { color: var(--text-inverse); opacity: .8; }
.sidebar .nav-item:hover, .sidebar .nav-item[aria-current="page"] { background: var(--surface-nav-2); color: var(--text-inverse); }
.sidebar .nav-item[aria-current="page"] { font-weight: 600; }
.sidebar .nav-item[aria-current="page"] .fa-solid { color: var(--brand-accent); opacity: 1; }
.sidebar button:focus-visible { outline-color: var(--brand-accent); }
.sidebar__collapse:hover { background: var(--surface-nav-2); color: var(--text-inverse); }
.shell__content { padding: 24px 28px 48px; scroll-margin-block-start: calc(var(--topbar-height) + var(--space-12)); }
.shell__topbar { gap: 12px; min-height: 72px; padding: 12px 24px; align-items: center; }
.header-brand { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; color: var(--text-primary); font-size: 13px; font-weight: 700; letter-spacing: .045em; flex: none; min-height: 44px; }
.header-brand img { width: 32px; height: 32px; }
.topbar__context { max-width: 14rem; }
.topbar__context .eyebrow { display: none; }
.topbar__context h1 { font-size: 13px; font-weight: 500; line-height: 1.4; letter-spacing: 0; }
.topbar__context [data-breadcrumb-mount] { display: none; }
.topbar__search { min-width: 130px; max-width: 26rem; }
.topbar__search input { min-height: 40px; font-size: 12px; border-color: var(--border-control); }
.topbar__kbd { transform: translateY(-50%); }
.icon-button { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; min-height: 40px; padding: 0; border: 1px solid transparent; border-radius: var(--radius-button); background: transparent; color: var(--text-secondary); font-size: 16px; font-weight: 500; }
.icon-button:hover { color: var(--text-primary); background: var(--surface-3); border-color: var(--border-subtle); }
.sidebar__close { color: var(--text-inverse); }
.sidebar__close:hover { background: var(--surface-nav-2); }
.shell__drawer-button, .sidebar__close, .header-more { display: none; }
.header-tools, .header-preferences, .header-preferences .account { display: flex; align-items: center; gap: 4px; }
.header-preferences .account > div { display: block; }
.header-preferences .topbar__actions { flex-wrap: nowrap; }
.currency-switcher__button { width: auto; min-width: 62px; display: inline-flex; gap: 6px; padding: 0 6px; }
.currency-switcher__code { font-size: 11px; font-weight: 600; }
.header-status { display: flex; align-items: center; gap: 8px; flex: none; color: var(--text-muted); font-size: 11px; }
[data-operation-status] .status-dot { box-shadow: none; background: var(--tone-neutral); }
[data-operation-status][data-state="connected"] .status-dot { background: var(--tone-success); }
[data-operation-status][data-state="unavailable"] .status-dot, [data-operation-status][data-state="offline"] .status-dot { background: var(--tone-warning); }
.header-bell { position: relative; }
.header-count { position: absolute; top: -1px; right: -2px; min-width: 17px; height: 17px; padding-inline: 3px; border-radius: 8px; background: var(--tone-danger); color: var(--surface-1); font-size: 10px; font-weight: 700; line-height: 17px; }
.profile-toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 0 0 8px; background: transparent; border: 0; color: var(--text-primary); text-align: start; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; background: var(--surface-sunken); color: var(--text-link); border: 1px solid var(--border-default); font-size: 12px; font-weight: 600; }
.account__identity { display: grid; gap: 2px; max-width: 160px; }
.account__identity strong { font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account__identity small { font-size: 9px; color: var(--text-muted); font-weight: 500; }
.header-popover { position: absolute; top: calc(100% - 3px); right: 20px; width: min(420px, calc(100vw - 24px)); max-height: min(650px, calc(100dvh - 90px)); overflow: auto; color: var(--text-primary); background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: var(--radius-overlay); box-shadow: var(--shadow-lg); z-index: var(--z-popover); overscroll-behavior: contain; }
.header-popover__heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); }
.header-popover__heading h2 { font-size: 15px; }
.header-popover__heading p { font-size: 11px; overflow-wrap: anywhere; }
.header-popover__body.empty-state { padding: 28px 20px; display: grid; gap: 12px; text-align: start; font-size: 13px; }
.header-popover__body.empty-state h3 { font-size: 14px; }
.header-popover__footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border-subtle); }
.header-popover--profile { width: min(340px, calc(100vw - 24px)); }
.profile-role { padding: 14px 18px 6px; font-size: 11px; color: var(--text-muted); }
.profile-links { padding: 8px; display: grid; }
.profile-links button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; border: 0; background: transparent; color: var(--text-primary); text-align: start; font-size: 13px; padding: 10px; border-radius: var(--radius-sm); }
.profile-links button:hover { background: var(--surface-3); }
.profile-links #logout-button { border-top: 1px solid var(--border-default); border-radius: 0; margin-top: 8px; color: var(--tone-danger); }
.text-button { position: static; transform: none; color: var(--text-link); font-weight: 600; font-size: 12px; padding: 6px 0; min-height: 32px; }
.password-field .text-button { position: absolute; transform: translateY(-50%); }
.notification-group__title { display: flex; align-items: center; gap: 8px; padding: 12px 18px 6px; font-size: 11px; color: var(--text-muted); font-weight: 600; }
.notification-group__title span { font-weight: 400; }
.notification-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); background: var(--surface-1); }
.notification-item.is-unread { background: var(--surface-3); border-inline-start: 3px solid var(--text-link); }
.notification-item.is-critical { border-inline-start-color: var(--tone-danger); }
.notification-item.is-critical .notification-item__icon { color: var(--tone-danger); }
.notification-item__icon { color: var(--text-muted); padding-top: 3px; }
.notification-item__meta { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; color: var(--text-muted); font-size: 10px; }
.notification-item h3 { font-size: 13px; font-weight: 600; margin: 4px 0; }
.notification-item p { color: var(--text-secondary); font-size: 12px; margin-bottom: 4px; }
.notification-item time { color: var(--text-muted); font-size: 10px; }
.notification-item__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.connection-banner, .inline-alert { padding: 14px 18px; margin-bottom: 16px; color: var(--tone-warning); background: var(--tone-warning-bg); border: 1px solid var(--tone-warning); border-radius: var(--radius-sm); font-size: 13px; }
.account-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.account-details dt { color: var(--text-muted); font-size: 12px; margin-bottom: 4px; }
.account-details dd { color: var(--text-primary); font-size: 14px; overflow-wrap: anywhere; }
.eyebrow { color: var(--text-muted); font-size: 10px; font-weight: 600; }
.section-heading { flex-wrap: wrap; }
.section-heading > div:first-child { min-width: 0; flex: 1 1 240px; }
.section-heading > button { max-width: 100%; white-space: normal; }
.section-heading > .dialog-actions { max-width: 100%; flex-wrap: wrap; }
.section-heading h2, .page-header h2 { font-size: 22px; font-weight: 600; }
.section-heading p.muted { font-size: 13px; max-width: 70ch; }
.primary-button { background: var(--brand-primary); border-color: var(--brand-primary); font-weight: 600; }
.primary-button:hover { background: var(--brand-primary-2); border-color: var(--brand-primary-2); }
.secondary-button, .row-action { font-weight: 500; }
.danger-button, .sos-confirm, .sos-button { color: white; background: var(--brand-action-dark); }
.card, .data-section, .incident-board, .unit-board { box-shadow: none; border-radius: var(--radius-card); background: var(--surface-1); color: var(--text-primary); }
.metric, .rescue-metrics > div, .domain-kpis > div { box-shadow: none; border: 1px solid var(--border-default); border-radius: var(--radius-card); }
.metric__value, .rescue-metrics strong { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.management-briefing { background: var(--surface-1); border: 1px solid var(--border-default); border-radius: var(--radius-card); padding: 20px 24px; }
.management-briefing h2 { font-size: 22px; }
.management-briefing__narrative { max-width: 90ch; font-size: 13px; line-height: 1.7; }
.management-briefing__links { margin-top: 14px; }
.table-wrap, .table-scroll { max-width: 100%; overflow-x: auto; }
table { font-variant-numeric: tabular-nums; }
thead th { position: sticky; top: 0; background: var(--surface-3); color: var(--text-secondary); font-weight: 600; }
input, select, textarea { color: var(--text-primary); background: var(--surface-1); border-color: var(--border-control); border-radius: var(--radius-input); font-weight: 400; }
label { font-weight: 500; color: var(--text-secondary); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 3px; }
.form-error { color: var(--tone-danger); }
.dialog { color: var(--text-primary); background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: var(--radius-overlay); }
.dialog h2 { font-size: 20px; }
.ticket, .fare-preview { color: var(--text-primary); background: var(--surface-3); }
.login-header .account > div { display: block; }
.login-header .icon-button { display: inline-grid; }
.login-story { background: var(--brand-primary-dark); }
.login-form h2 { font-size: 30px; }
.story-copy h1 { font-size: clamp(28px, 3vw, 46px); }
.story-copy > p:last-child { font-size: 15px; }
.story-foot { font-size: 12px; letter-spacing: 0; text-transform: none; }
.login-header .brand-text small { font-size: 9px; }
.drawer-scrim { display: none; }
@media (max-width: 1439px) { .header-status, .account__identity, .topbar__context { display: none; } }
@media (max-width: 1023px) {
  .header-more { display: inline-grid; }
  .header-preferences { display: none; }
  .shell[data-preferences="open"] .header-preferences { display: flex; position: absolute; top: calc(100% + 4px); right: 16px; padding: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-overlay); background: var(--surface-raised); box-shadow: var(--shadow-lg); z-index: var(--z-popover); }
  .topbar__search { display: block; }
  .shell__topbar { padding-inline: 16px; }
}
@media (min-width: 768px) { .sidebar__close { display: none; } }
@media (max-width: 767px) {
  .shell[data-sidebar] { grid-template-columns: minmax(0, 1fr); }
  .shell__drawer-button, .sidebar__close { display: inline-grid; }
  .shell__topbar { gap: 6px; min-height: 64px; padding: 8px 12px; flex-wrap: wrap; }
  .header-brand { flex: 1; }
  .header-brand img { width: 28px; height: 28px; }
  .header-tools { gap: 0; }
  .header-tools .icon-button { width: 36px; min-width: 36px; }
  .profile-toggle { padding-left: 4px; }
  .topbar__search { order: 5; flex: 1 0 100%; max-width: none; margin: 0; padding-top: 2px; }
  .topbar__search input { min-height: 36px; padding-block: 6px; }
  .shell__content { padding: 20px 16px 40px; }
  .search-bar { grid-template-columns: minmax(0, 1fr); }
  .shell__sidebar { height: 100dvh; }
  .shell[data-drawer="open"] .drawer-scrim { display: block; position: fixed; inset: 0; z-index: calc(var(--z-drawer) - 1); background: var(--shadow-overlay); background-color: var(--surface-nav-2); opacity: .55; border: 0; }
  .header-popover { right: 12px; max-height: calc(100dvh - 122px); }
  .header-preferences .theme-menu { right: 0; }
  .section-heading h2, .page-header h2 { font-size: 20px; }
  .account-details { grid-template-columns: 1fr; }
  .management-briefing { padding: 16px; }
  .management-briefing__links kbd { display: none; }
  .rescue-metrics, .domain-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-header__inner { min-height: 44px; }
  .login-header .brand-text small { display: none; }
}
@media (max-width: 374px) { .header-brand span { font-size: 11px; } .header-brand { gap: 4px; } .header-tools .icon-button { width: 32px; min-width: 32px; } .shell__content { padding-inline: 12px; } }
@media (pointer: coarse) { button, .icon-button, .text-button { min-height: 44px; } }
@media print { .header-popover, .connection-banner, .drawer-scrim { display: none; } }


/* Shared dashboard components (October 2026). */
/* Role analytics share the Mamore tokens and strict self-only CSP. */
.intelligence-dashboard { display: grid; gap: var(--space-5); min-width: 0; }
.intelligence-dashboard > * { min-width: 0; }
.intelligence-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; padding-bottom: var(--space-4); border-bottom: 1px solid var(--border-default); }
.intelligence-toolbar p { margin: 0 0 var(--space-2); color: var(--text-secondary); max-width: 70ch; font-size: var(--text-body-s); }
.intelligence-toolbar__actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); }
.intelligence-freshness, .intelligence-meta { font-size: var(--text-caption); color: var(--text-muted); overflow-wrap: anywhere; }
.intelligence-freshness { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.intelligence-snapshot-dot { width: 6px; height: 6px; background: var(--tone-neutral); border-radius: 50%; flex-shrink: 0; }
.intelligence-range { display: flex; border: 1px solid var(--border-control); padding: 3px; gap: 2px; border-radius: var(--radius-sm); background: var(--surface-1); }
.intelligence-range button, .intelligence-chart-switch button { background: transparent; border: 0; border-radius: var(--radius-xs); color: var(--text-secondary); padding: var(--space-2) var(--space-3); font-size: var(--text-caption); font-weight: var(--weight-semibold); min-height: 36px; }
.intelligence-range button[aria-pressed="true"], .intelligence-chart-switch button[aria-pressed="true"] { background: var(--brand-navy-veil); color: var(--text-primary); box-shadow: inset 0 -2px var(--brand-accent); }
.intelligence-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); border: 1px solid var(--border-default); border-radius: var(--radius-sm); background: var(--surface-1); overflow: hidden; }
.intelligence-metric { padding: var(--space-5); border-inline-end: 1px solid var(--border-subtle); min-width: 0; }
.intelligence-metric:last-child { border-inline-end: 0; }
.intelligence-metric__label { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-2); color: var(--text-secondary); font-size: var(--text-caption); font-weight: var(--weight-medium); }
.intelligence-metric__index { font: var(--text-micro) var(--font-mono); color: var(--text-muted); }
.intelligence-metric__value { display: block; margin-block: var(--space-3) var(--space-2); font-size: clamp(20px, 1.75vw, 28px); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; line-height: 1.3; overflow-wrap: anywhere; letter-spacing: var(--tracking-tight); }
.intelligence-metric p { font-size: var(--text-caption); color: var(--text-muted); margin: 0; }
.intelligence-metric[data-tone="warn"] .intelligence-metric__value { color: var(--tone-warning); }
.intelligence-metric[data-tone="alert"] .intelligence-metric__value { color: var(--tone-danger); }
.intelligence-card { border: 1px solid var(--border-default); background: var(--surface-1); border-radius: var(--radius-sm); min-width: 0; overflow: hidden; }
.intelligence-card__heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-subtle); }
.intelligence-card__heading h3 { margin: 0; font-size: var(--text-h3); font-weight: var(--weight-semibold); color: var(--text-primary); }
.intelligence-overline { color: var(--text-muted); text-transform: uppercase; font-size: 10px; font-weight: var(--weight-semibold); letter-spacing: .08em; margin: 0 0 var(--space-1); }
.intelligence-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
.intelligence-chart-stat { display: flex; align-items: baseline; gap: var(--space-3); padding: var(--space-5) var(--space-5) 0; flex-wrap: wrap; }
.intelligence-chart-stat strong { font-size: var(--text-h2); font-variant-numeric: tabular-nums; font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.intelligence-chart-stat span { color: var(--text-muted); font-size: var(--text-caption); }
.intelligence-chart { width: 100%; height: auto; display: block; min-height: 180px; padding: var(--space-3); }
.intelligence-chart-gridline { stroke: var(--chart-grid); stroke-width: 1; }
.intelligence-chart-axis { fill: var(--text-muted); font-size: 11px; font-family: var(--font-ui); }
.intelligence-trend, .intelligence-distribution { --series-color: var(--chart-1); }
[data-series-color="2"] { --series-color: var(--chart-2); }
[data-series-color="3"] { --series-color: var(--chart-3); }
[data-series-color="4"] { --series-color: var(--chart-4); }
[data-series-color="5"] { --series-color: var(--chart-5); }
[data-series-color="6"] { --series-color: var(--chart-6); }
.intelligence-chart-line { fill: none; stroke: var(--series-color); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.intelligence-chart-point, .intelligence-chart-bar { fill: var(--series-color); }
.intelligence-chart-point { stroke: var(--surface-1); stroke-width: 2; }
.intelligence-chart-point:focus { outline: none; stroke: var(--text-primary); stroke-width: 3; }
.intelligence-chart-bars { display: none; }
[data-chart-kind="bar"] .intelligence-chart-bars { display: block; }
[data-chart-kind="bar"] .intelligence-chart-lines { display: none; }
.intelligence-chart-switch { display: flex; gap: 2px; background: var(--surface-3); border: 1px solid var(--border-default); border-radius: var(--radius-xs); padding: 2px; }
.intelligence-chart-switch button { padding: var(--space-1) var(--space-2); min-height: 30px; }
.intelligence-chart-summary { padding: 0 var(--space-5) var(--space-3); margin: 0; font-size: var(--text-caption); color: var(--text-secondary); }
.intelligence-data-disclosure { border-top: 1px solid var(--border-subtle); }
.intelligence-data-disclosure summary { padding: var(--space-3) var(--space-5); font-size: var(--text-caption); color: var(--text-secondary); cursor: pointer; min-height: 40px; }
.intelligence-distribution-list { list-style: none; display: grid; gap: var(--space-4); padding: var(--space-5); margin: 0; }
.intelligence-distribution-list li { min-width: 0; }
.intelligence-distribution-list li > div { display: flex; justify-content: space-between; gap: var(--space-3); align-items: baseline; margin-bottom: var(--space-2); font-size: var(--text-caption); }
.intelligence-distribution-list strong { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.intelligence-distribution-track { height: 6px; display: block; width: 100%; background: var(--surface-3); border-radius: 2px; }
.intelligence-distribution-track > span { display: block; height: 100%; background: var(--series-color); border-radius: 2px; }
.intelligence-empty { padding: var(--space-8) var(--space-5); color: var(--text-secondary); font-size: var(--text-body-s); }
.intelligence-empty strong { display: block; margin-bottom: var(--space-2); color: var(--text-primary); }
.intelligence-empty p { margin: 0; max-width: 60ch; }
.intelligence-empty--compact { padding-block: var(--space-5); }
.intelligence-workflows { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.intelligence-workflows button { border: 1px solid var(--border-control); border-radius: var(--radius-sm); display: flex; align-items: center; gap: var(--space-5); background: var(--surface-1); padding: var(--space-3) var(--space-4); color: var(--text-primary); font-size: var(--text-body-s); min-height: 44px; }
.intelligence-workflows button span:last-child { color: var(--text-muted); }
.intelligence-period-summary { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-6); align-items: center; padding: var(--space-4) var(--space-5); background: var(--surface-3); border: 1px solid var(--border-default); border-radius: var(--radius-sm); }
.intelligence-period-summary > span { font-size: var(--text-caption); color: var(--text-muted); }
.intelligence-period-summary > div { display: grid; gap: var(--space-1); min-width: 0; }
.intelligence-period-summary strong { font-size: var(--text-h3); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.intelligence-period-summary div span { font-size: var(--text-caption); color: var(--text-secondary); }
.intelligence-record-grid { display: grid; gap: var(--space-5); }
.intelligence-table-wrap { overflow-x: auto; max-width: 100%; overscroll-behavior-inline: contain; }
.intelligence-table { width: 100%; border-collapse: collapse; font-size: var(--text-body-s); }
.intelligence-table th { background: var(--surface-3); color: var(--text-secondary); text-align: start; font-size: var(--text-caption); font-weight: var(--weight-semibold); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-default); position: sticky; top: 0; white-space: nowrap; }
.intelligence-table th button { font: inherit; color: inherit; border: 0; padding: 0; background: transparent; display: inline-flex; align-items: center; gap: var(--space-3); min-height: 30px; text-align: start; }
.intelligence-table th button span { color: var(--text-muted); }
.intelligence-table td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle); vertical-align: top; color: var(--text-primary); font-variant-numeric: tabular-nums; max-width: 32ch; overflow-wrap: break-word; }
.intelligence-table tbody tr:last-child td { border-bottom: 0; }
.intelligence-table tbody tr:hover { background: var(--surface-3); }
.intelligence-table tr[data-tone="alert"] td:first-child { border-inline-start: 3px solid var(--tone-danger); }
.intelligence-table tr[data-tone="warn"] td:first-child { border-inline-start: 3px solid var(--tone-warning); }
.intelligence-row-action { background: transparent; color: var(--text-secondary); padding: var(--space-1); border: 0; font-size: var(--text-caption); white-space: nowrap; min-height: 32px; }
.intelligence-table-search { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); padding: var(--space-3) var(--space-5); }
.intelligence-table-search input { width: min(100%, 280px); margin: 0; min-height: 38px; font-size: var(--text-body-s); }
.intelligence-table-search small { color: var(--text-muted); font-size: var(--text-caption); }
.intelligence-notes { border-inline-start: 2px solid var(--border-strong); padding: var(--space-2) var(--space-4); font-size: var(--text-caption); color: var(--text-muted); }
.intelligence-notes ul { margin: var(--space-2) 0 0; padding-inline-start: var(--space-4); display: grid; gap: var(--space-1); }
.intelligence-controls { display: grid; margin: 0; padding: var(--space-5); gap: var(--space-3); font-size: var(--text-body-s); }
.intelligence-controls > div { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr); gap: var(--space-4); padding-bottom: var(--space-3); border-bottom: 1px solid var(--border-subtle); }
.intelligence-controls > div:last-child { border-bottom: 0; }
.intelligence-controls dt { color: var(--text-secondary); font-weight: var(--weight-medium); }
.intelligence-controls dd { margin: 0; overflow-wrap: anywhere; }
.intelligence-attention { list-style: none; padding: 0; margin: 0; }
.intelligence-attention li { display: flex; align-items: baseline; gap: var(--space-4); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-subtle); }
.intelligence-attention li:last-child { border-bottom: 0; }
.intelligence-attention p { margin: 0; font-size: var(--text-body-s); overflow-wrap: anywhere; }
.intelligence-attention__kind { padding: 3px 7px; font-size: var(--text-micro); color: var(--text-secondary); background: var(--surface-3); border-radius: var(--radius-xs); }
.intelligence-attention [data-tone="alert"] .intelligence-attention__kind { color: var(--tone-danger); background: var(--tone-danger-bg); }
.intelligence-attention [data-tone="warn"] .intelligence-attention__kind { color: var(--tone-warning); background: var(--tone-warning-bg); }
.intelligence-scope-note { border: 1px solid var(--tone-warning); background: var(--tone-warning-bg); border-radius: var(--radius-sm); padding: var(--space-5); font-size: var(--text-body-s); }
.intelligence-scope-note p { margin: var(--space-2) 0 0; }
.intelligence-scope-note--error { border-color: var(--tone-danger); background: var(--tone-danger-bg); }
.intelligence-dashboard-loading { min-height: 400px; padding: var(--space-5); }
.intelligence-duty { padding-bottom: var(--space-5); }
.intelligence-duty__vehicle { padding-inline: var(--space-5); font-size: var(--text-h3); font-weight: var(--weight-medium); }
.intelligence-duty-status { font-size: var(--text-caption); color: var(--tone-info); font-weight: var(--weight-semibold); }
.intelligence-duty__times { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding-inline: var(--space-5); gap: var(--space-5); }
.intelligence-duty__times span, .intelligence-duty__times strong { display: block; font-size: var(--text-caption); }
.intelligence-duty__times span { color: var(--text-muted); margin-bottom: var(--space-2); }
.intelligence-seat-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: var(--space-2); padding-inline: var(--space-5); max-width: 780px; }
.intelligence-seat { height: 44px; min-width: 0; background: var(--surface-3); border: 1px solid var(--border-control); border-radius: var(--radius-xs); color: var(--text-muted); font-size: var(--text-caption); }
.intelligence-seat.is-reserved { color: var(--tone-info); background: var(--tone-info-bg); border-color: var(--tone-info); }
.intelligence-seat.is-boarded { color: var(--tone-success); background: var(--tone-success-bg); border-color: var(--tone-success); }
.intelligence-seat-legend { display: flex; gap: var(--space-4); padding: var(--space-4) var(--space-5) var(--space-2); font-size: var(--text-caption); flex-wrap: wrap; }
.intelligence-seat-legend span::before { content: ''; display: inline-block; width: 8px; height: 8px; border: 1px solid var(--border-control); margin-inline-end: var(--space-2); }
.intelligence-seat-legend .is-reserved::before { background: var(--tone-info); border-color: var(--tone-info); }
.intelligence-seat-legend .is-boarded::before { background: var(--tone-success); border-color: var(--tone-success); }
.intelligence-duty > .intelligence-meta { padding-inline: var(--space-5); }
.intelligence-map .tmap { border: 0; border-radius: 0; }
.intelligence-detail-dialog { max-width: min(640px, calc(100vw - 32px)); }
[data-density="compact"] .intelligence-table td { padding-block: var(--space-2); }
@media (min-width: 1440px) { [data-dashboard-role="finance"] .intelligence-chart-grid, [data-dashboard-role="admin"] .intelligence-chart-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767px) {
  .intelligence-chart-grid { grid-template-columns: minmax(0, 1fr); }
  .intelligence-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .intelligence-metric { padding: var(--space-4); border-bottom: 1px solid var(--border-subtle); }
  .intelligence-metric__value { font-size: 22px; }
  .intelligence-toolbar__actions { width: 100%; }
  .intelligence-range { flex: 1; }
  .intelligence-range button { flex: 1; padding-inline: var(--space-2); }
  .intelligence-records .intelligence-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .intelligence-records .intelligence-table, .intelligence-records .intelligence-table tbody { display: block; width: 100%; }
  .intelligence-records .intelligence-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); padding: var(--space-4); border-bottom: 1px solid var(--border-default); }
  .intelligence-records .intelligence-table td { display: block; padding: 0; border: 0; max-width: none; overflow-wrap: anywhere; }
  .intelligence-records .intelligence-table td::before { content: attr(data-label); display: block; color: var(--text-muted); font-size: var(--text-micro); padding-bottom: var(--space-1); }
  .intelligence-records .intelligence-table td:first-child { grid-column: 1 / -1; font-weight: var(--weight-semibold); font-size: var(--text-body); }
  .intelligence-records .intelligence-table td:last-child { grid-column: 1 / -1; }
  .intelligence-controls > div { grid-template-columns: 1fr; gap: var(--space-2); }
  .intelligence-duty__times { grid-template-columns: 1fr; gap: var(--space-3); }
  .intelligence-seat-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 390px) { .intelligence-kpis { grid-template-columns: 1fr; } .intelligence-range button { padding-inline: var(--space-1); } }
@media (pointer: coarse) { .intelligence-range button, .intelligence-chart-switch button, .intelligence-row-action, .intelligence-table th button { min-height: 44px; } }
@media print { .intelligence-toolbar__actions, .intelligence-workflows, .intelligence-chart-switch, .intelligence-table-search, .intelligence-row-action { display: none; } .intelligence-card { break-inside: avoid; } }

/* Authentication links follow the active semantic theme. */
.auth-links .text-button { color: var(--color-text-primary); }
.auth-links .text-button:hover { color: var(--color-accent); }
.seat-hold-status { color: var(--color-text-secondary); font-variant-numeric: tabular-nums; min-height: 1.5em; }
.seat[aria-pressed="true"] { outline: 2px solid var(--color-text-primary); outline-offset: 2px; }

.portal-trip-foot { flex-wrap: wrap; }
.portal-trip-foot > * { min-width: 0; max-width: 100%; }

/* ===========================================================================
   Smart Bus travel: search, results, seat map, checkout and ticket.

   WHY THIS BLOCK EXISTS SEPARATELY
   ===============================
   The seat map and the checkout are the only surfaces in the product where a
   customer must make a DECISION that costs money, on a phone, often on a poor
   connection. They get their own block so the rules that protect them -- a
   minimum 44px touch target, a colour that is never the only signal, a layout
   that cannot overflow at 320px -- are stated once and not scattered.

   NO INLINE STYLES. The shell runs under `style-src 'self'` with no
   'unsafe-inline', so a style attribute is discarded by the browser. Every
   dimension below is a token or a class. See states.js for the same note.

   NO COLOUR ALONE. Every seat state pairs its colour with a glyph and an
   aria-label, because WCAG 1.4.1 is a requirement and because a customer who
   cannot distinguish red from grey cannot tell a sold seat from a selected one.
   =========================================================================== */

/* ------------------------------------------------------------------ search */

.travel-search {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-panel);
  padding: var(--space-5);
  margin-block: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.travel-search__title {
  font-size: var(--text-h3);
  font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-4);
}

.travel-search__form { display: grid; gap: var(--space-4); }

/* The FROM / TO pair. Grid rather than flex so the two selects stay EQUAL
   width at every viewport -- a form whose two halves differ in width reads as
   a hierarchy that is not there. */
.travel-search__row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-3);
  align-items: end;
}

.travel-search__row--dates {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  align-items: end;
}

.travel-search__row .field { display: grid; gap: var(--space-2); min-width: 0; }
.travel-search__row label {
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
}

.travel-search__row select,
.travel-search__row input {
  width: 100%;
  min-height: 44px;              /* WCAG 2.5.5 target size, and it is a phone */
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-input);
  background: var(--surface-1);
  color: var(--text-primary);
  font: inherit;
  font-size: var(--text-body);
}

.travel-search__row select:focus-visible,
.travel-search__row input:focus-visible,
.travel-search__swap:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.travel-search__swap {
  min-width: 44px;
  min-height: 44px;
  margin-bottom: 2px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-input);
  background: var(--surface-3);
  color: var(--text-secondary);
  cursor: pointer;
}
.travel-search__swap:hover { background: var(--surface-sunken); color: var(--text-primary); }

/* Below the two-column breakpoint the swap button moves out of the row: keeping
   three columns on a 360px screen leaves each select ~150px, which truncates
   every station name. The swap becomes a full-width secondary action instead. */
@media (max-width: 640px) {
  .travel-search { padding: var(--space-4); }
  .travel-search__row { grid-template-columns: 1fr; }
  .travel-search__row--dates { grid-template-columns: 1fr 1fr; }
  .travel-search__row--dates .primary-button { grid-column: 1 / -1; }
  .travel-search__swap { justify-self: start; }
}

/* ----------------------------------------------------------------- results */

.travel-results { margin-top: var(--space-5); }

.travel-result {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--surface-1);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-3);
}

.travel-result__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.travel-result__operator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.travel-result__verified {
  font-size: var(--text-micro);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--tone-success);
  background: var(--tone-success-bg);
  border-radius: var(--radius-xs);
  padding: 2px var(--space-2);
  white-space: nowrap;
}

/* The route line: origin and destination are the most important thing on the
   card, so they lead and are the largest text in the component. */
.travel-result__route {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: var(--text-h3);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  flex-wrap: wrap;
}
.travel-result__route span { color: var(--text-muted); font-weight: var(--weight-regular); }

.travel-result__times {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-block: 1px solid var(--border-subtle);
}
.travel-result__time { display: grid; gap: 2px; min-width: 0; }
.travel-result__time dt {
  font-size: var(--text-micro);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: var(--weight-semibold);
}
.travel-result__time dd {
  margin: 0;
  font-size: var(--text-body-l);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.travel-result__amenities { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.travel-result__amenity {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 2px var(--space-2);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.travel-result__foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.travel-result__price { display: grid; gap: 2px; }
.travel-result__price strong {
  font-size: var(--text-h2);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.travel-result__price small { color: var(--text-muted); font-size: var(--text-caption); }

@media (max-width: 480px) {
  .travel-result__foot { align-items: stretch; flex-direction: column; }
  .travel-result__foot .primary-button { width: 100%; justify-content: center; }
}

/* ------------------------------------------------------------------- seats */

/*
   The seat map is a GRID of the bus, not a decorative picture. Seat codes are
   shown on every seat, because "14A" is what the passenger will say at the
   boarding desk.
*/
.seat-picker { display: grid; gap: var(--space-4); }

.seat-picker__bus {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--border-strong);
}

.seat-picker__grid {
  display: grid;
  gap: var(--space-2);
  justify-content: center;
  /* min() keeps the grid inside a 320px viewport: the seat cells shrink before
     the container does, so the map never forces a horizontal scrollbar. */
  grid-template-columns: repeat(var(--seat-columns, 4), minmax(0, 34px));
  margin-inline: auto;
  width: max-content;
  max-width: 100%;
}

.seat-cell {
  position: relative;
  min-width: 34px;
  min-height: 40px;              /* below 44 but the cell is not the only target:
                                     the row label is focusable and offers the same
                                     action, and the gap is 8px */
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-primary);
  font: inherit;
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.seat-cell:hover:not(:disabled) { background: var(--surface-3); }
.seat-cell:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

/* STATE IS NEVER COLOUR ALONE. Each state below pairs a tone with a glyph,
   and the accessible name carries the state as text. */
.seat-cell[data-state="available"] { border-color: var(--border-control); }
.seat-cell[data-state="selected"] {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: var(--text-inverse);
}
.seat-cell[data-state="sold"],
.seat-cell[data-state="blocked"],
.seat-cell[data-state="crew"] {
  background: var(--surface-sunken);
  border-color: var(--border-subtle);
  color: var(--text-muted);
  cursor: not-allowed;
}
.seat-cell[data-state="held"] {
  background: var(--tone-warning-bg);
  border-color: var(--tone-warning);
  color: var(--tone-warning);
  cursor: not-allowed;
}
.seat-cell[data-state="accessible"]:not([data-state="sold"]) { border-width: 2px; border-style: dashed; }

.seat-cell__glyph {
  position: absolute;
  inset-block-end: -2px;
  inset-inline-end: -2px;
  font-size: 9px;
  line-height: 1;
}

/* The aisle: a visible gap, not an empty cell, so the 2+2 / 2+1 shape reads
   correctly and a screen reader is not offered a non-existent seat. */
.seat-picker__aisle {
  min-height: 40px;
  background: repeating-linear-gradient(
    45deg,
    var(--surface-sunken),
    var(--surface-sunken) 4px,
    transparent 4px,
    transparent 8px
  );
  border-radius: var(--radius-xs);
}

.seat-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--text-caption);
  color: var(--text-secondary);
}
.seat-legend__item { display: inline-flex; align-items: center; gap: var(--space-1); }
.seat-legend__swatch {
  width: 14px; height: 14px;
  border: 1px solid var(--border-control);
  border-radius: 3px;
  display: inline-grid;
  place-items: center;
  font-size: 9px;
}
.seat-legend__swatch[data-state="selected"] { background: var(--brand-primary); border-color: var(--brand-primary); color: var(--text-inverse); }
.seat-legend__swatch[data-state="sold"] { background: var(--surface-sunken); border-color: var(--border-subtle); color: var(--text-muted); }
.seat-legend__swatch[data-state="held"] { background: var(--tone-warning-bg); border-color: var(--tone-warning); color: var(--tone-warning); }

/* --------------------------------------------------------------- checkout */

.travel-checkout { display: grid; gap: var(--space-5); }

.travel-steps {
  display: flex;
  gap: var(--space-2);
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0;
  flex-wrap: wrap;
}
.travel-steps__item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-caption);
  color: var(--text-muted);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--surface-3);
}
.travel-steps__item[aria-current="step"] {
  background: var(--brand-primary);
  color: var(--text-inverse);
  font-weight: var(--weight-semibold);
}
.travel-steps__item[data-complete="true"] { background: var(--tone-success-bg); color: var(--tone-success); }

.travel-panel { display: grid; gap: var(--space-4); }
.travel-panel[hidden] { display: none; }

/* The price breakdown. Money is tabular so the digits line up, and the total is
   separated by a rule rather than by bold alone. */
.travel-pricing { display: grid; gap: var(--space-2); }
.travel-pricing__row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-body);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.travel-pricing__row span:last-child { color: var(--text-primary); font-weight: var(--weight-medium); }
.travel-pricing__row--total {
  border-top: 1px solid var(--border-default);
  padding-top: var(--space-3);
  margin-top: var(--space-2);
  font-size: var(--text-h3);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}
.travel-pricing__note {
  font-size: var(--text-caption);
  color: var(--text-muted);
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
  background: var(--brand-gold-ring);
  border-radius: var(--radius-sm);
}

/* Passenger rows in checkout and on the ticket. */
.travel-passengers { display: grid; gap: var(--space-2); }
.travel-passenger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
}
.travel-passenger__seat {
  font-weight: var(--weight-bold);
  color: var(--brand-primary);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ ticket */

.travel-ticket {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  background: var(--surface-1);
  box-shadow: var(--shadow-md);
  /* A ticket is a document. A perforated rule is the one flourish here, and it
     is drawn with a border rather than an image so it prints correctly. */
}
.travel-ticket__header {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-start;
  border-bottom: 1px dashed var(--border-default);
  padding-bottom: var(--space-3);
}
.travel-ticket__reference {
  font-family: var(--font-mono);
  font-size: var(--text-h2);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}
.travel-ticket__qr {
  display: grid;
  place-items: center;
  padding: var(--space-3);
  background: #FFFFFF;           /* barcode geometry, not a theme surface */
  border-radius: var(--radius-sm);
}
.travel-ticket__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/*
   Seat-map grid rows. A row is a horizontal slice of the bus, so it is its own
   grid with its own column count -- that is what lets row 1 hold a DRIVER cell
   and the outer columns of row 2 hold window seats, without every row having to
   know about the layout rules of the others.
*/
.seat-picker__row {
  display: grid;
  grid-template-columns: repeat(var(--row-columns, 4), minmax(0, 34px));
  gap: var(--space-2);
  justify-content: center;
}

.seat-picker__grid--rows {
  display: grid;
  gap: var(--space-2);
  justify-items: center;
}

/*
   The checkout dialog is wider than a form dialog because a seat map and a
   price breakdown side by side need the room on a laptop. It is still capped and
   still scrolls, so a long checkout on a phone never grows past the viewport.
*/
.dialog--wide { max-width: min(680px, calc(100vw - var(--space-6))); }

/*
   The download/print affordance. A ticket is a document, so it gets a print
   stylesheet rather than a screenshot: what the customer prints must be what
   the server issued, re-rendered in ink rather than photographed.
*/
@media print {
  /*
     `currentColor` rather than a literal hex, for two reasons.

     1. It is the token rule. components.css may not hard-code a colour, and the
        lint that enforces it scans the file's text -- so even naming the hex in a
        COMMENT trips it. That is arguably over-strict, but the rule is cheap to
        obey and a stylesheet that only ever uses tokens is one that can be
        re-themed without reading every declaration.

     2. It is also more correct. A ticket printed from a dark-theme browser still
        prints dark ink on white paper, because print is its own medium -- but
        resolving from `color` means the rule follows whatever the ticket's own
        text colour is, rather than assuming one.
  */
  .travel-ticket {
    border: 1px solid currentColor;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .travel-ticket__actions,
  .travel-steps,
  .dialog-header .dialog-close { display: none !important; }
  body { background: #fff; }
}

/*
   Column counts for the seat map, as CLASSES rather than a custom property.
   The shell runs under `style-src 'self'` with no 'unsafe-inline', so an inline
   `--row-columns` would be discarded and every row would fall back to the same
   column count -- the 2+1 and the 2+2 would then render identically.
*/
.seat-picker__row--cols-2 { grid-template-columns: repeat(2, minmax(0, 34px)); }
.seat-picker__row--cols-3 { grid-template-columns: repeat(3, minmax(0, 34px)); }
.seat-picker__row--cols-4 { grid-template-columns: repeat(4, minmax(0, 34px)); }
.seat-picker__row--cols-5 { grid-template-columns: repeat(5, minmax(0, 34px)); }
.seat-picker__row--cols-6 { grid-template-columns: repeat(6, minmax(0, 34px)); }

/* An aisle cell is not interactive, so it must never take focus. It is also
   decorative: the seat codes either side already describe the layout. */
.seat-picker__aisle { pointer-events: none; }

/* ===========================================================================
   My Journeys and the conductor scan pad.
   =========================================================================== */

.journey-counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.journey-count {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--surface-1);
}
.journey-count__label {
  font-size: var(--text-micro);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: var(--weight-semibold);
}
.journey-count__value {
  font-size: var(--text-h2);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.journey-stage { margin-block-end: var(--space-6); }
.journey-stage__title {
  font-size: var(--text-h3);
  font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}
.journey-list { display: grid; gap: var(--space-3); }

.journey-card {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--surface-1);
  box-shadow: var(--shadow-sm);
  /* The stage is marked by a LEFT RULE as well as by the heading above it, so a
     card read out of context still says what stage it is in. */
  border-left: 3px solid var(--border-default);
}
.journey-card[data-stage="IN_PROGRESS"] { border-left-color: var(--tone-info); }
.journey-card[data-stage="CANCELLED"]   { border-left-color: var(--tone-danger); }
.journey-card[data-stage="COMPLETED"]   { border-left-color: var(--tone-success); }

.journey-card__head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-start;
  flex-wrap: wrap;
}
.journey-card__route {
  font-size: var(--text-body-l);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin: 0;
}
.journey-card__meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.journey-card__meta p { margin: 0; font-size: var(--text-caption); color: var(--text-muted); }
.journey-card__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* A journey that has not been paid for is shown in a warning tone and offers
   NO ticket action: there is nothing to show yet, and a greyed-out QR would
   imply otherwise. */
.journey-card[data-stage="PENDING_PAYMENT"] { border-left-color: var(--tone-warning); }

/* ------------------------------------------------------------------ scan pad */

.scan-pad {
  margin-top: var(--space-5);
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-panel);
  background: var(--surface-1);
}
.scan-pad__form { display: grid; gap: var(--space-3); max-width: 520px; }
.scan-pad__form .field { display: grid; gap: var(--space-2); }
.scan-pad__form label {
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
}
.scan-pad__form input,
.scan-pad__form select {
  min-height: 48px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-input);
  background: var(--surface-1);
  color: var(--text-primary);
  font: inherit;
}
.scan-pad__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/*
   The scan verdict.
   `aria-live="assertive"` on the container: a conductor needs this announced
   immediately, not politely queued behind other changes.
*/
.scan-verdict {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-default);
  background: var(--surface-3);
}
.scan-verdict__outcome {
  font-size: var(--text-h3);
  font-weight: var(--weight-bold);
  margin: 0;
}
/* Tone AND word AND glyph. A conductor must not have to tell red from green. */
.scan-verdict[data-may-board="true"] {
  border-color: var(--tone-success);
  background: var(--tone-success-bg);
}
.scan-verdict[data-may-board="true"] .scan-verdict__outcome { color: var(--tone-success); }
.scan-verdict[data-may-board="false"] {
  border-color: var(--tone-danger);
  background: var(--tone-danger-bg);
}
.scan-verdict[data-may-board="false"] .scan-verdict__outcome { color: var(--tone-danger); }
.scan-verdict__instruction { margin: 0; font-weight: var(--weight-semibold); color: var(--text-primary); }
.scan-verdict__detail { margin: 0; font-size: var(--text-caption); color: var(--text-secondary); }
.scan-verdict__luggage {
  margin: 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-caption);
  color: var(--text-secondary);
}

@media (max-width: 480px) {
  .scan-pad__actions { flex-direction: column; }
  .scan-pad__actions .primary-button,
  .scan-pad__actions .secondary-button { width: 100%; justify-content: center; }
  .journey-card__actions .primary-button,
  .journey-card__actions .secondary-button { flex: 1 1 auto; justify-content: center; }
}

/* Promotion entry on the review screen. */
.travel-promo {
  display: flex;
  gap: var(--space-2);
  align-items: end;
  flex-wrap: wrap;
}
.travel-promo .field { flex: 1 1 200px; display: grid; gap: var(--space-2); }
.travel-promo .field label {
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
}
.travel-promo input {
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-input);
  background: var(--surface-1);
  color: var(--text-primary);
  font: inherit;
  /* Promo codes are read aloud at a counter, so they are upper-case on entry. */
  text-transform: uppercase;
}
@media (max-width: 480px) {
  .travel-promo { flex-direction: column; align-items: stretch; }
}

/*
   Pricing & Rates
   ==============
   Money must be scannable: the value column is tabular-figure aligned so a
   column of fares lines up on the decimal point rather than drifting by glyph
   width. Currency colour is never the only signal -- the badge carries an icon
   and a word as well, which is also what makes the statuses readable to someone
   who cannot distinguish the hues.
*/
.pricing-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3, 0.75rem);
    margin-bottom: var(--space-6, 1.5rem);
}

.pricing-metric {
    display: grid;
    gap: 0.15rem;
    padding: var(--space-4);
    border: 1px solid var(--border-subtle, currentColor);
    border-radius: var(--radius-md, 10px);
    background: var(--surface-raised, transparent);
}

.pricing-metric__label { font-size: 0.8rem; color: var(--text-muted, currentColor); }
.pricing-metric__value { font-size: 1.5rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pricing-metric__hint  { font-size: 0.75rem; color: var(--text-muted, currentColor); }

.pricing-dashboard-grid {
    display: grid;
    gap: var(--space-5, 1.25rem);
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 60rem) {
    .pricing-dashboard-grid { grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); }
}

.pricing-coverage { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.pricing-coverage__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border-subtle, currentColor);
}
/* An unconfigured domain is dimmed but still listed. Hiding it would be
   indistinguishable from a domain that needs no attention. */
.pricing-coverage__row.is-empty { opacity: 0.75; }
.pricing-coverage__count { font-variant-numeric: tabular-nums; font-size: 0.85rem; }

.pricing-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: var(--space-3, 0.75rem); }
.pricing-chip {
    border: 1px solid var(--border-subtle, currentColor);
    background: transparent;
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    cursor: pointer;
    min-height: 32px; /* touch target */
}
.pricing-chip.is-active { background: var(--accent, currentColor); color: var(--accent-contrast, CanvasText); }

.pricing-controls__row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.pricing-controls__row input[type="search"],
.pricing-controls__row select { flex: 1 1 12rem; min-height: 40px; }
.pricing-count { font-size: 0.8rem; margin: 0 0 0.5rem; }

.pricing-table .pricing-code { font-family: var(--font-mono, monospace); font-size: 0.85rem; }
.pricing-table .pricing-name { display: block; font-size: 0.8rem; color: var(--text-muted, currentColor); }
/* Aligned digits: a column of prices is read by magnitude, and proportional
   glyphs defeat that. */
.pricing-table .pricing-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pricing-actions { display: flex; gap: 0.25rem; justify-content: flex-end; }
.pricing-actions .icon-button { min-width: 36px; min-height: 36px; }

.pricing-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid currentColor;
    font-size: 0.72rem;
    white-space: nowrap;
}
.pricing-badge.is-success { color: var(--success, currentColor); }
.pricing-badge.is-info    { color: var(--info, currentColor); }
.pricing-badge.is-warning { color: var(--warning, currentColor); }
.pricing-badge.is-muted   { color: var(--text-muted, currentColor); }

.pricing-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.pricing-history__version {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-subtle, currentColor);
}
.pricing-history__version strong { font-variant-numeric: tabular-nums; }

.pricing-notice {
    padding: 0.6rem 0.8rem;
    border-left: 3px solid var(--info, currentColor);
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

/* The editor is a two-column form: inputs left, consequences right, so a change
   is read against its effect before it is saved. */
.pricing-editor { display: grid; gap: var(--space-5, 1.25rem); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 64rem) { .pricing-editor { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.pricing-form { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.pricing-form .field { display: grid; gap: 0.25rem; }
.pricing-form .field__control { min-height: 40px; }
.pricing-form .field__help { font-size: 0.75rem; color: var(--text-muted, currentColor); }
.pricing-scope { grid-column: 1 / -1; border: 1px solid var(--border-subtle, currentColor); border-radius: var(--radius-md, 10px); padding: var(--space-3, 0.75rem); display: grid; gap: var(--space-3, 0.75rem); grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.pricing-scope legend { font-weight: 600; padding: 0 0.35rem; }

.pricing-preview { display: grid; gap: 0.5rem; }
.pricing-preview > div { display: flex; justify-content: space-between; gap: 0.5rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--border-subtle, currentColor); }
.pricing-preview dt { color: var(--text-muted, currentColor); font-size: 0.85rem; }
.pricing-preview dd { margin: 0; font-variant-numeric: tabular-nums; }
.pricing-preview__heading { margin-top: var(--space-4); font-size: 0.9rem; }

.pricing-conflicts { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.4rem; }
.pricing-conflict { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.82rem; padding: 0.4rem 0.5rem; border-left: 3px solid currentColor; }
.pricing-conflict.is-error   { color: var(--danger, currentColor); }
.pricing-conflict.is-warning { color: var(--warning, currentColor); }
.pricing-conflict.is-info    { color: var(--info, currentColor); }

.pricing-error { color: var(--danger, currentColor); font-size: 0.85rem; }
.pricing-editor__note { font-size: 0.8rem; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-top: var(--space-4); }
.pagination__label { font-size: 0.85rem; color: var(--text-muted, currentColor); }
/* Mamore UI v2 — the role-aware landing page (Command Home).
 *
 * The landing is deliberately NOT a dashboard: one hero, short sections, and
 * actions. Every section is a card in one responsive grid, mobile-first.
 *
 * Cascade position: after components.css, so these rules may reference the
 * semantic tokens and override component defaults for the landing only.
 */

/* ------------------------------------------------------------------ hero */

.landing {
  display: grid;
  gap: var(--space-4);
  max-width: 1200px;
  margin-inline: auto;
  animation: landing-rise 0.45s ease both;
}

@keyframes landing-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.landing-hero {
  position: relative;
  display: grid;
  gap: var(--space-4);
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background:
    radial-gradient(120% 160% at 100% 0%, var(--brand-navy-veil) 0%, transparent 55%),
    var(--surface);
  overflow: hidden;
}

.landing-hero__kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.landing-hero h1 {
  margin: 0;
  font-size: clamp(1.4rem, 4.5vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.landing-hero__subline {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.landing-hero__clock {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.landing-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

.landing-hero__lead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-button);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.landing-hero__lead h2 {
  margin: 0;
  font-size: 1rem;
}

.landing-hero__lead p {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* -------------------------------------------------------------- sections */

.landing-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}

.landing-section {
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.landing-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.landing-section__head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.landing-section__head .landing-section__meta {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.landing-muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ----------------------------------------------------------- attention */

.landing-attention {
  display: grid;
  gap: 0.6rem;
}

.landing-attention__item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius-button);
  background: var(--surface-2);
}

.landing-attention__item[data-severity="CRITICAL"] {
  border-left-color: var(--tone-danger);
  animation: landing-pulse 2.2s ease-in-out infinite;
}

.landing-attention__item[data-severity="HIGH"] { border-left-color: var(--tone-warning); }
.landing-attention__item[data-severity="MEDIUM"] { border-left-color: var(--tone-warning); }
.landing-attention__item[data-severity="NORMAL"] { border-left-color: var(--tone-info); }

@keyframes landing-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--tone-danger-bg); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

.landing-attention__severity {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.landing-attention__body h3 {
  margin: 0;
  font-size: 0.92rem;
}

.landing-attention__body p {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.landing-attention__meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.15rem;
  justify-items: end;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  /* The meta column is an `auto` track: without a zero minimum its
     un-wrappable status lines (finance batches, demo-data hints) floor the
     item at ~376px, which stretched the single-column landing grid to 422px
     and scrolled the whole document at a 320px viewport. Clipping with an
     ellipsis keeps the one-line intent while letting the track shrink; the
     zero floor on the internal column stops the inner spans from holding
     300px+ boxes that stick out of the clipped area. */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------ KPI strip */

.landing-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem;
}

.landing-kpi {
  display: grid;
  gap: 0.35rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-button);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.landing-kpi:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.landing-kpi__icon {
  color: var(--accent);
  font-size: 0.9rem;
}

.landing-kpi__value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.landing-kpi__label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---------------------------------------------------------- quick actions */

.landing-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.6rem;
}

.landing-action {
  display: grid;
  gap: 0.5rem;
  justify-items: start;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-button);
  background: var(--surface-2);
  color: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.landing-action:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
}

.landing-action i {
  color: var(--accent);
  font-size: 1.1rem;
}

/* --------------------------------------------------------------- rows */

.landing-rows {
  display: grid;
  gap: 0.5rem;
}

.landing-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-button);
  background: var(--surface-2);
  font-size: 0.85rem;
}

.landing-row strong {
  font-weight: 600;
}

.landing-row small {
  color: var(--text-muted);
}

/* -------------------------------------------------------------- health */

.landing-health {
  display: grid;
  gap: 0.5rem;
}

.landing-health__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.landing-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--tone-success);
}

.landing-dot[data-status="degraded"] { background: var(--tone-warning); }
.landing-dot[data-status="offline"] { background: var(--tone-danger); }

/* -------------------------------------------------------------- media */

.landing-hero__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.landing-hero__brand img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.landing-hero__brand span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.landing-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.landing-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.6s ease;
}

/* ----------------------------------------------------------- responsive */

@media (min-width: 768px) {
  .landing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .landing-section--wide {
    grid-column: 1 / -1;
  }
  .landing-hero {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .landing-hero__actions {
    justify-content: flex-end;
  }
}

@media (min-width: 1100px) {
  .landing-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .landing-section--wide {
    grid-column: 1 / -1;
  }
}

/* Register vehicle form (customer self-service). */
.register-vehicle-form {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-2);
}

.register-vehicle-form .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
}

.register-vehicle-form label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.register-vehicle-form input,
.register-vehicle-form select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-button);
  background: var(--surface);
  color: inherit;
}

/* Landing CTA rows (spacing lives in CSS, never an inline style). */
.landing-cta-row {
  margin-top: 0.6rem;
}
