/* TrayFlow design system — hand-authored, no build step.
   Loaded from base.html. Semantic component classes; pages compose these
   instead of ad-hoc utility soup. */

:root {
  /* Navy sidebar keyed to the Final Way logo's dark frame */
  --nav:        #132747;
  --nav-line:   #ffffff18;
  --nav-ink:    #c3d0e4;
  --nav-ink-dim:#8494ad;
  --nav-active: #26426f;
  --nav-active-ico: #82b1e7;
  --nav-band:   #1c3560;      /* every second menu section: a little lighter than --nav */
  --nav-band-active: #2f5189;

  /* Accent = the Final Way logo blue, deepened for AA contrast on white */
  --accent:     #2f6cb5;
  --accent-ink: #265c9c;
  --accent-tint:#e9f1fa;
  --logo-blue:  #3f7fc6;

  --bg:      #f3f5f8;
  --surface: #ffffff;
  --raise:   #f8fafc;

  --ink:   #1e2a3a;
  --muted: #647084;
  --faint: #97a2b3;
  --line:  #e4e8ef;

  --ok-ink:#3f7c62;    --ok-bg:#ebf6ef;
  --warn-ink:#8a6d2e;  --warn-bg:#fbf2e1;
  --danger-ink:#b04a41; --danger-bg:#fceceb;
  --info-ink:#3a6a92;  --info-bg:#eaf2f8;

  --radius: 9px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px #12233f0d, 0 8px 24px -12px #12233f1f;
  --sidebar-w: 244px;
  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 27px; font-weight: 650; letter-spacing: -.7px; line-height: 1.2; }
h2 { font-size: 15px; font-weight: 650; }
small { font-size: 12px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.muted { color: var(--muted); }
.act-amber { color: var(--warn-ink); }
.act-red { color: var(--danger-ink); font-weight: 600; }
.eyebrow {
  font-size: 10px; font-weight: 750; letter-spacing: 1.6px;
  color: var(--accent); text-transform: uppercase;
}
.tnum { font-variant-numeric: tabular-nums; }
.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;
}

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

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 30;
  background: var(--nav); color: var(--nav-ink);
  display: flex; flex-direction: column; padding: 22px 14px 0;
  transition: width .15s ease;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 9px; padding: 0 10px 4px;
  color: #fff; font-size: 20px; font-weight: 650; letter-spacing: -.6px;
}
.brand-mark {
  width: 28px; height: 28px; flex: none; border: 1px solid #3d5c8e; border-radius: 8px;
  display: grid; place-items: center; font-size: 12px; color: #8fb6e8; font-weight: 600;
}
.brand-mark b { color: #fff; font-weight: 700; }
.brand-dot { color: var(--logo-blue); }

.sidebar .org {
  margin: 18px 4px 20px; padding: 11px 10px; display: flex; gap: 9px; align-items: center;
  background: #ffffff0a; border: 1px solid var(--nav-line); border-radius: 8px;
}
.org-badge {
  width: 30px; height: 30px; flex: none; border-radius: 7px; display: grid; place-items: center;
  background: #2c467a; color: #bcd2ef; font-size: 11px; font-weight: 600;
}
.org strong { display: block; font-size: 12px; color: #e2ece9; }
.org small { font-size: 10px; color: var(--nav-ink-dim); }

.brand-tag { margin: -8px 10px 14px 47px; font-size: 11px; color: var(--nav-ink-dim); line-height: 1.3; }
body:not(.menu-dark) .sidebar .brand-tag { color: #4a5b74; }
body.menu-dark .sidebar .brand-tag { color: #aebdd3; }
.sidebar > .brand { margin-bottom: 14px; }
.sidebar nav { flex: 1; overflow-y: auto; padding-bottom: 12px; }
.nav-label {
  font-size: 9px; letter-spacing: 1.4px; color: var(--nav-ink-dim);
  padding: 0 12px; margin: 16px 0 6px; text-transform: uppercase;
}
.nav-label:first-child { margin-top: 4px; }
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin: 2px 0;
  border-radius: 7px; font-size: 13px; color: var(--nav-ink);
}
.nav-link .ico { width: 18px; flex: none; text-align: center; font-size: 15px; color: var(--nav-ink-dim); }
.nav-link .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-link:hover { background: #ffffff10; }
.nav-link[hidden] { display: none; }
.nav-link.active { background: var(--nav-active); color: #fff; }
.nav-link.active .ico { color: var(--nav-active-ico); }
.nav-link .pill {
  margin-left: auto; font-size: 10px; font-weight: 700; padding: 1px 6px;
  border-radius: 999px; background: #c0492f; color: #fff;
}

.nav-link .pill.warn { background: #c98a0a; }

.sidebar .foot {
  display: flex; align-items: center; gap: 9px; padding: 14px 6px 18px;
  border-top: 1px solid var(--nav-line);
}
.foot .avatar {
  width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: #36568c; color: #c9dcf5; font-size: 12px; font-weight: 600;
}
.foot .avatar { overflow: hidden; text-decoration: none; }
.foot-me { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; padding: 4px 6px; margin: -4px 0 -4px -6px; border-radius: 8px;
  color: inherit; text-decoration: none; }
.foot-me:hover, .foot-me.active { background: #ffffff12; }
.foot-me .who { display: block; min-width: 0; }
.foot-me .who strong, .foot-me .who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell.rail .foot-me { flex: none; justify-content: center; padding: 0; margin: 0; }
.shell.rail .foot-me .who { display: none; }
.foot .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-pic { width: 72px; height: 72px; flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: #36568c; color: #c9dcf5; font-size: 28px; font-weight: 600; }
.profile-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foot strong { display: block; font-size: 12px; color: #e2ece9; }
.foot small { font-size: 10px; color: var(--nav-ink-dim); }
.foot form { margin-left: auto; }
.foot .signout { border: 0; background: none; color: var(--nav-ink-dim); font-size: 18px; padding: 4px; }
.foot .signout:hover { color: #fff; }

.main { margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; transition: margin-left .15s ease; }

/* ---------- Collapsed sidebar (desktop rail) --------------------------- */
/* Round chevron button straddling the sidebar's right edge. */
.rail-toggle {
  position: absolute; top: 64px; right: -13px; z-index: 31;
  width: 26px; height: 26px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface);
  color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 6px #1223401f; transition: transform .15s ease, color .1s;
}
.rail-toggle:hover { color: var(--accent); }
.rail-toggle::before { content: "\2039\2039"; letter-spacing: -3px; }   /* ‹‹ */
.shell.rail .rail-toggle::before { content: "\203A\203A"; }             /* ›› */
@media (max-width: 900px) { .rail-toggle { display: none; } }

.shell.rail { --sidebar-w: 64px; }
.shell.rail .sidebar { padding-left: 10px; padding-right: 10px; }
.shell.rail .brand { justify-content: center; padding: 0; }
.shell.rail .brand-name,
.shell.rail .brand-dot,
.shell.rail .org,
.shell.rail .brand-tag,
.shell.rail .nav-label,
.shell.rail .foot > div { display: none; }
.shell.rail .nav-link { justify-content: center; padding: 10px 0; gap: 0; }
.shell.rail .nav-link .ico { margin: 0; }
.shell.rail .nav-link .pill {
  position: absolute; top: 3px; right: 5px; margin: 0; min-width: 8px; height: 8px;
  padding: 0; font-size: 0; border-radius: 50%;
}
.shell.rail .foot { flex-direction: column; gap: 8px; align-items: center; }
.shell.rail .foot form { margin: 0; }

/* Collapsed: hide labels inline, show them as a hover fly-out tooltip. */
.shell.rail .nav-link .lbl {
  position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
  margin-left: 12px; padding: 5px 10px; border-radius: 6px;
  background: var(--nav); color: #fff; font-size: 12px; white-space: nowrap;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .1s;
  z-index: 40;
}
.shell.rail .nav-link:hover .lbl { opacity: 1; }

.topbar {
  height: 60px; flex: none; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
}
.crumbs { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.crumbs strong { color: var(--ink); font-weight: 600; }
.crumbs .sep { color: #c4cecc; }
.menu-btn { display: none; border: 0; background: none; font-size: 19px; color: var(--accent); }
/* the recent pages button of the top bar (static/recent-pages.js): small, next to the page name; its list opens under it */
.trail { position: relative; display: inline-flex; }
.trail-btn { border: 1px solid var(--line); background: var(--surface); color: var(--accent); border-radius: 999px; width: 30px; height: 30px; font-size: 16px; line-height: 1; cursor: pointer; padding: 0; }
.trail-btn:hover, .trail-btn[aria-expanded=true] { background: var(--accent-tint, #eef4fb); }
.trail-pop { position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; min-width: 220px; max-width: 80vw; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
             box-shadow: 0 8px 24px #1e2a3a22; padding: 6px; display: flex; flex-direction: column; }
.trail-pop[hidden] { display: none; }
.trail-head { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .3px; padding: 4px 8px; text-transform: uppercase; }
.trail-pop a { display: block; padding: 10px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trail-pop a:hover { background: var(--accent-tint, #eef4fb); }
@media (max-width: 600px) {
  .crumbs > span:not(.trail) { display: none; }                      /* "Workspace /" gives its room to the page name and the recent pages button */
  .crumbs { gap: 8px; min-width: 0; }
  .crumbs strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
  .env-tag { white-space: nowrap; font-size: 11px; padding: 4px 8px; }
}
.env-tag {
  font-size: 10px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: #52a98f; display: inline-block; margin-right: 5px; }

/* ---------- Environment marking (TESTING) ------------------------------- */
:root { --env-h: 0px; }
body.has-env { --env-h: 34px; }
.env-banner {
  position: sticky; top: 0; z-index: 60; height: var(--env-h);
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: #f5a524; color: #3b2300; font-size: 12px; padding: 0 12px;
  border-bottom: 2px solid #b86e00; text-align: center; white-space: nowrap; overflow: hidden;
}
.env-banner strong { font-size: 13px; letter-spacing: 2px; background: #3b2300; color: #ffd48a;
  padding: 3px 10px; border-radius: 4px; }
.env-banner span { overflow: hidden; text-overflow: ellipsis; }
body.has-env .sidebar { top: var(--env-h); }
body.has-env .shell { min-height: calc(100vh - var(--env-h)); }
body.has-env .auth { min-height: calc(100vh - var(--env-h)); }
.env-chip { margin: 10px 14px 0; padding: 5px 8px; border-radius: 6px; background: #f5a524; color: #3b2300;
  font-size: 11px; font-weight: 800; letter-spacing: 2px; text-align: center; }
.shell.rail .env-chip { margin: 10px 4px 0; padding: 4px 0; font-size: 8px; letter-spacing: 0; }
.env-tag.test { background: #f5a524; border-color: #b86e00; color: #3b2300; font-weight: 700; letter-spacing: 1px; }
.env-tag.test .dot { background: #3b2300; }
.env-tag.live { border-color: #9ccbb8; color: #1f6b52; font-weight: 600; letter-spacing: 1px; }
@media (max-width: 700px) { .env-banner span { display: none; } }

.content { padding: 26px 28px 40px; width: 100%; max-width: 1400px; margin: 0 auto; }

.scrim { display: none; }

/* ---------- Page header ------------------------------------------------- */
.pagehead {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
  margin-bottom: 22px;
}
.pagehead .lead { margin-top: 8px; color: var(--muted); font-size: 13px; }
.pagehead .actions { display: flex; gap: 9px; flex: none; }

/* ---------- Buttons -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 37px; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid #b7cfea; background: #dbe8f7; color: #1f4f8f;                 /* the ordinary button: soft blue (the owner's choice A, 2026-11-25), the main action stays .primary */
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.btn:hover { background: #cddff3; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 3px #056a5814; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.sm { min-height: 30px; padding: 5px 10px; font-size: 11px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; min-height: 0; }
.btn[disabled] { opacity: .55; cursor: default; }

.textlink { font-size: 11px; font-weight: 600; color: var(--accent); white-space: nowrap; }

/* ---------- Cards / metrics -------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.cards.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
}
a.card:hover { border-color: #cdd8d5; }
.card .top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.card .ico-box {
  width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center;
  background: #f0f4f3; color: #6c8a80; font-size: 15px;
}
.card .ico-box.ok { background: var(--ok-bg); color: var(--ok-ink); }
.card .ico-box.warn { background: var(--warn-bg); color: var(--warn-ink); }
.card .ico-box.danger { background: var(--danger-bg); color: var(--danger-ink); }
.card .value { display: block; margin: 12px 0 10px; font-size: 27px; font-weight: 650; letter-spacing: -.6px; }
.card .value em { font-size: 13px; font-style: normal; font-weight: 500; color: var(--faint); }
.card .value .slash { color: var(--faint); font-weight: 400; }
.card .value .bad { color: var(--danger-ink); }
.card .foot { display: flex; justify-content: space-between; font-size: 10px; color: var(--faint); }
.card.attn { border-color: #e6cf9f; }
.card.attn .value { color: var(--warn-ink); }
.card.alarm { border-color: #e7b7b0; }

/* ---------- Panel ---------------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; margin-bottom: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel + .panel { margin-top: 20px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid #edf1ef;
}
.panel-head h2 .count { font-size: 10px; background: var(--warn-bg); color: var(--warn-ink); border-radius: 5px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
.panel-head p { font-size: 11px; color: var(--muted); margin-top: 3px; }
.panel-foot { display: flex; justify-content: space-between; align-items: center; padding: 13px 20px; background: var(--raise); font-size: 11px; font-weight: 600; color: var(--accent); }

.rowlink { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid #f0f3f1; }
.rowlink:last-child { border-bottom: 0; }
.rowlink:hover { background: var(--raise); }
.rowlink .lead { flex: 1; min-width: 0; }
.rowlink strong { font-size: 12px; font-weight: 600; }
.rowlink small { display: block; font-size: 10px; color: var(--faint); margin-top: 3px; }
.rowlink .end { text-align: right; white-space: nowrap; }
.thumb {
  width: 32px; height: 34px; flex: none; border-radius: 7px; display: grid; place-items: center;
  background: #f1f5f3; color: #8aa79a; font-size: 18px;
}

/* ---------- Toolbar / filters --------------------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar .spacer { flex: 1; }
/* the From / To boxes of a filter have one look everywhere: see "A FROM / TO DATE FILTER" further down */

/* ---------- Inputs ------------------------------------------------------- */
input, select, textarea {
  width: 100%; border: 1px solid #dde5e2; border-radius: var(--radius-sm);
  padding: 9px 11px; background: #fff; color: var(--ink); font-size: 12px;
}
input[type=date], input[type=datetime-local], input[type=time] { min-width: 0; max-width: 100%; box-sizing: border-box; }   /* a phone's date box must not be wider than its column */
input[type=checkbox], input[type=radio] { width: auto; height: auto; padding: 0; }                       /* a tick or a radio button is never stretched to the width of its box */
input::placeholder { color: #9aa6a3; }
select { max-width: 220px; }
textarea { min-height: 90px; }

.field { }
.field > label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; }
.field .hint { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.form-panel { max-width: 720px; padding: 24px; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 4px; }
.errorlist { list-style: none; margin: 4px 0 0; padding: 8px 12px; background: var(--danger-bg); color: var(--danger-ink); border-radius: var(--radius-sm); font-size: 11px; }
.field .err, p.err { margin: 4px 0 0; font-size: 11px; color: var(--danger-ink); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check input { width: auto; }
.confirm-box { padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); font-size: 13px; line-height: 1.7; }
.confirm-box.danger { border-color: #e7c1bc; background: var(--danger-bg); color: var(--danger-ink); }
.hintline { font-size: 11px; color: var(--faint); margin-top: 8px; }

/* ---------- Table ------------------------------------------------------- */
/* A long table scrolls inside its own box (static/frozen-header.js sets the height to fit the screen) and its header row stays put,
   like Freeze Panes in Excel. A short table is not affected: the cap only matters once the rows are taller than the box. */
.table-scroll { overflow: auto; max-height: var(--tbl-max, none); -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; text-align: left; }
table.data th {
  padding: 10px 18px; font-size: 10px; font-weight: 600; letter-spacing: .3px;
  text-transform: uppercase; color: #8a9891; background: var(--raise);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table-scroll > table > thead > tr > th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--line); }
/* A table that is a list of records can show as small cards on a phone (add the class cards-on-phone and a data-label to each cell). */
@media (max-width: 700px) {
  .table-scroll.cards-on-phone { max-height: none !important; overflow: visible; }
  .cards-on-phone table.data, .cards-on-phone table.data tbody { display: block; width: 100%; }
  .cards-on-phone table.data thead { display: none; }
  .cards-on-phone table.data tr { display: block; padding: 10px 14px; border-top: 1px solid var(--line, #e5e9f0); }
  .cards-on-phone table.data td { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 3px 0; border: 0; text-align: right; font-size: 13px; }
  .cards-on-phone table.data td::before { content: attr(data-label); color: var(--muted, #6b7a74); text-align: left; font-size: 12px; flex: none; }
  .cards-on-phone table.data td.t { font-weight: 650; font-size: 15px; justify-content: flex-start; text-align: left; white-space: normal; overflow-wrap: anywhere; }
  .cards-on-phone table.data td.file-cell { display: block; }
  .cards-on-phone table.data td.t::before, .cards-on-phone table.data td:not([data-label])::before { content: none; }
  .cards-on-phone table.data td.num { text-align: right; }
  /* what is inside a card cell (a badge and a button, a form) wraps inside the card and never runs past its edge */
  .cards-on-phone table.data td { flex-wrap: wrap; min-width: 0; }
  .cards-on-phone table.data td > * { max-width: 100%; min-width: 0; }
  .cards-on-phone table.data td .btn { white-space: normal; text-align: center; height: auto; }
  .cards-on-phone table.data td form { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 100%; }
}
@media print { .table-scroll { max-height: none !important; overflow: visible; } .table-scroll > table > thead > tr > th { position: static; box-shadow: none; } }
table.data td { padding: 13px 18px; font-size: 12px; border-bottom: 1px solid #eef2f0; }
table.data tr:last-child td { border-bottom: 0; }
body.compact table.data td { padding: 6px 12px; }
body.compact table.data th { padding-top: 7px; padding-bottom: 7px; }
body.big-text .content { zoom: 1.15; }
table.data tbody tr:hover td, table.data tr.hoverable:hover td { background: var(--raise); }
table.data td .t { font-weight: 600; color: #3d5b50; }
table.data td small { display: block; font-size: 10px; color: var(--faint); margin-top: 3px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: Consolas, ui-monospace, monospace; font-size: 11px; }
.low { color: var(--warn-ink); font-weight: 600; }

.pager { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.pager .grp { display: flex; gap: 7px; }

/* ---------- Badges ----------------------------------------------------- */
.badge { display: inline-block; font-size: 9px; font-weight: 600; border-radius: 5px; padding: 3px 7px; white-space: nowrap; letter-spacing: .2px; }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.danger { background: var(--danger-bg); color: var(--danger-ink); }
.badge.neutral { background: #eff3f2; color: #6f7f78; }
.badge.info { background: var(--info-bg); color: var(--info-ink); }

/* ---------- Misc ------------------------------------------------------- */
.empty { padding: 34px 20px; text-align: center; color: var(--faint); font-size: 12px; }
.flash { margin-bottom: 16px; padding: 11px 15px; border-radius: var(--radius-sm); font-size: 12px; border: 1px solid; }
.flash.success { background: var(--ok-bg); border-color: #cfe6d9; color: var(--ok-ink); }
.flash.error { background: var(--danger-bg); border-color: #ecc7c3; color: var(--danger-ink); }
.flash.info { background: var(--surface); border-color: var(--line); color: var(--ink); }
.flash.renewal-warn { background: #fdf0cf; border-color: #ecd08a; color: #5f3b00; }
.appfoot { margin-top: auto; padding: 22px 28px; color: var(--faint); font-size: 10px; display: flex; justify-content: space-between; }

/* ---------- Responsive ----------------------------------------------------- */
/* ---------- Section heading (between panels) --------------------------- */
.subhead { margin: 0 0 8px; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.section { margin-bottom: 22px; }
.section > .subhead + * { margin-top: 0; }

/* ---------- Grids ----------------------------------------------------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; margin-bottom: 20px; }
.grid-13 { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

/* ---------- Back link + detail header -------------------------------- */
.backlink { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.backlink:hover { color: var(--accent); }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.detail-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Action bar (workflow buttons on detail pages) ----------- */
.actionbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actionbar form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.actionbar input[type=text] { width: 130px; min-height: 30px; padding: 5px 8px; }

/* ---------- Info panels (dl-style key/value) ----------------------- */
.infogrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; }
.infocard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; font-size: 13px; }
.infocard .k { font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--faint); }
.infocard .v { margin-top: 5px; }
.infocard .v.big { font-size: 15px; font-weight: 600; }
dl.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px 20px; margin: 0; padding: 18px 20px; font-size: 13px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
dl.kv dt { font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--faint); }
dl.kv dd { margin: 4px 0 0; }

/* ---------- Chips (filter pills) ----------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.chip { font-size: 11px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: var(--surface); white-space: nowrap; }
.chip:hover { background: var(--raise); }
.chip.on { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-ink); font-weight: 600; }
/* a filter chip with an x: a long name is cut with an ellipsis, the x is always visible and never pushed off a phone's edge */
.chip.chip-x { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; }
.chip.chip-x .chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.chip-x a { flex: none; padding: 0 2px; font-size: 15px; line-height: 1; }

/* ---------- Tabs (scope toggles) --------------------------------- */
.tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--surface); }
.tabs a { padding: 7px 13px; font-size: 12px; font-weight: 600; color: var(--muted); border-right: 1px solid var(--line); }
.tabs a:last-child { border-right: 0; }
.tabs a.on { background: var(--accent); color: #fff; }

/* ---------- Calendar (visit plan) ------------------------------- */
.cal { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head span { padding: 9px 10px; font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--faint); background: var(--raise); text-align: left; }
.cal-week { border-top: 1px solid var(--line); }
.cal-day { min-height: 108px; padding: 8px; border-right: 1px solid #eef2f0; }
.cal-day:last-child { border-right: 0; }
.cal-day.pad { background: var(--raise); }
.cal-day .d { font-size: 11px; color: var(--faint); text-align: right; margin-bottom: 5px; }
.cal-ev { display: block; font-size: 10px; padding: 3px 6px; margin-bottom: 3px; border-radius: 4px;
  background: var(--accent-tint); color: var(--accent-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev.done { background: var(--ok-bg); color: var(--ok-ink); }
.cal-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--ok-ink); vertical-align: -1px; }
.cal-ev.cancelled { background: #eef2f0; color: var(--faint); text-decoration: line-through; }

/* ---------- Formset line cards -------------------------------- */
.line-card { border: 1px solid var(--line); border-radius: 7px; padding: 14px; margin-bottom: 12px; }
.line-card .line-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.line-card .line-top span { font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--faint); }
.line-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.line-grid .full { grid-column: 1 / -1; }
.line-grid label { display: block; margin-bottom: 5px; font-size: 11px; font-weight: 600; color: var(--muted); }

/* ---------- Two-column form grid ---------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- Login ----------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-story { background: var(--nav); color: var(--nav-ink); padding: 48px 52px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-story .brand { color: #fff; font-size: 22px; font-weight: 650; letter-spacing: -.6px; display: flex; align-items: center; gap: 9px; }
.auth-story h1 { color: #eef3fb; font-size: 44px; line-height: 1.15; letter-spacing: -1.5px; font-weight: 550; margin: 22px 0; }
.auth-story p { max-width: 340px; color: var(--nav-ink-dim); line-height: 1.85; }
.auth-flow { display: flex; gap: 12px; margin-top: 36px; }
.auth-flow > div { border: 1px solid #35558c; border-radius: 9px; padding: 12px 14px; font-size: 10px; color: #7c96bd; min-width: 92px; }
.auth-flow strong { display: block; margin-top: 8px; color: #cdddf4; font-size: 12px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-card { width: 100%; max-width: 340px; }
.auth-card .pill { font-size: 9px; letter-spacing: 1px; background: var(--accent-tint); color: var(--accent-ink); padding: 6px 10px; border-radius: 4px; font-weight: 700; }
.auth-card h2 { font-size: 27px; letter-spacing: -.6px; margin-top: 20px; font-weight: 650; }
.auth-card form { margin-top: 24px; }
.auth-card .field { margin-bottom: 15px; }
.auth-card .btn { width: 100%; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 16px 0; font-size: 11px; color: var(--faint); }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-foot { font-size: 11px; line-height: 1.8; color: var(--muted); margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-story { display: none; }
}

@media (max-width: 1180px) {
  :root { --sidebar-w: 214px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .grid-13 { grid-template-columns: 1fr; }
  .line-grid { grid-template-columns: repeat(2, 1fr); }
}
/* Stock page: once the two tables stack, show the short Expiring table first and keep the
   long on-hand list in a scrolling box so it cannot bury everything below it. */
@media (max-width: 1180px) {
  .stock-top .expiring { order: -1; }
  .stock-top .onhand-scroll { max-height: 55vh; overflow-y: auto; }
  .stock-top .onhand-scroll thead th { position: sticky; top: 0; z-index: 1; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .16s ease; box-shadow: 20px 0 45px #0004; }
  .shell.nav-open .sidebar { transform: translateX(0); }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: #0b1a1c66; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-block; }
  .content { padding: 20px 16px 32px; }
  .topbar { padding: 0 16px; }
  .pagehead { flex-direction: column; align-items: stretch; }
  .pagehead .actions { flex-wrap: wrap; }
}
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .line-grid { grid-template-columns: 1fr; }
  .detail-head { flex-direction: column; }
  .actionbar { width: 100%; }
  .cal-head span { padding: 6px 2px; font-size: 9px; letter-spacing: 0; text-align: center; }
  .cal-day { min-height: 54px; padding: 3px; }
  .cal-day .d { font-size: 10px; text-align: center; margin-bottom: 3px; }
  /* on a phone each visit is a small coloured bar (the list underneath has the names), so the calendar fits the screen */
  .cal-ev { font-size: 0; height: 7px; padding: 0; margin-bottom: 2px; border-radius: 3px; background: var(--accent-ink); }
  .cal-ev.done { background: var(--ok-ink); }
  .cal-ev.cancelled { background: var(--faint); }
  table.data th, table.data td { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  h1 { font-size: 22px; }
  .toolbar select, .toolbar .grow { width: 100%; max-width: none; flex-basis: 100%; }
}


/* ---------- Link checklists (Field -> Links) ---------------------------- */
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 4px 10px;
  max-height: 58vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--surface); }
.chk { display: flex; gap: 9px; align-items: flex-start; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.chk:hover { background: var(--raise); }
.chk input { margin-top: 3px; flex: none; width: auto; height: auto; padding: 0; }
.chk > span { min-width: 0; overflow-wrap: anywhere; }
.chk-head { margin: 0 0 8px; font-size: 14px; }
/* a list you can search by typing (combo-select.js) */
.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(47, 108, 181, .45); } 50% { box-shadow: 0 0 0 8px rgba(47, 108, 181, 0); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.combo { position: relative; }
.combo-input { width: 100%; box-sizing: border-box; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; max-height: 260px; overflow: auto; margin: 2px 0 0; padding: 4px; list-style: none; background: var(--surface, #fff); border: 1px solid var(--line, #d7dee8); border-radius: 8px; box-shadow: 0 8px 22px rgba(15, 23, 42, .14); }
.combo-list[hidden] { display: none; }
.combo-list li { padding: 10px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.combo-list li:hover { background: var(--raise, #f1f5f9); }
.combo-list .combo-none { color: var(--muted, #64748b); cursor: default; }
.chk-cols { display: flex; gap: 9px; padding: 6px 16px 6px 8px; margin: 0 0 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); }
.chk-cols .c1 { width: 36px; flex: none; }
.chk-cols small { font-weight: 400; text-transform: none; letter-spacing: 0; }
.chk strong { font-weight: 600; font-size: 13px; }
.chk small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }

.checklist.small { max-height: 190px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.picklist .pick-filter { margin-bottom: 6px; width: 100%; }
.picklist label > small { font-weight: 400; }

/* A delivery-note line from a location the user cannot use: shown, but not editable. */
.line-card.locked { background: var(--raise); }


/* ---------- System health: bigger, bolder, higher-contrast figures --------------------
   (the default 10px light-grey headers and 9px pale badges were hard to read) */
.health table.data th { font-size: 12px; font-weight: 700; color: #34423c; background: #e9eeeb; letter-spacing: .3px; }
.health table.data td { font-size: 14px; font-weight: 500; color: #16212a; padding: 13px 18px; }
.health table.data tbody tr:nth-child(even) td { background: #f5f8f6; }
.health table.data tbody tr:hover td { background: #eaf0ed; }
.health table.data td .t { font-size: 14px; font-weight: 700; color: #16212a; }
.health table.data td small { font-size: 12px; font-weight: 500; color: #4a5953; }
.health .num { font-weight: 650; }
.health .hintline, .health .muted { font-size: 12.5px; color: #4a5953; }
.health .subhead { color: #34423c; }
.health .stat { display: inline-block; min-width: 66px; text-align: center; font-size: 14px; font-weight: 700;
  padding: 4px 10px; border-radius: 7px; font-variant-numeric: tabular-nums; line-height: 1.3; }
.health .stat.inline { min-width: 0; padding: 1px 8px; font-size: 13px; }
.health .stat.ok { background: #d3eddc; color: #07461f; }
.health .stat.warn { background: #fde2a8; color: #5f3b00; }
.health .stat.danger { background: #f9cbc5; color: #7d150c; }
.health .stat.neutral { background: #e3e9ec; color: #2a363e; }
@media (max-width: 700px) { .health table.data td { padding: 11px 12px; } .health .stat { min-width: 58px; } }

/* System health: three equal cards with the same rows (figure, bar, detail, last-24-hours line) */
.health .health-card { display: flex; flex-direction: column; padding: 18px 20px; }
.health .health-card .subhead { margin: 0 0 10px; }
.health .health-card .big { margin: 0; }
.health .health-card .big .stat { font-size: 26px; padding: 6px 16px; min-width: 96px; }
.health .health-card .bar { height: 8px; border-radius: 5px; background: #dfe6e2; margin: 14px 0 12px; }
.health .health-card .bar > div { height: 8px; border-radius: 5px; background: var(--accent); }
.health .health-card .detail { margin: 0; font-size: 13.5px; font-weight: 500; color: #16212a; min-height: 2.8em; }
.health .health-card .foot { margin: auto 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; color: #34423c; }

/* System health: the last-days chart (SVG with axes, gridlines, thresholds and value labels) */
.health .health-chart { display: block; width: 100%; height: auto; max-height: 340px; }
.health .health-chart .grid { stroke: #dde4e0; stroke-width: 1; }
.health .health-chart .axis { stroke: #34423c; stroke-width: 1.5; }
.health .health-chart .warn-line { stroke: #e0a100; stroke-width: 1.5; stroke-dasharray: 6 5; }
.health .health-chart .bad-line { stroke: #d0402f; stroke-width: 1.5; stroke-dasharray: 6 5; }
.health .health-chart .bar.cpu { fill: var(--accent); }
.health .health-chart .bar.mem { fill: #6b7c86; }
.health .health-chart text { fill: #34423c; font-size: 12px; font-family: inherit; }
.health .health-chart .val { font-size: 12px; font-weight: 700; fill: #16212a; }
.health .health-chart .xlab { font-size: 13px; font-weight: 600; }
.health .health-chart .axis-title { font-size: 12px; font-weight: 600; fill: #4a5953; }
.health .legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 10px 0 0; font-size: 13px; font-weight: 600; color: #34423c; }
.health .legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.health .legend .sw.cpu { background: var(--accent); }
.health .legend .sw.mem { background: #6b7c86; }
.health .legend .sw.warn { background: #e0a100; }
.health .legend .sw.bad { background: #d0402f; }
.health .health-chart .avg { stroke-width: 2.5; stroke-dasharray: 2 5; stroke-linecap: round; }
.health .health-chart .avg.cpu { stroke: #1d4f8f; }
.health .health-chart .avg.mem { stroke: #3b4a54; }
.health .health-chart .avg-label { font-size: 12px; font-weight: 700; }
.health .health-chart .avg-label.cpu { fill: #1d4f8f; }
.health .health-chart .avg-label.mem { fill: #3b4a54; }
.health .legend .sw.avgline { background: none; border-top: 3px dotted #34423c; border-radius: 0; height: 0; vertical-align: 3px; }
.health .health-chart .val-halo { font-size: 12px; font-weight: 700; fill: #ffffff; stroke: #ffffff; stroke-width: 5px; stroke-linejoin: round; }

/* Click-to-sort table headings */
th a.sortlink { color: inherit; text-decoration: none; white-space: nowrap; }
th a.sortlink:hover { text-decoration: underline; }
th a.sortlink.active { color: var(--accent-ink, #1d4ed8); font-weight: 700; }

/* "View as user" banner: blue while it is read-only, amber once changes are allowed */
.imp-banner { position: sticky; top: var(--env-h); z-index: 59; min-height: 38px; display: flex; align-items: center;
  justify-content: center; gap: 14px; flex-wrap: wrap; padding: 4px 12px; background: #1d4ed8; color: #fff; font-size: 13px; }
.imp-banner.on { background: #b45309; }
.imp-banner form { margin: 0; }
.imp-banner button { background: #fff; color: #1d4ed8; border: 0; border-radius: 6px; padding: 5px 12px; font-weight: 600; cursor: pointer; }
.imp-banner.on button { color: #b45309; }
body:has(.imp-banner) .sidebar { top: calc(var(--env-h) + 38px); }

/* Collapsible menu sections */
.nav-label[role="button"] { cursor: pointer; display: flex; align-items: center; justify-content: space-between; user-select: none; min-height: 28px; }
.nav-label[role="button"]::after {                              /* a drawn chevron: no font glyph to go missing on a phone */
  content: ""; width: 6px; height: 6px; margin: -3px 4px 0 0; flex: none;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg); transition: transform .15s ease; }
.nav-label.is-collapsed::after { transform: rotate(-45deg); margin-top: 0; }
.nav-label[role="button"]:hover, .nav-label[role="button"]:focus-visible { color: var(--nav-ink); outline: none; }
.nav-group.collapsed { display: none; }
.shell.rail .nav-group.collapsed { display: block; }          /* the narrow icon-only menu shows every icon */
@media (max-width: 900px) { .nav-label[role="button"] { min-height: 40px; } }

/* Menu sections take turns: dark (as the menu itself), then a little lighter, so where one ends and the next begins is easy to see */
.nav-label.nav-band { background: var(--nav-band); margin-bottom: 0; padding: 9px 16px 6px; border-radius: 9px 9px 0 0; }
.nav-label.nav-band.is-collapsed { padding-bottom: 9px; border-radius: 9px; }
.nav-group.nav-band { background: var(--nav-band); padding: 0 4px 6px; border-radius: 0 0 9px 9px; }
.nav-group.nav-band .nav-link.active { background: var(--nav-band-active); }
.shell.rail .nav-group.nav-band { border-radius: 9px; padding: 4px; }

/* Type-to-search drop-downs (see searchable-select.js) */
.ss-wrap { position: relative; width: 100%; }
.ss-input { padding-right: 28px; cursor: text;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239aa6a3'/%3E%3C/svg%3E") no-repeat right 10px center; }
.ss-native { position: absolute !important; left: 0; bottom: 0; width: 100%; height: 1px; opacity: 0; pointer-events: none; }
.ss-list { position: absolute; z-index: 90; left: 0; right: 0; top: 100%; margin-top: 2px; min-width: 220px; max-height: 280px; overflow-y: auto;
  background: #fff; border: 1px solid #c8d3cf; border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(15, 30, 45, .18); }
.ss-item { padding: 8px 11px; font-size: 12px; line-height: 1.35; cursor: pointer; border-bottom: 1px solid #f0f3f2; }
.ss-item:last-child { border-bottom: 0; }
.ss-item.active { background: #e8f0fe; }
.ss-item.selected { font-weight: 650; }
.ss-item.none { color: var(--muted); font-style: italic; }
/* an open search drop-down may reach past the box it sits in (panels hide anything outside their edge) */
.panel:has(.ss-list:not([hidden])), .form-panel:has(.ss-list:not([hidden])), .infocard:has(.ss-list:not([hidden])), .card:has(.ss-list:not([hidden])), .table-scroll:has(.ss-list:not([hidden])) { overflow: visible; }
.ss-empty { padding: 9px 11px; font-size: 12px; color: var(--muted); }
@media (max-width: 800px) { .ss-list { max-height: 45vh; } .ss-item { padding: 11px 12px; font-size: 14px; } }

/* "tick all that apply" and "pick one" lists (templates/_tick_choices.html, _pick_one.html): kept the same everywhere, easy to tap on a phone */
.tickgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 4px 0; }
.tickmore > summary { display: inline-block; cursor: pointer; }
.ticklist { display: grid; grid-template-columns: 1fr; gap: 8px; max-height: 240px; overflow: auto; padding: 4px 2px; }
.pillrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span { display: inline-block; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 14px; cursor: pointer; }
.pill input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* a long file name wraps instead of stretching the page (a phone would otherwise zoom out and push things off the screen) */
.infocard, .panel { min-width: 0; }
a.textlink, .infocard a, .panel td a { overflow-wrap: anywhere; word-break: break-word; }

/* Reports pages: chart axes and titles, tooltips */
.rev-chart .axtitle { fill: var(--muted); font-size: 12px; font-weight: 600; }
.rev-chart .colbar { cursor: pointer; }
.rev-chart .colbar:hover { opacity: .8; }
.chart-tip { position: fixed; z-index: 80; pointer-events: none; background: var(--ink); color: #fff; padding: 8px 10px; border-radius: 6px; font-size: 12px; max-width: 280px; box-shadow: 0 6px 18px #0004; }
.chart-tip b { display: block; margin-bottom: 3px; }
/* a flex row's text part may shrink and wrap (without this a long name keeps its full width and runs out of the card) */
.infocard [style*="display:flex"] > *, .infocard [style*="display: flex"] > *, .panel [style*="display:flex"] > *, .actionbar > span { min-width: 0; }
.infocard, .panel, .infocard span, .panel td { overflow-wrap: anywhere; }
/* the link of a file name in a card may wrap (a table cell's link keeps its single line) */
.infocard a.textlink, .infocard .textlink { white-space: normal; }

/* AI document reader: the tick, its message, and the values it suggested (they stay highlighted until a person edits them) */
.reader-box { margin: 4px 0 14px; padding: 10px 12px; background: var(--accent-tint); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.reader-box label { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.reader-box .reader-msg { margin-top: 6px; font-size: 12.5px; color: var(--ink); }
.reader-box .reader-msg.bad { color: var(--danger-ink); }
.reader-box .reader-msg ul { margin: 4px 0 0 18px; padding: 0; color: var(--warn-ink); }
input.ai-suggested, select.ai-suggested, textarea.ai-suggested { background: var(--warn-bg) !important; box-shadow: 0 0 0 2px var(--warn-ink) inset; }

/* System health: last 7 days against the 7 days before (line chart) */
.health .health-chart .cmp-line { fill: none; stroke-width: 2.8; stroke-linejoin: round; stroke-linecap: round; }
.health .health-chart .cmp-line.this { stroke: var(--accent); }
.health .health-chart .cmp-line.prev { stroke: #9aa7a0; stroke-dasharray: 7 5; }
.health .health-chart .cmp-dot.this { fill: var(--accent); stroke: #fff; stroke-width: 1.5; }
.health .health-chart .cmp-dot.prev { fill: #9aa7a0; stroke: #fff; stroke-width: 1.5; }
.health .health-chart .cmp-avg { stroke-width: 2; stroke-dasharray: 2 5; stroke-linecap: round; }
.health .health-chart .cmp-avg.this { stroke: #1d4f8f; }
.health .health-chart .cmp-avg.prev { stroke: #6f7d76; }
.health .health-chart .cmp-avg-label { font-size: 12px; font-weight: 700; }
.health .health-chart .cmp-avg-label.this { fill: #1d4f8f; }
.health .health-chart .cmp-avg-label.prev { fill: #5a6862; }
.health .legend .sw.cmpthis { background: var(--accent); }
.health .legend .sw.cmpprev { background: #9aa7a0; }
.health .tabs a { font-size: 13px; padding: 9px 16px; }
.health .tabs { display: flex; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.health .tabs a { white-space: nowrap; flex: 0 0 auto; }
@media (max-width: 700px) { .health .tabs a { padding: 10px 14px; } }

/* Notifications: the two groups, and a table with nothing in it collapses to one line */
.notif-group { font-size: 13px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; }
.notif-group:first-of-type { margin-top: 4px; }
.panel.notif-none { padding: 10px 14px; font-size: 13px; }

/* Expenses: what we owe and what was paid back */
.pay-strip { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; margin: 0 0 10px; font-size: 14px; }
.pay-strip:empty { display: none; }
.pay-strip .paid-green { color: var(--ok-ink); }
.pay-group { margin-top: 12px; }
.pay-group .pay-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; padding: 12px 14px; font-weight: 600; }
.pay-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--raise); }

/* AI reader: the box changes colour with a word beside the tick while it reads (blue), if it fails (red); the fields it fills turn yellow */
.reader-box { transition: background .2s, border-color .2s; }
.reader-legend { font-size: 12px; font-weight: 700; margin-left: 4px; }
.reader-box.reading { background: #cfe3f8; border-color: var(--accent); animation: ai-box 1s ease-in-out infinite; }
.reader-box.reading .reader-legend { color: var(--accent-ink); }
.reader-box.failed { background: var(--danger-bg); border-color: var(--danger-ink); }
.reader-box.failed .reader-legend { color: var(--danger-ink); }
@keyframes ai-box { 50% { background: #e1eefb; } }
tr.ai-reading input[name$="-expiry_date"], tr.ai-reading input[name$="-lot_number"] { background: #cfe3f8 !important; box-shadow: 0 0 0 2px var(--accent) inset !important; animation: ai-pulse 1s ease-in-out infinite; }
@keyframes ai-pulse { 50% { opacity: .55; } }
.reader-note { font-size: 12.5px; font-weight: 400; color: var(--faint); }
.reader-box label { flex-wrap: wrap; }
.ai-filling { background: #cfe3f8 !important; box-shadow: 0 0 0 2px var(--accent) inset !important; animation: ai-pulse 1s ease-in-out infinite; }

/* Kits list: the name and the products get the room, and words are not chopped letter by letter (a name is about 37 characters, the products about 90);
   on a phone the client and the products go under the name and the calculated price under the kit price. */
.kit-table td, .kit-table th { overflow-wrap: break-word; word-break: normal; }
.kit-table td.c-kit { min-width: 220px; font-size: 13px; line-height: 1.35; }
.kit-table td.c-for { min-width: 130px; }
.kit-table td.c-prod { min-width: 200px; }
.kit-table .c-calc, .kit-table .c-price { white-space: nowrap; }
.kit-table .m-only { display: none; }
@media (max-width: 700px) {
  .kit-table .c-for, .kit-table .c-prod, .kit-table .c-calc, .kit-table .c-tax { display: none; }
  .kit-table td.c-kit { min-width: 0; }
  .kit-table .m-only { display: block; }
  .kit-table .m-codes { overflow-wrap: anywhere; }
}
/* Edit, Copy and Make inactive each on their own line, at every width */
.kit-table td.c-actions { white-space: normal !important; min-width: 110px; }
.kit-table td.c-actions .sep { display: none; }
.kit-table td.c-actions a, .kit-table td.c-actions form { display: block; margin: 0 0 6px; }
.kit-table td.c-actions .btn.link { padding: 0; }

/* Consignment screen (a client's loaned stock): the item column keeps room for the code and the description, the number boxes keep a
   readable width, and on a phone the lots move under the item so the table fits. */
.loan-table td, .loan-table th { overflow-wrap: break-word; word-break: normal; }
.loan-table td.c-item { min-width: 190px; font-size: 13px; line-height: 1.35; }
.loan-table td.c-lots { min-width: 120px; }
.loan-table td.c-at { white-space: nowrap; }
.loan-table td.c-price, .loan-table td.c-used, .loan-table td.c-ret { min-width: 92px; }
.loan-table td.c-price input, .loan-table td.c-used input, .loan-table td.c-ret input { min-width: 78px; }
.loan-table .m-only { display: none; }
@media (max-width: 700px) {
  .loan-table .c-lots { display: none; }
  .loan-table .m-only { display: block; }
  .loan-table td.c-item { min-width: 140px; }
  .loan-table td.c-price, .loan-table td.c-used, .loan-table td.c-ret { min-width: 82px; }
}

/* Item types page and the Type column of the Products list: the words keep whole (no letter-by-letter wrapping). */
.type-table td, .type-table th { overflow-wrap: break-word; word-break: normal; }
.type-table td.c-name { min-width: 150px; }
.type-table td.c-flag { min-width: 110px; }
.product-row td.c-type { min-width: 92px; overflow-wrap: normal; word-break: normal; }

/* Consignment tracking check page */
.trace-table td, .trace-table th { overflow-wrap: break-word; word-break: normal; }
.trace-table td.c-item { min-width: 170px; }

/* Consignment screen: the optional "which delivery note" boxes under an item */
.trace-box { margin-top: 6px; font-size: 12px; }
.trace-box summary { cursor: pointer; }
.trace-box select, .trace-box input { display: block; width: 100%; max-width: 280px; margin-top: 4px; }

/* Lists and tables: the first column (a document number, an item code, a name) is a little bigger. It wraps between words once it reaches 22em, so a long name
   or a row of badges never squeezes the other columns (owner 2026-11-25: one rule for every table); a word or a code is never split, and the column is never
   narrower than 8em, so a short number such as INV 261300 stays on one line. */
table.data td.t { white-space: normal; overflow-wrap: normal; word-break: keep-all; min-width: 8em; max-width: 22em; font-size: 14px; font-weight: 700; }
table.data td .t { overflow-wrap: normal; word-break: normal; font-size: 13.5px; font-weight: 700; }
table.data td.c-client { overflow-wrap: break-word; word-break: normal; font-size: 13px; min-width: 150px; }

.chips-label { font-size: 11px; font-weight: 700; color: var(--muted); align-self: center; margin-right: 4px; text-transform: uppercase; letter-spacing: .3px; }
table.data td.c-desc { overflow-wrap: break-word; word-break: normal; font-size: 13px; min-width: 200px; }
table.data td.c-kind { white-space: nowrap; overflow-wrap: normal; word-break: normal; font-size: 13px; }
table.data td.c-from { overflow-wrap: break-word; word-break: normal; font-size: 13px; min-width: 140px; }
table.data td.c-date { white-space: nowrap; overflow-wrap: normal; word-break: normal; font-size: 13px; }

/* Every list table: a word is never cut into letters (a long word makes its column wider and the table scrolls instead). */
table.data td { overflow-wrap: break-word; }
table.data td a { overflow-wrap: break-word; word-break: normal; }
.loan-table .js-load-list { display: block; padding: 0; margin-top: 2px; font-size: 11px; white-space: normal; text-align: right; }

/* ---------- Menu, easier to read (2026-11-20) -------------------------------------------------------------------------------------
   The side menu is now light with dark, larger text: every section has a clear heading chip, every item an icon in the accent blue, and the page you
   are on is a solid blue bar with white text. Only the menu changes: the sign-in page keeps its navy panel, because the colours are set on .sidebar
   alone, and only for people who did not choose the dark menu in My profile (body class menu-dark keeps the original navy menu). */
:root { --sidebar-w: 262px; }
body:not(.menu-dark) .sidebar {
  --nav: #ffffff; --nav-line: #dde5f0; --nav-ink: #1b2a41; --nav-ink-dim: #4a5b74;
  --nav-active: #2f6cb5; --nav-active-ico: #ffffff; --nav-band: #eef3fa; --nav-band-active: #2f6cb5;
  background: #ffffff; border-right: 1px solid #dde5f0;
}
body:not(.menu-dark) .sidebar .brand { color: #132747; }
body:not(.menu-dark) .sidebar .brand-mark { border-color: #b9c9de; color: #2f6cb5; background: #f3f7fc; }
body:not(.menu-dark) .sidebar .brand-mark b { color: #132747; }
body:not(.menu-dark) .sidebar .org { background: #f3f7fc; border: 1px solid #dde5f0; }
body:not(.menu-dark) .sidebar .org strong { color: #132747; font-size: 13px; }
body:not(.menu-dark) .sidebar .org small { color: #4a5b74; font-size: 11px; }
body:not(.menu-dark) .sidebar .org-badge { background: #2f6cb5; color: #fff; }

body:not(.menu-dark) .sidebar .nav-label, body:not(.menu-dark) .sidebar .nav-label.nav-band {
  font-size: 11.5px; font-weight: 700; letter-spacing: .7px; color: #1c3a66;
  background: #e1eaf7; border-radius: 8px; padding: 8px 12px; margin: 16px 0 6px; box-shadow: inset 3px 0 0 #7fa6d8;
}
body:not(.menu-dark) .sidebar .nav-label.nav-band.is-collapsed, body:not(.menu-dark) .sidebar .nav-label.is-collapsed { border-radius: 8px; padding-bottom: 8px; }
body:not(.menu-dark) .sidebar .nav-group.nav-band { background: transparent; padding: 0; border-radius: 0; }
body:not(.menu-dark) .sidebar .nav-label:first-child { margin-top: 4px; }
body:not(.menu-dark) .sidebar .nav-label[role="button"]:hover { background: #d3e1f4; color: #0f2a52; }

body:not(.menu-dark) .sidebar .nav-link { font-size: 14.5px; font-weight: 500; padding: 10px 12px; margin: 2px 0; color: #1b2a41; }
body:not(.menu-dark) .sidebar .nav-link .ico { color: #2f6cb5; font-size: 17px; width: 22px; }
body:not(.menu-dark) .sidebar .nav-link:hover { background: #eaf1fb; color: #0f2038; }
/* The page you are on: a soft blue panel with a solid blue bar on its left edge and bold dark text: clear to find, calm to look at */
body:not(.menu-dark) .sidebar .nav-link.active, body:not(.menu-dark) .sidebar .nav-group.nav-band .nav-link.active { background: #d0e1f7; color: #0b1a30; font-weight: 700; box-shadow: inset 4px 0 0 #2f6cb5; }
body:not(.menu-dark) .sidebar .nav-link.active .ico { color: #2f6cb5; }
body:not(.menu-dark) .sidebar .nav-link .pill { font-size: 11px; padding: 2px 7px; }

body:not(.menu-dark) .sidebar .foot { border-top: 1px solid #dde5f0; }
body:not(.menu-dark) .sidebar .foot strong { color: #132747; font-size: 13px; }
body:not(.menu-dark) .sidebar .foot small { color: #4a5b74; font-size: 11px; }
body:not(.menu-dark) .sidebar .foot-me:hover, body:not(.menu-dark) .sidebar .foot-me.active { background: #e8f0fb; }
body:not(.menu-dark) .sidebar .foot .signout { color: #4a5b74; }
body:not(.menu-dark) .sidebar .foot .signout:hover { color: #2f6cb5; }

body:not(.menu-dark) .shell.rail .sidebar .nav-link .lbl { background: #132747; color: #ffffff; font-size: 13px; }
body:not(.menu-dark) .shell.rail .sidebar .nav-link.active .ico { color: #2f6cb5; }
@media (max-width: 900px) { :root { --sidebar-w: 262px; } body:not(.menu-dark) .sidebar .nav-link { font-size: 15px; padding: 12px 12px; } }

/* ---------- Dark menu, a softer dark (2026-11-20) --------------------------------------------------------------------------------
   For the people who choose the dark menu in My profile: a slate blue (not near-black navy), light text with a high score, heading chips like the
   light menu, and the current page as a lifted panel with a pale-blue bar on its edge. */
body.menu-dark .sidebar {
  --nav: #1f2b3d; --nav-line: #34445c; --nav-ink: #e8eef8; --nav-ink-dim: #aebdd3;
  --nav-active: #34507a; --nav-active-ico: #a9cdf6; --nav-band: #2a3a52; --nav-band-active: #34507a;
  background: #1f2b3d; border-right: 1px solid #2c3b52;
}
body.menu-dark .sidebar .brand { color: #ffffff; }
body.menu-dark .sidebar .org { background: #2a3a52; border: 1px solid #34445c; }
body.menu-dark .sidebar .org strong { color: #f1f5fb; font-size: 13px; }
body.menu-dark .sidebar .org small { color: #aebdd3; font-size: 11px; }
body.menu-dark .sidebar .nav-label, body.menu-dark .sidebar .nav-label.nav-band {
  font-size: 11.5px; font-weight: 700; letter-spacing: .7px; color: #d9e6fa;
  background: #2f4260; border-radius: 8px; padding: 8px 12px; margin: 16px 0 6px; box-shadow: inset 3px 0 0 #6f9bd1;
}
body.menu-dark .sidebar .nav-label.nav-band.is-collapsed, body.menu-dark .sidebar .nav-label.is-collapsed { border-radius: 8px; padding-bottom: 8px; }
body.menu-dark .sidebar .nav-group.nav-band { background: transparent; padding: 0; border-radius: 0; }
body.menu-dark .sidebar .nav-label:first-child { margin-top: 4px; }
body.menu-dark .sidebar .nav-label[role="button"]:hover { background: #3a4f70; color: #ffffff; }
body.menu-dark .sidebar .nav-link { font-size: 14.5px; font-weight: 500; padding: 10px 12px; margin: 2px 0; color: #f4f7fc; }
body.menu-dark .sidebar .nav-link .ico { color: #8dbcf2; font-size: 17px; width: 22px; }
body.menu-dark .sidebar .nav-link:hover { background: #2b3b55; color: #ffffff; }
body.menu-dark .sidebar .nav-link.active, body.menu-dark .sidebar .nav-group.nav-band .nav-link.active {
  background: #3d5f94; color: #ffffff; font-weight: 700; box-shadow: inset 4px 0 0 #a8d0ff; }
body.menu-dark .sidebar .nav-link.active .ico { color: #c4defc; }
body.menu-dark .sidebar .nav-link .pill { font-size: 11px; padding: 2px 7px; }
body.menu-dark .sidebar .foot { border-top: 1px solid #34445c; }
body.menu-dark .sidebar .foot strong { color: #f1f5fb; font-size: 13px; }
body.menu-dark .sidebar .foot small { color: #aebdd3; font-size: 11px; }
body.menu-dark .sidebar .foot-me:hover, body.menu-dark .sidebar .foot-me.active { background: #2a3a52; }
body.menu-dark .sidebar .foot .signout { color: #aebdd3; }
body.menu-dark .sidebar .foot .signout:hover { color: #ffffff; }
body.menu-dark .shell.rail .sidebar .nav-link .lbl, .shell.rail body.menu-dark .sidebar .nav-link .lbl { background: #0f1a2b; color: #ffffff; font-size: 13px; }
@media (max-width: 900px) { body.menu-dark .sidebar .nav-link { font-size: 15px; padding: 12px 12px; } }

/* ---------- Menu sections take turns (2026-11-20) ---------------------------------------------------------------------------------
   Every second section has its own heading colour and a faint panel behind its items, in both menus, so where one section ends and the next begins
   is easy to see. The first section uses the stronger heading, the second the softer one, and so on. */
body:not(.menu-dark) .sidebar .nav-label.nav-band { background: #eef3fa; color: #2c3d57; box-shadow: inset 3px 0 0 #a9c3e6; margin-bottom: 0; border-radius: 8px 8px 0 0; }
body:not(.menu-dark) .sidebar .nav-label.nav-band.is-collapsed { margin-bottom: 6px; border-radius: 8px; }
body:not(.menu-dark) .sidebar .nav-group.nav-band { background: #f6f9fd; padding: 4px 4px 6px; border-radius: 0 0 8px 8px; }
body.menu-dark .sidebar .nav-label.nav-band { background: #2a3a52; color: #cfdcf0; box-shadow: inset 3px 0 0 #5d86bb; margin-bottom: 0; border-radius: 8px 8px 0 0; }
body.menu-dark .sidebar .nav-label.nav-band.is-collapsed { margin-bottom: 6px; border-radius: 8px; }
body.menu-dark .sidebar .nav-group.nav-band { background: #253348; padding: 4px 4px 6px; border-radius: 0 0 8px 8px; }

/* ---------- Menu sections as two alternating blocks (2026-11-20, second try) ----------------------------------------------------
   No more chips and bars. Each section (heading and its items) is one rounded block; blocks take turns between a lighter and a darker shade, so you can
   see at once where one ends and the next begins. The current page is the odd one out: a clean panel with a solid bar on its edge. */
body:not(.menu-dark) .sidebar .nav-label,
body:not(.menu-dark) .sidebar .nav-label.nav-band { background: #f1f6fd; color: #1c3a66; box-shadow: none; border-radius: 10px 10px 0 0; margin: 12px 0 0; padding: 10px 14px 6px; }
body:not(.menu-dark) .sidebar .nav-label.nav-band, body:not(.menu-dark) .sidebar .nav-group.nav-band { background: #dfe9f8; }
body:not(.menu-dark) .sidebar .nav-label.is-collapsed, body:not(.menu-dark) .sidebar .nav-label.nav-band.is-collapsed { border-radius: 10px; padding-bottom: 10px; }
body:not(.menu-dark) .sidebar .nav-group, body:not(.menu-dark) .sidebar .nav-group.nav-band { padding: 2px 6px 8px; border-radius: 0 0 10px 10px; }
body:not(.menu-dark) .sidebar .nav-group { background: #f1f6fd; }
body:not(.menu-dark) .sidebar .nav-label:first-child { margin-top: 4px; }
body:not(.menu-dark) .sidebar .nav-label[role="button"]:hover { background: #d6e3f5; color: #0f2a52; }
body:not(.menu-dark) .sidebar .nav-label.nav-band[role="button"]:hover { background: #cddcf1; }
body:not(.menu-dark) .sidebar .nav-link:hover { background: rgba(47, 108, 181, .12); color: #0f2038; }
body:not(.menu-dark) .sidebar .nav-link.active, body:not(.menu-dark) .sidebar .nav-group.nav-band .nav-link.active {
  background: #ffffff; color: #0b1a30; font-weight: 700; box-shadow: inset 4px 0 0 #2f6cb5, 0 1px 3px rgba(15, 32, 56, .16); }
body:not(.menu-dark) .sidebar .nav-link.active .ico { color: #2f6cb5; }

body.menu-dark .sidebar .nav-label,
body.menu-dark .sidebar .nav-label.nav-band { background: #2a3c57; color: #d6e4f8; box-shadow: none; border-radius: 10px 10px 0 0; margin: 12px 0 0; padding: 10px 14px 6px; }
body.menu-dark .sidebar .nav-label.nav-band, body.menu-dark .sidebar .nav-group.nav-band { background: #1a2536; }
body.menu-dark .sidebar .nav-label.is-collapsed, body.menu-dark .sidebar .nav-label.nav-band.is-collapsed { border-radius: 10px; padding-bottom: 10px; }
body.menu-dark .sidebar .nav-group, body.menu-dark .sidebar .nav-group.nav-band { padding: 2px 6px 8px; border-radius: 0 0 10px 10px; }
body.menu-dark .sidebar .nav-group { background: #2a3c57; }
body.menu-dark .sidebar .nav-label:first-child { margin-top: 4px; }
body.menu-dark .sidebar .nav-label[role="button"]:hover { background: #35496a; color: #ffffff; }
body.menu-dark .sidebar .nav-label.nav-band[role="button"]:hover { background: #243249; }
body.menu-dark .sidebar .nav-link:hover { background: rgba(255, 255, 255, .09); color: #ffffff; }
body.menu-dark .sidebar .nav-link.active, body.menu-dark .sidebar .nav-group.nav-band .nav-link.active {
  background: #3d5f94; color: #ffffff; font-weight: 700; box-shadow: inset 4px 0 0 #a8d0ff; }

/* ---------- Dark menu back in the original navy, with the two alternating blocks (2026-11-20) ----------------------------------
   The navy of the first menu (#132747) with the lighter and darker section blocks of the light menu. */
body.menu-dark .sidebar {
  --nav: #132747; --nav-line: #2a4170; --nav-ink: #eaf1fb; --nav-ink-dim: #a9bbd6;
  --nav-active: #2f5189; --nav-active-ico: #b7d6fa; --nav-band: #1c3560; --nav-band-active: #2f5189;
  background: #132747; border-right: 1px solid #0d1d38;
}
body.menu-dark .sidebar .org { background: #1c3560; border: 1px solid #2a4170; }
body.menu-dark .sidebar .org small, body.menu-dark .sidebar .foot small { color: #a9bbd6; }
body.menu-dark .sidebar .nav-label,
body.menu-dark .sidebar .nav-label.nav-band { background: #1c3560; color: #c9d9f1; }
body.menu-dark .sidebar .nav-group { background: #1c3560; }
body.menu-dark .sidebar .nav-label.nav-band, body.menu-dark .sidebar .nav-group.nav-band { background: #0f2140; }
body.menu-dark .sidebar .nav-label[role="button"]:hover { background: #274778; color: #ffffff; }
body.menu-dark .sidebar .nav-label.nav-band[role="button"]:hover { background: #183057; }
body.menu-dark .sidebar .nav-link { color: #eaf1fb; }
body.menu-dark .sidebar .nav-link .ico { color: #8dbcf2; }
body.menu-dark .sidebar .nav-link:hover { background: rgba(255, 255, 255, .08); color: #ffffff; }
body.menu-dark .sidebar .nav-link.active, body.menu-dark .sidebar .nav-group.nav-band .nav-link.active {
  background: #2f5189; color: #ffffff; font-weight: 700; box-shadow: inset 4px 0 0 #8dbcf2; }
body.menu-dark .sidebar .nav-link.active .ico { color: #b7d6fa; }
body.menu-dark .sidebar .foot { border-top: 1px solid #2a4170; }
body.menu-dark .sidebar .foot-me:hover, body.menu-dark .sidebar .foot-me.active { background: #1c3560; }

/* ---------- Dark menu: a touch lighter navy and firmer text (2026-11-20) ------------------------------------------------------ */
body.menu-dark .sidebar {
  --nav: #172d52; --nav-line: #2e4777; --nav-ink: #f2f6fc; --nav-ink-dim: #b3c4de;
  --nav-active: #35589a; --nav-band: #20396a;
  background: #172d52; border-right: 1px solid #10223f;
}
body.menu-dark .sidebar .org { background: #20396a; border: 1px solid #2e4777; }
body.menu-dark .sidebar .nav-label,
body.menu-dark .sidebar .nav-label.nav-band { background: #20396a; color: #d3e1f5; font-weight: 800; font-size: 12px; letter-spacing: .6px; }
body.menu-dark .sidebar .nav-group { background: #20396a; }
body.menu-dark .sidebar .nav-label.nav-band, body.menu-dark .sidebar .nav-group.nav-band { background: #162d55; }
body.menu-dark .sidebar .nav-label[role="button"]:hover { background: #2c4a82; color: #ffffff; }
body.menu-dark .sidebar .nav-label.nav-band[role="button"]:hover { background: #1d3868; }
body.menu-dark .sidebar .nav-link { color: #f2f6fc; font-weight: 600; }
body.menu-dark .sidebar .nav-link .ico { color: #9cc6f5; }
body.menu-dark .sidebar .nav-link.active, body.menu-dark .sidebar .nav-group.nav-band .nav-link.active {
  background: #35589a; color: #ffffff; font-weight: 700; box-shadow: inset 4px 0 0 #9cc8ff; }
body.menu-dark .sidebar .foot { border-top: 1px solid #2e4777; }
body.menu-dark .sidebar .foot-me:hover, body.menu-dark .sidebar .foot-me.active { background: #20396a; }

/* Menu icons: one box for all of them, so a small character and a big one sit on the same line and take the same space (menu-icons.js sets each size). */
.sidebar .nav-link .ico { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; line-height: 1; flex: none; overflow: visible; }

/* Polish with AI: a small underlined link under a text box; it opens a row of small choices, and the suggestion appears beside the person's own words */
.polish { margin: 2px 0 8px; font-size: 12px; line-height: 1.4; }
.polish [hidden] { display: none !important; }
.polish-open { background: none; border: 0; padding: 2px 0; font: inherit; font-size: 12px; color: var(--muted, #64748b); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.polish-open:hover, .polish-open[aria-expanded="true"] { color: var(--accent, #0f6b7e); }
.polish-open:disabled { opacity: .6; cursor: progress; text-decoration: none; }
.polish-msg { margin-left: 8px; color: var(--muted, #64748b); }
.polish-msg.bad { color: #b42318; }
.polish-menu { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 4px; }
.polish-mode { background: var(--raise, #f1f5f9); border: 1px solid var(--line, #d7dee8); border-radius: 999px; padding: 2px 10px; font: inherit; font-size: 12px; cursor: pointer; color: var(--ink, #0f172a); }
.polish-mode:hover { border-color: var(--accent, #0f6b7e); }
.polish-accept, .polish-keep, .polish-undo { background: var(--surface, #fff); border: 1px solid var(--line, #d7dee8); border-radius: 8px; padding: 3px 11px; font: inherit; font-size: 12px; cursor: pointer; color: var(--ink, #0f172a); }
.polish-accept { background: var(--accent, #0f6b7e); border-color: var(--accent, #0f6b7e); color: #fff; margin-right: 6px; }
.polish-undo { padding: 0 8px; margin-left: 4px; }
.polish-result { margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line, #d7dee8); border-left: 3px solid var(--accent, #0f6b7e); border-radius: 8px; background: var(--raise, #f8fafc); font-size: 13px; }
.polish-suggestion { white-space: pre-wrap; margin-bottom: 8px; line-height: 1.45; }
.polish-left { margin-left: 8px; color: var(--muted, #64748b); font-size: 12px; }

/* The receipt bar at the top of the expense form: one slim line, so it is easy to ignore and easy to use */
.reader-bar { margin: 0 0 14px; padding: 8px 12px; border: 1px dashed var(--line, #d7dee8); border-radius: 10px; background: var(--raise, #f8fafc); }
.reader-bar .bar-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.form-panel .reader-bar label.bar-attach, .reader-bar .bar-attach { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--accent, #0f6b7e); }
.reader-bar .bar-attach span { text-decoration: underline; text-underline-offset: 2px; }
.reader-bar .bar-say { color: var(--muted, #64748b); font-size: 13px; }
.form-panel .reader-bar label.bar-tick, .reader-bar .bar-tick { margin-left: auto; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.reader-bar .bar-left { font-size: 12px; color: var(--muted, #64748b); }
.reader-bar .bar-reason { margin-top: 4px; font-size: 12px; color: var(--muted, #64748b); }
.reader-bar.off .bar-tick { opacity: .55; }
.form-panel .reader-bar label.bar-level, .reader-bar .bar-level { display: block; margin-top: 6px; font-size: 13px; }
.reader-bar .bar-level select { margin-left: 4px; }
.reader-bar .bar-name { margin-top: 4px; font-size: 12px; color: var(--muted, #64748b); }
.form-panel .reader-bar .bar-tick input[type=checkbox], .reader-bar .bar-tick input[type=checkbox] { width: auto; height: auto; display: inline-block; margin: 0; padding: 0; flex: none; }
.sidebar .feedback-link { display: block; margin: 0 14px 8px; padding: 4px 0; font-size: 12px; color: var(--nav-ink-dim, #9fb0c8); text-decoration: underline; text-underline-offset: 2px; }
.sidebar .feedback-link:hover { color: var(--nav-ink, #fff); }
body:not(.menu-dark) .sidebar .feedback-link { color: #4a5b74; }
.shell.rail .feedback-link { display: none; }
.free-banner { padding: 6px 16px; font-size: 13px; text-align: center; background: #fff7e6; color: #7a4b00; border-bottom: 1px solid #f0d9a8; }
.free-banner.ended { background: #fdecea; color: #8a1c14; border-bottom-color: #f3c0bb; }
.free-banner a { color: inherit; text-decoration: underline; }
/* the (i) help button next to a page title and its small card */
.page-help-btn { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-left: 6px; padding: 0; vertical-align: middle; border: 1px solid var(--line, #cbd5e1); border-radius: 50%; background: var(--surface, #fff); color: var(--muted, #64748b); font: italic 700 14px/1 Georgia, serif; cursor: pointer; }
.page-help-btn:hover, .page-help-btn[aria-expanded="true"] { color: var(--accent, #0f6b7e); border-color: var(--accent, #0f6b7e); }
.page-help-card { max-width: 520px; margin: 6px 0 12px; padding: 10px 14px; border: 1px solid var(--line, #d7dee8); border-left: 3px solid var(--accent, #0f6b7e); border-radius: 8px; background: var(--raise, #f8fafc); font-size: 14px; line-height: 1.45; }
.page-help-card[hidden] { display: none; }
.page-help-card ul { margin: 6px 0 8px 18px; padding: 0; }
/* Totals per vendor / category: quick periods, the grand total beside them, a share bar per row */
.totals-bar { padding: 10px 14px; display: flex; gap: 12px 20px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.totals-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.totals-dates summary { list-style: none; cursor: pointer; }
.totals-dates summary::-webkit-details-marker { display: none; }
.totals-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; margin-top: 8px; }
.totals-form label { display: grid; gap: 2px; font-size: 12px; color: var(--muted, #64748b); min-width: 0; position: relative; }
.totals-form button.btn { grid-column: 1 / -1; justify-self: start; }
@media (min-width: 700px) { .totals-form { grid-template-columns: 190px 190px auto; align-items: end; } .totals-form button.btn { grid-column: auto; } }
/* date boxes: a fixed height and the full width of their column (an empty date box on iOS collapses otherwise); the small x that empties a date sits inside the box, so it never adds a row */
.totals-form input[type=date], .filters input[type=date] { display: block; width: 100%; min-height: 40px; padding-right: 30px; -webkit-appearance: none; appearance: none; }
.totals-form .date-clear, .filters .date-clear { position: absolute; right: 6px; bottom: 6px; z-index: 1; }
@media (hover: hover) { .totals-form .date-clear, .filters .date-clear { right: 34px; } }
.filters .field { position: relative; }
/* a filter row (expenses list): every box has a width of its own and wraps; two to a row on a phone, the search box alone on its row */
.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: end; }
.filters .field { flex: 1 1 150px; min-width: 0; }
.filters .field select { width: 100%; max-width: none; }
.filters .field.wide { flex-basis: 100%; }
@media (max-width: 600px) { .filters .field { flex-basis: calc(50% - 8px); } .filters .field.wide { flex-basis: 100%; } .filters .btn { flex: 1 1 100%; } }
/* A FROM / TO DATE FILTER, one look on every page (a form that only searches, never a form that saves): the small label sits above its box, the box has a fixed height and the full width of its
   column, and the small x that empties a date sits inside the box. On a computer the boxes are side by side with the button at their foot; on a phone From and To share a row and the button
   takes the row below. Nothing can overlap, because every box and the button are items of the same row. */
form:not([method="post"]) label:has(> input[type=date]) { display: grid; gap: 2px; min-width: 0; margin: 0; position: relative; font-size: 12px; color: var(--muted, #64748b); white-space: normal; }
form:not([method="post"]) label:has(> input[type=date]) > br { display: none; }
form:not([method="post"]) label > input[type=date] { display: block; width: 100%; min-height: 40px; padding-right: 30px; -webkit-appearance: none; appearance: none; }
form:not([method="post"]) label:has(> input[type=date]) .date-clear { position: absolute; right: 6px; bottom: 6px; z-index: 1; }
@media (hover: hover) { form:not([method="post"]) label:has(> input[type=date]) .date-clear { right: 34px; } }
.toolbar:has(input[type=date]) { align-items: end; }
.toolbar:has(input[type=date]) > label:has(> input[type=date]) { flex: 0 1 170px; }
.toolbar:has(input[type=date]) > .btn, .toolbar:has(input[type=date]) > button { min-height: 40px; }
@media (max-width: 600px) {
  .toolbar:has(input[type=date]) > label:has(> input[type=date]) { flex: 1 1 calc(50% - 8px); }
  .toolbar:has(input[type=date]) > .btn, .toolbar:has(input[type=date]) > button { flex: 1 1 100%; }
}
/* the same look for the filter box of the reports (.rev-box: revenue, expenses, purchasing ...): From and To side by side, every drop-down and the buttons on a row of their own on a phone */
.rev-box > label:has(> input[type=date]) { flex: 0 1 170px; }
.rev-box:has(input[type=date]) > .btn, .rev-box:has(input[type=date]) > button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 600px) {
  .rev-box > label:has(> input[type=date]) { flex: 1 1 calc(50% - 8px); }
  .rev-box > .multi, .rev-box > label:not(.tick):not(:has(> input[type=date])), .rev-box > select { flex: 1 1 100%; }
  .rev-box > .multi > summary { min-width: 0; }
  .rev-box > label.tick { flex: 1 1 100%; }
  .rev-box > .btn, .rev-box > button { flex: 1 1 calc(50% - 8px); }
}
.totals-grand strong { font-size: 18px; margin-left: 6px; }
.share-bar { display: inline-block; width: 90px; height: 8px; border-radius: 4px; background: var(--line, #e2e8f0); vertical-align: middle; overflow: hidden; }
.share-bar i { display: block; height: 100%; background: var(--accent, #0f6b7e); }
.year-banner { margin: 0; } .year-banner .btn { margin-left: 8px; }
.simple-filters .sf-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.simple-filters .sf-row input[type=search] { flex: 1 1 220px; min-width: 0; }
.simple-filters .sf-row select { flex: 0 1 auto; width: auto; max-width: 100%; }
.simple-filters .sf-row label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted, #667); }
.simple-filters .sf-more summary { cursor: pointer; font-size: 13px; color: var(--muted, #667); margin-top: 8px; }
.btn.filter { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.filter:hover { background: var(--accent); color: #fff; }
.simple-filters .sf-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); align-items: end; }
.simple-filters .sf-grid label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted, #667); min-width: 0; }
.simple-filters .sf-grid select, .simple-filters .sf-grid input { width: 100%; min-width: 0; }
.simple-filters .sf-dates { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* every From / To pair of a filter: its own line, the two side by side (static/date-clear.js makes the row) */
.date-range { flex: 1 1 100%; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 10px; align-items: end; }
.date-range label, .date-range > * { min-width: 0; }
.date-range .field { margin: 0; }
.date-range label { display: flex; flex-direction: column; gap: 2px; }
.date-range .dr-box { display: flex; align-items: center; gap: 0; width: 100%; }
.date-range input[type=date] { flex: 1 1 auto; width: 100%; min-width: 0; padding-left: 8px; padding-right: 4px; }
.date-range .date-clear { flex: none; position: static !important; padding: 0 0 0 4px !important; font-size: 18px !important; }
.date-range input[type=date] { min-height: 40px; }
.c-file { text-align: center; width: 1%; white-space: nowrap; }
.file-yes { color: #1f8a4c; font-weight: 800; }
.file-no { color: var(--faint, #b0b8c4); }
.est-lines textarea { min-width: 15em; }
.est-lines input[type=number] { min-width: 8.5em; text-align: right; }
.est-lines td { vertical-align: top; }
.rev-box label.check { flex-direction: row; align-items: center; gap: 6px; }
@media (max-width: 700px) {
  .cards-on-phone table.data tr { display: flex; flex-direction: column; }
  .cards-on-phone table.data td.t { order: -1; }
}

/* a group of download buttons in one box (Sales history): Export [Detailed] [Summary] [CSV] */
.exportbox { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line, #d9e1ec); border-radius: 12px; background: var(--panel, transparent); }
.exportbox > .muted { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

/* the public sign-up pages: the step the person is on, and the package cards */
.auth-flow > div.on { border-color: #8fb6e8; color: #cdddf4; background: rgba(143, 182, 232, .12); }
.plan-card:has(input:checked) { border-color: var(--accent, #2f6cb5) !important; background: var(--accent-tint, #eaf1fb); }
.plan-card:hover { border-color: var(--accent, #2f6cb5) !important; }
@media (max-width: 860px) { .auth-flow { flex-wrap: wrap; margin-top: 20px; } }
/* a long name in a table cell is cut short with ... (the full name is in the tooltip); in a phone card it wraps instead */
.clip { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
@media (max-width: 700px) {
  .cards-on-phone table.data td .clip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .cards-on-phone table.data td.pick-cell { position: absolute; right: 12px; }
  .cards-on-phone table.data tr { position: relative; }
}
/* voice typing: the small microphone button under a text box (static/voice.js) */
.voice { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; flex-wrap: wrap; }
/* The writing tools under a text box (static/text-tools.js): microphone, speaker and Polish with AI side by side in one row, the wider parts of a tool underneath. */
.text-tools { margin: 4px 0 8px; }
.tt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.tt-row .tt-polish { order: 1; } .tt-row .tt-read { order: 2; } .tt-row .tt-voice { order: 3; }
/* the microphone and the speaker are icons only, big enough to hit with a finger */
.tt-row .voice-btn { min-width: 44px; min-height: 40px; padding: 4px 12px; font-size: 18px; line-height: 1; }
.tt-row .voice, .tt-row .polish { margin: 0; }
.tt-below .polish { margin: 4px 0 0; }
.tt-below:empty { display: none; }
.voice .voice-lang { min-height: 40px; width: 64px; padding: 2px 6px; font-size: 13px; border-radius: 999px; border: 1px solid var(--line, #d7dde5); background: var(--raise, #f6f8fb); color: inherit; }
@media (max-width: 480px) { .tt-row { gap: 4px 8px; } }
.voice .voice-btn { border: 1px solid var(--line, #d7dde5); background: var(--raise, #f6f8fb); color: inherit; border-radius: 999px; padding: 3px 12px; font-size: 13px; cursor: pointer; }
.voice .voice-btn.on { background: #b42318; border-color: #b42318; color: #fff; }
.voice .voice-msg { font-size: 12px; color: var(--muted, #6b7a74); }
.voice .voice-msg.bad { color: #b42318; }
/* the "Show who spent it" tick next to the Export buttons of the expense list and report */
.show-user-tick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin-left: 6px; cursor: pointer; }
/* a softer blue button (between the white one and the navy primary): used for the kit swap while the colour of all the white buttons is being chosen */
.btn.soft { background: #dbe8f7; border-color: #b7cfea; color: #1f4f8f; }
.btn.soft:hover { background: #cddff3; }
/* two date boxes (from / to) ALWAYS side by side, also on a phone, each taking half the row; the same layout wherever a filter has a from and a to */
.datepair { display: flex; gap: 8px; flex: 1 1 100%; flex-wrap: nowrap; }
.datepair label { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.datepair label > span { font-size: 12px; color: var(--muted); }
.datepair input[type=date] { width: 100%; min-width: 0; min-height: 36px; font-size: 14px; padding: 4px 8px; }
