/* DEMID identity: navy menu and blocks, RE/MAX blue and red, one family (Schibsted Grotesk, SIL OFL, self-hosted: the CSP
   allows font-src 'self', see lib/fonts). Text colors are contrast-checked (4.5:1 or more on the surface they sit on). */
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("../lib/fonts/schibsted-grotesk-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --bg: #f5f7fb;
  --surface: #fff;
  --surface-2: #e9eef6;
  --text: #0b1a36;
  --muted: #5b6680;
  --line: #e2e7f0;
  --line-strong: #c9d2e3;
  --control-border: #7d8aa3; /* 3.5:1 on white: inputs, secondary buttons, pending route nodes (non-text contrast ≥ 3:1) */
  --brand: #003da5;
  --brand-hover: #002b75;
  --brand-text: #fff;
  --navy: #071d49;
  --navy-2: #0c2a63;
  --navy-line: #1c3a75;
  --menu-text: #c9d4ea;
  --menu-muted: #8fa1c7;
  --accent: #d6192b;
  --danger: #c4172a;
  --danger-soft: #fbe3e5;
  --ok: #11734f;
  --ok-soft: #dcf1e8;
  --warn: #8a5a00;
  --warn-soft: #fdf1d8;
  --radius-control: 10px;
  --radius-panel: 16px;
  --focus: #003da5;
  --tabbar-h: 4.5rem;
  font-family: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
/* Figures line up (tabular) where numbers are read; on running text the font would widen its punctuation too. */
/* Tabular figures only on pure-digit counters: in this font they also widen '.', ',' and ':' inside amounts, dates and addresses. */
.badge, .navlink .badge, .tab .badge { font-variant-numeric: tabular-nums; }
body { margin: 0; line-height: 1.45; font-size: .9375rem; }
a { color: var(--brand); }
a:hover { color: var(--brand-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sidemenu, .mobile-top, .sheet, .bare-bar { --focus: #fff; }

.skip-link { position: absolute; left: .5rem; top: -4rem; z-index: 100; padding: .6rem 1rem; border-radius: var(--radius-control); background: var(--surface); color: var(--text); }
.skip-link:focus { top: .5rem; }

/* App shell: one column with a navy header and a tab bar on a phone; a navy side menu and the page from 64rem. */
.shell { min-height: 100vh; }
.sidemenu { display: none; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: #fff; font-size: 1.375rem; font-weight: 800; letter-spacing: .04em; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark { width: .875rem; height: .875rem; flex: none; background: var(--accent); transform: rotate(45deg); }
.mobile-top { position: sticky; top: var(--support-h, 0px); z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 1rem; background: var(--navy); color: #fff; }
.mobile-top .brand { font-size: 1.0625rem; }
.ctx-pill { display: inline-flex; align-items: center; gap: .375rem; min-height: 2.75rem; max-width: 60%; padding: 0 .75rem; border: 1px solid var(--navy-line); border-radius: 999px; background: var(--navy-2); color: #fff; font-size: .875rem; text-decoration: none; }
.ctx-pill:hover { color: #fff; }
.icon { width: 1.25rem; height: 1.25rem; flex: none; }
.ctx-pill .icon { width: .875rem; height: .875rem; }

.page { padding: 1rem 1rem calc(var(--tabbar-h) + 1.5rem + env(safe-area-inset-bottom, 0px)); }
.bare-page { max-width: 64rem; margin: 0 auto; padding-bottom: 2rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 1.25rem; margin-bottom: 1rem; }
.narrow { max-width: 26rem; margin-left: auto; margin-right: auto; }
h1 { margin: 0 0 .75rem; font-size: clamp(1.625rem, 1.2rem + 1.4vw, 2.25rem); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
h2 { margin: 0 0 .75rem; font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.req { color: var(--danger); font-weight: 700; text-decoration: none; cursor: help; }

/* The side menu and the "Más" sheet share one body: context, sections, the person's area. */
.ctx { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .75rem; border: 1px solid var(--navy-line); border-radius: var(--radius-control); background: var(--navy-2); color: #fff; text-decoration: none; }
.ctx:hover { color: #fff; border-color: #2c4d90; }
.ctx-text { display: grid; gap: 2px; min-width: 0; }
.ctx-name { font-weight: 700; overflow-wrap: anywhere; }
.ctx-detail { color: #a9b8d8; font-size: .8125rem; }
.menu-nav { display: grid; gap: .25rem; }
.menu-nav ul { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.menu-heading { margin: 0; padding: .75rem .625rem .25rem; color: var(--menu-muted); font-size: .8125rem; }
.navlink { display: flex; align-items: center; gap: .75rem; min-height: 2.75rem; padding: .625rem; border-radius: 8px; color: var(--menu-text); text-decoration: none; }
.navlink:hover { background: var(--navy-2); color: #fff; }
.navlink[aria-current="page"] { background: var(--brand); color: #fff; font-weight: 600; }
.navlabel { flex: 1; }
.menu-user { display: grid; gap: .25rem; margin-top: auto; padding-top: .75rem; border-top: 1px solid var(--navy-line); }
.menu-user form { display: block; }
.who { display: flex; align-items: center; gap: .625rem; padding: 0 .5rem .5rem; }
.avatar { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none; border-radius: 50%; background: var(--navy-line); color: #fff; font-weight: 700; }
.who-name { color: #fff; font-weight: 600; overflow-wrap: anywhere; }
.menu-user .langnav { padding: 0 .5rem; color: var(--menu-text); }
.menu-action { display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 2.75rem; padding: .5rem .625rem; border: 0; border-radius: 8px; background: none; color: var(--menu-text); font: inherit; text-align: left; }
.menu-action:hover, .menu-action[aria-pressed="true"] { background: var(--navy-2); color: #fff; }
.langnav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .25rem; font-size: .875rem; }
.langnav button.link { min-width: 2.75rem; min-height: 2.75rem; padding: 0 .5rem; color: inherit; text-decoration: none; }
.langnav .current { font-weight: 700; box-shadow: inset 0 -2px 0 currentColor; }

/* DEMID support mode (D2 extension): a bar that stays on top while a DEMID person works inside an agency. Its height is a variable so the
   sticky header and side menu sit under it; the text is one line, cut with an ellipsis, so the height never changes. */
.has-support { --support-h: 2.75rem; }
.support-banner { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: .75rem; height: var(--support-h); padding: 0 1rem; background: var(--warn-soft); color: var(--warn); border-bottom: 2px solid var(--warn); font-weight: 600; }
.support-banner .support-text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.support-banner form { display: block; flex: none; }
.support-banner .link { min-height: 2.75rem; color: var(--warn); font-weight: 700; }

/* Tab bar and "Más" sheet of the phone. */
.tabbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 6px 4px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--surface); }
.tab { position: relative; display: grid; align-content: center; justify-items: center; gap: 2px; min-height: 3.5rem; padding: 4px 0 0; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: .75rem; text-decoration: none; cursor: pointer; }
.tab:hover { color: var(--brand); }
.tab .icon { width: 1.5rem; height: 1.5rem; }
.tab[aria-current="page"] { color: var(--brand); font-weight: 700; box-shadow: inset 0 3px 0 var(--brand); }
.tab .badge.unread { position: absolute; top: 2px; left: 54%; }
.tab-more > summary { list-style: none; }
.tab-more > summary::-webkit-details-marker { display: none; }
.tab-more[open] > summary { color: var(--brand); }
.sheet { position: fixed; z-index: 25; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 1rem; max-height: calc(100vh - var(--tabbar-h) - 5rem); overflow-y: auto; padding: 1rem; border-radius: var(--radius-panel) var(--radius-panel) 0 0; background: var(--navy); color: var(--menu-text); box-shadow: 0 -8px 24px rgba(7, 29, 73, .3); }

@media (min-width: 64rem) {
  .shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); }
  .sidemenu { position: sticky; top: var(--support-h, 0px); display: flex; flex-direction: column; gap: 1.25rem; height: calc(100vh - var(--support-h, 0px)); overflow-y: auto; padding: 1.25rem 1rem; background: var(--navy); color: var(--menu-text); }
  .sidemenu .brand { padding: .25rem .5rem; }
  .mobile-top, .tabbar { display: none; }
  .page { width: 100%; max-width: 82rem; margin: 0 auto; padding: 2.25rem 3rem 3rem; }
}

/* Plain pages (context selector, errors): a slim navy bar over the content. */
.bare-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1rem; padding: .5rem 1rem; background: var(--navy); color: var(--menu-text); }
.bare-bar .langnav { margin-left: auto; }
.bare-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; }
.bare-bar a, .bare-bar .link { color: #fff; }

label { display: block; margin: .75rem 0 .25rem; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select {
  width: 100%;
  min-height: 3rem;
  padding: 0 .875rem;
  font: inherit;
  color: var(--text);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-control);
  background: var(--surface);
}
input[type=checkbox], input[type=radio] { width: 1.25rem; height: 1.25rem; accent-color: var(--brand); }
button { font: inherit; cursor: pointer; }
button.primary { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; margin-top: 1rem; padding: 0 1.25rem; border: 0; border-radius: var(--radius-control); background: var(--brand); color: var(--brand-text); font-weight: 700; }
button.primary:hover { background: var(--brand-hover); }
button.link { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; }
form.inline { display: inline; }
/* Fields the flow editor hides by the choice above them (app.js); an author rule must not undo the attribute. */
[hidden] { display: none !important; }

.alert { padding: .6rem .8rem; border-radius: var(--radius-control); margin: .5rem 0; }
.alert:empty, .alert.validation-summary-valid { display: none; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.missing-data { display: grid; gap: .25rem; margin: 0 0 1.25rem; }
.missing-data h2 { margin: 0; font-size: 1.125rem; }
.missing-data p { margin: 0; }
.alert ul { margin: 0; padding-left: 1.1rem; }

.options { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.option:hover { border-color: var(--brand); }
.option { width: 100%; text-align: left; display: grid; gap: .15rem; min-height: 2.75rem; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); }
.option span { color: var(--muted); font-size: .9rem; }

.links { padding-left: 1.1rem; }
.links li { margin: .35rem 0; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius-control); margin: 1rem 0 0; padding: .5rem .75rem; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; margin: .35rem 0; }
.more { margin: 1rem 0 0; }
.more > summary { display: flex; align-items: center; min-height: 2.75rem; padding: 0 .75rem; cursor: pointer; font-weight: 600; border: 1px dashed var(--line-strong); border-radius: var(--radius-control); }
.more[open] > summary { border-style: solid; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .75rem .625rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { border-bottom-color: var(--line-strong); color: var(--muted); font-size: .875rem; font-weight: 500; }
tbody tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; display: flex; align-items: center; gap: .75rem; }
.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }

.copyrow { display: flex; gap: .5rem; align-items: stretch; flex-wrap: wrap; }
.copyrow input { flex: 1 1 16rem; }
.copyrow button { margin-top: 0; }


.htmx-request { opacity: .6; }

/* Editable texts (plan 6.9): a text keeps its line breaks; in editing mode every text can be clicked. */
.custom-text { white-space: pre-line; }
.text-edit .custom-text { outline: 1px dashed var(--brand); outline-offset: 2px; cursor: text; }
.text-edit .custom-text.editing { outline: 2px solid var(--brand); background: var(--warn-soft); }
.text-edit .sidemenu .custom-text, .text-edit .sheet .custom-text, .text-edit .bare-bar .custom-text { outline-color: var(--menu-muted); }
.text-edit .sidemenu .custom-text.editing, .text-edit .sheet .custom-text.editing, .text-edit .bare-bar .custom-text.editing { color: var(--text); }
.textedit-bar { display: none; }
.text-edit .textedit-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem 1rem;
  padding: .5rem 1rem;
  background: var(--warn-soft);
  border-top: 2px solid var(--brand);
}
.textedit-help, .textedit-state { color: var(--muted); }
.textedit-state.failed { color: var(--danger); }
.textedit-key:empty, .textedit-bar [data-text-reset] { display: none; }
.text-editing .textedit-key, .text-editing .textedit-bar [data-text-reset] { display: inline; }
textarea { width: 100%; padding: .75rem .875rem; font: inherit; color: var(--text); border: 1px solid var(--control-border); border-radius: var(--radius-control); }
.searchrow { display: grid; gap: .25rem; max-width: 26rem; }

/* Flow configuration (Flujos). */
form.rename { display: flex; gap: .5rem; align-items: center; }
form.rename input[type=text] { min-width: 10rem; }
.badge { display: inline-block; padding: .125rem .625rem; border: 1px solid transparent; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .8125rem; font-weight: 600; }
button.primary.danger { background: var(--danger); }
.confirm { display: grid; gap: .5rem; }
.stages { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .75rem; }
.stage { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; background: var(--surface); }
.stage.has-issues { border-color: var(--danger); }
.stage-head { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: center; }
dl.facts { display: grid; grid-template-columns: minmax(7rem, max-content) 1fr; gap: .25rem 1rem; margin: .5rem 0 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
dl.facts ul { margin: 0; padding-left: 1.1rem; }
ul.issues { margin: .5rem 0 0; padding-left: 1.5rem; }
.stage-actions { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .5rem; }
.stage-form { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .5rem; }
.row { display: grid; gap: .25rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-control); padding: .5rem; margin: .5rem 0; }
.row label { margin: .25rem 0 0; }
.row input[type=number], .row select, .row textarea { max-width: 100%; }
ul.field-errors { margin: .25rem 0 0; padding-left: 1.1rem; color: var(--danger); }

/* Reservations (Reservas): mobile first, one column of cards. */
.titlebar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .5rem; }
.titlebar h1 { margin: 0; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem 1rem; margin: .75rem 0 1.25rem; }
.filters .field { flex: 1 1 12rem; max-width: 18rem; }
.filters label { margin: 0 0 .25rem; }
.filters .check { flex: 1 1 100%; margin: 0; }
.filters button.primary { margin-top: 0; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.card-row { display: grid; gap: .25rem; padding: 1rem 1.125rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.card-row .row-title { color: var(--text); font-weight: 700; text-align: left; text-decoration: none; }
.card-row a.row-title:hover { color: var(--brand); text-decoration: underline; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; color: var(--muted); font-size: .9rem; }
.badge.overdue { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.money { display: grid; grid-template-columns: 1fr 6rem; gap: .5rem; }
.stage-form + .stage-form { margin-top: .5rem; }
@media (max-width: 40rem) {
  button.primary { min-height: 2.75rem; }
}

/* Notices (Notificaciones): the badge of the top bar and the inbox. */
.badge.unread { min-width: 1.375rem; padding: 1px 7px; border-color: var(--accent); border-radius: 11px; background: var(--accent); color: #fff; font-size: .8125rem; font-weight: 700; text-align: center; }
.card .badge.unread { border-color: var(--brand); background: var(--brand); }
.tab .badge.unread { min-width: 1.125rem; padding: 0 5px; font-size: .6875rem; line-height: 1.125rem; }
.card-row.notice.unread { border-left: .25rem solid var(--accent); }
.filters-inline { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: .5rem 0 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.panel-grid { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
.panel-grid > .card { margin-bottom: 0; }
.chart { width: 100%; min-height: 8rem; }
@media (min-width: 40rem) {
  .panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 63.99rem) {
  .text-edit .textedit-bar { bottom: var(--tabbar-h); }
}

/* Buttons: primary blue, secondary outlined. */
.button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.75rem; padding: 0 1.25rem; border: 0; border-radius: var(--radius-control); background: var(--brand); color: var(--brand-text); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--brand-hover); color: var(--brand-text); }
.button.secondary { border: 1px solid var(--control-border); background: var(--surface); color: var(--text); font-weight: 600; }
.button.secondary:hover { background: var(--surface-2); color: var(--text); }
.button[disabled] { background: var(--line); color: var(--muted); cursor: not-allowed; }
.button .icon { width: 1.125rem; height: 1.125rem; }
.eyebrow { margin: 0 0 .25rem; color: var(--muted); }
.lead { margin: .25rem 0 0; color: var(--muted); font-size: 1rem; }
.navy-block { margin-bottom: 1.25rem; padding: 1.5rem 1.75rem; border-radius: var(--radius-panel); background: var(--navy); color: #fff; }
.navy-block h2 { margin: 0 0 .75rem; color: var(--menu-text); font-size: 1.0625rem; font-weight: 600; letter-spacing: 0; }
.big-figure { display: flex; align-items: baseline; gap: .75rem; margin: 0 0 1rem; color: var(--menu-text); }
.big-figure strong { color: #fff; font-size: 4rem; font-weight: 800; line-height: .9; letter-spacing: -.03em; }
a.on-navy { color: #fff; font-weight: 600; }

/* Inicio: greeting, what is waiting for the person (by urgency), the summary of the office and the latest notices. */
.home-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; margin-bottom: 1.5rem; }
.home-head h1 { margin: 0; }
.home-counters { display: none; }
.home-grid { display: grid; gap: 1.25rem; align-items: start; }
.home-side { display: grid; gap: 1.25rem; }
.home-side > * { margin: 0; }
.todo h2 { margin: 0 0 .25rem; font-size: 1.375rem; font-weight: 700; }
.group-title { display: flex; align-items: center; gap: .5rem; margin: 1.25rem 0 .5rem; font-size: .9375rem; font-weight: 700; }
.group-title .dot { width: .5rem; height: .5rem; flex: none; border-radius: 50%; background: var(--brand); }
.group-title.overdue { color: var(--danger); }
.group-title.overdue .dot { background: var(--accent); }
.group-title.thisweek, .group-title.later { color: var(--muted); }
.group-title.thisweek .dot, .group-title.later .dot { box-sizing: border-box; border: 2px solid var(--muted); background: none; }
.todo-list { margin: 0; padding: 0; list-style: none; }
.todo-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .25rem 1rem; padding: .875rem 0; border-top: 1px solid var(--line); }
.todo-title { color: var(--text); font-size: 1rem; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.todo-title:hover { color: var(--brand); text-decoration: underline; }
.todo-sub { grid-column: 1 / -1; color: var(--muted); }
.due { font-weight: 600; }
.due.postponed { color: var(--warn); }
.summary-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: 0 0 1rem; }
.summary-facts dt { color: var(--menu-text); font-size: .8125rem; }
.summary-facts dd { margin: 0; font-size: 1.375rem; font-weight: 700; }
.summary-facts .danger dd { color: #ff8a94; }
.notices ul { display: grid; gap: .875rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.notices li { display: grid; gap: 2px; }
.notice-title { font-weight: 600; }
.notice-body { color: var(--muted); font-size: .875rem; }
.notices .is-new .notice-title::before { content: ""; display: inline-block; width: .5rem; height: .5rem; margin-right: .5rem; border-radius: 50%; background: var(--accent); }

/* Reservation detail: header, the route (vertical on a phone, horizontal from 64rem), the current stage and the side blocks. */
.crumb { margin: 0 0 .75rem; font-weight: 600; }
.crumb a { text-decoration: none; }
.detail-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; margin-bottom: 1.25rem; }
.detail-head h1 { margin: 0 0 .25rem; overflow-wrap: anywhere; }
.detail-head .badge { vertical-align: middle; font-size: .8125rem; }
.head-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.detail { display: grid; gap: 1.25rem; }
.detail > *, .detail-side > * { min-width: 0; margin: 0; }
.detail-side { display: grid; gap: 1.25rem; align-content: start; }
.current { padding: 1.5rem; }
.current h2 { margin: 0 0 1rem; font-size: 1.625rem; font-weight: 800; letter-spacing: -.01em; }
.hint { display: grid; gap: .375rem; margin: 1rem 0; padding: 1rem 1.125rem; border-radius: 12px; background: var(--bg); }
.hint span { color: var(--muted); }
.stage-actions { align-items: center; gap: .75rem; margin-top: 1rem; }
.history-link { margin-left: auto; font-weight: 600; }
dl.facts dd.strong { font-weight: 700; }
.route-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; margin-bottom: 1.25rem; }
.route-head h2 { margin: 0; }
.route { display: grid; margin: 0; padding: 0; list-style: none; }
.route-step { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: .75rem; }
.track { display: flex; flex-direction: column; align-items: center; }
.node { display: grid; place-items: center; width: 1.5rem; height: 1.5rem; flex: none; box-sizing: border-box; border: 2px solid var(--control-border); border-radius: 50%; background: var(--surface); color: #fff; }
.node svg { width: .875rem; height: .875rem; }
.seg { flex: 1 1 auto; width: 3px; min-height: 1.75rem; background: var(--line); }
.route-step:last-child .seg { display: none; }
.route-info { display: grid; align-content: start; gap: 2px; padding-bottom: .75rem; }
.route-name { color: var(--text); font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.route-name:hover { color: var(--brand); text-decoration: underline; }
.route-note { color: var(--muted); font-size: .875rem; }
.route-origin { color: var(--muted); font-size: .8125rem; }
.route-step.done .node { border-color: var(--brand); background: var(--brand); }
.route-step.done .seg, .route-step.na .seg { background: var(--brand); }
.route-step.na .node { border-color: var(--surface-2); background: var(--surface-2); color: var(--muted); }
.route-step.active .node { border: 4px solid var(--accent); box-shadow: 0 0 0 4px var(--danger-soft); }
.route-step.active .route-name { font-weight: 800; }
.route-step.active .route-note { color: var(--danger); font-weight: 600; }
.route-step.postponed .node { border: 2px dashed var(--warn); background: var(--warn-soft); }
.route-step.postponed .route-note { color: var(--warn); font-weight: 600; }
.route-step.end .node { border-color: var(--brand); background: var(--brand); }
.route-step.end .route-name { color: var(--text); font-weight: 800; }
.route-step.end.cancelled .node { border-color: var(--danger); background: var(--danger); }
.route-step.end.cancelled .route-note { color: var(--danger); font-weight: 600; }
.route.stopped .route-step.active .node { border: 2px solid var(--control-border); box-shadow: none; }
.route.stopped .route-step.active .route-note, .route.stopped .route-step.postponed .route-note { color: var(--muted); font-weight: 400; }
.badge.outcome { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.outcome-note { display: grid; gap: .25rem; margin: 0 0 1.25rem; }
.outcome-note h2 { margin: 0; font-size: 1.125rem; }
.outcome-note p { margin: 0; }

@media (max-width: 63.99rem) {
  .home-head { flex-direction: column; align-items: stretch; margin: -1rem -1rem 1.25rem; padding: 1rem 1.25rem 1.375rem; background: var(--navy); color: #fff; }
  .home-head .eyebrow, .home-head .lead { color: var(--menu-text); }
  .home-head a:not(.button) { color: #fff; }
  .home-head .button { background: var(--surface); color: var(--brand); }
  .home-counters { display: flex; gap: .625rem; margin: 0; padding: 0; list-style: none; }
  .home-counters li { flex: 1; padding: .625rem .75rem; border-radius: 12px; background: var(--navy-2); color: var(--menu-text); font-size: .8125rem; }
  .home-counters strong { display: block; color: #fff; font-size: 1.625rem; font-weight: 800; }
  .home-counters .overdue strong { color: #ff8a94; }
  .todo.card { padding: 0; border: 0; background: none; }
  .todo-row { margin-bottom: .625rem; padding: .875rem 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
  .group-title { margin-top: 1rem; }
  .detail-head .button { flex: 1; }
}

@media (min-width: 64rem) {
  .home-grid { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 1.75rem; }
  .todo.card { padding: 1.5rem 1.75rem; }
  .detail { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); grid-template-areas: "route route" "current side" "others side"; gap: 1.75rem; align-items: start; }
  .route-card { grid-area: route; padding: 1.75rem 2rem 1.5rem; }
  .current { grid-area: current; padding: 1.625rem 1.875rem; }
  .detail-side { grid-area: side; }
  .others { grid-area: others; }
  .route { grid-auto-flow: column; grid-auto-columns: minmax(9rem, 1fr); overflow-x: auto; padding: 6px 6px 2px; }
  .route-step { grid-template-columns: none; align-content: start; justify-items: start; gap: .625rem; }
  .track { flex-direction: row; width: 100%; }
  .node { width: 2.25rem; height: 2.25rem; }
  .node svg { width: 1.125rem; height: 1.125rem; }
  .seg { flex: 1 1 auto; width: auto; min-height: 0; height: 4px; }
  .route-info { padding: 0 .75rem 0 0; }
  .route-name { font-size: 1rem; }
}

.home-counters strong { font-variant-numeric: tabular-nums; }
.guarantee .big-figure strong { font-size: 2.75rem; letter-spacing: -.02em; }

/* Control panel: the summary strip (navy first cell), the two charts, two tables. */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0; }
.head-filter { display: grid; gap: .25rem; color: var(--muted); font-size: .875rem; }
.head-filter label { margin: 0; font-weight: 400; }
.head-filter div { display: flex; gap: .5rem; }
.head-filter select { min-width: 12rem; }
.strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 1.25rem; padding: 0; overflow: hidden; list-style: none; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); }
.strip li { display: grid; align-content: start; gap: .25rem; padding: 1rem 1.25rem; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.strip .strip-label { color: var(--muted); }
.strip .strip-label a:not(.on-navy) { color: var(--muted); }
.strip .num { font-size: 2.25rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.strip .bad .num { color: var(--danger); }
.strip .strip-main { grid-column: 1 / -1; border: 0; background: var(--navy); color: #fff; }
.strip .strip-main .strip-label { color: var(--menu-text); }
.strip .strip-main .num { font-size: 3.5rem; }
.late { color: var(--danger); font-weight: 700; }
.stack-table .row-title { color: var(--text); font-weight: 700; text-decoration: none; }
.stack-table .row-title:hover { color: var(--brand); text-decoration: underline; }
@media (max-width: 39.99rem) {
  .stack-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .stack-table tr { display: block; padding: .5rem 0; border-top: 1px solid var(--line); }
  .stack-table td { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; border: 0; text-align: right; }
  .stack-table td::before { content: attr(data-label); color: var(--muted); text-align: left; }
}
@media (min-width: 64rem) {
  .strip { grid-template-columns: 1.3fr repeat(5, minmax(0, 1fr)); }
  .strip li { border-top: 0; }
  .strip .strip-main { grid-column: auto; }
}

/* Login and invitations: the navy brand panel and the form, split from 64rem; on a phone the panel is a short header. */
.split-page { position: relative; min-height: 100vh; }
.split-flash { position: absolute; top: 1rem; left: 50%; z-index: 10; width: min(25rem, 92vw); transform: translateX(-50%); }
.auth { display: grid; grid-template-rows: auto 1fr; min-height: 100vh; }
.auth-brand { display: flex; flex-direction: column; gap: .75rem; padding: 1.25rem; background: var(--navy); color: #fff; --focus: #fff; }
.auth-claim { display: grid; gap: 1.5rem; max-width: 35rem; }
.claim { margin: 0; font-size: 1.75rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.claim-text, .auth-route { display: none; }
.auth-form { display: grid; align-content: center; justify-items: center; gap: 1.5rem; padding: 2rem 1.25rem 3rem; }
.auth-card { display: grid; gap: 1.125rem; width: 100%; max-width: 25rem; }
.auth-card > div > h1 { margin-bottom: .375rem; }
.auth-card label { margin: 0 0 .375rem; }
.auth-card p { margin: 0; }
.button.wide { width: 100%; min-height: 3.125rem; }
@media (min-width: 64rem) {
  .auth { grid-template-columns: 1.15fr 1fr; grid-template-rows: none; }
  .auth-brand { justify-content: space-between; gap: 2rem; padding: 3.5rem 4.5rem; }
  .auth-brand .brand { font-size: 1.625rem; }
  .claim { font-size: 4rem; line-height: .98; }
  .claim-text { display: block; margin: 0; color: var(--menu-text); font-size: 1.25rem; line-height: 1.45; }
  .auth-route { display: flex; align-items: center; max-width: 32.5rem; margin: 0; padding: 0; list-style: none; }
  .auth-route li { display: flex; flex: 1 1 auto; align-items: center; }
  .auth-route li:last-child { flex: none; }
  .auth-route li::before { content: ""; width: 1.125rem; height: 1.125rem; flex: none; box-sizing: border-box; border: 2px solid #3d5a92; border-radius: 50%; }
  .auth-route li:not(:last-child)::after { content: ""; flex: 1 1 auto; height: 3px; background: var(--navy-line); }
  .auth-route li.done::before { border-color: #4f86f0; background: #4f86f0; }
  .auth-route li.done::after { background: #4f86f0; }
  .auth-route li.active::before { border: 3px solid #ff5a68; }
}

form.stack { max-width: 46rem; }
