:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;      /* hover, code, image placeholders */
  --input-bg: #ffffff;
  --text: #1d2330;
  --muted: #667085;
  --border: #dde1e7;
  --accent: #008143;         /* DEKRA green: buttons, highlights */
  --accent-hover: #006a37;
  --link: #008143;
  --brand: #008143;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --danger-border: #fecdca;
  --success-bg: #ecfdf3;
  --success-border: #abefc6;
  --info-bg: #eff4ff;
  --info-border: #c7d7fe;
  --row-hover: #fafbfc;
  --row-current: #f5f8ff;
  --row-error: #fffbfa;
  --b-gray-bg: #f2f4f7;  --b-gray: #475467;
  --b-green-bg: #ecfdf3; --b-green: #067647;
  --b-blue-bg: #eff4ff;  --b-blue: #3538cd;
  --b-amber-bg: #fffaeb; --b-amber: #b54708;
  --b-pink-bg: #fdf2fa;  --b-pink: #9e165f;
  --line-gray: #c9d3cd;      /* coloured edges on tiles and cards */
  --line-green: #008143;
  --line-blue: #2f6fde;
  --line-amber: #e0a100;
  --line-red: #d0342c;
  --side-bg: #0b3d26;        /* side menu layout */
  --side-text: #cfe3d7;
  --side-hover: rgba(255, 255, 255, .08);
  --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

/* Dark theme: chosen in "My account", or "system" when the OS/browser prefers dark. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1513;
  --surface: #172019;
  --surface-2: #212c26;
  --input-bg: #111915;
  --text: #e3ebe6;
  --muted: #94a39b;
  --border: #2b3832;
  --accent: #1f8f55;
  --accent-hover: #24a462;
  --link: #6fd6a0;
  --brand: #3cc57f;
  --danger: #f97066;
  --danger-bg: #3a1714;
  --danger-border: #7a2a22;
  --success-bg: #12301f;
  --success-border: #1f5a39;
  --info-bg: #172040;
  --info-border: #2d3d7a;
  --row-hover: #1b261f;
  --row-current: #1a2433;
  --row-error: #2a1614;
  --b-gray-bg: #26302b;  --b-gray: #b7c2bc;
  --b-green-bg: #133523; --b-green: #6fd6a0;
  --b-blue-bg: #1c2550;  --b-blue: #a4b4ff;
  --b-amber-bg: #3a2a0c; --b-amber: #fbbf5a;
  --b-pink-bg: #3d1630;  --b-pink: #f5a3d0;
  --line-gray: #3a4842;
  --line-green: #3cc57f;
  --line-blue: #5b8def;
  --line-amber: #e8b030;
  --line-red: #f0645a;
  --side-bg: #0a120e;
  --side-text: #b9cdc2;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
  color-scheme: dark;
  --bg: #0f1513;
  --surface: #172019;
  --surface-2: #212c26;
  --input-bg: #111915;
  --text: #e3ebe6;
  --muted: #94a39b;
  --border: #2b3832;
  --accent: #1f8f55;
  --accent-hover: #24a462;
  --link: #6fd6a0;
  --brand: #3cc57f;
  --danger: #f97066;
  --danger-bg: #3a1714;
  --danger-border: #7a2a22;
  --success-bg: #12301f;
  --success-border: #1f5a39;
  --info-bg: #172040;
  --info-border: #2d3d7a;
  --row-hover: #1b261f;
  --row-current: #1a2433;
  --row-error: #2a1614;
  --b-gray-bg: #26302b;  --b-gray: #b7c2bc;
  --b-green-bg: #133523; --b-green: #6fd6a0;
  --b-blue-bg: #1c2550;  --b-blue: #a4b4ff;
  --b-amber-bg: #3a2a0c; --b-amber: #fbbf5a;
  --b-pink-bg: #3d1630;  --b-pink: #f5a3d0;
  --line-gray: #3a4842;
  --line-green: #3cc57f;
  --line-blue: #5b8def;
  --line-amber: #e8b030;
  --line-red: #f0645a;
  --side-bg: #0a120e;
  --side-text: #b9cdc2;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--link); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h1 small { font-size: .9rem; color: var(--muted); font-weight: 400; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: .6rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;   /* stays visible while scrolling */
}
html { scroll-padding-top: 4.5rem; }       /* #anchors aren't hidden under the sticky bar */
/* Brand: DEKRA logo | DIM */
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--brand); }
.brand .logo { display: block; height: 24px; width: auto; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: .06em; padding-left: .7rem;
              border-left: 1px solid var(--border); line-height: 1.2; color: var(--brand); }
.login-brand .logo { height: 36px; }
.login-brand .brand-name { font-size: 1.4rem; }
.login-sub { margin: .3rem 0 1rem; }
.mainnav { display: flex; gap: 1rem; flex: 1; }
.mainnav a { text-decoration: none; color: var(--muted); padding: .25rem 0; }
.mainnav a.active, .mainnav a:hover { color: var(--text); border-bottom: 2px solid var(--accent); }
.usermenu { display: flex; align-items: center; gap: .6rem; }
.usermenu a { text-decoration: none; color: var(--text); }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; margin-bottom: 1.25rem;
}
.card.narrow { max-width: 480px; }
.card.login { max-width: 380px; margin: 10vh auto 0; }

/* Forms */
form.inline { display: inline; margin: 0; }
label { display: block; margin: .75rem 0 .25rem; font-weight: 500; }
label small { color: var(--muted); font-weight: 400; }
input, select, textarea {
  width: 100%; padding: .5rem .6rem; font: inherit; color: inherit;
  border: 1px solid var(--border); border-radius: 6px; background: var(--input-bg);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button {
  font: inherit; cursor: pointer; padding: .5rem 1rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; margin-top: 1rem; }
button.primary:hover { background: var(--accent-hover); }
button.linkbutton { border: 0; background: none; padding: 0; color: var(--link); }
button.linkbutton:hover { text-decoration: underline; }
.card.login button.primary { width: 100%; }

/* Flash messages */
.flash { padding: .6rem .9rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid var(--border); }
.flash-error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.flash-success { background: var(--success-bg); border-color: var(--success-border); }
.flash-info { background: var(--info-bg); border-color: var(--info-border); }

/* Badges */
.badge { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 999px;
         background: var(--b-gray-bg); color: var(--muted); font-weight: 600; }
.badge.role-superadmin { background: var(--b-pink-bg); color: var(--b-pink); }
.badge.role-admin { background: var(--b-green-bg); color: var(--b-green); }
.badge.role-readonly { background: var(--b-blue-bg); color: var(--b-blue); }
.badge.role-business { background: var(--b-amber-bg, #fff4e5); color: var(--b-amber, #9a5b00); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--line-gray);
        border-radius: var(--radius); padding: .9rem 1rem; }
.stat .num { display: block; font-size: 1.6rem; font-weight: 700; text-align: left; }
/* same colours as the status badges */
.stat.status-in_stock, .stat.tone-green { border-top-color: var(--line-green); }
.stat.status-assigned, .stat.tone-blue { border-top-color: var(--line-blue); }
.stat.status-repair, .stat.tone-amber { border-top-color: var(--line-amber); }
.stat.status-lost, .stat.tone-red { border-top-color: var(--line-red); }
.stat .label { color: var(--muted); font-size: .85rem; }

/* Tables and details */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.5rem; margin: 0; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; }

/* --- Phase 2: lists, forms, detail pages, images --------------------------- */
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; }
.num { text-align: right; }
.pad { padding: 1rem 1.5rem; margin: 0; }
h1 .badge { vertical-align: middle; }
h3 { font-size: 1rem; margin: 1.25rem 0 .4rem; }
.crumbs { margin: 0 0 .25rem; color: var(--muted); font-size: .9rem; }
.crumbs a { color: var(--muted); }

.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pagehead h1 { margin: 0; }
.buttons { display: flex; gap: .5rem; }

a.button {
  display: inline-block; padding: .5rem 1rem; border-radius: 6px; text-decoration: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
a.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
a.button.primary:hover { background: var(--accent-hover); }
a.button:not(.primary):hover, button:not(.primary):not(.linkbutton):hover { background: var(--surface-2); }
button.linkbutton.danger { color: var(--danger); }
button.danger:not(.linkbutton):not(.pill-btn) { color: var(--danger); }
.buttons button { margin-top: 0; }

/* Filters */
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters input[type=search] { flex: 1 1 260px; width: auto; }
.filters select { width: auto; }

/* Tables */
.card.flush { padding: 0; overflow-x: auto; }
table.list tbody tr:hover { background: var(--row-hover); }
table.list td a { text-decoration: none; }
table.list td a:hover { text-decoration: underline; }
th a.sort { color: inherit; text-decoration: none; }
th a.sort.active { color: var(--text); }
th a.sort.active::after { content: " ▾"; }
th a.sort.active.desc::after { content: " ▴"; }
/* a filter form with changes not applied yet: its button lights up */
.filters.changed button[type=submit], .filters.changed button:not([type]) {
  background: var(--accent); border-color: var(--accent); color: #fff; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }
.pager.pager-top { justify-content: flex-end; margin: 0 0 .5rem; font-size: .9rem; flex-wrap: wrap; }

/* Status badges */
.badge.status-in_stock { background: var(--b-green-bg); color: var(--b-green); }
.badge.status-assigned { background: var(--b-blue-bg); color: var(--b-blue); }
.badge.status-repair { background: var(--b-amber-bg); color: var(--b-amber); }
.badge.status-retired { background: var(--b-gray-bg); color: var(--b-gray); }
.badge.status-lost { background: var(--danger-bg); color: var(--danger); }
.badge.status-active { background: var(--b-green-bg); color: var(--b-green); }
.badge.status-left { background: var(--b-gray-bg); color: var(--b-gray); }
.badge.kind-leaver { background: var(--danger-bg); color: var(--danger); }
.badge.status-maternity { background: var(--b-pink-bg); color: var(--b-pink); }

/* Stats as links */
a.stat { text-decoration: none; color: inherit; }
a.stat:hover { border-left-color: var(--accent); border-right-color: var(--accent); border-bottom-color: var(--accent); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 1.25rem; }
.form-grid .wide { grid-column: 1 / -1; }
.field .error { color: var(--danger); font-size: .85rem; margin-top: .2rem; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field .hint, .hint { color: var(--muted); font-size: .85rem; }
.field p.static { margin: .3rem 0 0; }
.req { color: var(--danger); }
.actions { display: flex; gap: .75rem; align-items: center; margin-top: 1rem; }
.actions button.primary { margin-top: 0; }

/* Detail pages */
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 0 1.25rem; }
.notes { white-space: pre-wrap; margin: 0; }

/* History */
ol.history { list-style: none; margin: 0; padding: 0; }
ol.history li { padding: .6rem 0; border-bottom: 1px solid var(--border); }
ol.history li:last-child { border-bottom: 0; }
table.changes { width: auto; margin: .3rem 0 0 .5rem; font-size: .9rem; }
table.changes th, table.changes td { border: 0; padding: .1rem .5rem .1rem 0; text-transform: none; letter-spacing: 0; font-size: .9rem; }
table.changes th { color: var(--muted); font-weight: 500; }
table.changes td.old { color: var(--muted); text-decoration: line-through; }
table.changes td.arrow { color: var(--muted); }
a.quiet { color: inherit; text-decoration: none; }
a.quiet:hover, a.quiet:focus-visible { text-decoration: underline; }
.activity-changes summary { cursor: pointer; color: var(--accent); white-space: nowrap; }
.activity-changes table.changes { margin-left: 0; }

/* Images */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; background: var(--surface-2); }
.gallery figcaption { font-size: .85rem; margin-top: .25rem; display: flex; flex-direction: column; gap: .1rem; }
form.upload { border-top: 1px solid var(--border); padding-top: .5rem; }
form.upload input[type=file] { padding: .4rem; }

/* --- Phases 3-8 ------------------------------------------------------------- */
[hidden] { display: none !important; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .85em; background: var(--surface-2); padding: .05rem .3rem; border-radius: 4px; }
a.button.small { padding: .2rem .6rem; font-size: .85rem; }
.filter-note { margin: -.5rem 0 1rem; color: var(--muted); font-size: .9rem; }
.inline-check { display: inline-flex; align-items: center; gap: .35rem; margin: 0; font-weight: 400; }
.inline-check input, .field.check input, .checklabel input { width: auto; }
.field.check label, .checklabel { display: flex; align-items: center; gap: .4rem; font-weight: 500; margin-top: 1.9rem; }
.field.check .hint { margin-top: .2rem; }

/* top bar search */
.topsearch input { width: 220px; padding: .35rem .6rem; }
@media (max-width: 900px) { .topsearch { order: 5; flex-basis: 100%; } .topsearch input { width: 100%; } }

/* settings sub navigation */
.subnav { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.subnav a { padding: .5rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a.active, .subnav a:hover { color: var(--text); border-bottom-color: var(--accent); }
form.rename { display: flex; gap: .4rem; }
form.rename input { max-width: 260px; }
tr.inactive td { color: var(--muted); }

/* tables */
table.list.compact th, table.list.compact td { padding: .35rem .5rem; font-size: .92rem; }
tr.current td { background: var(--row-current); }
.card.attention { border-left: 4px solid var(--line-amber); }

/* hand-out picker */
select.picker { margin-top: .4rem; height: auto; }

/* comments */
ol.comments { list-style: none; margin: 0 0 1rem; padding: 0; }
ol.comments li { padding: .7rem 0; border-bottom: 1px solid var(--border); }
ol.comments .body { white-space: pre-wrap; margin-top: .2rem; }
.comment-actions { display: flex; gap: 1rem; align-items: flex-start; margin-top: .3rem; font-size: .85rem; }
.comment-actions summary { cursor: pointer; color: var(--link); }
.comment-actions details[open] { flex: 1; }
.comment-actions details form { margin-top: .4rem; display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
form.add-comment button.primary { margin-top: .5rem; }

/* import preview */
.actions-bar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.actions-bar button.primary { margin-top: 0; }
.badge.result-create { background: var(--b-green-bg); color: var(--b-green); }
.badge.result-update { background: var(--b-blue-bg); color: var(--b-blue); }
.badge.result-unchanged, .badge.result-skip { background: var(--b-gray-bg); color: var(--b-gray); }
.badge.result-error { background: var(--danger-bg); color: var(--danger); }
tr.row-error td { background: var(--row-error); }
.changes-inline { display: flex; flex-wrap: wrap; gap: .2rem .9rem; font-size: .88rem; }
.changes-inline .old { color: var(--muted); text-decoration: line-through; }
.preview .error { color: var(--danger); font-size: .88rem; }

/* --- Layouts --------------------------------------------------------------- */

/* Side menu layout */
.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--side-bg); color: var(--side-text); padding: 1.1rem .8rem;
           display: flex; flex-direction: column; gap: 1.4rem;
           position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand, .sidebar .brand-name { color: #fff; }
.sidebar .brand { padding: 0 .5rem; }
.sidebar .brand-name { border-left-color: rgba(255, 255, 255, .3); }
.sidenav { display: flex; flex-direction: column; gap: 2px; }
.sidenav a { color: var(--side-text); text-decoration: none; padding: .55rem .75rem; border-radius: 6px; }
.sidenav a:hover { background: var(--side-hover); color: #fff; }
.sidenav a.active { background: #008143; color: #fff; font-weight: 600; }
.sidebar-foot { margin-top: auto; font-size: .75rem; opacity: .65; padding: 0 .5rem; }
.topbar.slim { justify-content: flex-start; gap: .5rem; }
.topbar.slim .usermenu { margin-left: auto; }   /* search + scan on the left, user on the right */
.topbar.slim .topsearch input { width: 320px; }
.shell-main .container { max-width: 1400px; margin: 0; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
             gap: .6rem; padding: .6rem 1rem; }
  .sidenav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { display: none; }
  .topbar.slim { justify-content: flex-start; }
  .topbar.slim .topsearch input { width: 100%; }
}

/* My account: appearance */
form.appearance fieldset { border: 0; padding: 0; margin: 0 0 .75rem; }
form.appearance legend { font-weight: 600; margin-bottom: .2rem; }
label.choice { display: flex; align-items: center; gap: .5rem; margin: .3rem 0; font-weight: 400; }
label.choice input { width: auto; }

/* --- Orders ------------------------------------------------------------------ */
.badge.order-draft { background: var(--b-gray-bg); color: var(--b-gray); }
.badge.order-approved { background: var(--b-blue-bg); color: var(--b-blue); }
.badge.order-ordered { background: var(--b-amber-bg); color: var(--b-amber); }
.badge.order-delivered { background: var(--b-green-bg); color: var(--b-green); }
.badge.order-cancelled { background: var(--danger-bg); color: var(--danger); }
ul.errors { margin: .3rem 0 0; padding-left: 1.2rem; }

.order-line { padding-top: .8rem; }
.order-line.has-error { border-color: var(--danger); box-shadow: inset 4px 0 0 var(--danger); }
.line-head { display: flex; justify-content: space-between; align-items: center; }
.line-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0 1rem; }
.line-grid .field { grid-column: span 1; min-width: 0; }
.line-grid .wide2 { grid-column: span 2; }
.line-grid label { margin-top: .6rem; }
@media (max-width: 1100px) { .line-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .line-grid { grid-template-columns: 1fr; }
  .line-grid .wide2 { grid-column: span 1; }
}
.line-summary { margin: .75rem 0 0; font-size: .92rem; }
.readout { display: flex; gap: .4rem; }
.readout input { flex: 1; min-width: 0; }
input[readonly] { background: var(--surface-2); color: var(--text); }
button.copy { padding: .2rem .6rem; font-size: .8rem; }
input.no-address, .no-address { background: #fff4c2; color: #6b4e00; }
.no-address { padding: .05rem .35rem; border-radius: 4px; }
:root[data-theme="dark"] input.no-address, :root[data-theme="dark"] .no-address { background: #4a3a06; color: #ffe08a; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] input.no-address, :root[data-theme="system"] .no-address { background: #4a3a06; color: #ffe08a; }
}
input.invalid, input[aria-invalid="true"] { border-color: var(--danger); outline-color: var(--danger); background: var(--danger-bg); }

/* searchable department picker */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: .25rem 0;
              list-style: none; max-height: 18rem; overflow-y: auto; background: var(--surface);
              border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); }
.combo-list [role=option] { padding: .45rem .7rem; cursor: pointer; }
.combo-list [role=option]:hover, .combo-list [role=option].active { background: var(--b-green-bg); color: var(--b-green); }
.combo-list [aria-selected="true"] { font-weight: 600; }
.combo-sep { border-top: 1px solid var(--border); margin: .3rem 0; }
.combo-empty { padding: .45rem .7rem; color: var(--muted); }

/* visible keyboard focus everywhere */
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden;
                   clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }
.status-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.status-actions p { flex-basis: 100%; margin: 0; }
.status-actions button.primary { margin-top: 0; }
ul.approvers { margin: 0 0 .5rem; padding-left: 1.1rem; }
tr.group-sep td { background: var(--surface-2); color: var(--muted); font-size: .8rem; font-weight: 600;
                  text-transform: uppercase; letter-spacing: .04em; }
.narrow-field { max-width: 260px; }
.combo-list [role=option] small { display: block; color: var(--muted); font-size: .8rem; }
.combo-list [role=option].active small, .combo-list [role=option]:hover small { color: inherit; opacity: .8; }
.badge.order-open { background: var(--b-blue-bg); color: var(--b-blue); }
.badge.order-sent { background: var(--b-amber-bg); color: var(--b-amber); }
.badge.order-completed { background: var(--b-green-bg); color: var(--b-green); }
.badge.line-waiting { background: var(--b-amber-bg); color: var(--b-amber); }
.badge.line-received { background: var(--b-green-bg); color: var(--b-green); }
.badge.line-cancelled { background: var(--b-gray-bg); color: var(--b-gray); }
[data-line].has-error { box-shadow: inset 4px 0 0 var(--danger); padding-left: .9rem; }
fieldset.recipient-choice { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.recipient-choice legend { font-weight: 500; margin: .6rem 0 .25rem; padding: 0; }
label.inline-choice { display: inline-flex; margin: .45rem 1.1rem .45rem 0; }
.receive-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; border-bottom: 1px solid var(--border); }
.receive-bar label { margin: 0; }
.receive-bar input[type=date] { width: auto; }
.receive-bar button.primary { margin-top: 0; }
h2.pad { padding-bottom: .5rem; }
.pagehead.pad { margin-bottom: 0; padding-bottom: .5rem; }
.order-summary { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: baseline; }
.order-summary .num { font-size: 1.4rem; font-weight: 700; text-align: left; }
.buttons { align-items: center; flex-wrap: wrap; }
.buttons button.primary { margin-top: 0; }

/* small pill buttons for row actions (Edit / Remove / Receive / Cancel) */
.row-actions { display: flex; gap: .35rem; justify-content: flex-end; align-items: center; flex-wrap: nowrap; }
.pill-btn { display: inline-block; font: inherit; font-size: .75rem; font-weight: 600; line-height: 1.5;
            padding: .1rem .65rem; border: 0; border-radius: 999px; cursor: pointer; white-space: nowrap;
            text-decoration: none; background: var(--b-green-bg); color: var(--b-green); }
.pill-btn.danger { background: var(--danger-bg); color: var(--danger); }
.pill-btn:hover { filter: brightness(.94); text-decoration: none; }
button.pill-btn:not(.primary):not(.linkbutton):hover { background: var(--b-green-bg); }
button.pill-btn.danger:hover { background: var(--danger-bg); }

/* --- Mobile ----------------------------------------------------------------- */

/* scan link and menu button (the menu button only shows on small screens) */
.scanlink { display: inline-flex; align-items: center; gap: .35rem; color: var(--text); text-decoration: none;
            padding: .3rem .45rem; border-radius: 6px; }
.scanlink:hover { background: var(--surface-2); }
.scanlink-text { display: none; }
.navtoggle { display: none; padding: .35rem .5rem; line-height: 0; background: none; border-color: transparent; color: inherit; }
.navtoggle:hover { background: var(--surface-2); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sidebar .navtoggle:hover { background: var(--side-hover); }

/* scan page */
.scan-page { max-width: 560px; margin: 0 auto; }
.scan-reader { width: 100%; min-height: 220px; background: #000; border-radius: var(--radius); overflow: hidden; }
.scan-reader video { display: block; width: 100% !important; height: auto !important; }
.scan-help { min-height: 1.5em; }
.scan-help.scan-error { color: var(--danger); }
.scan-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: .75rem 0; }
.scan-actions button.primary { margin-top: 0; }
.scan-manual { margin-top: 1.5rem; }
.scan-manual .readout input { font-size: 16px; }

/* columns and form grids never get wider than the screen */
.columns { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }
.form-grid { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
/* Tabs scroll sideways on narrow screens. The grey line is drawn inside the bar (inset
   shadow) and the active tab's underline covers it, so nothing sticks out below the bar -
   a -1px margin there made the bar scroll vertically too. */
.subnav { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
          border-bottom: 0; box-shadow: inset 0 -1px 0 var(--border); }
.subnav a { white-space: nowrap; margin-bottom: 0; }
img, video, svg { max-width: 100%; }

@media (max-width: 900px) {
  /* top menu layout: logo + scan + menu button, search below, the menu folds out */
  .topbar { gap: .5rem .75rem; padding: .5rem 1rem; }
  .topbar .brand { order: 1; margin-right: auto; }
  .topbar .scanlink { order: 2; }
  .topbar .navtoggle { order: 3; }
  .topbar .topsearch { order: 4; }
  .topbar .mainnav { order: 5; }
  .topbar .usermenu { order: 6; }
  .navtoggle { display: inline-block; }
  .scanlink-text { display: inline; }
  .topbar .mainnav { display: none; flex-basis: 100%; flex-direction: column; gap: 0; }
  .topbar .mainnav a { padding: .7rem .25rem; border-bottom: 1px solid var(--border); }
  .topbar .mainnav a.active, .topbar .mainnav a:hover { border-bottom: 1px solid var(--border); color: var(--accent); font-weight: 600; }
  .topbar:not(.slim) .usermenu { display: none; flex-basis: 100%; padding: .6rem .25rem .2rem; flex-wrap: wrap; }
  .topbar.nav-open .mainnav, .topbar.nav-open .usermenu { display: flex; }

  /* side menu layout: the sidebar becomes a bar with a menu button */
  .sidebar { flex-direction: column; align-items: stretch; gap: 0; }
  .sidebar-head { width: 100%; }
  .sidebar .sidenav { display: none; flex-direction: column; padding-top: .5rem; }
  .sidebar.nav-open .sidenav { display: flex; }
  .topbar.slim { gap: .5rem; padding: .5rem 1rem; }
  .topbar.slim .topsearch { order: 1; flex: 1 1 200px; flex-basis: auto; }
  .topbar.slim .scanlink { order: 2; }
  .topbar.slim .usermenu { order: 3; flex-wrap: wrap; }

  .container, .shell-main .container { padding: 1rem; }
  .card { padding: 1rem; }
  .pad { padding: .9rem 1rem; }
  h1 { font-size: 1.35rem; }
  .pagehead { align-items: flex-start; }
  /* 16px text stops iPhones zooming in when a field is tapped */
  input, select, textarea { font-size: 16px; }
  .topsearch input { padding: .5rem .6rem; }
  .filters > * { flex: 1 1 auto; }
  .filters input[type=search] { flex-basis: 100%; }
  form.rename { flex-wrap: wrap; }
  form.rename input { max-width: none; }
  .narrow-field { max-width: none; }
}

@media (max-width: 640px) {
  .container, .shell-main .container { padding: .75rem; }
  .buttons { width: 100%; }
  .buttons > a.button, .buttons > button, .buttons > form { flex: 1 1 auto; text-align: center; }
  .buttons > form button { width: 100%; }
  dl.details { grid-template-columns: 1fr; gap: 0; }
  dl.details dt { font-size: .8rem; margin-top: .55rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat .num { font-size: 1.35rem; }

  /* list tables become one card per row; app.js copies each column name to data-label */
  .card.flush { overflow-x: visible; }
  table.list.stacked thead { display: none; }
  table.list.stacked, table.list.stacked tbody, table.list.stacked tr, table.list.stacked td { display: block; width: 100%; }
  table.list.stacked tr { padding: .6rem 1rem; border-bottom: 1px solid var(--border); }
  table.list.stacked tbody tr:hover { background: none; }
  table.list.stacked td { border: 0; padding: .15rem 0; display: flex; gap: .75rem; justify-content: space-between;
                          align-items: baseline; text-align: right; min-height: 0; }
  table.list.stacked td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; text-align: left;
                                  flex: 0 0 auto; max-width: 45%; }
  table.list.stacked td:not([data-label])::before, table.list.stacked td[data-label=""]::before { content: none; }
  table.list.stacked td.is-empty { display: none; }
  /* the first real column (tag / name) is the card's title */
  table.list.stacked td.cell-title { font-size: 1.02rem; text-align: left; justify-content: flex-start; }
  table.list.stacked td.cell-title::before { content: none; }
  /* a row checkbox sits to the left of the card */
  table.list.stacked tr.has-check { position: relative; padding-left: 2.8rem; }
  table.list.stacked td.row-check { position: absolute; left: 1rem; top: .7rem; width: auto; padding: 0; }
  table.list.stacked td.row-check::before { content: none; }
  table.list.stacked td.row-check input { width: 1.25rem; height: 1.25rem; }
  table.list.stacked .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  table.list.stacked tr.group-sep td { justify-content: flex-start; }
  table.list.stacked tr.group-sep td::before { content: none; }
}

/* --- Kits and subscriptions ---------------------------------------------- */
.kit-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 1rem; }
a.kit-choice { display: flex; flex-direction: column; gap: .35rem; text-decoration: none; color: inherit; margin: 0; }
a.kit-choice:hover { border-color: var(--accent); }
a.kit-choice strong { font-size: 1.05rem; }
.kit-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 0 1.25rem; margin-bottom: .5rem; }
table.kit-items select, table.kit-items input { min-width: 8rem; }
table.kit-items input[type=number] { width: 5.5rem; min-width: 0; }
ul.kit-lines { margin: 0 0 .75rem; padding-left: 1.2rem; }
.badge.sub-active { background: var(--b-green-bg); color: var(--b-green); }
.badge.sub-cancelled { background: var(--b-gray-bg); color: var(--b-gray); }
table.kit-items td:last-child { width: 1%; white-space: nowrap; }
.badge.lic-active { background: var(--b-green-bg); color: var(--b-green); }
.badge.lic-expired { background: var(--danger-bg); color: var(--danger); }
.badge.lic-cancelled { background: var(--b-gray-bg); color: var(--b-gray); }
code.licence-key { white-space: pre-wrap; word-break: break-all; }
.seat-form { border-top: 1px solid var(--border); margin-top: 1rem; }

/* Classes due for account creation: very visible on the IT dashboard */
.class-alert { border: 2px solid var(--b-amber); background: var(--b-amber-bg); }
.class-alert h2 { color: var(--b-amber); margin: 0; }
.class-alert .list { background: var(--surface); }
.class-coming { margin: -.25rem 0 1rem; }
.badge.class-new { background: var(--b-amber-bg); color: var(--b-amber); }
.badge.class-created { background: var(--b-green-bg); color: var(--b-green); }
.badge.class-deleted { background: var(--b-gray-bg); color: var(--b-gray); }
tr.highlight td { background: var(--b-amber-bg); }
.class-members input { width: 100%; }
.class-members td:nth-child(3) { min-width: 16rem; }
details.paste { margin: .75rem 0 1rem; }
details.paste textarea { width: 100%; }
.team-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.team-row input[name=name] { flex: 1 1 12rem; }
.team-row input[name=teams_id] { flex: 2 1 18rem; }
.button.warn { border-color: var(--b-amber); color: var(--b-amber); }

/* --- Grouped main menu (itinv/menu.py, templates/_menu.html) ------------------
   ITINV_MENU=classic switches back to the old flat menu; these rules then do nothing. */
[data-menu="grouped"] .topbar:not(.slim) { flex-wrap: nowrap; gap: 1rem; }
.mainnav.grouped { display: flex; align-items: center; gap: .15rem; flex: 1; min-width: 0; }
.menu-group { position: relative; }
.mainnav.grouped .menu-top {
  display: inline-flex; align-items: center; gap: .3rem; position: relative;
  padding: .45rem .7rem; border: 0; border-radius: 6px; background: none;
  color: var(--muted); font: inherit; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.mainnav.grouped .menu-top:hover, .menu-group.open > .menu-top { background: var(--surface-2); color: var(--text); border-bottom: 0; }
.mainnav.grouped .menu-top.active { color: var(--text); font-weight: 600; border-bottom: 0; }
.mainnav.grouped .menu-top.active::after {
  content: ""; position: absolute; left: .7rem; right: .7rem; bottom: -.62rem;
  height: 3px; border-radius: 3px 3px 0 0; background: var(--accent);
}
.chev { flex: none; opacity: .7; }
.menu-group.open > [data-dropdown-button] .chev { transform: rotate(180deg); }
.menu-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-amber); align-self: flex-start; margin-top: .15rem; }

.menu-panel {
  display: none; position: absolute; top: calc(100% + .45rem); left: 0; z-index: 30;
  min-width: 270px; padding: .35rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
}
.menu-panel.align-right { left: auto; right: 0; min-width: 240px; }
.menu-group.open > .menu-panel { display: block; }
html:not(.js) .menu-group:focus-within > .menu-panel { display: block; }   /* works without JavaScript */
.menu-section { display: none; }
.menu-heading { margin: .3rem -.35rem 0; padding: .6rem 1.05rem .2rem; border-top: 1px solid var(--border);
                font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.menu-item {
  display: block; width: 100%; padding: .5rem .7rem; border: 0; border-radius: 6px; background: none;
  color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.mainnav.grouped .menu-item, .mainnav.grouped .menu-item.active { color: var(--text); border-bottom: 0; }
.mainnav.grouped .menu-item:hover, .menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); border-bottom: 0; }
.menu-item.active { background: var(--b-green-bg); }
.menu-item.active .menu-label { color: var(--b-green); font-weight: 600; }
.menu-label { display: flex; align-items: center; gap: .4rem; }
.menu-hint { display: block; margin-top: .1rem; font-size: .8rem; color: var(--muted); }
.menu-count { display: inline-block; margin-left: .35rem; padding: 0 .45rem; border-radius: 999px; line-height: 1.5;
              font-size: .72rem; font-weight: 700; background: var(--b-amber-bg); color: var(--b-amber); }
.menu-panel form { margin: 0; }
.menu-item.logout { color: var(--danger); }

/* search with the scan button inside the box */
.topsearch.with-scan { position: relative; display: flex; align-items: center; margin-left: auto; }
.topsearch.with-scan input { width: clamp(170px, 18vw, 280px); padding-left: 2rem; padding-right: 2.5rem; }
.topsearch.with-scan .search-icon { position: absolute; left: .6rem; color: var(--muted); pointer-events: none; }
.topsearch.with-scan .scanlink { position: absolute; right: .2rem; padding: .2rem .3rem; color: var(--muted); }
.topsearch.with-scan .scanlink:hover { color: var(--text); }

/* user menu */
.userbutton { display: inline-flex; align-items: center; gap: .45rem; padding: .2rem .45rem .2rem .2rem;
              border: 0; border-radius: 999px; background: none; color: var(--text); font: inherit; cursor: pointer; }
.userbutton:hover, .userdrop.open .userbutton { background: var(--surface-2); }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none;
          background: var(--accent); color: #fff; font-size: .75rem; font-weight: 700; letter-spacing: .03em; }
.userbutton .username { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-user-head { display: flex; flex-direction: column; gap: .1rem; margin-bottom: .3rem; padding: .5rem .7rem .65rem;
                  border-bottom: 1px solid var(--border); }
.menu-user-head .badge { align-self: flex-start; margin-top: .35rem; }
@media (max-width: 1250px) { .userbutton .username, .userbutton .chev { display: none; } .userbutton { padding: .2rem; } }

/* side menu layout: groups become headings, everything listed */
.topbar.slim .topsearch.with-scan { margin-left: 0; }
.topbar.slim .topsearch.with-scan input { width: 320px; }
.topbar.slim .userdrop { margin-left: auto; }
.sidenav.grouped a { display: flex; align-items: center; justify-content: space-between; padding: .4rem .75rem; }
.sidenav.grouped summary { display: flex; align-items: center; gap: .4rem; list-style: none; cursor: pointer;
                           border-radius: 6px; user-select: none; }
.sidenav.grouped summary::-webkit-details-marker { display: none; }
.sidenav.grouped summary:hover { background: var(--side-hover); color: #fff; }
.sidenav.grouped summary .chev { margin-left: auto; transform: rotate(-90deg); }
.sidenav.grouped details[open] > summary .chev { transform: none; }
.sidenav.grouped details[open] > summary .menu-dot { display: none; }   /* the counts show inside */
.sidenav.grouped .side-heading { margin-top: .35rem; padding: .55rem .75rem; font-size: .72rem; font-weight: 600;
                                 text-transform: uppercase; letter-spacing: .08em; color: var(--side-text); }
.sidenav.grouped .side-group:not([open]) > .side-heading { opacity: .75; }
.sidenav.grouped .side-group > a { padding-left: 1.1rem; }
.sidenav.grouped .side-sub > summary { padding: .4rem .75rem .4rem 1.1rem; }
.sidenav.grouped .side-sub > a { padding-left: 1.8rem; font-size: .95em; }
.sidenav.grouped > a + details { margin-top: .35rem; }
.sidenav.grouped details + a { margin-top: .35rem; }

@media (max-width: 900px) {
  /* logo, user, menu button; search below; the menu folds out with every group expanded */
  [data-menu="grouped"] .topbar:not(.slim) { flex-wrap: wrap; gap: .5rem .75rem; }
  [data-menu="grouped"] .topbar .userdrop { order: 2; }
  [data-menu="grouped"] .topbar .navtoggle { order: 3; }
  [data-menu="grouped"] .topbar .topsearch.with-scan { order: 4; flex-basis: 100%; margin-left: 0; }
  .topsearch.with-scan input, .topbar.slim .topsearch.with-scan input { width: 100%; }
  [data-menu="grouped"] .topbar.slim .topsearch.with-scan { flex: 1 1 200px; }
  .topbar .mainnav.grouped { display: none; flex-direction: column; align-items: stretch; gap: 0; }
  .topbar.nav-open .mainnav.grouped { display: flex; }
  .mainnav.grouped .menu-group > .menu-top { display: none; }
  .mainnav.grouped .menu-panel { display: block; position: static; min-width: 0; padding: 0;
                                 border: 0; box-shadow: none; background: none; }
  .mainnav.grouped .menu-section { display: block; padding: .9rem .25rem .2rem; font-size: .72rem; font-weight: 600;
                                   text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
  .mainnav.grouped .menu-heading { margin: 0; padding: .6rem .25rem .2rem; border-top: 0; }
  .mainnav.grouped .menu-hint { display: none; }
  .mainnav.grouped .menu-item, .mainnav.grouped > a.menu-top { border-radius: 0; padding: .65rem .25rem; }
  .mainnav.grouped > a.menu-top { color: var(--text); }
  .mainnav.grouped .menu-top.active::after { display: none; }
  .mainnav.grouped .menu-item.active { background: none; }
}

/* New-starter form and checklist */
.starter-form fieldset { border: 0; border-top: 1px solid var(--border, #e4e7ec); margin: 0 0 .5rem; padding: .75rem 0 0; min-width: 0; }
.starter-form fieldset:first-of-type { border-top: 0; padding-top: 0; }
.starter-form legend { font-weight: 600; font-size: 1.05rem; padding: 0; }
.starter-form .field > .label { display: block; margin: .75rem 0 .25rem; font-weight: 500; }
.checks-row { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.check-btn { background: none; border: 0; padding: 0; font-size: 1.15rem; line-height: 1; cursor: pointer; color: inherit; }
.check-btn:hover { color: var(--accent, inherit); }
table.checklist tr.done td:not(.check-cell) { color: var(--muted); }
.due-form { display: inline-flex; gap: .35rem; align-items: center; }
.due-form input[type="date"] { width: auto; padding: .15rem .35rem; }

/* One-row edit forms (Settings -> MitID companies) */
.row-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row-form input:not([type=checkbox]) { width: auto; flex: 1 1 160px; }

/* Proxy changes: field by field */
ul.diff { margin: .3rem 0 0; padding-left: 1.1rem; }
ul.diff s { color: var(--muted, #667085); }

/* Proxy host options as coloured pills */
.tags { display: flex; flex-wrap: wrap; gap: .25rem; }
.badge.tag-exploits { background: var(--b-blue-bg); color: var(--b-blue); }
.badge.tag-ws { background: var(--b-green-bg); color: var(--b-green); }
.badge.tag-cache { background: var(--b-gray-bg); color: var(--b-gray); }
.badge.tag-custom { background: var(--b-pink-bg); color: var(--b-pink); }
a.badge.tag-custom { text-decoration: none; cursor: pointer; }
a.badge.tag-custom:hover { filter: brightness(.95); text-decoration: underline; }

/* Popup (dialog) */
dialog.popup { width: min(900px, calc(100vw - 32px)); max-height: 85vh; padding: 1.25rem 1.5rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  color: inherit; overflow: auto; }
dialog.popup::backdrop { background: rgba(0, 0, 0, .45); }
.popup-close { position: sticky; top: 0; float: right; margin: -.5rem -.75rem 0 0; }
.popup-close button { background: none; border: 0; font-size: 1.2rem; cursor: pointer; color: inherit; }
pre.config-text { background: var(--input-bg); border: 1px solid var(--border); border-radius: 6px;
  padding: .75rem 1rem; overflow-x: auto; white-space: pre; font-size: .85rem; line-height: 1.45; }
/* Proxy servers: internal blue, internet-facing amber */
.badge.proxy-int { background: var(--b-blue-bg); color: var(--b-blue); }
.badge.proxy-ext { background: var(--b-amber-bg); color: var(--b-amber); }

/* Settings -> Suggested features */
.feature-group { margin: 1.25rem 0 .5rem; font-size: .8rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted, #667085); }
.card.feature { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: .6rem; padding: 1rem 1.25rem; }
.card.feature h4 { margin: 0 0 .3rem; }
.card.feature p { margin: .25rem 0; }
.card.feature.status-done, .card.feature.status-rejected { opacity: .7; }
.feature-body { flex: 1; min-width: 0; }
.vote-btn { display: flex; flex-direction: column; align-items: center; min-width: 3rem; padding: .35rem .5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--muted, #667085);
  cursor: pointer; line-height: 1.1; font-size: .8rem; }
.vote-btn span { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.vote-btn.voted { border-color: var(--accent); color: var(--accent); background: var(--b-green-bg); }
.vote-btn[disabled] { cursor: default; }
.badge.feature-suggested { background: var(--b-gray-bg); color: var(--b-gray); }
.badge.feature-planned { background: var(--b-blue-bg); color: var(--b-blue); }
.badge.feature-in_progress { background: var(--b-amber-bg); color: var(--b-amber); }
.badge.feature-done { background: var(--b-green-bg); color: var(--b-green); }
.badge.feature-rejected { background: var(--danger-bg); color: var(--danger); }

/* Waiting: spinner, background-job page and the overlay for slow actions */
@keyframes dim-spin { to { transform: rotate(360deg); } }
.spinner { width: 2rem; height: 2rem; flex: none; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent); animation: dim-spin .9s linear infinite; }
.job-wait { display: flex; gap: 1rem; align-items: center; }
.job-wait p { margin: .2rem 0; }
#wait-overlay { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center;
  justify-content: center; background: rgba(0, 0, 0, .35); }
#wait-overlay.show { display: flex; }
#wait-overlay .wait-box { display: flex; gap: 1rem; align-items: center; max-width: min(460px, calc(100vw - 32px));
  padding: 1.25rem 1.5rem; background: var(--surface); color: var(--text); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
#wait-overlay p { margin: 0; }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* Email settings and shared bits */
.text-danger { color: var(--danger); }
.subnav.subnav-small { font-size: .9rem; }
.card-head { padding: .9rem 1rem .4rem; margin: 0; }
.code-input { font-size: 1.4rem; letter-spacing: .35em; text-align: center; font-family: ui-monospace, Consolas, monospace; }
.trust-check { margin-top: .75rem; }
.login-resend { margin-top: .75rem; text-align: center; font-size: .9rem; }

/* Settings: grouped pills on as many rows as needed */
.settings-nav { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; margin: 0 0 1.25rem; padding-bottom: .9rem;
                border-bottom: 1px solid var(--border); }
.settings-group { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.settings-group-label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
                        color: var(--muted); margin-right: .2rem; }
.settings-pill { padding: .2rem .7rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
                 color: var(--text); text-decoration: none; font-size: .88rem; white-space: nowrap; }
.settings-pill:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.settings-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* Settings -> Email -> Mails: on/off switches in the list */
button.mail-toggle { display: inline-flex; align-items: center; gap: .45rem; margin: 0; padding: .15rem .65rem .15rem .2rem;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  font-size: .8rem; font-weight: 600; cursor: pointer; min-width: 4.4rem; }
button.mail-toggle .knob { width: 1rem; height: 1rem; border-radius: 50%; background: var(--muted); }
button.mail-toggle.on { background: var(--b-green-bg); color: var(--b-green); border-color: var(--success-border); }
button.mail-toggle.on .knob { background: var(--accent); }
tr.mail-off td:not(:last-child) { opacity: .55; }

/* Email settings: is it sending, and what's missing */
.mail-status { padding: .6rem .8rem; border-radius: 8px; margin-bottom: 1rem; font-size: .95rem; }
.mail-status.ok { background: var(--b-green-bg); color: var(--b-green); }
.mail-status.warn { background: var(--b-amber-bg); color: var(--b-amber); }
.mail-status.off { background: var(--surface-2, rgba(127, 127, 127, .1)); color: var(--muted); }
.field.has-missing input { border-color: var(--b-amber); box-shadow: 0 0 0 1px var(--b-amber); }
.key-status { margin: 0 0 .35rem; font-size: .9rem; color: var(--b-green); }
/* a secret typed into a text field (so browsers don't fill in saved passwords) */
.secret-input:not(:placeholder-shown) { -webkit-text-security: disc; }
.field input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.wrap-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Servers (BookStack): how many pages follow the template */
.wiki-progress { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; margin: 0 0 .5rem; }
.wiki-bar { display: flex; gap: 3px; margin: 0 0 .35rem; }
.wiki-seg { flex: 1 1 0; min-width: 6px; height: .8rem; border-radius: 3px; background: var(--b-green); }
.wiki-seg.warning { background: #f5b800; }   /* yellow: clearly not the red of errors */
.wiki-seg.error { background: var(--danger); }
a.wiki-seg:hover, a.wiki-seg:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.wiki-legend { margin: 0 0 1rem; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.wiki-legend .wiki-seg { display: inline-block; flex: none; width: .9rem; height: .7rem; margin-left: .5rem; }
.wiki-legend .wiki-seg:first-child { margin-left: 0; }
ul.plain { list-style: none; padding: 0; margin: .5rem 0 0; }
ul.plain li { padding: .15rem 0; }
/* A server's page: the wiki sections, values wrap inside their card */
.wiki-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: 0 1.25rem; }
.wiki-section { min-width: 0; }
.wiki-section.wide { grid-column: 1 / -1; }
.wiki-section h3 { margin: 1rem 0 .4rem; font-size: 1rem; }
dl.wiki-fields { display: grid; grid-template-columns: minmax(8rem, 15rem) minmax(0, 1fr); gap: .4rem 1.25rem; margin: 0; }
dl.wiki-fields dt { color: var(--muted); overflow-wrap: anywhere; }
dl.wiki-fields dd { margin: 0; overflow-wrap: anywhere; }
table.wiki-table td { overflow-wrap: anywhere; vertical-align: top; }
ul.wiki-items { margin: .25rem 0 0; padding-left: 1.2rem; }
ul.wiki-items li { padding: .15rem 0; }
.wiki-notes { margin-top: .75rem; }
.wiki-notes summary { cursor: pointer; color: var(--muted); }
.wiki-notes ul { margin-top: .5rem; }
@media (max-width: 640px) { dl.wiki-fields { grid-template-columns: 1fr; gap: 0; } dl.wiki-fields dt { font-size: .8rem; margin-top: .55rem; } }
.table-scroll { overflow-x: auto; }
.wiki-pills { display: inline-flex; flex-wrap: wrap; gap: .3rem; vertical-align: middle; font-size: .9rem; font-weight: 400; }
.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; }

/* Owner picker on the create-team page: a grid of tiles, ticked ones in green */
fieldset.owner-picker { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.owner-picker legend { font-weight: 600; padding: 0; margin: 0 0 .4rem; }
.owner-tools { display: flex; align-items: center; gap: .75rem; margin: -.2rem 0 .5rem; font-size: .9rem; }
.owner-tools .linkish { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; text-decoration: underline; font: inherit; }
.owner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.owner-tile { display: flex; align-items: center; gap: .6rem; margin: 0; padding: .55rem .75rem; font-weight: 400;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer;
  transition: border-color .12s, background-color .12s; }
.owner-tile:hover { border-color: var(--accent); }
.owner-tile input { width: auto; margin: 0; flex: none; accent-color: var(--accent); }
.owner-tile:has(input:checked) { border-color: var(--accent); background: var(--success-bg); }
.owner-tile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.owner-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.owner-name { font-weight: 500; }
.owner-email { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Annual wheel */
.badge.wheel-done { background: var(--b-green-bg); color: var(--b-green); }
.badge.wheel-skipped { background: var(--b-gray-bg); color: var(--b-gray); }
.badge.wheel-overdue { background: var(--danger-bg); color: var(--danger); }
.badge.wheel-soon { background: var(--b-amber-bg); color: var(--b-amber); }
.badge.wheel-upcoming { background: var(--b-blue-bg); color: var(--b-blue); }
.wheel-dot { flex: none; width: .7rem; height: .7rem; border-radius: 50%; background: var(--b-blue); }
.wheel-dot.wheel-done { background: var(--b-green); }
.wheel-dot.wheel-skipped { background: var(--b-gray); }
.wheel-dot.wheel-overdue { background: var(--danger); }
.wheel-dot.wheel-soon { background: var(--b-amber); }
.wheel-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; margin-bottom: 1rem; }
.wheel-counts { display: flex; flex-wrap: wrap; gap: .35rem; }
.wheel-filter { display: flex; gap: .25rem; font-size: .9rem; }
.wheel-filter a { padding: .2rem .7rem; border-radius: 999px; text-decoration: none; color: var(--muted); border: 1px solid var(--border); }
.wheel-filter a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.wheel-months { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr)); gap: 1rem; align-items: start; }
.card.wheel-month { margin: 0; padding: .9rem 1rem; }
.card.wheel-month h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.card.wheel-month.current { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.card.wheel-month.empty h2 { color: var(--muted); }
.card.wheel-month p { margin: 0; }
.wheel-entry { display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem; margin: 0 -.5rem;
  border-radius: 6px; text-decoration: none; color: inherit; }
.wheel-entry:hover { background: var(--surface-2); text-decoration: none; }
.wheel-entry-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.wheel-entry .badge { flex: none; }
.wheel-note { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.wheel-note p { margin: 0; }
.wheel-tick { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.wheel-tick input[type="text"] { flex: 1 1 12rem; min-width: 0; padding: .25rem .5rem; font-size: .9rem; }
.wheel-close { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: flex-start; }
.wheel-skip { display: flex; gap: .5rem; align-items: center; flex: 1 1 20rem; }
.wheel-skip input { flex: 1; min-width: 0; }
.wheel-upload { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem 1rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.wheel-upload .field { margin: 0; flex: 1 1 16rem; }
.wheel-files .nowrap { white-space: nowrap; }
.wheel-checklist-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; }
.wheel-checklist-head h2 { margin: 0; }
.wheel-checklist-head.pad { padding-bottom: .5rem; }
.wheel-sheets { flex-wrap: wrap; }
.wheel-sheet-picker { border: 0; padding: 0; margin: 1rem 0; }
.wheel-sheet-picker legend { font-weight: 600; padding: 0; }
.wheel-sheet-picker .inline-check { display: flex; margin: .3rem 0; }
/* The year as a wheel: 12 month segments, a dot per task, a line for today */
.wheel-graphic { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem 2.5rem; margin-bottom: 1rem; }
.wheel-svg { width: min(100%, 28rem); height: auto; display: block; }
.wheel-svg .seg { fill: var(--surface); stroke: var(--border); stroke-width: 1; transition: fill .15s; }
.wheel-svg .seg.alt { fill: var(--surface-2); }
.wheel-svg .seg.current { fill: var(--b-green-bg); stroke: var(--accent); stroke-width: 2; }
.wheel-svg a:hover .seg, .wheel-svg a:focus-visible .seg { fill: var(--row-hover); }
.wheel-svg .month { fill: var(--muted); font-size: 13px; font-weight: 600; pointer-events: none; }
.wheel-svg .month.current { fill: var(--accent); }
.wheel-svg .pt { fill: var(--b-blue); stroke: var(--surface); stroke-width: 2; transition: r .15s; }
.wheel-svg .pt.wheel-done { fill: var(--b-green); }
.wheel-svg .pt.wheel-skipped { fill: var(--b-gray); }
.wheel-svg .pt.wheel-overdue { fill: var(--danger); }
.wheel-svg .pt.wheel-soon { fill: var(--b-amber); }
.wheel-svg a:hover .pt, .wheel-svg a:focus-visible .pt { stroke: var(--text); }
.wheel-svg a:focus { outline: none; }
.wheel-svg .needle { stroke: var(--danger); stroke-width: 2.5; stroke-linecap: round; }
.wheel-svg .hub-year { fill: var(--text); font-size: 30px; font-weight: 700; }
.wheel-svg .hub-sub { fill: var(--muted); font-size: 13px; }
.wheel-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; max-width: 16rem; }
.wheel-legend li { display: flex; align-items: center; gap: .5rem; }
.wheel-needle-key { display: inline-block; width: .7rem; height: 3px; border-radius: 2px; background: var(--danger); }
.wheel-alert { border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.wheel-alert h2 { font-size: 1rem; margin: 0 0 .35rem; }
.wheel-alert ul { margin: 0; padding-left: 1.2rem; }
.wheel-alert li { margin: .15rem 0; }
.wheel-alert-warn { background: var(--b-amber-bg); border-color: var(--b-amber); }
.wheel-alert-warn h2 { color: var(--b-amber); }
.wheel-alert-info { background: var(--info-bg); border-color: var(--info-border); }

/* Servers → Export: tick the columns */
.export-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1.5rem; }
.export-row .field { margin: 0; }
.export-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; }
.export-head h2 { margin: 0; }
.export-head .buttons { align-items: center; }
.export-group { border: 0; border-top: 1px solid var(--border); padding: .75rem 0 .25rem; margin: .75rem 0 0; }
.export-group legend { font-weight: 600; padding: 0 .5rem 0 0; }
.export-group legend .link-btn { font-weight: 400; font-size: .85rem; }
.export-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr)); gap: .3rem 1rem; }
.export-grid .inline-check { align-items: baseline; }
.link-btn, button.link-btn { background: none; border: 0; padding: 0; margin: 0; color: var(--link); cursor: pointer; text-decoration: underline; font: inherit; min-height: 0; }
.wiki-link { font-weight: 400; margin-left: .35rem; white-space: nowrap; }

/* Location tasks */
.badge.task-open { background: var(--b-blue-bg); color: var(--b-blue); }
.badge.task-progress { background: var(--b-amber-bg); color: var(--b-amber); }
.badge.task-waiting { background: var(--b-pink-bg); color: var(--b-pink); }
.badge.task-done { background: var(--b-green-bg); color: var(--b-green); }
.badge.task-cancelled { background: var(--b-gray-bg); color: var(--b-gray); }
.badge.task-high { background: var(--danger-bg); color: var(--danger); }
.badge.task-visit { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.task-update { display: grid; grid-template-columns: minmax(10rem, 14rem) 1fr; gap: 0 1.25rem; align-items: start; }
.task-update .actions { grid-column: 1 / -1; }
@media (max-width: 640px) { .task-update { grid-template-columns: 1fr; } }

/* The map of Denmark (dkmap.py): land, the Bornholm box, towns and a dot per location */
.map-card { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: flex-start; }
.dk-map { width: min(100%, 44rem); height: auto; display: block; flex: 1 1 22rem; }
.dk-map .land { fill: var(--surface-2); stroke: var(--line-gray); stroke-width: 1; stroke-linejoin: round; }
.dk-map .inset { fill: none; stroke: var(--line-gray); stroke-width: 1; stroke-dasharray: 4 3; }
.dk-map .inset-label, .dk-map .town-label { fill: var(--muted); font-size: 11px; pointer-events: none; }
.dk-map .town { fill: var(--muted); }
/* the dot: the department's area (Bilsyn green, AMU grey, IDI brown, Hub a grey star,
   no department white);
   a ring round it: blue = open tasks, red = an overdue task */
.dk-map, .map-side { --area-bilsyn: #008143; --area-amu: #7d8794; --area-idi: #8b5a2b;
  --area-kta: #7b3fb5; --area-primary: #f2c200; --area-other: #ffffff;
  --ring-open: #2f6fde; --ring-overdue: #d0342c; }
.dk-map .pin.area-kta { fill: var(--area-kta); }
.dk-map .pin-primary, .map-key-star .pin-primary { fill: var(--area-primary); stroke: #8a6d00; stroke-width: 1; stroke-linejoin: round; }
.dk-map .slice, .map-key-star path { stroke: none; }
.dk-map .slice.area-bilsyn, .map-key-star .area-bilsyn { fill: var(--area-bilsyn); }
.dk-map .slice.area-amu, .map-key-star .area-amu { fill: var(--area-amu); }
.dk-map .slice.area-idi { fill: var(--area-idi); }
.dk-map .slice.area-kta { fill: var(--area-kta); }
.dk-map .slice.area-hub { fill: var(--area-amu); }
.dk-map .pin-edge { fill: none; stroke: var(--surface); stroke-width: 2; }
.dk-map a:hover .pin-edge, .dk-map a:focus-visible .pin-edge { stroke: var(--text); }
.map-key.area-kta { background: var(--area-kta); }
.dk-map .pin { stroke: var(--surface); stroke-width: 2; }
.dk-map .pin.area-bilsyn { fill: var(--area-bilsyn); }
.dk-map .pin.area-amu { fill: var(--area-amu); }
.dk-map .pin.area-idi { fill: var(--area-idi); }
.dk-map .pin.area-hub { fill: var(--area-amu); stroke-linejoin: round; }
.dk-map .pin.area-other { fill: var(--area-other); stroke: var(--area-amu); stroke-width: 1.5; }
.dk-map .ring { fill: none; stroke-width: 3.5; }
.dk-map .ring-open { stroke: var(--ring-open); }
.dk-map .ring-overdue { stroke: var(--ring-overdue); }
.dk-map a:hover .pin, .dk-map a:focus-visible .pin { stroke: var(--text); }
.dk-map a:focus { outline: none; }
.dk-map .pin-count { fill: #fff; font-size: 10px; font-weight: 700; pointer-events: none; }
.dk-map .pin-count.count-other, .dk-map .pin-count.count-primary { fill: #1d2330; }
.dk-map .pin-count.count-star { font-size: 9px; }
.map-legend-head { font-size: .9rem; margin: 0 0 .4rem; }
.map-side .wheel-legend { margin-bottom: 1rem; }
.map-key { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; flex: none; }
.map-key.area-bilsyn { background: var(--area-bilsyn); }
.map-key.area-amu { background: var(--area-amu); }
.map-key.area-idi { background: var(--area-idi); }
.map-key.area-other { background: var(--area-other); border: 1.5px solid var(--area-amu); }
.map-key-star { width: 1.1rem; height: 1.1rem; flex: none; margin: -.15rem -.15rem 0; }
.map-key-star .area-hub { fill: var(--area-amu); }
.map-key.ring-key { width: .9rem; height: .9rem; border: 3px solid; background: transparent; }
.map-key.ring-key.ring-open { border-color: var(--ring-open); }
.map-key.ring-key.ring-overdue { border-color: var(--ring-overdue); }
.map-side { flex: 0 1 16rem; }

/* Trips: the stops in order, each with its tasks to tick off (also on a phone) */
.trip-maps { flex-wrap: wrap; margin-top: .5rem; }
.trip-stops { list-style: none; margin: 0 0 1rem; padding: 0; }
.trip-start { padding: .4rem .25rem; }
.trip-stop { margin: 0 0 .75rem; }
.trip-stop-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }
.trip-stop-head h2 { margin: 0; font-size: 1.1rem; }
.trip-stop-move { display: inline-flex; gap: .25rem; }
.trip-leg { margin: 0 0 .35rem; }
.stop-no { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: .85rem; font-weight: 700; margin-right: .25rem; }
.trip-tasks { list-style: none; margin: .5rem 0 0; padding: 0; }
.trip-tasks li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; padding: .6rem 0; border-top: 1px solid var(--border); }
.trip-tasks li.done .trip-task-text { color: var(--muted); text-decoration: line-through; }
.trip-task-text { flex: 1 1 16rem; min-width: 0; }
.trip-tick { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; flex: 0 1 20rem; }
.trip-tick input[type="text"] { flex: 1 1 8rem; min-width: 0; padding: .3rem .5rem; }
.trip-tick .pill-btn { min-height: 2.25rem; padding-left: 1rem; padding-right: 1rem; }
.trip-actions { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; margin-bottom: .75rem; }
.trip-add { display: flex; gap: .5rem; align-items: center; flex: 1 1 18rem; }
.trip-add select { flex: 1; min-width: 0; }
.trip-edit summary { cursor: pointer; margin-bottom: .5rem; }

/* Takeovers */
.progress { height: .4rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; max-width: 8rem; margin-bottom: .15rem; }
.progress-bar { display: block; height: 100%; width: 0; background: var(--accent); }
.progress-bar[data-pct="10"] { width: 10%; } .progress-bar[data-pct="20"] { width: 20%; }
.progress-bar[data-pct="30"] { width: 30%; } .progress-bar[data-pct="40"] { width: 40%; }
.progress-bar[data-pct="50"] { width: 50%; } .progress-bar[data-pct="60"] { width: 60%; }
.progress-bar[data-pct="70"] { width: 70%; } .progress-bar[data-pct="80"] { width: 80%; }
.progress-bar[data-pct="90"] { width: 90%; } .progress-bar[data-pct="100"] { width: 100%; }
.takeover-group-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem; }
.takeover-group-head h2 { margin: 0; }
.step-update { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; min-width: 14rem; }
.step-update select { width: auto; padding: .2rem .4rem; }
.step-update input[type="text"] { flex: 1 1 7rem; min-width: 0; padding: .2rem .5rem; font-size: .9rem; }
.takeover-add { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr)); gap: 1rem 1.5rem; align-items: end; }
.takeover-add form { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.takeover-add .field { margin: 0; width: 100%; }
tr.row-late td { background: var(--row-error); }
.worker-status p { margin: 0 0 .35rem; }
.worker-link { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.worker-link select { width: auto; max-width: 100%; }
.template-steps input, .template-steps select { padding: .25rem .4rem; font-size: .9rem; }
.template-steps td:nth-child(2) { min-width: 16rem; }
.template-steps .num-input { width: 4.5rem; }
.map-missing summary { cursor: pointer; }
.coord-file { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; }
.coord-import { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.map-roles { border: 0; padding: 0; margin: 0 0 1rem; }
.map-roles legend { font-weight: 600; padding: 0; margin-bottom: .35rem; }
.map-roles-row { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }

/* Version at the bottom of the page (admins) and the changelog */
.app-footer { text-align: center; font-size: .8rem; color: var(--muted); padding: 1.5rem 1rem 1.25rem; }
.app-footer a { color: var(--muted); text-decoration: none; }
.app-footer a:hover { color: var(--link); text-decoration: underline; }
.new-dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: var(--line-amber); margin-left: .3rem; vertical-align: super; }
.changelog-version h2 { margin-top: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; }
.changelog-version.current { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.changelog-version h3 { font-size: .95rem; margin: .75rem 0 .25rem; }
.changelog-version ul { margin: 0; padding-left: 1.2rem; }
.changelog-version li { margin: .15rem 0; }
@media print { .app-footer a { color: #555; } .new-dot { display: none; } }
.map-total { margin: 0 0 1rem; font-size: 1rem; }
.map-tip { position: fixed; z-index: 1000; pointer-events: none; max-width: 22rem; padding: .35rem .6rem; border-radius: 6px; background: var(--text); color: var(--surface); font-size: .85rem; line-height: 1.35; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
/* System health */
.badge.health-ok { background: var(--b-green-bg); color: var(--b-green); }
.badge.health-info { background: var(--b-blue-bg); color: var(--b-blue); }
.badge.health-warn { background: var(--b-amber-bg); color: var(--b-amber); }
.badge.health-bad { background: var(--danger-bg); color: var(--danger); }
table.health td:first-child { width: 50%; }

/* Bookmarks: the select-and-export bar stays in view while scrolling */
.bookmark-bar { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: .5rem 0; align-items: center; }
.bookmark-folder { margin-bottom: 1rem; }
.bookmark-folder-head { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: 1rem; border-bottom: 1px solid var(--border); }
table.list td.check, table.list th.check { width: 2rem; }
table.list td.check input, table.list th.check input, .bookmark-folder-head input { width: auto; }
ul.bookmark-links { list-style: none; padding: 0; margin: 0 0 .75rem; }
ul.bookmark-links li { padding: .35rem 0; border-bottom: 1px solid var(--border); }
