/* ============================================================
   Calibre Engine - dual-theme token system (UI spec §2), with
   the XPages Master dark surfaces and band containers
   (11_UI_SHELL.md §5).
   Every colour pair in here is checked against WCAG 2.1 AA by
   tests/shell/audit_contrast.py: 4.5:1 for text, 3:1 for
   control boundaries and meaningful graphics.
   The theme is resolved to an explicit data-bs-theme by
   static/theme.js before first paint, so Bootstrap's own
   components switch with us. The media query below is the no-JS
   fallback. The two dark copies must stay identical; the audit
   fails if they differ.
   ============================================================ */
:root{
  --page:#cbd6e2; --card:#ffffff; --sunk:#f1f4f7;
  --ink:#131c26; --ink-2:#333f4b; --mute:#4e5862;
  --rule:#c3cdd6; --rule-strong:#6d7985;
  --accent:#0b6340; --accent-soft:#e2efe8;
  --danger:#b3261e; --success:#136a3e; --warn:#7a5300;
  --link:#14528f;
  --idle-bg:#e6eaee; --idle-fg:#414c56;
  --run-bg:#e3eefb;  --run-fg:#14528f;
  --done-bg:#e0f2e8; --done-fg:#0f5a35;
  --warn-bg:#fdf3e2; --warn-bd:#8f6914;
  --chrome-bg:#131c26; --chrome-ink:#e8eef4; --chrome-mute:#9fb0c0;
  --chrome-rule:#3a4755; --chrome-hover:#1e2a36;
  --chrome-accent:#4fc48d; --chrome-accent-ink:#0b1016; --chrome-control:#77848f;
  --violet-fg:#5b3fa8;
  --hero-a:#101a26; --hero-b:#1f3a5f; --hero-c:#0f5a46; --hero-d:#3a2a78; --hero-e:#1b4a86;
  --hero-ink:#ffffff; --hero-ink-2:#d5dee8; --hero-soft:#12303f; --hero-rule:#566a88;
  --shadow:0 1px 2px rgba(16,24,32,.05);
  --brand-text:var(--brand-text-light,#1F3A5F);
  --brand-bar:var(--brand-bar-light,#1F3A5F);
  --brand-btn:var(--brand-btn-light,#1F3A5F);
  --brand-btn-fg:var(--brand-btn-fg-light,#ffffff);
}
@media (prefers-color-scheme:dark){
  :root:not([data-bs-theme="light"]){
    --page:#05080b; --card:#212c38; --sunk:#2b3846;
    --ink:#e8eef4; --ink-2:#c2cdd8; --mute:#a0adba;
    --rule:#414f5f; --rule-strong:#808d98;
    --accent:#4fc48d; --accent-soft:#15291f;
    --danger:#ff9b91; --success:#6edb9f; --warn:#e6b355;
    --link:#8ec5f7;
    --idle-bg:#242e38; --idle-fg:#b9c5d1;
    --run-bg:#12293f;  --run-fg:#8ec5f7;
    --done-bg:#0f2a1d; --done-fg:#71dda3;
    --warn-bg:#2c2113; --warn-bd:#e6b355;
    --chrome-bg:#131c26; --chrome-ink:#e8eef4; --chrome-mute:#9fb0c0;
    --chrome-rule:#3a4755; --chrome-hover:#1e2a36;
    --chrome-accent:#4fc48d; --chrome-accent-ink:#0b1016; --chrome-control:#77848f;
    --violet-fg:#c4b1f5;
    --hero-a:#101a26; --hero-b:#1f3a5f; --hero-c:#0f5a46; --hero-d:#3a2a78; --hero-e:#1b4a86;
    --hero-ink:#ffffff; --hero-ink-2:#d5dee8; --hero-soft:#12303f; --hero-rule:#566a88;
    --shadow:0 1px 2px rgba(0,0,0,.5);
    --brand-text:var(--brand-text-dark,#8fa3bb);
    --brand-bar:var(--brand-bar-dark,#8fa3bb);
    --brand-btn:var(--brand-btn-dark,#556985);
    --brand-btn-fg:var(--brand-btn-fg-dark,#ffffff);
  }
}
[data-bs-theme="dark"]{
  --page:#05080b; --card:#212c38; --sunk:#2b3846;
  --ink:#e8eef4; --ink-2:#c2cdd8; --mute:#a0adba;
  --rule:#414f5f; --rule-strong:#808d98;
  --accent:#4fc48d; --accent-soft:#15291f;
  --danger:#ff9b91; --success:#6edb9f; --warn:#e6b355;
  --link:#8ec5f7;
  --idle-bg:#242e38; --idle-fg:#b9c5d1;
  --run-bg:#12293f;  --run-fg:#8ec5f7;
  --done-bg:#0f2a1d; --done-fg:#71dda3;
  --warn-bg:#2c2113; --warn-bd:#e6b355;
  --chrome-bg:#131c26; --chrome-ink:#e8eef4; --chrome-mute:#9fb0c0;
  --chrome-rule:#3a4755; --chrome-hover:#1e2a36;
  --chrome-accent:#4fc48d; --chrome-accent-ink:#0b1016; --chrome-control:#77848f;
  --violet-fg:#c4b1f5;
  --hero-a:#101a26; --hero-b:#1f3a5f; --hero-c:#0f5a46; --hero-d:#3a2a78; --hero-e:#1b4a86;
  --hero-ink:#ffffff; --hero-ink-2:#d5dee8; --hero-soft:#12303f; --hero-rule:#566a88;
  --shadow:0 1px 2px rgba(0,0,0,.5);
  --brand-text:var(--brand-text-dark,#8fa3bb);
  --brand-bar:var(--brand-bar-dark,#8fa3bb);
  --brand-btn:var(--brand-btn-dark,#556985);
  --brand-btn-fg:var(--brand-btn-fg-dark,#ffffff);
}

/* ---------- base ---------- */
/* nothing may push the page sideways; a safety net only (UI spec §10) */
html,body{max-width:100%;overflow-x:hidden}
body{background:var(--page);color:var(--ink);font-size:14.5px;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
.mono,.num{font-variant-numeric:tabular-nums;
  font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace}
h1,h2,h3,h4,h5,h6{color:var(--ink)}
hr{border-color:var(--rule-strong);opacity:1}
.text-muted{color:var(--mute)!important}
.text-danger{color:var(--danger)!important}
.text-success{color:var(--success)!important}
code{color:var(--ink)}

/* Bootstrap's link blue is replaced by a token that clears 4.5:1 on every
   surface a link can sit on, in both themes. */
a{color:var(--link)}
a:hover,a:focus{color:var(--link);text-decoration-thickness:2px}

/* focus: one visible, high-contrast treatment everywhere. On the dark chrome
   the content accent is a dark green on near-black, so the navbar and footer
   carry their own; a menu that opens from the navbar is a card again. */
html{--focus:var(--accent);
  /* The theme's own values, under second names. A band re-points --ink and
     the rest at light-on-dark; a light surface inside a band points back. */
  --t-ink:var(--ink);--t-ink-2:var(--ink-2);--t-mute:var(--mute);--t-rule:var(--rule);
  --t-accent:var(--accent);--t-accent-soft:var(--accent-soft);--t-link:var(--link);--t-sunk:var(--sunk)}
.site-header,.site-footer{--focus:var(--chrome-accent)}
.site-header .dropdown-menu{--focus:var(--accent)}
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{
  outline:3px solid var(--focus);outline-offset:2px;border-radius:4px}
/* Bootstrap swaps the outline of these for a faint glow; put the ring back. */
.btn:focus-visible,.btn-close:focus-visible,.nav-link:focus-visible,
.navbar-toggler:focus-visible,.dropdown-item:focus-visible{
  outline:3px solid var(--focus);outline-offset:2px;box-shadow:none}

.skip{position:absolute;left:-9999px;top:0;z-index:1080;
  background:var(--card);color:var(--ink);padding:.6rem 1rem;border:2px solid var(--accent);
  border-radius:0 0 6px 0;font-weight:600}
.skip:focus{left:0}

/* ---------- chrome ---------- */
.navbar{background:var(--chrome-bg);border-bottom:1px solid var(--chrome-rule);
  --bs-navbar-toggler-border-color:var(--chrome-control)}
.navbar-brand-mark{width:30px;height:30px;border-radius:6px;background:var(--brand-chrome);
  color:var(--brand-chrome-fg);display:grid;place-items:center;font-weight:700;font-size:13px;flex:0 0 auto}
.navbar .navbar-brand{color:var(--chrome-ink)}
.navbar .nav-link{color:var(--chrome-mute);font-weight:500;padding:.35rem .8rem;border-radius:6px}
.navbar .nav-link:hover{color:var(--chrome-ink);background:var(--chrome-hover)}
.navbar .nav-link.active{color:var(--chrome-ink);background:var(--chrome-hover);font-weight:600}
/* The bar is dark in both themes, so the toggler icon is always the chrome ink. */
.navbar{--bs-navbar-toggler-icon-bg:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23e8eef4' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e")}
.navbar-toggler{color:var(--chrome-ink)}

/* theme switch */
.theme-switch{display:inline-flex;border:1px solid var(--chrome-control);border-radius:7px;overflow:hidden}
.theme-switch button{background:transparent;color:var(--chrome-mute);border:0;padding:.3rem .5rem;
  display:grid;place-items:center;line-height:0}
.theme-switch button+button{border-left:1px solid var(--chrome-control)}
.theme-switch button:hover{background:var(--chrome-hover);color:var(--chrome-ink)}
.theme-switch button[aria-pressed="true"]{background:var(--chrome-accent);color:var(--chrome-accent-ink)}
.theme-switch button:focus-visible{outline-offset:-3px}
.theme-switch svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;
  stroke-linecap:round;stroke-linejoin:round}

/* ---------- bands: the standard containers (XPages Master) ----------
   A band is a dark gradient, navy into a hue, with light text - the same in
   both themes, like the navbar. Page heads, card headers and any card marked
   .band are bands; inside one, the ordinary tokens mean their light-on-dark
   counterparts, so every component just works there. */
.band,.page-head,.card-header{
  --band-bg:linear-gradient(118deg,var(--hero-a) 0%,var(--hero-b) 45%,var(--band-end,var(--hero-d)) 100%);
  background:var(--band-bg);
  color:var(--hero-ink-2);
  --ink:var(--hero-ink);--ink-2:var(--hero-ink-2);--mute:var(--hero-ink-2);--link:var(--hero-ink);
  --accent:var(--chrome-accent);--accent-soft:var(--hero-soft);--rule:var(--hero-rule);
  --sunk:var(--hero-a);--focus:var(--chrome-accent)}
.band-green{--band-end:var(--hero-c)}
.band-blue{--band-end:var(--hero-e)}
/* .card sets its own surface further down, so a band card says so again */
.card.band{border:0;background:var(--band-bg);color:var(--hero-ink-2)}
/* a card header inside a band is part of it, not a second band */
.band .card-header{background:none;border-bottom:1px solid var(--rule)}
/* a light surface inside a band is an ordinary surface again */
.band :where(.alert,.light){
  --ink:var(--t-ink);--ink-2:var(--t-ink-2);--mute:var(--t-mute);--rule:var(--t-rule);
  --accent:var(--t-accent);--accent-soft:var(--t-accent-soft);--link:var(--t-link);--sunk:var(--t-sunk);
  color:var(--t-ink)}

/* ---------- page head: every page's only <h1> sits in a band ---------- */
.page-head{color:var(--hero-ink);border:0;border-radius:10px;
  box-shadow:var(--shadow);padding:1.1rem 1.25rem;margin-bottom:1rem;
  display:flex;justify-content:space-between;align-items:flex-end;gap:1rem;flex-wrap:wrap}
.page-head h1{margin:0;color:var(--hero-ink)}
.page-head .section-label{color:var(--chrome-accent)}
.page-head .page-head-sub{color:var(--hero-ink-2);font-size:13px;margin:.15rem 0 0}
/* the headline figure on the right of a page head */
.page-head .figure{display:block;font-size:1.35rem;font-weight:600;line-height:1.1;color:var(--hero-ink)}
.page-head .btn-outline-secondary{--bs-btn-color:var(--hero-ink);--bs-btn-border-color:var(--hero-ink-2);
  --bs-btn-hover-color:var(--hero-a);--bs-btn-hover-bg:var(--hero-ink);--bs-btn-hover-border-color:var(--hero-ink);
  --bs-btn-active-color:var(--hero-a);--bs-btn-active-bg:var(--hero-ink);--bs-btn-active-border-color:var(--hero-ink)}
.page-head .avatar-lg{border-color:var(--hero-ink-2)}
.section-label{font-size:10.5px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;
  color:var(--mute)}

/* ---------- cards ---------- */
.card{background:var(--card);color:var(--ink);border:1px solid var(--rule);
  border-top:3px solid var(--violet-fg);border-radius:10px;box-shadow:var(--shadow)}
/* a card that opens with a header gets its colour from that header instead */
.card:has(> .card-header:first-child){border-top:1px solid var(--rule)}
/* card headers can also hold a badge or a small form */
.card-header{border-bottom:0;color:var(--hero-ink);
  font-weight:600;font-size:13px;padding:.7rem 1rem;
  display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.5rem .75rem}
.card-header:first-child{border-radius:9px 9px 0 0}
.card-header>form{flex-wrap:wrap}
.card-header h2{font-size:13px;font-weight:600;margin:0;color:var(--hero-ink)}

/* ---------- stat tiles: the gaps are the dividers ---------- */
.tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(165px,1fr));gap:1px;
  background:var(--rule);border:1px solid var(--rule);border-top:3px solid var(--violet-fg);
  border-radius:10px;overflow:hidden;box-shadow:var(--shadow)}
.tile{background:var(--card);padding:14px 16px}
.tile .k{font-size:10.5px;font-weight:700;letter-spacing:.11em;text-transform:uppercase;
  color:var(--mute);display:block;margin-bottom:6px}
.tile .v{font-size:1.35rem;font-weight:600;line-height:1.1;display:block;
  font-variant-numeric:tabular-nums;color:var(--ink)}
.tile .n{font-size:11.5px;color:var(--mute);display:block;margin-top:4px}
.tile.accent .v{color:var(--accent)}
.tile.brand .v{color:var(--brand-text)}

/* ---------- meter with a target marker ---------- */
.meter{height:26px;border-radius:6px;background:var(--sunk);overflow:hidden;position:relative;
  border:1px solid var(--rule-strong)}
.meter .fill{height:100%;background:var(--brand-bar)}
.meter .pace{position:absolute;top:-3px;bottom:-3px;width:3px;background:var(--danger)}
.meter-legend{display:flex;justify-content:space-between;gap:1rem;font-size:11.5px;
  color:var(--mute);margin-top:5px}

/* ---------- tables ---------- */
table.tight{font-size:13.5px;color:var(--ink)}
table.tight th{font-size:10.5px;font-weight:700;letter-spacing:.09em;text-transform:uppercase;
  color:var(--mute);border-bottom:1px solid var(--rule-strong)!important;white-space:nowrap;
  background:var(--sunk)}
table.tight td{border-bottom:1px solid var(--rule);vertical-align:middle;color:var(--ink)}
table.tight tr:last-child td{border-bottom:none}
table.tight td.num{white-space:nowrap}
/* row actions wrap in the stacked phone layout, but stay on one line where the
   table is a real table */
.row-actions{display:inline-flex;gap:.25rem;justify-content:flex-end;flex-wrap:wrap}
.row-actions .btn{white-space:nowrap}
@media (min-width:1200px){.row-actions{flex-wrap:nowrap}}
.table{--bs-table-bg:transparent;--bs-table-color:var(--ink)}
/* tables scroll inside their own box, never the page; never vertically, or
   axe sees a scrollable region with nothing focusable (XPages F5) */
.table-responsive{-webkit-overflow-scrolling:touch;overflow-y:hidden}
.table-responsive>table.tight{min-width:460px}

/* ---------- status badges: the word carries the meaning ---------- */
.badge-status{font-size:10.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;
  padding:.28em .6em;border-radius:5px;border:1px solid transparent;display:inline-block}
.s-idle{background:var(--idle-bg);color:var(--idle-fg);border-color:var(--rule-strong)}
.s-running{background:var(--run-bg);color:var(--run-fg);border-color:var(--run-fg)}
.s-done{background:var(--done-bg);color:var(--done-fg);border-color:var(--done-fg)}
.s-failed{background:var(--warn-bg);color:var(--danger);border-color:var(--danger)}

/* ---------- forms and buttons ---------- */
.btn-brand{background:var(--brand-btn);border-color:var(--brand-btn);
  color:var(--brand-btn-fg);font-weight:500}
.navbar .btn-brand{background:var(--brand-chrome);border-color:var(--brand-chrome);
  color:var(--brand-chrome-fg)}
.btn-brand:hover,.btn-brand:focus{filter:brightness(1.14);color:var(--brand-btn-fg)}
.form-label{font-size:12px;font-weight:600;color:var(--ink-2);margin-bottom:.25rem}
.form-control,.form-select{background-color:var(--card);color:var(--ink);border-color:var(--rule-strong)}
.form-control::placeholder{color:var(--mute);opacity:1}
.form-control:focus,.form-select:focus{background-color:var(--card);color:var(--ink);
  border-color:var(--accent);box-shadow:0 0 0 .2rem color-mix(in srgb,var(--accent) 26%,transparent)}
/* invalid controls read as invalid without relying on colour alone */
.form-control:user-invalid,.form-select:user-invalid{border-color:var(--danger);border-width:2px}
.alert{border-radius:8px}
.alert-light{background:var(--sunk)!important;color:var(--ink)!important;border-color:var(--rule-strong)!important}
.alert-warning{background:var(--warn-bg)!important;color:var(--ink)!important;border-color:var(--warn-bd)!important}
.alert-success{background:var(--done-bg)!important;color:var(--ink)!important;border-color:var(--done-fg)!important}
.alert-danger{background:var(--warn-bg)!important;color:var(--ink)!important;border-color:var(--danger)!important}
.btn-outline-secondary{color:var(--ink-2);border-color:var(--rule-strong)}
.btn-outline-secondary:hover{background:var(--sunk);color:var(--ink);border-color:var(--rule-strong)}
/* Bootstrap's own danger red fails 4.5:1 in the dark theme, so it is replaced. */
.btn-outline-danger{--bs-btn-color:var(--danger);--bs-btn-border-color:var(--danger);
  --bs-btn-hover-color:var(--card);--bs-btn-hover-bg:var(--danger);
  --bs-btn-hover-border-color:var(--danger);
  --bs-btn-active-color:var(--card);--bs-btn-active-bg:var(--danger);
  --bs-btn-active-border-color:var(--danger)}
.btn-link{--bs-btn-color:var(--link);--bs-btn-hover-color:var(--link);--bs-btn-active-color:var(--link)}

.visually-hidden-focusable:not(:focus):not(:focus-within){position:absolute!important;
  width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
@media (prefers-contrast:more){
  :root{--rule:var(--rule-strong)}
  .card,.tiles{border-width:2px}
}

/* ============================================================
   Mobile. Three things drive the breakpoints below:
   an odd tile count leaves a hole in a 2-up grid; card headers
   that carry a control need to wrap rather than collide; and
   wide tables read better stacked than side-scrolled.
   ============================================================ */
@media (max-width:767.98px){
  body{font-size:15px}
  main.container-fluid{padding-left:1rem!important;padding-right:1rem!important}

  /* an odd last tile spans the row instead of leaving a hole */
  .tiles{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tiles .tile:nth-child(odd):last-child{grid-column:1/-1}
  .tile .v{font-size:1.2rem}

  /* the page head stops trying to be a two-column layout */
  .page-head{flex-direction:column;align-items:flex-start;padding:.9rem 1rem}
  .page-head .text-end{text-align:left!important}

  /* alerts with an action stack the action underneath */
  .alert-stack{flex-direction:column;align-items:flex-start!important;gap:.6rem}
  .alert-stack .btn{align-self:flex-start}

  .meter-legend{flex-wrap:wrap;gap:.25rem .75rem}
  .meter-legend .mid{order:3;flex-basis:100%;text-align:center}
}
@media (max-width:359.98px){
  .tiles{grid-template-columns:1fr}
  .tiles .tile:nth-child(odd):last-child{grid-column:auto}
}
@media (max-width:575.98px){
  h1.h4{font-size:1.28rem}
}

/* touch targets: 44px where the pointer is a finger */
@media (pointer:coarse){
  .theme-switch button{min-width:44px;min-height:44px}
  .navbar .nav-link{padding-top:.6rem;padding-bottom:.6rem}
  .btn-sm{min-height:38px}
  table.tight td .form-select{min-height:38px}
}

/* the navbar's right-hand cluster stacks once collapsed */
@media (max-width:991.98px){
  .navbar-collapse .nav-actions{flex-direction:column;align-items:stretch!important;
    gap:.5rem!important;padding-top:.75rem;margin-top:.5rem;border-top:1px solid var(--chrome-rule)}
  .navbar-collapse .nav-actions .btn{width:100%}
  .navbar-collapse .theme-switch{align-self:flex-start}
}

/* ============================================================
   Focus and scroll. The navbar is fixed, so anything scrolled
   to must reserve room for it or it lands underneath.
   ============================================================ */
:root{ --nav-h:57px; }   /* measured header height; shell padding and
                             scroll-margin both key off this */
h1,h2,h3,.card,.alert,.tile,
input,select,textarea,summary,[tabindex]{ scroll-margin-top:calc(var(--nav-h) + 16px); }

/* the field the page has sent you to */
.field-attention{animation:field-ping 1.1s ease-out 1}
@keyframes field-ping{
  0%   { box-shadow:0 0 0 0 color-mix(in srgb,var(--accent) 55%,transparent); }
  100% { box-shadow:0 0 0 12px transparent; }
}
@media (prefers-reduced-motion:reduce){ .field-attention{ animation:none; } }

/* ---------- account menu ---------- */
.navbar .dropdown-toggle{
  background:none;border:0;color:var(--chrome-mute);font-weight:500;
  padding:.3rem .6rem;border-radius:6px;
}
.navbar .dropdown-toggle:hover{background:var(--chrome-hover);color:var(--chrome-ink)}
.navbar .dropdown-toggle.active{background:var(--chrome-hover);color:var(--chrome-ink);font-weight:600}
.navbar .dropdown-toggle::after{color:var(--chrome-mute)}
.dropdown-menu{
  background:var(--card);border:1px solid var(--rule-strong);border-radius:9px;
  box-shadow:0 8px 28px -12px rgba(16,24,32,.4);padding:.35rem;min-width:12rem;
}
/* holds an email address, so no uppercasing and no letter-spacing */
.dropdown-header{color:var(--mute);font-size:12px;font-weight:600;padding:.4rem .6rem}
.dropdown-item{color:var(--ink);border-radius:6px;padding:.42rem .6rem;font-size:14px}
.dropdown-item:hover,.dropdown-item:focus{background:var(--sunk);color:var(--ink)}
.dropdown-item.active,.dropdown-item:active{
  background:var(--accent-soft);color:var(--accent);font-weight:600;
}
.dropdown-divider{border-color:var(--rule);margin:.3rem 0;opacity:1}

/* Below lg the toggle itself shows the address, so the menu header repeats it. */
@media (max-width:991.98px){
  .navbar .dropdown-header,
  .navbar .dropdown-menu > li:first-child + li > .dropdown-divider{ display:none; }
  .navbar .dropdown-menu{ width:100%; }
}

/* ---------- avatars ---------- */
.user-chip{width:26px;height:26px;border-radius:50%;flex:0 0 auto;overflow:hidden;
  background:var(--brand-chrome);color:var(--brand-chrome-fg);
  display:grid;place-items:center;font-size:11px;font-weight:700;letter-spacing:.02em}
.avatar-lg{width:84px;height:84px;border-radius:50%;flex:0 0 auto;overflow:hidden;
  background:var(--brand-btn);color:var(--brand-btn-fg);
  display:grid;place-items:center;font-size:26px;font-weight:700;
  border:1px solid var(--rule-strong)}
.user-chip img,.avatar-lg img{width:100%;height:100%;object-fit:cover;border-radius:50%;display:block}

/* "or" divider between sign-in methods */
.sep-or{display:flex;align-items:center;gap:.75rem;margin:1rem 0;color:var(--mute);font-size:12px}
.sep-or::before,.sep-or::after{content:"";flex:1;height:1px;background:var(--rule-strong)}

/* ---------- shell: footer sits after the content, and at the bottom of a
   short page rather than floating mid-screen ---------- */
body.app-shell{min-height:100vh;display:flex;flex-direction:column;
  padding-top:var(--nav-h)}
body.app-shell > main{flex:1 0 auto}

/* Fixed, not sticky: the nav lives inside <header>, which is a flex item of
   the shell, so a sticky nav could only stick within its own header box and
   scrolled away with it. */
.site-header{position:fixed;top:0;left:0;right:0;z-index:1030}
.site-header .navbar{width:100%;min-height:var(--nav-h)}
/* the collapsed menu can exceed the viewport on a phone */
@media (max-width:991.98px){
  .site-header .navbar-collapse{max-height:calc(100vh - var(--nav-h));overflow-y:auto}
}
.site-footer{flex-shrink:0;border-top:1px solid var(--chrome-rule);background:var(--chrome-bg);
  color:var(--chrome-mute);font-size:12.5px}
.footer-inner{max-width:1320px;margin:0 auto;padding:.9rem 1.5rem;
  display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}
.footer-grow{flex:1 1 auto}
.footer-sep{color:var(--chrome-mute)}
@media (max-width:575.98px){
  .footer-inner{padding:.8rem 1rem;font-size:12px}
  .footer-grow{flex-basis:100%;height:0}
}

/* ---------- wide record tables become one card per row ----------
   The table element must stop laying out as a table or it keeps its content
   width and pushes the page sideways; that drops implicit table semantics, so
   the markup carries explicit ARIA roles. */
@media (max-width:1199.98px){
  table.stacked{display:block;width:100%;min-width:0!important}
  table.stacked tbody{display:block;width:100%}
  /* a table-header-group ignores overflow, so it becomes a block before it is
     shrunk out of sight; otherwise its cells still widen the page */
  table.stacked thead{display:block;position:absolute;width:1px;height:1px;overflow:hidden;
    clip:rect(0,0,0,0)}
  table.stacked tr{display:block;border:1px solid var(--rule);border-radius:9px;
    padding:.5rem .75rem;margin:.6rem;background:var(--card)}
  table.stacked td{display:flex;justify-content:space-between;align-items:center;gap:1rem;
    border:0;border-bottom:1px solid var(--rule);padding:.42rem 0!important;text-align:left!important}
  table.stacked tr td:last-child{border-bottom:0}
  table.stacked td::before{content:attr(data-label);font-size:10.5px;font-weight:700;
    letter-spacing:.08em;text-transform:uppercase;color:var(--mute);flex:0 0 auto}
  table.stacked td:empty{display:none}
  table.stacked td.rowhead{border-bottom:1px solid var(--rule-strong);padding-top:0!important;
    font-weight:600}
  table.stacked td.rowhead::before{content:none}
  .stacked-wrap{overflow:visible!important}
}

/* the one thing the visitor came for, led with rather than buried */
.hero{border-color:var(--accent);border-width:2px}
.hero .hero-figure{font-size:2rem;font-weight:600;line-height:1.1;color:var(--ink)}
@media (max-width:575.98px){
  .hero .hero-figure{font-size:1.6rem}
  .hero .btn-lg{width:100%;justify-content:center}
}

/* ---------- guided tour ---------- */
.tour-mask{position:fixed;inset:0;background:rgba(8,12,16,.62);z-index:1080}
.tour-hole{position:absolute;z-index:1081;border-radius:10px;pointer-events:none;
  box-shadow:0 0 0 3px var(--accent),0 0 0 9999px rgba(8,12,16,.62)}
.tour-pop{position:absolute;z-index:1082;max-width:340px;background:var(--card);
  color:var(--ink);border:1px solid var(--rule-strong);border-radius:11px;
  padding:1rem 1.1rem;box-shadow:0 14px 40px -12px rgba(0,0,0,.55)}
.tour-step{font-size:10.5px;font-weight:700;letter-spacing:.13em;text-transform:uppercase;
  color:var(--mute);margin:0 0 .35rem}
.tour-title{font-size:1rem;font-weight:600;margin:0 0 .35rem;color:var(--ink)}
.tour-body{font-size:13.5px;color:var(--ink-2);margin:0 0 .9rem}
.tour-actions{display:flex;align-items:center;gap:.4rem}
.tour-grow{flex:1 1 auto}
.tour-actions .btn-link{color:var(--mute);text-decoration:underline;padding-left:0}
.tour-actions .btn-link:hover{color:var(--ink)}
body.tour-open{overflow:hidden}
@media (max-width:575.98px){ .tour-pop{max-width:none} }
.tour-launch{color:var(--mute);text-decoration:underline;font-size:12.5px}
.tour-launch:hover{color:var(--ink)}

/* Passkey sign-in is a peer of the password, not a lesser option: it carries
   the accent rather than a muted outline. */
.btn-passkey{
  background:var(--accent-soft);color:var(--accent);
  border:2px solid var(--accent);font-weight:600;
  display:inline-flex;align-items:center;justify-content:center;gap:.5rem;
}
.btn-passkey:hover,.btn-passkey:focus-visible{
  background:var(--accent);color:var(--card);border-color:var(--accent);
}
.btn-passkey svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;
  stroke-linecap:round;stroke-linejoin:round}

/* feature list on the sign-in page */
.feature-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.8rem}
.feature-list li{display:flex;gap:.7rem;align-items:flex-start;font-size:13.5px;color:var(--ink-2)}
.feature-list strong{color:var(--ink);font-weight:600}
.feature-mark{flex:0 0 auto;width:20px;height:20px;border-radius:50%;
  background:var(--accent-soft);display:grid;place-items:center;margin-top:.1rem}
.feature-mark svg{width:12px;height:12px;fill:none;stroke:var(--accent);
  stroke-width:3;stroke-linecap:round;stroke-linejoin:round}

/* ---------- step rail ----------
   Where a record is in its process. Every colour here is an audited pair:
   accent on accent-soft, ink/mute on card, rule-strong borders. */
.steps{list-style:none;display:flex;flex-wrap:wrap;gap:.35rem;margin:0;padding:.5rem .75rem;
  background:var(--card);border:1px solid var(--rule);border-radius:.5rem}
.steps li{display:flex;align-items:center;gap:.45rem;font-size:13px;color:var(--mute);
  padding:.15rem .6rem .15rem .15rem}
.steps li + li::before{content:"";width:14px;height:1px;background:var(--rule-strong);
  margin-right:.45rem;flex:0 0 auto}
.steps .mark{flex:0 0 auto;width:20px;height:20px;border-radius:50%;
  display:grid;place-items:center;font-size:11px;font-weight:700;
  border:1px solid var(--rule-strong);color:var(--mute);background:var(--card)}
.steps .now, .steps .done{color:var(--ink);font-weight:600}
.steps .now .mark, .steps .done .mark{background:var(--accent-soft);color:var(--accent);
  border-color:var(--accent)}
.steps .failed{color:var(--danger);font-weight:600}
.steps .failed .mark{background:var(--warn-bg);color:var(--danger);border-color:var(--danger)}
@media (max-width:575.98px){ .steps li{font-size:12px} }

/* An advanced control that is right there but not in the way. */
details.opt > summary{cursor:pointer;font-size:13px;color:var(--ink-2);
  padding:.35rem .5rem;border:1px solid var(--rule);border-radius:.375rem;
  background:var(--sunk)}
details.opt > summary:hover{color:var(--ink)}
