/* CORE · ERP by Lancaster: design system, shared with the Lancaster LMS.
   White top bar, icon sidebar, cards on a light grey canvas, one brand colour throughout and a
   dark mode; every shade is mixed from --brand and --accent. The ERP's older colour names
   (--maroon, --gold…) are mapped onto these tokens below, so every screen follows the theme. */

@font-face { font-family: 'DM Sans'; src: url('../fonts/DMSans-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('../fonts/DMSans-Medium.ttf') format('truetype'); font-weight: 500 600; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('../fonts/DMSans-Bold.ttf') format('truetype'); font-weight: 700 800; font-display: swap; }

:root {
  --brand: #5d0013;
  --accent: #c28618;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-2: #374151;
  --muted: #636a76;
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 9%, var(--surface));
  --brand-softer: color-mix(in srgb, var(--brand) 4%, var(--surface));
  --brand-line: color-mix(in srgb, var(--brand) 28%, var(--surface));
  --brand-strong: color-mix(in srgb, var(--brand) 82%, #000);
  --brand-text: var(--brand);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface));
  /* The executive (C-suite) gold: text on light surfaces, and the icon tile's gradient. */
  --gold-text: #87580a; --gold-tile-from: #b87f1c; --gold-tile-to: #8a5a07;
  --success: #15803d; --success-soft: #dcfce7;
  --warn: #92570a; --warn-soft: #fef3c7;
  --danger: #b91c1c; --danger-soft: #fee2e2;
  --info: #1d4ed8; --info-soft: #dbeafe;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);
  --topbar: 64px;
  --sidebar: 256px;
  color-scheme: light;
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
}
:root[data-theme='dark'] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #162032;
  --border: #243044;
  --border-strong: #334155;
  --text: #e5e7eb;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --brand-soft: color-mix(in srgb, var(--brand) 26%, var(--surface));
  --brand-softer: color-mix(in srgb, var(--brand) 14%, var(--surface));
  --brand-line: color-mix(in srgb, var(--brand) 50%, var(--surface));
  --brand-text: color-mix(in srgb, var(--brand) 45%, #fff);
  --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--surface));
  --gold-text: #f2c373; --gold-tile-from: #b87f1c; --gold-tile-to: #8a5a07;
  --success: #4ade80; --success-soft: #14532d55;
  --warn: #fbbf24; --warn-soft: #78350f55;
  --danger: #f87171; --danger-soft: #7f1d1d55;
  --info: #93c5fd; --info-soft: #1e3a8a55;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); }
body { line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; margin: 2px 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--text); }
h2 { font-size: 16px; font-weight: 700; margin: 0 0 14px; color: var(--text); }
h3 { font-size: 14px; font-weight: 700; margin: 22px 0 10px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
code { background: var(--brand-soft); color: var(--brand-text); padding: 1px 6px; border-radius: 4px; font-size: 0.92em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 0.92em; }
.pre { white-space: pre-wrap; line-height: 1.6; margin: 0; }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hint { font-size: 12px; color: var(--muted); margin: 0; font-weight: 400; }
.ic { flex: none; vertical-align: -3px; }

/* ===== App shell ===== */
body.booting .app, body.booting #auth { visibility: hidden; }
body.auth-mode .app { display: none; }
body:not(.auth-mode) #auth { display: none; }

.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar); display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .brand { display: flex; align-items: center; gap: 12px; color: var(--text); min-width: 0; }
.topbar .brand > span { min-width: 0; overflow: hidden; }
.topbar .brand { flex: 0 1 auto; }
.topbar .brand:hover { text-decoration: none; }
.topbar .brand img { height: 40px; width: auto; max-width: 140px; object-fit: contain; }
.topbar .brand strong { display: block; font-size: 15px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .brand small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1; }
.round-btn { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: inline-grid; place-items: center; cursor: pointer; position: relative; }
.round-btn:hover { background: var(--surface-2); }
.round-btn .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }

.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border: 0; background: none; color: var(--text); cursor: pointer; border-radius: 999px; font: inherit; text-align: left; }
.user-btn:hover { background: var(--surface-2); }
.user-btn strong { display: block; font-size: 13px; line-height: 1.2; }
.user-btn small { display: block; font-size: 12px; color: var(--muted); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-text); display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; }
.menu-pop button, .menu-pop a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: var(--radius-sm); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--surface-2); text-decoration: none; }
.menu-pop .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-pop .who small { color: var(--muted); display: block; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
.menu-label { padding: 6px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.menu-pop button .grow { flex: 1; }
.menu-pop button.on { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.menu-pop { max-height: calc(100vh - var(--topbar) - 16px); overflow-y: auto; }

.layout { display: flex; min-height: calc(100vh - var(--topbar)); }
.sidebar { width: var(--sidebar); flex: none; position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); padding: 12px 10px; display: flex; flex-direction: column; }
#nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; margin-bottom: 2px; white-space: nowrap; position: relative; }
#nav a:hover { background: var(--surface-2); text-decoration: none; }
#nav a.active { background: var(--brand-soft); color: var(--brand-text); font-weight: 700; }
#nav a.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
#nav .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-heading { margin: 16px 12px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.nav-badge { min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.side-foot { margin-top: auto; padding: 12px; font-size: 11px; color: var(--muted); }
/* Desktop: the menu button folds the sidebar to icons only. */
body.nav-mini .sidebar { width: 68px; }
body.nav-mini #nav .label, body.nav-mini .nav-heading, body.nav-mini .nav-badge, body.nav-mini .side-foot { display: none; }
body.nav-mini #nav a { justify-content: center; padding: 10px; }
/* Folding and unfolding it (0.70): the width glides; the words fade out as it folds and in as it
   opens, and what folding takes away (the section headings, the module's name in its box) shrinks
   with it, so nothing below jumps when the move ends (public/js/app.js foldNav adds these classes
   for the length of the move only). */
@media (min-width: 961px) {
  body.nav-anim .sidebar { transition: width 0.22s cubic-bezier(0.2, 0.7, 0.2, 1); overflow-x: hidden; }
  body.nav-anim #nav .label, body.nav-anim .nav-badge, body.nav-anim .nav-soon, body.nav-anim .side-foot { transition: opacity 0.12s ease; }
  body.nav-anim #nav .label, body.nav-anim .nav-heading, body.nav-anim .side-foot { white-space: nowrap; overflow: hidden; }
  body.nav-anim .nav-heading { max-height: 20px; transition: max-height 0.22s ease, margin 0.22s ease, opacity 0.12s ease; }
  body.nav-anim .nav-module { transition: padding 0.22s ease, background-color 0.22s ease, border-color 0.22s ease; }
  body.nav-anim .nav-module > span:not(.mod-ic) { max-height: 52px; overflow: hidden; transition: max-height 0.22s ease, opacity 0.12s ease; }
  body.nav-closing .sidebar { width: 68px; }
  body.nav-closing #nav .label, body.nav-closing .nav-badge, body.nav-closing .nav-soon, body.nav-closing .side-foot { opacity: 0; }
  body.nav-closing .nav-heading { max-height: 0; margin-top: 0; margin-bottom: 0; opacity: 0; }
  body.nav-closing .nav-module { padding: 6px; background-color: transparent; border-color: transparent; }
  body.nav-closing .nav-module > span:not(.mod-ic) { max-height: 0; opacity: 0; }
  body.nav-opening #nav .label, body.nav-opening .nav-badge, body.nav-opening .nav-soon, body.nav-opening .side-foot { animation: nav-words-in 0.2s ease 0.05s both; }
  body.nav-opening .nav-heading { animation: nav-heading-in 0.22s ease both; }
  body.nav-opening .nav-module { animation: nav-module-in 0.22s ease both; }
  body.nav-opening .nav-module > span:not(.mod-ic) { animation: nav-module-words-in 0.22s ease both; }
}
@keyframes nav-words-in { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }
@keyframes nav-heading-in { from { max-height: 0; margin-top: 0; margin-bottom: 0; opacity: 0; } to { max-height: 20px; margin-top: 16px; margin-bottom: 6px; opacity: 1; } }
@keyframes nav-module-in { from { padding: 6px; background-color: transparent; border-color: transparent; } }
@keyframes nav-module-words-in { from { max-height: 0; opacity: 0; } to { max-height: 52px; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  body.nav-anim .sidebar, body.nav-anim .nav-heading, body.nav-anim .nav-module, body.nav-anim .nav-module > span:not(.mod-ic) { transition: none; }
  body.nav-opening #nav .label, body.nav-opening .nav-badge, body.nav-opening .nav-soon, body.nav-opening .side-foot, body.nav-opening .nav-heading, body.nav-opening .nav-module, body.nav-opening .nav-module > span:not(.mod-ic) { animation: none; }
}

main { flex: 1; min-width: 0; padding: 20px 28px 56px; max-width: 1360px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand-text); }
.crumbs .cur { color: var(--text-2); font-weight: 500; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.stack.tight { gap: 12px; margin: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; align-items: start; }
.cols.wide-left { grid-template-columns: minmax(0, 2fr) minmax(min(280px, 100%), 1fr); }
.card + .card, .card.scroll-x + .card, .cols + .card, .cols + .cols, .card + .cols { margin-top: 16px; }
.cols > .card + .card, .stats > .card + .card, .tiles > * + *, .stack > .card + .card { margin-top: 0; }

/* ===== Surfaces ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card-head a { font-size: 13px; font-weight: 500; }
.card.empty, .empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty h2 { color: var(--text); margin-bottom: 6px; }
.empty .ic { color: var(--brand-line); margin-bottom: 6px; }
.scroll-x { overflow-x: auto; padding: 0; }
.scroll-x > h2 { padding: 18px 20px 0; }
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--surface)); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; color: var(--text); }
.notice p { margin: 0; }
.notice.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, var(--surface)); }
.notice.ok { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, var(--surface)); }
.notice.bad { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, var(--surface)); }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; min-height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background 0.12s, border-color 0.12s, color 0.12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.gold { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.ghost, .btn.ghost.danger { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--surface)); }
.btn.danger.ghost:hover { background: var(--danger-soft); }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.quiet:hover { background: var(--surface-2); }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn.block { width: 100%; padding: 11px 16px; font-size: 15px; }
.btn.big { padding: 12px 22px; font-size: 15px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--brand-text); cursor: pointer; font: inherit; font-weight: 600; padding: 0 2px; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--danger); }
.link:disabled { color: var(--muted); cursor: not-allowed; text-decoration: none; }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: var(--radius-sm); cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; font-size: 20px; line-height: 1; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ===== Forms ===== */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span:first-child { font-weight: 600; font-size: 13px; color: var(--text-2); }
.field em { color: var(--danger); font-style: normal; margin-left: 2px; }
.field.check { flex-direction: row; align-items: flex-start; gap: 10px; }
.field.check > span:first-child, .field.check span { font-weight: 400; color: var(--text); }
.field.check input { margin-top: 2px; }
input, select, textarea { font: inherit; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); width: 100%; }
input[type='checkbox'], input[type='radio'] { width: 16px; height: 16px; accent-color: var(--brand); flex: none; padding: 0; }
input[type='color'] { padding: 2px; height: 38px; width: 64px; }
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--brand) 22%, transparent); border-color: var(--brand); }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.days, .checks { display: flex; gap: 14px; flex-wrap: wrap; }
.checks { flex-direction: column; gap: 8px; }
.days label, .checks label { display: flex; align-items: center; gap: 6px; }
.form-error { color: var(--danger); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 25%, var(--surface)); padding: 10px 12px; border-radius: var(--radius-sm); margin: 0; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar input[type='search'] { max-width: 320px; }
.toolbar select { width: auto; }
label.inline { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* ===== Tables ===== */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td small { display: block; color: var(--muted); font-size: 12px; }
.table.clickable tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--brand-softer); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.warn { color: var(--warn); font-weight: 700; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn + .btn { margin-left: 6px; }
.notes { color: var(--muted); max-width: 240px; }
.matrix .center { text-align: center; }
.table.matrix td:first-child { min-width: 260px; }

/* ===== Badges, stats ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; line-height: 1.5; }
.badge.green { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.amber { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.blue { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.red { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.gray { background: var(--surface-2); color: var(--muted); }
.badge.brand, .badge.maroon { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 12px; margin-bottom: 16px; }
.stats .card { padding: 16px 18px; color: var(--text); display: block; }
.stats a.card:hover { border-color: var(--brand-line); text-decoration: none; }
.stats small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.stats strong { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; overflow-wrap: anywhere; }
.stats .card.accent { border-color: var(--brand-line); background: var(--brand-softer); }
.stats .card.accent strong { color: var(--brand-text); }
.stats.small { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.stats.small strong { font-size: 20px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 16px; margin: 0; }
.info dt { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.info dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand-text); border-bottom-color: var(--brand); }
.tabs .count { font-size: 11px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }

.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13px; }
.meta span { display: inline-flex; align-items: center; gap: 6px; }

/* ===== Tiles, lists ===== */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow); position: relative; overflow: hidden; transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s; }
.tile::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--brand); opacity: 0.85; }
a.tile:hover { text-decoration: none; border-color: var(--brand-line); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.tile .code { font-size: 12px; font-weight: 700; color: var(--brand-text); letter-spacing: 0.02em; margin-top: 4px; }
.tile strong { font-size: 16px; line-height: 1.3; }
.tile small { color: var(--muted); }
.tile .meta { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; }
.tile .progress { margin-top: 4px; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); color: var(--text); }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
a.list-item:hover { text-decoration: none; }
a.list-item:hover strong { color: var(--brand-text); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item small { display: block; color: var(--muted); font-size: 12px; }
.item-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.item-ic.warn { background: var(--warn-soft); color: var(--warn); }
.item-ic.danger { background: var(--danger-soft); color: var(--danger); }
.item-ic.ok { background: var(--success-soft); color: var(--success); }
.item-ic.info { background: var(--info-soft); color: var(--info); }
.date-box { width: 46px; flex: none; text-align: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.date-box b { display: block; background: var(--brand); color: var(--brand-ink); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 0; }
.date-box span { display: block; font-size: 18px; font-weight: 700; padding: 2px 0 3px; }
.feed-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: 0; }
.feed-item small { display: block; color: var(--muted); }





.gradebook th.score-cell { white-space: normal; min-width: 92px; }
.register th:first-child, .register td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 140px; border-right: 1px solid var(--border); }

/* ===== Modal & toast ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); display: flex; align-items: flex-start; justify-content: center; padding: 7vh 16px; z-index: 80; overflow-y: auto; }
.modal { background: var(--surface); color: var(--text); border-radius: 14px; width: 100%; max-width: 540px; box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--border); }
.modal.wide { max-width: 820px; }
.modal header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal header h2 { margin: 0; font-size: 17px; }
.modal-title p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-body { padding: 20px; }
.modal .form-error { margin: 0 20px 12px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--text); color: var(--surface); padding: 11px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: all 0.2s; z-index: 100; font-weight: 500; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); color: #fff; }

/* ===== Sign-in ===== */
/* Sign-in (Vault): CORE's ground, deep maroon with the mark drawn large in gold line, beside a
   cream panel that holds the form. On a phone the ground becomes a band above the form. */
.auth-screen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(400px, 480px); min-height: 100vh; min-height: 100dvh; background: #2c0009; }
.auth-stage { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 48px 64px 40px; color: #f7efe4;
  background: radial-gradient(90% 70% at 15% 10%, #6a0618 0%, #3a000c 55%, #2c0009 100%); }
.auth-stage-mark { position: absolute; right: -250px; bottom: -250px; width: 740px; height: 740px; opacity: 0.36; pointer-events: none; user-select: none; }
.auth-wordmark { position: relative; display: flex; align-items: center; gap: 14px; }
.auth-wordmark img { width: 40px; height: 40px; flex: none; }
.auth-wordmark span { font-weight: 800; font-size: 20px; letter-spacing: 0.26em; color: #fbf7f0; }
.auth-intro { position: relative; display: flex; flex-direction: column; gap: 20px; max-width: 620px; }
.auth-kicker { margin: 0; font-size: 13px; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: #f2c373; }
.auth-intro h1 { margin: 0; display: block; color: #fbf7f0; font-size: clamp(44px, 5vw, 72px); font-weight: 700; line-height: 0.98; letter-spacing: -0.03em; text-wrap: balance; }
.auth-intro p:last-child { margin: 0; max-width: 460px; font-size: 17px; line-height: 1.55; color: #e6d6c6; }
.auth-modules { position: relative; list-style: none; margin: 0; padding: 18px 0 0; border-top: 1px solid rgba(242, 195, 115, 0.35); display: flex; flex-wrap: wrap; gap: 8px 32px;
  font-size: 12px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: #f2c373; }
.auth-panel { --auth-ink: #1d1a17; --auth-quiet: #5b5249; background: #fbf7f0; color: var(--auth-ink); display: flex; flex-direction: column; gap: 28px; padding: 56px 56px 32px; }
.auth-card { width: 100%; margin-block: auto; display: flex; flex-direction: column; gap: 20px; }
.auth-card h2 { margin: 0; font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -0.015em; color: var(--auth-ink); }
.auth-card > p { margin: -12px 0 2px; }
.auth-panel .muted, .auth-foot { color: var(--auth-quiet); }
.auth-panel .field > span:first-child { font-weight: 500; color: var(--auth-ink); }
.auth-panel input { height: 50px; padding: 0 16px; border-radius: 0; border-color: #c9bcab; background: #fff; color: var(--auth-ink); font-size: 16px; }
.auth-panel input:focus { outline: 2px solid var(--brand-text); outline-offset: 1px; border-color: var(--brand); }
.auth-panel .pw-wrap input { padding-right: 64px; }
.auth-panel .btn.primary.block { min-height: 54px; border-radius: 0; font-weight: 700; letter-spacing: 0.04em; box-shadow: inset 0 -3px 0 var(--accent); }
.auth-foot { text-align: left; font-size: 13px; margin: 0; }
.auth-switch { text-align: center; font-size: 13px; margin: 0; }
.auth-legal { margin: 0; padding-top: 20px; border-top: 1px solid #e3d8c9; font-size: 12px; line-height: 1.5; color: #6b6157; }
:root[data-theme='dark'] .auth-panel { --auth-ink: #efe6e1; --auth-quiet: #c2b3ac; background: #1b1113; }
:root[data-theme='dark'] .auth-panel input { background: #24181a; border-color: #4f3a3d; color: #efe6e1; }
:root[data-theme='dark'] .auth-panel input:focus { outline-color: #f2c373; border-color: #f2c373; }
:root[data-theme='dark'] .auth-panel .pw-wrap .link { color: #f2c373; }
:root[data-theme='dark'] .auth-legal { border-color: #3a2a2c; color: #a8989a; }
@media (max-width: 960px) {
  .auth-screen { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-stage { padding: 24px 24px 28px; gap: 26px; }
  .auth-stage-mark { width: 340px; height: 340px; right: -120px; bottom: -140px; }
  .auth-intro { gap: 12px; }
  .auth-intro h1 { font-size: 36px; }
  .auth-intro p:last-child { font-size: 15px; }
  .auth-modules { display: none; }
  .auth-panel { padding: 28px 24px 24px; }
  .auth-card, .auth-legal { width: 100%; max-width: 520px; margin-inline: auto; }
  .auth-card { margin-block: 0 auto; }
}
@media (min-width: 600px) and (max-width: 960px) {
  .auth-stage { padding: 40px 48px 44px; gap: 36px; }
  .auth-intro h1 { font-size: 52px; }
  .auth-intro p:last-child { font-size: 17px; }
  .auth-panel { padding: 40px 48px 32px; }
}
@media (max-width: 420px) {
  .auth-stage { gap: 18px; padding-bottom: 22px; }
  .auth-intro h1 { font-size: 30px; }
  .auth-intro p:last-child { display: none; }
}
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 60px; }
.pw-wrap .link { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; }
#auth > .empty { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }

/* ===== University Portal (/) ===== */
.hub-main { padding: 0 0 0; max-width: none; display: block; min-height: calc(100vh - var(--topbar)); display: flex; flex-direction: column; }
.hub-wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
section.hub-wrap { margin-top: 28px; }
.hub-hero { color: #fff; padding: 40px 0 46px; position: relative; overflow: hidden;
  background: radial-gradient(circle at 85% 20%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 35%), linear-gradient(135deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 62%, #000) 100%); }
.hub-hero::after { content: ''; position: absolute; right: -90px; top: -120px; width: 380px; height: 380px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.15); box-shadow: 0 0 0 46px rgba(255, 255, 255, 0.04); }
.hub-hero h1 { color: #fff; font-size: 34px; margin: 4px 0 8px; }
.hub-hero p { margin: 0; opacity: 0.9; font-size: 15px; max-width: 640px; }
.hub-kicker { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.85 !important; }
.hub-role { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); font-size: 13px; font-weight: 600; }
.hub-role + .hub-role { margin-left: 8px; }
/* "Your modules" carousel: the same layout as the ATLAS home. */
.sys-nav { display: flex; align-items: center; gap: 12px; }
.sys-arrows { display: inline-flex; gap: 6px; }
.sys-arrows[hidden] { display: none; }
.sys-arrows .icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); }
.sys-arrows .icon-btn:hover:not(:disabled) { border-color: var(--brand-line); color: var(--brand-text); }
.sys-arrows .icon-btn:disabled { opacity: 0.4; cursor: default; }
.sys-carousel { position: relative; }
.sys-track { --gap: 16px; --per: 4; display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - (var(--per) - 1) * var(--gap)) / var(--per)); gap: var(--gap);
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none;
  padding: 6px 8px 18px; margin: -6px -8px -10px; scroll-padding-inline: 8px; }
.sys-track::-webkit-scrollbar { display: none; }
.sys-track:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; border-radius: 18px; }
.sys-track > .sys-card { scroll-snap-align: start; }
/* A soft fade on the side where more cards wait. */
.sys-carousel.more-right .sys-track { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); }
.sys-carousel.more-left .sys-track { -webkit-mask-image: linear-gradient(to right, transparent, #000 56px); mask-image: linear-gradient(to right, transparent, #000 56px); }
.sys-carousel.more-left.more-right .sys-track { -webkit-mask-image: linear-gradient(to right, transparent, #000 56px, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to right, transparent, #000 56px, #000 calc(100% - 56px), transparent); }
.sys-dots { position: relative; z-index: 1; display: flex; justify-content: center; gap: 2px; }
.sys-dots[hidden] { display: none; }
/* 24px targets around small dots. */
.sys-dots button { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 4px; border: 0; background: none; cursor: pointer; }
.sys-dots button::before { content: ''; width: 8px; height: 8px; border-radius: 999px; background: var(--border-strong); transition: width 0.2s, background 0.2s; }
.sys-dots button:hover::before { background: var(--muted); }
.sys-dots button[aria-current='true']::before { width: 22px; background: var(--brand); }
.sys-dots button:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 0; border-radius: 999px; }
@media (prefers-reduced-motion: reduce) { .sys-track { scroll-behavior: auto; } .sys-dots button::before { transition: none; } }
@media (max-width: 1100px) { .sys-track { --per: 3; } }
@media (max-width: 820px) { .sys-track { --per: 2; } }
@media (max-width: 560px) { .sys-track { --per: 1; grid-auto-columns: 84%; } }
.sys-card { display: flex; flex-direction: column; gap: 6px; padding: 20px; min-height: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; color: var(--text); box-shadow: var(--shadow); position: relative; overflow: hidden; transition: transform 0.14s, box-shadow 0.14s, border-color 0.14s; }
.sys-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--brand); }
a.sys-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--brand-line); }
.sys-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.sys-ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); }
.sys-name { font-size: 26px; font-weight: 800; letter-spacing: 0.01em; color: var(--brand-text); line-height: 1.1; }
.sys-title { font-size: 14px; line-height: 1.3; }
.sys-card p { margin: 2px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.sys-open { margin-top: auto; padding-top: 12px; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--brand-text); }
.sys-card.soon { background: var(--surface-2); box-shadow: none; cursor: not-allowed; }
.sys-card.soon::before { background: var(--border-strong); }
.sys-card.soon .sys-ic { background: var(--surface); color: var(--muted); border: 1px solid var(--border); filter: grayscale(1); }
.sys-card.soon .sys-name, .sys-card.soon .sys-open { color: var(--muted); }
.sys-card.soon .sys-title { color: var(--text-2); }
.sys-card.soon .sys-open { font-weight: 500; }
.sys-track > .sys-slot { scroll-snap-align: start; position: relative; display: flex; min-width: 0; }
.sys-slot > .sys-card { flex: 1; min-width: 0; }
.sys-slot .sys-top { padding-right: 42px; }
.sys-slot:hover > a.sys-card { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--brand-line); }
.sys-slot.pinned > .sys-card { border-color: var(--brand-line); }
/* The star that pins a module to the front of the CORE home (0.40). */
.sys-pin { position: absolute; right: 10px; top: 12px; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; transition: transform 0.14s, color 0.14s, background 0.14s; }
.sys-pin:hover { background: var(--surface-2); border-color: var(--border); color: var(--accent); }
.sys-pin:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.sys-pin[aria-pressed="true"] { color: var(--accent); }
.sys-pin[aria-pressed="true"] .ic { fill: currentColor; }
.sys-pin:disabled { opacity: 0.5; cursor: progress; }
.sys-slot:hover .sys-pin { transform: translateY(-2px); }
@media (pointer: coarse) { .sys-pin { width: 44px; height: 44px; right: 6px; top: 8px; } .sys-slot .sys-top { padding-right: 46px; } }
@media (prefers-reduced-motion: reduce) { .sys-pin, .sys-slot:hover .sys-pin { transition: none; transform: none; } }
.hub-foot { margin-top: auto; padding: 22px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.hub-foot .hub-wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
body.hub .topbar { padding-left: 24px; }


/* ===== Phones and tablets ===== */
.nav-scrim { display: none; }
@media (max-width: 960px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar .brand img { height: 34px; }
  .user-btn .who-text { display: none; }
  .sidebar { position: fixed; top: var(--topbar); left: 0; bottom: 0; height: auto; z-index: 55; width: min(84vw, 290px); transform: translateX(-102%); transition: transform 0.2s ease, visibility 0.2s; visibility: hidden; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  body.nav-mini .sidebar { width: min(84vw, 290px); }
  body.nav-mini #nav .label, body.nav-mini .nav-heading { display: initial; }
  .nav-scrim { display: block; position: fixed; inset: var(--topbar) 0 0 0; z-index: 50; background: rgba(15, 23, 42, 0.45); }
  .nav-scrim[hidden] { display: none; }
  main { padding: 16px 16px 48px; }
  h1 { font-size: 22px; }
  .card { padding: 16px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .cols.wide-left, .res-layout, .quiz-layout, .class-head { grid-template-columns: minmax(0, 1fr); }
  .grid, .grid.two { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3 { grid-column: auto; }
  .hub-wrap { padding: 0 16px; }
  .hub-hero h1 { font-size: 26px; }
  body.hub .topbar { padding-left: 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stats strong { font-size: 22px; }
  .toolbar > input, .toolbar > select, .toolbar > label.inline { flex: 1 1 100%; max-width: none; }
  .toolbar input[type='search'] { max-width: none; }
  .toolbar label.inline > input[type='checkbox'] { flex: none; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { max-width: none; border-radius: 16px 16px 0 0; max-height: 92vh; display: flex; flex-direction: column; }
  .modal-body { overflow-y: auto; flex: 1 1 auto; }
  .modal footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal footer .btn { flex: 1; }
  #toast { left: 16px; right: 16px; transform: translateY(20px); text-align: center; max-width: none; }
  #toast.show { transform: none; }
  input:not([type='checkbox']):not([type='radio']):not([type='range']), select, textarea { font-size: 16px; }
}
/* Touch screens: tap targets (raised to 44 px in "Phones and tablets, 0.18" at the end of this file). */
@media (pointer: coarse) {
  input:not([type='checkbox']):not([type='radio']):not([type='range']), select, textarea { font-size: 16px; }
  .btn.sm { min-height: 36px; padding: 6px 12px; }
  .icon-btn { min-width: 36px; min-height: 36px; }
  .chip { min-height: 36px; padding: 7px 14px; }
  button.link { min-height: 32px; min-width: 32px; padding: 4px 6px; display: inline-flex; align-items: center; justify-content: center; }
  input[type='color'] { min-height: 36px; }
  .crumbs a { padding: 6px 0; }
}
@media (max-width: 760px) {
  .topbar .brand small { display: none; }
  /* Tables become a list of small cards of "Label: value" lines. */
  .scroll-x:has(.table.stackable) { overflow-x: visible; }
  .card.scroll-x:has(.table.stackable) { padding: 0 16px 6px; }
  .table.stackable thead { display: none; }
  .table.stackable, .table.stackable tbody, .table.stackable tfoot, .table.stackable tr { display: block; width: 100%; }
  .table.stackable tr { padding: 12px 2px; border-bottom: 1px solid var(--border); }
  .table.stackable tbody tr:hover { background: none; }
  .table.stackable td { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 4px 0; border: 0; text-align: right; overflow-wrap: anywhere; min-width: 0; }
  .table.stackable td::before { content: attr(data-label); flex-shrink: 0; text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
  .table.stackable td:not([data-label])::before { content: none; }
  .table.stackable td:first-child { display: block; text-align: left; font-size: 15px; padding-bottom: 6px; }
  .table.stackable td:first-child::before { content: none; }
  .table.stackable td.is-empty { display: none; }
  .table.stackable td.row-actions, .table.stackable td:last-child:not([data-label]) { justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding-top: 8px; }
  .table.stackable td.row-actions .btn { flex: 1 1 auto; }
  .table.stackable .cell-v { text-align: right; min-width: 0; }
  .table.stackable td:first-child .cell-v { text-align: left; }
  .topbar .brand img { width: 34px; max-width: 34px; object-fit: cover; object-position: left center; }
  .table.stackable td.row-actions .link { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 12px; min-height: 36px; justify-content: center; }
  @media (pointer: coarse) { .table.stackable td.row-actions .link { min-height: 44px; } }
  .table.stackable td.row-actions .link.danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--surface)); }
  .table.stackable .module-row td:not(:first-child) { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: start; text-align: left; gap: 4px 12px; padding: 8px 0; }
  .table.stackable .module-row td::before { grid-row: span 2; }
  .table.stackable .module-row .desc { grid-column: 2; max-width: none; margin-top: 0; }
  .scroll-x:has(.att-take) { overflow-x: visible; }
  .tiles { grid-template-columns: 1fr; }
  .sys-card { min-height: 0; }
}
@media print {
  .sidebar, .topbar, .nav-scrim, .no-print, #toast { display: none !important; }
  body, main { background: #fff; padding: 0; }
}

/* ===== The ERP's older colour names, on the shared tokens ===== */
:root {
  --maroon: var(--brand-text);
  --maroon-dark: var(--brand-strong);
  --maroon-soft: var(--brand-soft);
  --gold: var(--accent);
  --gold-bright: var(--accent);
  --gold-light: color-mix(in srgb, var(--accent) 55%, var(--surface));
  --gold-soft: var(--accent-soft);
  --card: var(--surface);
  --display: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.btn.small-btn { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.badge.maroon-soft { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; }
.stats .card.attention { border-color: var(--brand-line); background: var(--brand-softer); }
.stats .card.attention strong { color: var(--brand-text); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.center { text-align: center !important; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.back:hover { color: var(--brand-text); text-decoration: none; }
.page-head h1 + p, .page-head p.muted { margin-top: 4px; }

/* ===== ERP: base pieces the LMS does not have ===== */
.back { font-size: 13px; font-weight: 500; }
.actions.center { justify-content: center; }
.clock-cols { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.table td.num small { display: inline; }
.table td.num small.block { display: block; }
.table.compact td { padding: 8px 10px; }
.table tfoot td { border-top: 2px solid var(--maroon); border-bottom: 0; background: var(--maroon-soft); }
.register { font-size: 13px; }
.register th, .register td { padding: 10px 8px; }
.register td:first-child { white-space: nowrap; }
.person { display: flex; align-items: center; gap: 10px; }
.person strong { display: block; }
.person.big .avatar { width: 60px; height: 60px; font-size: 21px; border: 3px solid var(--gold-light); }
.person.big p { margin: 2px 0 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { padding: 9px 0; border-bottom: 1px solid var(--border); }
.danger-zone { margin-top: 28px; display: flex; gap: 12px; align-items: center; }
.stats .card.wide-figure { grid-column: span 2; }
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: 120px 1fr 28px; gap: 10px; align-items: center; padding: 7px 0; }
.bars span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { background: var(--surface-2); border-radius: 999px; height: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--maroon), var(--gold-bright)); border-radius: 999px; }
.bars b { text-align: right; color: var(--maroon); }
.latest-run { display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.latest-run:hover { color: var(--text); }
.latest-run strong { font-family: var(--display); font-weight: 800; font-size: 34px; color: var(--maroon); }
.welcome { padding: 64px 20px; }
.welcome h2 { font-size: 40px; font-weight: 800; text-transform: none; letter-spacing: 0.01em; margin-bottom: 8px; }
.welcome h2 span { color: var(--gold); }
.welcome p { font-style: italic; font-size: 16px; }
.clock-card { text-align: center; display: flex; flex-direction: column; gap: 16px; border-top: 4px solid var(--gold-bright); }
.clock-time { font-family: var(--display); font-weight: 800; font-size: 72px; line-height: 1; color: var(--maroon); font-variant-numeric: tabular-nums; }
.clock-date { color: var(--muted); margin-top: -6px; font-style: italic; }
.clock-card .field { text-align: left; }
.clock-status { min-height: 20px; color: var(--muted); }
.clock-buttons { display: flex; gap: 12px; }
/* Payslip: a formal pay statement, laid out like a printed A4 document. */
.payslips { display: flex; flex-direction: column; gap: 24px; }
/* A formal statement: black ink on white, thin rules, one type size for the body and
   no display-size figures. The logo carries the brand colour. */
.payslip { --ps-ink: #1a1a1a; --ps-rule: #cfcfcf; --ps-soft: #f4f4f4; --ps-quiet: #595959; position: relative; overflow: hidden; background: #fff; color: var(--ps-ink); border: 1px solid #9a9a9a; border-radius: 0; padding: 32px 36px 26px; max-width: 860px; font-size: 12.5px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.payslip h3 { font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ps-ink); margin: 0 0 6px; }
.payslip > :not(.ps-watermark) { position: relative; z-index: 1; }
.ps-watermark { z-index: 0; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; font-weight: 700; font-size: 96px; letter-spacing: 0.3em; color: rgba(0, 0, 0, 0.045); transform: rotate(-24deg); }
.ps-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 14px; border-bottom: 3px double var(--ps-ink); }
.ps-company { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.ps-company img { height: 40px; width: auto; flex: none; }
.ps-company > div { display: grid; gap: 1px; padding-left: 14px; border-left: 1px solid var(--ps-rule); min-width: 0; }
.ps-company strong { font-size: 13px; letter-spacing: 0.02em; text-transform: uppercase; }
.ps-company span { font-size: 11px; color: var(--ps-quiet); max-width: 380px; }
.ps-title { text-align: right; flex: none; }
.ps-title h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ps-ink); line-height: 1.2; }
.ps-ref { margin: 4px 0 0; font-family: ui-monospace, Consolas, monospace; font-size: 11px; }
.ps-conf { margin: 3px 0 0; font-size: 9.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ps-quiet); }
.ps-meta { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 18px; border-bottom: 1px solid var(--ps-rule); }
.ps-meta div { padding: 8px 12px; border-left: 1px solid var(--ps-rule); }
.ps-meta div:first-child { border-left: 0; padding-left: 0; }
.ps-meta dt, .ps-fields dt, .ps-summary dt { font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ps-quiet); }
.ps-meta dd { margin: 2px 0 0; font-weight: 600; }
.ps-block { margin-bottom: 18px; }
.ps-fields { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border: 1px solid var(--ps-rule); }
.ps-fields div { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: baseline; padding: 5px 10px; border-top: 1px solid var(--ps-rule); }
.ps-fields div:nth-child(-n+2) { border-top: 0; }
.ps-fields div:nth-child(even) { border-left: 1px solid var(--ps-rule); }
.ps-fields dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.ps-ledger { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; align-items: start; }
.ps-table { width: 100%; border-collapse: collapse; border: 1px solid var(--ps-rule); }
.ps-table th { text-align: left; padding: 6px 10px; background: var(--ps-soft); border-bottom: 1px solid var(--ps-ink); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ps-ink); }
.ps-table td { padding: 5px 10px; border-top: 1px solid #e6e6e6; vertical-align: baseline; }
.ps-table tbody tr:first-child td { border-top: 0; }
.ps-table td small { display: block; font-size: 10.5px; color: var(--ps-quiet); }
.ps-table tr.sub td:first-child { padding-left: 22px; color: var(--ps-quiet); }
.ps-table tr.sub td.num { color: var(--ps-quiet); }
.ps-table .num { text-align: right; white-space: nowrap; }
.ps-table tfoot td { font-weight: 700; border-top: 1px solid var(--ps-ink); background: var(--ps-soft); }
.ps-small .ps-table td { padding: 4px 10px; font-size: 12px; }
.ps-summary { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--ps-ink); margin-bottom: 18px; }
.ps-summary dl { margin: 0; padding: 10px 14px; display: grid; gap: 4px; align-content: center; }
.ps-summary dl div { display: flex; justify-content: space-between; gap: 12px; }
.ps-summary dd { margin: 0; font-weight: 600; }
.ps-net { display: grid; align-content: center; gap: 2px; padding: 10px 14px; border-left: 1px solid var(--ps-ink); background: var(--ps-soft); text-align: right; }
.ps-net span { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.ps-net strong { font-size: 17px; font-weight: 700; line-height: 1.3; }
.ps-net em { font-style: italic; font-size: 11px; color: var(--ps-quiet); }
.ps-remarks { margin-bottom: 18px; padding: 8px 12px; border: 1px solid var(--ps-rule); }
.ps-remarks p { margin: 0; white-space: pre-wrap; }
.ps-foot { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px 40px; padding-top: 26px; }
.ps-sign { display: grid; gap: 4px; font-size: 10.5px; color: var(--ps-quiet); }
.ps-sign span { display: block; height: 24px; border-bottom: 1px solid var(--ps-ink); }
.ps-foot p { grid-column: 1 / -1; margin: 12px 0 0; padding-top: 8px; border-top: 1px solid var(--ps-rule); font-size: 10px; color: var(--ps-quiet); text-align: center; }

.matrix td, .matrix th { padding: 9px 12px; }
.matrix .center { text-align: center; }
.matrix .yes { color: var(--success); font-weight: 700; font-size: 16px; }
.matrix .no { color: var(--border-strong); }
.scroll-x.flat { border: 0; }
.stack.tight { gap: 12px; margin: 0; }
.role-hint { margin: -6px 0 0; }
.you { font-weight: 400; font-size: 12px; }

.badge.maroon-soft { background: var(--maroon-soft); color: var(--maroon); }
.btn.small-btn { padding: 4px 12px; font-size: 13px; }
.stats .card.attention { border-top-color: var(--maroon); background: var(--gold-soft); }
.toolbar.pad, .muted.pad, h2.pad, .card-head.pad { padding: 16px 16px 0; }
.card-head.pad { padding-top: 20px; }
.muted.small.pad:last-child { padding-bottom: 16px; }
.balances th small { display: block; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.center { text-align: center !important; }
.cell-btn { background: none; border: 1px solid transparent; border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit; color: var(--text); min-width: 72px; }
.cell-btn:hover { border-color: var(--gold-light); background: var(--gold-soft); }
.cell-btn strong { font-family: var(--display); font-size: 20px; color: var(--maroon); }
.cell-btn span { color: var(--muted); margin-left: 2px; }
.cell-btn small { display: block; color: var(--muted); font-size: 11px; }
.cell-btn.override { border-color: var(--gold-bright); }
.cell-btn.low strong { color: var(--danger); }
.balance-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); gap: 12px; }
.balance { border: 1px solid var(--border); border-left: 4px solid var(--gold-bright); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.balance strong { font-family: var(--display); font-weight: 800; font-size: 30px; color: var(--maroon); line-height: 1.1; }
.balance.low { border-left-color: var(--danger); }
.balance.low strong { color: var(--danger); }
.balance-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.balance-chips div { background: var(--gold-soft); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; min-width: 92px; }
.balance-chips strong { font-family: var(--display); font-weight: 800; font-size: 24px; color: var(--maroon); line-height: 1; }
.balance-chips span { font-size: 11px; color: var(--muted); }
.request-preview { margin: -4px 0 0; }
.input-suffix { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.input-suffix:focus-within { outline: 3px solid rgba(204, 153, 52, 0.25); border-color: var(--gold); }
.input-suffix input { border: 0; outline: none !important; min-width: 0; }
.input-suffix em { font-style: normal; color: var(--muted); padding: 0 10px; white-space: nowrap; font-size: 13px; }
.input-suffix em.pre { padding: 0 0 0 10px; }
.edit-table td { padding: 6px; }
.tax-cols { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.tax-cols h3 { margin-top: 4px; }
/* Tablets and landscape phones: one bracket table per row, so each input shows its whole value. */
@media (max-width: 1100px) { .tax-cols { grid-template-columns: minmax(0, 1fr); } }
.try { max-width: 560px; }
.table .mono { white-space: nowrap; }
/* A long value (an email address) on one line, cut with "…"; the whole of it shows on hover (0.47). */
.table .cell-clip { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1024px) { .table.stackable .cell-clip { max-width: none; white-space: normal; overflow-wrap: anywhere; } }
.tag-line { margin: 6px 0 0; color: var(--gold); font-weight: 700; letter-spacing: 0.08em; font-size: 13px; }
/* ===== Asset module ===== */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 170px 1fr; gap: 16px; padding: 10px 0 10px 16px; border-left: 2px solid var(--gold-light); position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--gold); }
.timeline li.ev-assigned::before, .timeline li.ev-transferred::before { background: var(--brand); border-color: var(--brand); }
.timeline li.ev-returned::before { background: var(--success); border-color: var(--success); }
.timeline li.ev-status::before { background: var(--gold-light); }
.timeline li.ev-issue::before, .timeline li.ev-open::before { background: var(--maroon-soft); border-color: var(--brand); }
.timeline li.ev-in_progress::before { background: var(--gold-bright); border-color: var(--gold); }
.timeline li.ev-resolved::before { background: var(--success); border-color: var(--success); }
.timeline li.ev-closed::before { background: var(--border-strong); border-color: var(--border-strong); }
.timeline time { color: var(--muted); font-size: 13px; }
.timeline span { display: block; color: var(--muted); font-size: 13px; }
.timeline em { display: block; font-size: 13px; color: var(--text); }
.bars.stacked li { grid-template-columns: 140px 1fr 48px; }
.bars.stacked i { background: var(--accent-soft); position: relative; }
.bars.stacked i b { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--maroon), var(--gold-bright)); border-radius: 999px; }
.bars.stacked em { font-style: normal; text-align: right; color: var(--maroon); font-weight: 700; font-variant-numeric: tabular-nums; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; vertical-align: -1px; }
.key-assigned { background: var(--brand); margin-left: 0; }
.key-free { background: var(--accent-soft); }
.seg { display: flex; gap: 0; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; width: fit-content; }
.seg label { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-left: 1px solid var(--border-strong); cursor: pointer; font-weight: 500; }
.seg label:first-child { border-left: 0; }
.seg label:has(input:checked) { background: var(--brand); color: #fff; }
.seg input { accent-color: var(--gold); width: auto; flex: none; margin: 0; }
.seg label { white-space: nowrap; }
.holder-card .holder-name { font-family: var(--display); font-weight: 800; font-size: 28px; color: var(--maroon); margin: 0; }
.holder-card.held { border-top: 4px solid var(--maroon); }
.holders { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(540px, 100%), 1fr)); gap: 16px; margin-top: 16px; }
/* The cards of a row line up (0.47); a holder's assets scroll sideways inside the card when narrow. */
.holders > .card + .card { margin-top: 0; }
.holder-assets { margin: 0 -4px; }
.card.holder header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.card.holder h2 { margin: 6px 0 0; text-transform: none; font-size: 22px; }
.card.holder p { margin: 2px 0 0; }
.holder-count { text-align: center; border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; }
.holder-count strong { display: block; font-family: var(--display); font-size: 26px; color: var(--maroon); line-height: 1; }
.holder-count span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.consumed { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row-low td { background: var(--accent-soft); }
:root[data-theme='dark'] .row-low td { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.num.neg { color: var(--maroon); font-weight: 700; }
.num.pos { color: var(--success); font-weight: 700; }
.unit { font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--muted); }
.asset-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; margin-bottom: 16px; }
.asset-card { border-top: 4px solid var(--gold-bright); }
.asset-card h2 { text-transform: none; font-size: 22px; margin: 2px 0 4px; }
.asset-card .info-grid { margin-top: 12px; }
/* ===== Problem reports ===== */
.report-text { white-space: pre-wrap; margin: 0 0 14px; line-height: 1.55; }
.table td small.clip { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
h2.spaced { margin-top: 22px; }
.asset-card-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.report-flag { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--maroon); }
.my-reports { display: grid; gap: 14px; }
.my-report { border: 1px solid var(--border); border-left: 4px solid var(--gold-bright); border-radius: 8px; padding: 14px 16px; scroll-margin-top: 20px; }
.my-report header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.my-report .report-text { color: var(--muted); }

/* ===== Dev log ===== */
.devlog-page { --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; }
.devlog-page code, .devlog-page time, .rel-version, .buildbar, .mono-line, .seg-btns button, .ctype, .flag { font-family: var(--mono); }
.mono-line { font-size: 13px; margin: 2px 0 0; }
.byline strong { color: var(--text); }
.byline .link { font-family: 'DM Sans', sans-serif; font-size: 13px; }
.buildbar { display: flex; flex-wrap: wrap; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; overflow: hidden; }
.buildbar .kv { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-right: 1px solid var(--border); white-space: nowrap; }
.buildbar .kv:last-child { border-right: 0; }
.buildbar .kv > span:first-child { color: var(--muted); }
.buildbar strong { color: var(--maroon); }
.flag { display: inline-block; padding: 0 6px; border-radius: 3px; font-size: 11px; line-height: 18px; border: 1px solid; text-transform: lowercase; }
.flag.ok { color: var(--success); border-color: var(--border); background: var(--success-soft); }
.flag.warn, .flag.new { color: var(--warn); border-color: var(--gold-light); background: var(--gold-soft); }
.flag.installed { color: var(--maroon); border-color: var(--border); background: var(--maroon-soft); }
.log-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 14px 0 10px; }
.log-toolbar input[type='search'] { max-width: 260px; padding: 6px 10px; font-size: 13px; }
.log-toolbar .spacer { flex: 1; }
.log-toolbar .link { font-size: 13px; }
.seg-btns { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg-btns button { font-size: 12px; padding: 5px 10px; border: 0; border-left: 1px solid var(--border); background: none; color: var(--text); cursor: pointer; }
.seg-btns button:first-child { border-left: 0; }
.seg-btns button:hover { background: var(--surface-2); }
.seg-btns button.active { background: var(--brand); color: #fff; }
.releases { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; }
.releases > .card.empty { border: 0; margin: 0; }
.release { border-top: 1px solid var(--border); }
.release:first-child { border-top: 0; }
.release.unseen { box-shadow: inset 3px 0 0 var(--gold-bright); }
.release > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 9px 14px; cursor: pointer; list-style: none; font-size: 14px; }
.release > summary::-webkit-details-marker { display: none; }
.release > summary::before { content: '▸'; color: var(--muted); font-size: 11px; width: 10px; transition: transform 0.12s; }
.release[open] > summary::before { transform: rotate(90deg); }
.release > summary:hover { background: var(--surface-2); }
.release > summary:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: -2px; }
.rel-version { font-weight: 700; color: var(--maroon); min-width: 92px; font-size: 13px; }
.release time { color: var(--muted); font-size: 12.5px; }
.rel-title { font-weight: 700; color: var(--text); flex: 1 1 200px; }
.rel-scopes { display: inline-flex; gap: 4px; }
.rel-scopes code, .cscope { font-size: 11.5px; padding: 0 5px; border-radius: 3px; background: var(--surface-2); color: var(--muted); line-height: 18px; }
.rel-tally { display: inline-flex; gap: 8px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.rel-flags { display: inline-flex; gap: 4px; }
.rel-actions { display: inline-flex; gap: 2px; font-size: 13px; }
.rel-actions .link { padding: 0 4px; }
.t-new { color: var(--success); }
.t-improved { color: var(--info); }
.t-fixed { color: var(--warn); }
.t-known { color: var(--muted); }
.rel-body { padding: 0 14px 12px 38px; }
.rel-notes { margin: 0 0 8px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.changes { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.changes li { display: grid; grid-template-columns: 64px 62px 1fr; gap: 10px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; line-height: 1.45; }
.ctype { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.cscope { justify-self: start; }
.known { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: baseline; padding: 6px 0; font-size: 13.5px; color: var(--muted); }
.known ul { margin: 0; padding: 0; list-style: none; }
.known li + li { margin-top: 3px; }
.rel-meta { margin: 6px 0 0; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.change-rows { display: grid; gap: 8px; margin-bottom: 8px; }
/* Wide screens: line the summary columns up from release to release. */
@media (min-width: 1200px) {
  .release > summary { display: grid; grid-template-columns: 10px 96px 84px minmax(0, 1fr) 130px 200px 120px auto; gap: 14px; align-items: baseline; }
  .rel-scopes, .rel-flags { justify-content: flex-end; }
  .rel-version { min-width: 0; }
}
.change-row { display: grid; grid-template-columns: 120px 190px 1fr 36px; gap: 8px; align-items: center; }
@media (max-width: 760px) {
  .change-row { grid-template-columns: 1fr 1fr 36px; }
  .change-row input { grid-column: 1 / 3; grid-row: 2; }
  .buildbar { display: grid; grid-template-columns: 1fr 1fr; }
  .buildbar { gap: 1px; background: var(--surface-2); }
  .buildbar .kv { min-width: 0; white-space: normal; overflow-wrap: anywhere; border-right: 0; padding: 6px 12px; background: var(--surface); }
  .buildbar .kv:nth-child(1), .buildbar .kv:nth-child(3) { grid-column: 1 / -1; }
  .buildbar .kv:nth-child(1) { order: -3; }
  .buildbar .kv:nth-child(3) { order: -2; }
  .buildbar .kv:nth-child(2), .buildbar .kv:nth-child(6) { order: -1; }
  .log-toolbar input[type='search'] { max-width: none; flex: 1 1 100%; order: -1; }
  .log-toolbar .seg-btns { max-width: 100%; overflow-x: auto; }
  .log-toolbar .spacer { display: none; }
  .release > summary { padding: 10px 12px; gap: 4px 10px; }
  .rel-version { min-width: 0; }
  .rel-title { flex-basis: 100%; order: 1; padding-left: 24px; }
  .rel-scopes, .rel-tally { order: 2; }
  .rel-scopes { padding-left: 24px; }
  .rel-flags { order: 0; }
  .rel-actions { order: 3; margin-left: auto; }
  .rel-body { padding: 0 12px 12px; }
  .changes li { grid-template-columns: auto 1fr; gap: 2px 8px; }
  .changes .ctext { grid-column: 1 / -1; }
  .known { grid-template-columns: 1fr; gap: 2px; }
}

#add-change { align-self: flex-start; }
@media (max-width: 760px) {
  .grid.two { grid-template-columns: 1fr; }
  .grid.two > * { grid-column: 1 / -1; }
}

/* ===== Employee leave ===== */
.toolbar .spacer { flex: 1; }
.emp-leave tr.not-offered td { background: var(--surface-2); }
.emp-leave tr.not-offered strong { color: var(--muted); }
.emp-leave .negative, .table .negative { color: var(--maroon); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; transition: background 0.15s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { left: 18px; }
.switch input:focus-visible { outline: 3px solid rgba(204, 153, 52, 0.4); outline-offset: 2px; }

/* ===== Feedback and attachments ===== */
.seg.wrap { flex-wrap: wrap; width: auto; }
.seg.wrap label { border-left: 0; border-right: 1px solid var(--border-strong); white-space: nowrap; flex: 1 1 auto; justify-content: center; }
.seg.wrap input { width: auto; flex: none; margin: 0; }
.seg.wrap label:last-child { border-right: 0; }
.table tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--gold-bright); }
.table tr.unread strong { color: var(--maroon); }
/* Feedback list rows (own submissions, and the inbox on phones) */
.fb-list { display: grid; gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.fb-row { display: grid; gap: 4px; width: 100%; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 0; border-top: 1px solid var(--border); padding: 14px 16px; cursor: pointer; }
.fb-row:first-child { border-top: 0; }
@media (hover: hover) { .fb-row:hover { background: var(--surface-2); } }
.fb-row:active { background: var(--surface-2); }
.fb-card .card-head { margin-bottom: 14px; }
.fb-card .fb-list { margin: 0 -22px -22px; border-width: 1px 0 0; border-radius: 0 0 var(--radius) var(--radius); }
.fb-card .fb-row { padding: 14px 22px; }
.fb-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 6px 0 0; }
.fb-row:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: -2px; }
.fb-row.unread { box-shadow: inset 3px 0 0 var(--gold-bright); }
.fb-row-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.fb-row-top .mono { color: var(--maroon); font-weight: 700; letter-spacing: 0.02em; }
.fb-row-subject { font-size: 15px; line-height: 1.35; }
.fb-row-excerpt, .fb-row-from { font-size: 13px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fb-row-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.fb-row-tags small { color: var(--muted); font-size: 12px; }
.fb-cards { display: none; }
/* The inbox table needs about 1180px; below that the cards show (QA 0.37). A long subject wraps. */
.fb-table td strong { overflow-wrap: anywhere; }
.fb-table td:nth-child(3) { min-width: 9em; }
@media (max-width: 1180px) {
  .fb-table { display: none; }
  .fb-cards { display: grid; margin: 0; border-radius: 0 0 var(--radius) var(--radius); border-width: 1px 0 0; }
}
.fb-row-subject { overflow-wrap: anywhere; }
/* Details and history */
.fb-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 12px 16px; margin: 0; }
.fb-meta div { min-width: 0; }
.fb-meta dt { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.fb-meta dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.fb-meta dd small { display: block; color: var(--muted); font-size: 12px; }
.fb-message { margin: 0; white-space: pre-wrap; line-height: 1.6; overflow-wrap: anywhere; }
/* Written in the visual editor (0.35): formatted, so no pre-wrap. */
.rich.fb-message, .fb-history blockquote .rich { white-space: normal; }
.fb-history blockquote .rich > :first-child { margin-top: 0; }
.fb-history blockquote .rich > :last-child { margin-bottom: 0; }
.fb-modal .rich-ed { margin-top: 2px; }
/* The editor is span-2 for the two-column task form; the feedback forms are one column (0.36). */
.fb-modal .modal-body > .rich-ed { grid-column: auto; }
.fb-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.fb-section h3 { margin: 0 0 10px; font-size: 14px; }
.fb-history { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); display: grid; gap: 14px; }
.fb-history > li { position: relative; font-size: 14px; }
.fb-history > li::before { content: ''; position: absolute; left: -25px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--gold); }
.fb-history > li.ev-sent::before { border-color: var(--brand); }
.fb-history > li.ev-resolved::before, .fb-history > li.ev-closed::before { background: var(--success); border-color: var(--success); }
.fb-history > li.ev-note::before { background: var(--gold-bright); }
.fb-ev-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; }
.fb-ev-head time { font-size: 12px; color: var(--muted); }
.fb-history > li > span { display: block; font-size: 13px; color: var(--muted); }
.fb-history blockquote { margin: 8px 0 0; padding: 10px 12px; background: var(--surface-2); border-left: 3px solid var(--gold-light); border-radius: 0 6px 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
/* New feedback form */
.fb-modal .modal-body { display: grid; gap: 16px; }
.fb-types { border: 0; margin: 0; padding: 0; min-width: 0; }
.fb-types legend { padding: 0; margin-bottom: 6px; font-weight: 500; }
.fb-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fb-type { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: var(--surface); }
.fb-type input { width: auto; flex: none; margin: 2px 0 0; accent-color: var(--maroon); }
.fb-type span { display: grid; gap: 2px; min-width: 0; }
.fb-type strong { font-size: 14px; }
.fb-type small { font-size: 12px; color: var(--muted); line-height: 1.35; }
.fb-type:has(input:checked) { border-color: var(--brand); background: var(--maroon-soft); box-shadow: 0 0 0 1px var(--maroon) inset; }
.fb-type:has(input:focus-visible) { outline: 2px solid var(--gold-bright); outline-offset: 1px; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.fb-privacy { margin: 0; }
.modal-title { min-width: 0; }
.modal-title p { margin: 3px 0 0; font-size: 13px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.fb-type:last-child:nth-child(odd) { grid-column: 1 / -1; }
/* Keep notices clear of an open window's buttons. */
body:has(.modal-backdrop) #toast { bottom: auto; top: 16px; }
.att-preview { display: block; width: 100%; height: min(70vh, 720px); border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); object-fit: contain; }
img.att-preview { height: auto; max-height: 70vh; }
.cert-link { display: block; padding: 0; margin-top: 4px; font-size: 13px; text-align: left; }
.cert-field.required > span { color: var(--maroon); font-weight: 700; }
.cert-field input[type=file] { padding: 8px; border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--surface-2); }
.cert-field.required input[type=file] { border-color: var(--gold-bright); background: var(--gold-soft); }

.flex-tag { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--info-soft); color: var(--info); font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; line-height: 17px; vertical-align: 1px; }

/* ===== IT Service Desk ===== */
a.fb-row { color: var(--text); }
.hd-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.hd-tile { display: grid; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--gold-bright); border-radius: 10px; color: var(--text); }
.hd-tile small { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.hd-tile strong { font-family: var(--display); font-weight: 800; font-size: 30px; color: var(--maroon); line-height: 1; }
.hd-tile.warn { border-top-color: var(--gold); background: var(--gold-soft); }
.hd-tile.bad { border-top-color: var(--danger); }
.hd-tile.bad strong { color: var(--danger); }
.hd-tile:hover { border-color: var(--gold-light); }
.hd-mailbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 18px; margin-bottom: 16px; border-left: 4px solid var(--success); }
.hd-mailbar.err { border-left-color: var(--danger); }
.hd-mailbar.off { border-left-color: var(--border-strong); }
.hd-mailbar > div { display: grid; gap: 2px; }
.hd-mini { list-style: none; margin: 0; padding: 0; }
.hd-mini li { display: grid; gap: 3px; padding: 9px 0; border-top: 1px solid var(--border); }
.hd-mini li:first-child { border-top: 0; }
.hd-mini a { color: var(--text); font-weight: 600; }
.hd-mini .mono { color: var(--maroon); margin-right: 4px; }
.hd-mini small { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); }
.sla { display: inline-block; font-size: 12px; white-space: nowrap; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.sla-due_soon { background: var(--gold-soft); color: var(--warn); }
.sla-breached { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.hd-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 6px; }
.hd-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.hd-main > .card + .card { margin-top: 16px; }
.hd-side { display: grid; gap: 16px; }
.hd-side .card + .card { margin-top: 0; }
.hd-thread { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hd-msg { border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; background: var(--surface); }
.hd-msg.agent { border-left: 4px solid var(--maroon); background: var(--surface-2); }
.hd-msg.requester { border-left: 4px solid var(--info); }
.hd-msg.note { border-left: 4px solid var(--gold-bright); background: var(--gold-soft); }
.hd-msg header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 6px; }
.hd-msg header span { font-size: 12px; color: var(--muted); }
.hd-msg header time { margin-left: auto; font-size: 12px; color: var(--muted); }
.hd-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.hd-files { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 13px; }
.hd-files .link { padding: 0; }
.hd-delivery { margin: 8px 0 0; font-size: 12px; color: var(--success); }
.hd-delivery.failed { color: var(--danger); }
.hd-delivery.not_sent { color: var(--muted); }
.hd-event { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.hd-event time { color: var(--muted); }
.hd-compose textarea { width: 100%; }
.hd-mode { margin-bottom: 10px; }
.hd-compose-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 10px; }
.hd-compose-bar .spacer { flex: 1; }
.hd-compose-bar select { width: auto; }
.hd-attach { cursor: pointer; }
.hd-props { display: grid; gap: 10px; }
.hd-dl { display: grid; gap: 10px; margin: 0; }
.hd-dl dt { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.hd-dl dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.hd-dl dd small { display: block; color: var(--muted); font-size: 12px; }
.hd-error { color: var(--danger); }
.hd-sla input { width: 90px; text-align: right; }
.hd-table td small { display: block; }
/* On a laptop the subject keeps a readable width and the short columns stay on one line (0.47). */
@media (min-width: 1025px) {
  .hd-table td[data-label='Subject'] { min-width: 220px; }
  .hd-table td:is([data-label='Status'], [data-label='Priority'], [data-label='Due'], [data-label='Assignee']) { white-space: nowrap; }
}

/* ===== Public service desk page (/support) ===== */
.support-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.sp-head { background: var(--surface); border-bottom: 1px solid var(--border); }
.sp-head-inner { max-width: 760px; height: var(--topbar); margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 14px; }
.sp-head img { height: 36px; width: auto; display: block; }
.sp-head img.on-dark, :root[data-theme='dark'] .sp-head img.on-light { display: none; }
:root[data-theme='dark'] .sp-head img.on-dark { display: block; }
.sp-divider { width: 1px; height: 28px; background: var(--border-strong); }
.sp-title strong { display: block; font-size: 15px; line-height: 1.2; color: var(--text); }
.sp-title small { display: block; font-size: 12px; color: var(--muted); }
.support-page main.sp-main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 28px 20px 48px; box-sizing: border-box; }
.sp-card { background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--brand); border-radius: 16px; padding: 28px 30px; box-shadow: var(--shadow-lg); }
.sp-card h1 { font-size: 30px; margin: 0 0 8px; }
.sp-intro { color: var(--muted); line-height: 1.55; margin: 0 0 18px; }
.sp-card form { display: grid; gap: 14px; }
.sp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.sp-card .field em { color: var(--danger); font-style: normal; }
.sp-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.sp-privacy { margin: 0; font-size: 12px; color: var(--muted); }
.sp-submit { justify-self: start; min-width: 160px; justify-content: center; }
.sp-kicker { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.sp-done h1 .mono { color: var(--maroon); }
.sp-link { display: flex; gap: 8px; margin: 14px 0; }
.sp-link input { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.sp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.sp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.sp-status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--info-soft); color: var(--info); }
.sp-status.sp-new { background: var(--gold-soft); color: var(--warn); }
.sp-status.sp-pending { background: var(--warn-soft); color: var(--warn); }
.sp-status.sp-resolved { background: var(--success-soft); color: var(--success); }
.sp-status.sp-closed { background: var(--surface-2); color: var(--muted); }
.sp-thread { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 12px; }
.sp-msg { border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
.sp-msg.mine { border-left: 4px solid var(--info); }
.sp-msg.theirs { border-left: 4px solid var(--maroon); background: var(--surface-2); }
.sp-msg header { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.sp-msg time { font-size: 12px; color: var(--muted); }
.sp-event { text-align: center; font-size: 12px; color: var(--muted); }
.sp-reply { border-top: 1px solid var(--border); padding-top: 16px; }
.sp-foot { text-align: center; font-size: 12px; color: var(--muted); padding: 0 20px 24px; }
.pf-link { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pf-link input { flex: 1 1 320px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.pf-cats { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.pf-snippet { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

/* ===== Clock-in locations ===== */
.geo-notice { margin: 14px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.geo-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.geo-pill.ok { background: var(--success-soft); color: var(--success); }
.geo-pill.out { background: var(--gold-soft); color: var(--warn); border-color: var(--gold-light); }
.geo-pill.remote { background: var(--info-soft); color: var(--info); }
.geo-pill.none { background: var(--surface-2); color: var(--muted); }
.geo-link { padding: 0; }
.geo-link:hover .geo-pill { text-decoration: underline; }
.geo-map { display: block; width: 100%; height: min(52vh, 380px); border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.geo-links { margin: 8px 0 16px; }
/* In a card (stacked table), a long location wraps inside the card instead of running past its edge. */
@media (max-width: 1024px) {
  .geo-pill { white-space: normal; max-width: 100%; text-align: left; overflow-wrap: anywhere; }
  button.link.geo-link { flex-shrink: 1; min-width: 0; max-width: 100%; }
}
.office-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 22px; }
.office-bar > div { display: grid; gap: 2px; }
.table tr.flag-row td:first-child { box-shadow: inset 3px 0 0 var(--gold-bright); }

@keyframes sheet-up { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal { animation: none !important; } }

@media (max-width: 960px) {
  .modal { position: relative; animation: sheet-up 0.22s ease-out; box-shadow: 0 -12px 40px rgba(61, 0, 12, 0.25); }
  .modal::before { content: ''; position: absolute; top: 7px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--border-strong); }
  .modal header { flex: none; padding: 20px 16px 12px 20px; border-bottom-width: 2px; align-items: flex-start; }
  .modal header h2 { font-size: 18px; line-height: 1.15; }
  .modal header .icon-btn { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--surface-2); font-size: 22px; line-height: 1; }
  .modal footer .btn { min-height: 46px; }
  .fb-type { padding: 10px; }
  .fb-meta { grid-template-columns: 1fr 1fr; }
  .fb-table { display: none; }
  .fb-cards { display: grid; margin: 0 -16px -6px; border-radius: 0 0 var(--radius) var(--radius); border-width: 1px 0 0; }
  .fb-card .fb-list { margin: 0 -16px -16px; }
  .fb-card .fb-row, .fb-cards .fb-row { padding: 14px 16px; }
  .fb-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .fb-filters input[type='search'] { grid-column: 1 / -1; }
  .fb-filters #shown { align-self: center; justify-self: end; }
  .payslip { padding: 20px 16px 16px; font-size: 12px; }
  .ps-head { flex-direction: column; gap: 14px; }
  .ps-title { text-align: left; }
  .ps-title h2 { font-size: 14px; }
  .ps-company { flex-direction: column; gap: 10px; }
  .ps-company img { height: 36px; }
  .ps-company > div { border-left: 0; padding-left: 0; }
  .ps-meta { grid-template-columns: 1fr 1fr; }
  .ps-meta div { border-left: 0; padding-left: 0; }
  .ps-fields { grid-template-columns: 1fr; }
  .ps-fields div { grid-template-columns: 110px 1fr; border-left: 0 !important; }
  .ps-fields div:nth-child(2) { border-top: 1px solid var(--ps-rule); }
  .ps-ledger, .ps-summary, .ps-foot { grid-template-columns: 1fr; }
  .ps-net { text-align: left; border-left: 0; border-top: 1px solid var(--ps-ink); }
  .ps-watermark { font-size: 64px; }
  .hd-tiles { grid-template-columns: 1fr 1fr; }
  .hd-tiles .hd-tile:last-child { grid-column: 1 / -1; }
  .hd-layout { grid-template-columns: 1fr; }
  .hd-compose-bar .btn.primary { width: 100%; justify-content: center; }
  .hd-compose-bar label.inline { flex: 1; }
  .sp-head img { height: 30px; }
  .sp-head img { height: 30px; }
  .sp-title small { display: none; }
  .support-page main.sp-main { padding: 16px 12px 32px; }
  .sp-card { padding: 20px 16px; }
  .sp-card h1 { font-size: 24px; }
  .sp-grid { grid-template-columns: 1fr; }
  .sp-submit { justify-self: stretch; }
  .sp-link { flex-direction: column; }
  .fb-page .page-head .actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
  .office-bar { padding: 14px 16px; }
  .office-bar .btn { width: 100%; justify-content: center; }
  .geo-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .geo-filters > select { grid-column: 1 / -1; }
  .geo-filters label.inline { display: grid; gap: 4px; font-size: 13px; }
}
@media (max-width: 760px) {
  .table.stackable tfoot tr { background: var(--brand-softer); border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
  .table.stackable tfoot td { background: none; border: 0; }
  .table.stackable td.num, .table.stackable td.center { text-align: right; }
  .table.balances th:first-child, .table.balances td:first-child, .table.matrix th:first-child, .table.matrix td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
}
@page { size: A4; margin: 12mm; }
@media print {
  .sidebar, .topbar, .nav-scrim, .no-print, #toast { display: none !important; }
  html, body, main { background: #fff; }
  body, main { padding: 0; }
  .payslips { gap: 0; }
  .payslip { box-shadow: none; border: 0; border-radius: 0; padding: 0; max-width: none; font-size: 11.5px; break-after: page; break-inside: avoid; }
  .payslip:last-child { break-after: auto; }
  .payslip, .ps-net, .ps-table th, .ps-table tfoot td, .ps-remarks { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ps-watermark { color: rgba(0, 0, 0, 0.07); }
  .ps-meta, .ps-block, .ps-ledger, .ps-summary, .ps-remarks { margin-bottom: 14px; }
  .ps-foot { padding-top: 16px; }
}
/* Printed payslips: an A4 page is narrower than the phone breakpoint, so restore the
   document layout here (last in the file, so it wins) and fit one payslip per sheet. */
@media print {
  main, #app { padding: 0 !important; margin: 0 !important; }
  .payslip { padding: 0; font-size: 10.5px; line-height: 1.35; }
  .ps-head { flex-direction: row; gap: 18px; padding-bottom: 12px; }
  .ps-title { text-align: right; }
  .ps-title h2 { font-size: 13px; }
  .ps-company { flex-direction: row; gap: 14px; }
  .ps-company img { height: 38px; }
  .ps-company > div { border-left: 1px solid var(--ps-rule); padding-left: 14px; }
  .ps-company strong { font-size: 12px; }
  .ps-company span { font-size: 9.5px; }
  .ps-meta { grid-template-columns: repeat(4, 1fr); margin-bottom: 12px; }
  .ps-meta div { padding: 7px 10px; border-left: 1px solid var(--ps-rule); }
  .ps-meta div:first-child { border-left: 0; padding-left: 0; }
  .ps-fields { grid-template-columns: 1fr 1fr; }
  .ps-fields div { grid-template-columns: 105px 1fr; padding: 4px 10px; }
  .ps-fields div:nth-child(2) { border-top: 0; }
  .ps-fields div:nth-child(even) { border-left: 1px solid var(--ps-rule) !important; }
  .ps-ledger { grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 12px; }
  .ps-summary { grid-template-columns: 1fr 1fr; margin-bottom: 12px; }
  .ps-summary dl { padding: 8px 12px; gap: 3px; }
  .ps-net { text-align: right; padding: 8px 12px; border-left: 1px solid var(--ps-ink); border-top: 0; }
  .ps-net strong { font-size: 14px; }
  .ps-net em { font-size: 9.5px; }
  .ps-table th { padding: 5px 10px; font-size: 9px; }
  .ps-table td, .ps-small .ps-table td { padding: 4px 10px; font-size: 10.5px; }
  .ps-table td small { font-size: 9px; }
  .ps-table tr.sub td:first-child { padding-left: 20px; }
  .payslip h3 { margin-bottom: 5px; font-size: 9.5px; }
  .ps-block, .ps-remarks { margin-bottom: 12px; }
  .ps-remarks { padding: 6px 10px; }
  .ps-foot { grid-template-columns: 1.4fr 1fr; gap: 6px 30px; padding-top: 14px; }
  .ps-sign span { height: 22px; }
  .ps-foot p { margin-top: 8px; padding-top: 6px; font-size: 8.5px; }
  .ps-watermark { font-size: 84px; }
}

/* ===== CORE: brand, module switcher, launcher ===== */
/* The payslip is paper: it keeps light colours in dark mode too. */
.payslip { --maroon: var(--brand); --maroon-soft: color-mix(in srgb, var(--brand) 8%, #fff); --gold-light: color-mix(in srgb, var(--accent) 55%, #fff); --border: #e5e7eb; --border-strong: #d1d5db; --text: #1f1a1a; --text-2: #374151; --muted: #6b7280; --surface: #fff; --surface-2: #f9fafb; }

.topbar .brand img.core-mark { height: 34px; width: 34px; max-width: none; }
.topbar .brand img.core-mark.on-dark, :root[data-theme='dark'] .topbar .brand img.core-mark.on-light { display: none; }
:root[data-theme='dark'] .topbar .brand img.core-mark.on-dark { display: block; }
.core-word { display: flex; align-items: baseline; gap: 8px; }
.topbar .brand .core-word strong { font-size: 17px; font-weight: 800; letter-spacing: 0.14em; color: var(--brand-text); }
.topbar .brand .core-word em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.topbar .brand small b { color: var(--text-2); font-weight: 600; }
.mod-switch { position: relative; }
/* The modules menu (0.45): every module as a compact tile, three across. */
.mod-pop { width: 340px; padding: 8px; }
.mod-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 2px 0 6px; }
.menu-pop .mod-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; padding: 10px 4px 8px; min-height: 84px; border-radius: 12px; text-align: center; color: var(--text); }
.mod-tile .mod-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.mod-tile .mod-name { font-size: 12px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.menu-pop a.mod-tile:hover { background: var(--surface-2); }
.menu-pop a.mod-tile.on { background: var(--brand-soft); }
.menu-pop a.mod-tile.on .mod-ic { background: var(--brand); color: #fff; }
.mod-tile.locked, .mod-tile.soon { cursor: default; color: var(--muted); }
.mod-tile.locked .mod-ic, .mod-tile.soon .mod-ic { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.mod-tile .mod-tag { display: inline-flex; align-items: center; gap: 2px; margin-top: -2px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; line-height: 16px; text-transform: uppercase; }
.mod-tile .mod-pin { position: absolute; top: 6px; right: 8px; color: var(--accent); }
.mod-tile .mod-pin .ic { fill: currentColor; }
.menu-pop .mod-row { gap: 10px; padding: 8px 10px; }
.mod-row .mod-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.mod-row strong { font-size: 13px; font-weight: 600; }
.menu-pop a.mod-row.on { background: var(--brand-soft); }

/* The CORE home's compact view (0.46): every module at once, as small tiles in a grid. */
.sys-nav .sys-view { margin-left: 4px; }
.sys-compact { display: none; }
.sys-section.compact .sys-carousel, .sys-section.compact .sys-dots, .sys-section.compact .sys-arrows { display: none !important; }
.sys-section.compact .sys-compact { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.sys-mini-slot { position: relative; display: flex; min-width: 0; }
.sys-mini-slot > .sys-mini { flex: 1; min-width: 0; padding-right: 44px; }
/* Every tile the same height (QA 0.68.1): one line for the name, one for the figure. */
.sys-mini { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 68px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text); box-shadow: var(--shadow); position: relative; overflow: hidden; transition: border-color 0.14s, box-shadow 0.14s; }
.sys-mini::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--brand); }
a.sys-mini:hover, .sys-mini-slot:hover > a.sys-mini { text-decoration: none; border-color: var(--brand-line); box-shadow: var(--shadow-lg); }
.sys-mini .sys-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.sys-mini .grow { flex: 1; min-width: 0; }
.sys-mini strong { display: block; font-size: 14px; line-height: 1.25; color: var(--brand-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sys-mini small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sys-mini.locked, .sys-mini.soon { background: var(--surface-2); box-shadow: none; cursor: default; }
.sys-mini.locked::before, .sys-mini.soon::before { background: var(--border-strong); }
.sys-mini.locked .sys-ic, .sys-mini.soon .sys-ic { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.sys-mini.locked strong, .sys-mini.soon strong { color: var(--muted); }
.sys-mini-slot .sys-pin { top: 50%; right: 8px; transform: translateY(-50%); }
.sys-mini-slot:hover .sys-pin { transform: translateY(-50%); }
.sys-mini-slot.pinned > .sys-mini { border-color: var(--brand-line); }
.sys-mini.soon.accent-gold { background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 12%, var(--surface)) 0%, var(--surface) 70%); border-color: color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.sys-mini.soon.accent-gold::before { background: linear-gradient(180deg, var(--gold-tile-from), var(--gold-tile-to)); width: 4px; }
.sys-mini.soon.accent-gold .sys-ic { background: linear-gradient(135deg, var(--gold-tile-from), var(--gold-tile-to)); color: #fff; border: 0; }
.sys-mini.soon.accent-gold strong, .sys-mini.soon.accent-gold small { color: var(--gold-text); }
/* On a phone (0.47): two tiles a row even at 320px, each a small card with its icon on top and the
   star beside it, so the name and its line have the tile's whole width. */
@media (max-width: 560px) {
  .sys-section.compact .sys-compact { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
  .sys-mini { flex-direction: column; align-items: flex-start; padding: 10px; gap: 8px; min-height: 0; }
  .sys-mini .sys-ic { width: 34px; height: 34px; }
  .sys-mini .grow { width: 100%; }
  .sys-mini strong { font-size: 13px; }
  /* Room for two lines under every name, used or not, so the tiles are the same height. */
  .sys-mini small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; min-height: 2.7em; }
  .sys-mini-slot .sys-mini strong { padding-right: 22px; }
  .sys-mini-slot > .sys-mini { padding-right: 10px; }
  .sys-mini-slot .sys-pin, .sys-mini-slot:hover .sys-pin { top: 4px; right: 4px; transform: none; }
  /* The section head: the count on its own line, then Cards / Compact; the dots and a swipe move the row. */
  .sys-section > .card-head { align-items: flex-start; }
  .sys-nav { flex-wrap: wrap; gap: 8px 12px; width: 100%; }
  .sys-nav > .sys-count { flex: 1 1 100%; }
  .sys-nav .sys-view { margin-left: 0; }
  .sys-arrows { display: none !important; }
}
/* The narrowest phones (320–360px): the top bar's buttons sit closer, and the menu under your name
   shows without its arrow, so the bar fits. */
@media (max-width: 360px) {
  .topbar { gap: 2px; padding: 0 6px; }
  .user-btn { padding: 4px; }
  .user-btn > .ic { display: none; }
}

/* C-suite, the executive module: a gold accent, on its tile and on its CORE home card (0.45). */
.mod-tile.accent-gold { color: var(--gold-text); }
.mod-tile.accent-gold .mod-ic { background: linear-gradient(135deg, var(--gold-tile-from), var(--gold-tile-to)); color: #fff; border: 0; box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 35%, transparent); }
.mod-tile.accent-gold .mod-tag { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--surface)); color: var(--gold-text); }
.sys-card.soon.accent-gold { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 10%, var(--surface)) 0%, var(--surface) 55%); border-color: color-mix(in srgb, var(--accent) 45%, var(--surface)); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 16%, transparent); cursor: default; }
.sys-card.soon.accent-gold::before { background: linear-gradient(90deg, var(--gold-tile-from), var(--gold-tile-to), var(--gold-tile-from)); height: 5px; }
.sys-card.soon.accent-gold .sys-ic { background: linear-gradient(135deg, var(--gold-tile-from), var(--gold-tile-to)); color: #fff; border: 0; filter: none; box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 30%, transparent); }
.sys-card.soon.accent-gold .sys-name { color: var(--gold-text); }
.sys-card.soon.accent-gold .sys-open { color: var(--gold-text); }
.sys-card.soon.accent-gold p { color: var(--text-2); }
.sys-tagline { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.sys-card.accent-gold .sys-tagline { color: var(--gold-text); }
.badge.gold { background: var(--accent-soft); color: var(--gold-text); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--surface)); }
.nav-module { display: flex; align-items: center; gap: 10px; margin: 2px 2px 10px; padding: 10px 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.nav-module .mod-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--brand); color: #fff; flex: none; }
.nav-module strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 13px; line-height: 1.2; color: var(--text); overflow: hidden; overflow-wrap: anywhere; }
.nav-module small { display: block; font-size: 11px; color: var(--muted); }
.nav-module > span { min-width: 0; }
body.nav-mini .nav-module { padding: 6px; justify-content: center; background: none; border-color: transparent; }
body.nav-mini .nav-module > span:not(.mod-ic) { display: none; }
.round-btn .dot[hidden] { display: none; }
#menu-btn { position: relative; }
#menu-btn .dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }

/* Launcher (signed-in home) */
body.launcher-mode .sidebar, body.launcher-mode #menu-btn { display: none; }
/* On a phone inside a module the menu button takes the wordmark's room: the mark alone stands for CORE
   (the link keeps its name for screen readers). */
@media (max-width: 480px) { body:not(.launcher-mode) .topbar .brand > span { display: none; } }
@media (max-width: 360px) { .topbar .brand > span { display: none; } }
body.launcher-mode main#app { padding: 0; max-width: none; display: flex; flex-direction: column; min-height: calc(100vh - var(--topbar)); }
.hub-hero .hub-wrap { position: relative; z-index: 1; }
.hub-hero .hero-mark { position: absolute; right: 6%; top: 50%; transform: translateY(-50%); width: 210px; height: 210px; opacity: 0.16; z-index: 0; pointer-events: none; }
.sys-figs { list-style: none; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px dashed var(--border); display: grid; gap: 4px; font-size: 12.5px; color: var(--text-2); }
.sys-figs li { display: flex; align-items: center; gap: 8px; }
.sys-figs li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.sys-card.locked { background: var(--surface-2); box-shadow: none; }
.sys-card.locked::before { background: var(--border-strong); }
.sys-card.locked .sys-ic { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.sys-card.locked .sys-name { color: var(--muted); }
.sys-code { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; color: var(--muted); }
.admin-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.admin-tile { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow); }
.admin-tile:hover { text-decoration: none; border-color: var(--brand-line); background: var(--brand-softer); }
.admin-tile .ic-box { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.admin-tile strong { display: block; font-size: 13.5px; }
.admin-tile small { display: block; color: var(--muted); font-size: 12px; }
.admin-tile .grow { flex: 1; min-width: 0; }
.admin-tile .count { padding: 1px 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.hub-foot .core-foot { display: inline-flex; align-items: center; gap: 8px; }
.hub-foot .core-foot img { width: 18px; height: 18px; }

@media (max-width: 1100px) {
  .admin-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .hub-hero .hero-mark { width: 140px; height: 140px; right: 4%; }
}
/* The modules menu spans the screen on a phone only; on a tablet it drops from its button (0.47). */
@media (max-width: 560px) {
  .mod-pop { position: fixed; left: 10px; right: 10px; top: calc(var(--topbar) + 4px); min-width: 0; width: auto; }
}
@media (max-width: 760px) {
  .table.stackable tr.unread td:first-child, .table.stackable tr.flag-row td:first-child { box-shadow: none; }
  .table.stackable tr.unread, .table.stackable tr.flag-row { box-shadow: inset 3px 0 0 var(--gold-bright); padding-left: 12px; }
  .admin-tiles { grid-template-columns: 1fr; }
    .hub-hero .hero-mark { display: none; }
  .topbar .brand .core-word em { display: none; }
}
@media print {
  .hub-hero, .hub-foot { display: none; }
}
body.launcher-mode main#app > section:last-of-type { margin-bottom: 36px; }
@media (min-width: 961px) { body:not(.nav-mini) #menu-btn .dot { display: none; } }

/* ===== Sales & CRM ===== */
.sys-grid.two-by-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.avatar.xs { width: 22px; height: 22px; font-size: 9.5px; }
.crm-owner { display: inline-flex; align-items: center; gap: 6px; }
.crm-due { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.crm-due.warn { color: var(--warn); }
.crm-due.bad { color: var(--danger); }
.crm-amt { text-align: right; font-weight: 700; white-space: nowrap; }
.crm-amt small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; margin-top: 2px; }
.crm-desc { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--text-2); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline > span:first-child { font-size: 12px; white-space: nowrap; }
.field.inline input, .field.inline select { width: auto; }
.crm-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); flex-wrap: wrap; }
.crm-seg button { border: 0; background: none; padding: 7px 12px; font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.crm-seg button + button { border-left: 1px solid var(--border); }
.crm-seg button.active { background: var(--brand); color: #fff; }
.table tr.muted-row td { color: var(--muted); }
.table tr.muted-row strong { text-decoration: line-through; font-weight: 500; }

/* Search */
.crm-search { position: relative; }
.crm-search input { width: 300px; max-width: 100%; }
.crm-search-pop { position: absolute; right: 0; top: calc(100% + 6px); width: min(440px, 92vw); max-height: 60vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 30; }
.crm-search-pop a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); }
.crm-search-pop a:hover { background: var(--surface-2); text-decoration: none; }
.crm-search-pop strong { display: block; font-size: 13.5px; }
.crm-search-pop small { display: block; color: var(--muted); font-size: 12px; }
.crm-search-pop .badge { flex: none; min-width: 64px; text-align: center; }
.crm-search-pop p { margin: 8px 10px; }

/* Compact lists in cards */
.crm-mini { list-style: none; margin: 0; padding: 0; }
.crm-mini li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.crm-mini li:first-child { border-top: 0; padding-top: 2px; }
.crm-mini .grow { flex: 1; min-width: 0; }
.crm-mini strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.crm-mini small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
/* Long emails and unbroken names wrap instead of pushing the card (or the phone page) sideways. */
.crm-mini small, .crm-act small, .crm-act strong { overflow-wrap: anywhere; }
/* The Won/Lost drop zones are not covered by a toast while a card is dragged. */
body:has(.crm-dropbar:not([hidden])) #toast { opacity: 0; }
.crm-tick { display: inline-grid; place-items: center; flex: none; }
.crm-tick input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; margin: 0; }

/* Overview charts */
.crm-funnel { display: grid; gap: 10px; margin-bottom: 18px; }
.crm-funnel-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 110px; align-items: center; gap: 14px; color: var(--text); }
.crm-funnel-row:hover { text-decoration: none; }
.crm-funnel-row:hover .crm-funnel-bar i { filter: brightness(1.1); }
.crm-funnel-name { font-weight: 600; font-size: 13.5px; }
.crm-funnel-name small, .crm-funnel-val small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.crm-funnel-bar { height: 26px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.crm-funnel-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 55%, var(--accent))); border-radius: 6px; }
.crm-funnel-val { text-align: right; }
.crm-forecast { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: end; margin-bottom: 4px; }
.crm-forecast > div { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.crm-fc-bar { width: 56%; height: 110px; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 8px 8px 0 0; border: 1px solid var(--border); border-bottom: 2px solid var(--accent); overflow: hidden; }
.crm-fc-bar i { display: block; width: 100%; background: var(--accent); opacity: 0.85; border-radius: 6px 6px 0 0; }
.crm-forecast small { color: var(--muted); font-size: 12px; }

/* Pipeline board */
.crm-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.crm-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 220px; max-height: calc(100vh - 230px); transition: border-color 0.15s, background 0.15s; }
.crm-col > header { padding: 12px 14px 10px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr auto; row-gap: 2px; border-top: 4px solid var(--brand-line); border-radius: var(--radius) var(--radius) 0 0; }
.crm-col > header strong { font-size: 14px; }
.crm-col > header small { grid-column: 1; color: var(--muted); font-size: 12px; }
.crm-col-sum { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 800; font-size: 15px; color: var(--brand-text); }
.crm-col.won > header { border-top-color: var(--success); }
.crm-col.won .crm-col-sum { color: var(--success); }
.crm-col.lost > header { border-top-color: var(--border-strong); }
.crm-col.lost .crm-col-sum { color: var(--muted); }
.crm-col.over { border-color: var(--brand); background: var(--brand-softer); }
.crm-col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; }
.crm-col-empty { margin: 18px 0; text-align: center; font-size: 12.5px; color: var(--muted); border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 18px 8px; }
.crm-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; cursor: grab; }
.crm-card[draggable='false'] { cursor: default; }
.crm-card:hover { border-color: var(--brand-line); }
.crm-card.dragging { opacity: 0.45; }
.crm-card-title { font-weight: 700; color: var(--text); font-size: 13.5px; line-height: 1.3; }
.crm-card-acct { color: var(--muted); font-size: 12.5px; }
.crm-card-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.crm-card-foot strong { font-size: 14px; color: var(--brand-text); }
.crm-card-foot .avatar { margin-left: auto; }
.crm-card-next { color: var(--text-2); font-size: 12px; display: flex; gap: 3px; align-items: flex-start; border-top: 1px dashed var(--border); padding-top: 6px; margin-top: 4px; }

/* Stage bar on a deal */
.crm-path { display: flex; margin: 0 0 18px; overflow-x: auto; gap: 3px; padding: 3px 0; }
.crm-path button:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--brand-text); }
.crm-path-break { display: none; }
.crm-path button { flex: 1 0 auto; border: 0; background: var(--surface-2); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; padding: 10px 18px 10px 24px; cursor: pointer; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; border-block: 1px solid var(--border); }
.crm-path button:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 8px 0 0 8px; padding-left: 16px; }
.crm-path button:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); border-radius: 0 8px 8px 0; }
.crm-path button:hover:not(:disabled) { background: var(--brand-soft); color: var(--brand-text); }
.crm-path button.past { background: var(--brand-soft); color: var(--brand-text); }
.crm-path button.cur { background: var(--brand); color: #fff; }
.crm-path button.won.cur { background: var(--success); }
.crm-path button.lost.cur { background: var(--text-2); color: var(--surface); }
.crm-path button:disabled { cursor: default; }

/* Timeline */
.crm-composer { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); margin-bottom: 8px; }
.crm-composer textarea { min-height: 60px; }
.crm-composer-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.crm-tl-h { margin: 18px 0 6px; }
.crm-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.crm-timeline::before { content: ''; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.crm-act { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.crm-act-ic { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--brand-text); z-index: 1; }
.crm-act.task .crm-act-ic { color: var(--warn); }
.crm-act.event .crm-act-ic { color: var(--muted); width: 32px; background: var(--surface-2); }
.crm-by { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; color: var(--text-2); }
.crm-by .ic { flex: none; }
.crm-act.event strong { font-weight: 500; color: var(--text-2); font-size: 13px; }
.crm-act .grow { flex: 1; min-width: 0; }
.crm-act-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.crm-act-head strong { font-size: 14px; }
.crm-act.done:not(.event):not(.note) .crm-act-head strong { color: var(--muted); }
.crm-act p { margin: 4px 0; color: var(--text-2); }
.crm-act small { font-size: 12px; }

/* Bid checklist */
.crm-checklist { list-style: none; margin: 0; padding: 0; }
.crm-checklist li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.crm-checklist li:first-child { border-top: 0; }
.crm-checklist label { display: flex; gap: 10px; align-items: flex-start; flex: 1; cursor: pointer; font-size: 14px; }
.crm-checklist input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--success); flex: none; }
.crm-checklist li.done label span { color: var(--muted); text-decoration: line-through; }
.crm-checklist .icon-btn { opacity: 0.5; }
.crm-checklist li:hover .icon-btn { opacity: 1; }
.crm-add-item { display: flex; gap: 8px; margin-top: 12px; }
.crm-docs { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.crm-docs .progress { width: 60px; }

.crm-stage-table input { width: 100%; }
.crm-stage-table td.num input { width: 90px; text-align: right; }

@media (max-width: 960px) {
  .crm-search, .crm-search input { width: 100%; }
  .crm-funnel-row { grid-template-columns: 110px minmax(0, 1fr) 84px; gap: 10px; }
  .crm-board { grid-auto-columns: minmax(240px, 82vw); scroll-snap-type: x mandatory; }
  .crm-col { scroll-snap-align: start; max-height: none; }
  .sys-grid.two-by-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .sys-grid.two-by-two { grid-template-columns: 1fr; }
  .crm-composer-foot .btn { flex: 1 1 100%; }
  .crm-path button { padding: 9px 14px 9px 20px; font-size: 12.5px; }
}
.stats .card > span.muted, .stats .card > span.small, .stats .card > .crm-due { display: block; margin-top: 4px; }
.stats .card > .progress { display: block; margin-top: 10px; }
.crm-board { grid-auto-flow: unset; grid-template-columns: repeat(var(--cols, 4), minmax(176px, 1fr)); scrollbar-width: thin; }
.crm-closed-note { margin: 4px 0 0; }
.crm-closed-note .ic { vertical-align: -2px; margin-right: 4px; }
.crm-dropbar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 70; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(560px, calc(100vw - 32px)); }
.crm-drop { display: flex; align-items: center; justify-content: center; gap: 8px; height: 76px; border-radius: 14px; font-weight: 800; font-size: 16px; border: 2px dashed; background: var(--surface); box-shadow: var(--shadow-lg); transition: transform 0.12s, background 0.12s; }
.crm-drop.won { color: var(--success); border-color: var(--success); }
.crm-drop.lost { color: var(--danger); border-color: var(--danger); }
.crm-drop.over { transform: scale(1.04); }
.crm-drop.won.over { background: var(--success-soft); }
.crm-drop.lost.over { background: var(--danger-soft); }
@media (max-width: 960px) {
  .crm-board { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(240px, 82vw); }
}
@media (max-width: 760px) {
  .crm-checklist li { flex-wrap: wrap; }
  .crm-checklist li > small { order: 3; width: 100%; padding-left: 28px; margin-top: -4px; }
  .crm-act-head strong { flex-basis: 100%; order: -1; }
}

/* ===== Requests and approvals ===== */
.appr-trail { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.appr-trail li { display: flex; gap: 12px; padding: 8px 0; position: relative; }
.appr-trail li + li::before { content: ''; position: absolute; left: 13px; top: -8px; height: 16px; width: 2px; background: var(--border); }
.appr-trail strong { display: block; font-size: 14px; }
.appr-trail small { display: block; margin-top: 3px; font-size: 12px; }
.appr-dot { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.appr-trail li.pending .appr-dot { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.appr-trail li.approved .appr-dot { background: var(--success-soft); color: var(--success); border-color: transparent; }
.appr-trail li.rejected .appr-dot { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.appr-trail li.returned .appr-dot { background: var(--info-soft); color: var(--info); border-color: transparent; }
.appr-trail li.skipped { opacity: 0.65; }
.req-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.req-detail h3 { margin-top: 0; }
.req-detail p { margin: 0 0 10px; }
.req-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.req-days { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.req-days li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 7px 12px; font-size: 13.5px; }
.req-days li + li { border-top: 1px solid var(--border); }
.req-days.edit select { width: auto; min-width: 120px; padding-block: 5px; }
.req-days.edit { max-height: 260px; overflow-y: auto; }
.req-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.req-sum strong { font-size: 18px; }
.req-route { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.req-route-step { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.req-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.req-history li { display: flex; flex-direction: column; font-size: 13.5px; }
.req-actions { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.appr-table th.check, .appr-table td.check { width: 36px; }
.appr-table input[type=checkbox], .flow-people input { width: 18px; height: 18px; accent-color: var(--brand); }
.flow-choice { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.flow-levels { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 10px; }
.flow-levels li { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.flow-levels select { max-width: 320px; }
/* Phones: the level's number and its remove button on top, the approver picker across the card under them. */
@media (max-width: 760px) {
  .flow-levels li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; }
  .flow-levels li > .grow { grid-column: 1 / -1; grid-row: 2; }
  .flow-levels li > .icon-btn { grid-column: 3; grid-row: 1; }
  .flow-levels select { width: 100%; max-width: none; }
}
.flow-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 6px 14px; margin-top: 10px; }
@media (max-width: 760px) {
  .req-detail { grid-template-columns: minmax(0, 1fr); }
  .req-days li { grid-template-columns: 1fr auto; }
  .req-days li > :last-child:not(:nth-child(2)) { grid-column: 1 / -1; justify-self: start; }
}
.table td.row-actions > * + * { margin-left: 10px; }

/* ---------- Holiday and night premiums (Payroll Setup) ---------- */
.field.narrow { max-width: 420px; }
.premium-table { max-width: 640px; margin-bottom: 16px; }
.premium-table { width: 100%; table-layout: fixed; }
.premium-table th:first-child { width: 46%; }
.premium-table .input-suffix { max-width: 140px; }
.premium-table input { min-width: 0; width: 100%; }
.premium-rules { margin-top: 14px; }
@media (max-width: 640px) {
  .premium-table th:first-child { width: 40%; }
  .premium-table td, .premium-table th { padding-left: 3px; padding-right: 3px; }
  .premium-table th { font-size: 12px; }
  .premium-table .input-suffix input { padding-left: 8px; padding-right: 2px; }
  .premium-table .input-suffix em { padding: 0 6px 0 0; }
}

/* ---------- Year to date and audit log (0.11) ---------- */
.section-title { font-size: 15px; margin: 4px 0 10px; }
.audit-changes { margin: 4px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.audit-changes li { overflow-wrap: anywhere; }
.audit-changes b { color: var(--text); font-weight: 600; }
.audit-table td { vertical-align: top; }
.audit-table td:first-child { white-space: nowrap; }
.ytd-table td, .ytd-table th { white-space: nowrap; }

/* Phones: the stage bar wraps so Won and Lost are always on screen; setup stage names stay readable;
   the tabs fit. */
@media (max-width: 640px) {
  .crm-path { flex-wrap: wrap; overflow: visible; row-gap: 6px; }
  .crm-path button { flex: 1 1 auto; padding: 9px 14px 9px 18px; }
  .crm-path-break { display: block; flex-basis: 100%; height: 0; }
  .crm-path button.won, .crm-path button.lost { flex: 1 1 40%; clip-path: none; border-radius: 8px; border: 1px solid var(--border); padding: 9px 14px; }
  .crm-stage-table { table-layout: fixed; width: 100%; }
  .crm-stage-table th:nth-child(2) { width: 64px; white-space: normal; }
  .crm-stage-table th:nth-child(3) { width: 96px; }
  .crm-stage-table th, .crm-stage-table td { padding-left: 4px; padding-right: 4px; }
  .crm-stage-table td.num input { width: 100%; padding-left: 4px; padding-right: 4px; text-align: center; }
  .crm-stage-table td.row-actions { white-space: nowrap; display: table-cell; }
  .crm-stage-table .row-actions .icon-btn { width: 28px; height: 30px; margin: 0; padding: 0; display: inline-grid; place-items: center; }
  .tabs a { padding: 10px 9px; }
}

/* Leave type: the medical certificate rules */
.cert-rules { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 0; gap: 10px; }
.cert-rules legend { font-weight: 600; font-size: 13px; color: var(--text-2); padding: 0 6px; }
.cert-rules > p { margin: 0; }
.inline-pair { display: flex; gap: 8px; }
.inline-pair input { flex: 1 1 80px; min-width: 0; }
.inline-pair select { flex: 0 1 auto; width: auto; }

/* 2-step verification: setting up the authenticator app, recovery codes */
.modal .tfa-step .actions { justify-content: flex-end; }
.tfa-step { display: flex; flex-direction: column; gap: 12px; }
.tfa-step > p { margin: 0; }
.tfa-steps { margin: 0; padding-left: 20px; }
.tfa-qr { align-self: center; width: 208px; height: 208px; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tfa-qr svg { display: block; width: 100%; height: 100%; }
.tfa-key { font-size: 13px; letter-spacing: 0.06em; word-break: break-all; }
.recovery { display: flex; flex-direction: column; gap: 10px; }
.recovery > p { margin: 0; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 20px; margin: 0; padding: 12px 16px 12px 36px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.recovery-codes code { font-size: 14px; letter-spacing: 0.05em; }
.recovery .check { display: flex; gap: 8px; align-items: center; }
.recovery .check input { width: 16px; height: 16px; }
.auth-card .tfa-box .actions { justify-content: flex-end; }

/* ===== Project Management (MOD-05) ===== */
:root { --pm-teal: #0f766e; --pm-violet: #6d28d9; }
:root[data-theme='dark'] { --pm-teal: #2dd4bf; --pm-violet: #a78bfa; }
.pm-c-gray { --c: var(--muted); }
.pm-c-blue { --c: var(--info); }
.pm-c-teal { --c: var(--pm-teal); }
.pm-c-amber { --c: var(--warn); }
.pm-c-violet { --c: var(--pm-violet); }
.pm-c-green { --c: var(--success); }
.pm-c-red { --c: var(--danger); }
/* A status: a coloured dot and its name. Health: a shape, a word and a colour. */
.pm-st { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.pm-st i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.pm-health { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1.5; }
.pm-health i { width: 10px; height: 10px; flex: none; }
.pm-health.green { background: var(--success-soft); color: var(--success); }
.pm-health.green i { border-radius: 50%; background: currentColor; }
.pm-health.amber { background: var(--warn-soft); color: var(--warn); }
.pm-health.amber i { background: currentColor; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.pm-health.red { background: var(--danger-soft); color: var(--danger); }
.pm-health.red i { background: currentColor; border-radius: 2px; }
.pm-progress { display: inline-flex; align-items: center; gap: 8px; min-width: 110px; }
.pm-progress .progress { flex: 1; min-width: 60px; }
.pm-progress b { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pm-diamond { display: inline-block; width: 10px; height: 10px; transform: rotate(45deg); background: var(--brand-text); margin: 0 8px 1px 2px; flex: none; border-radius: 1px; }
.pm-diamond.deliverable { background: var(--accent); }
.pm-nobody { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--border-strong); }
.pm-tabs { margin-top: -6px; }
.pm-tabs a .ic { vertical-align: -3px; }
.pm-portfolio td small .mono { font-size: 1em; }

/* Overview: health line, milestone strip, activity */
.pm-healthbar { display: flex; flex-wrap: wrap; gap: 14px 32px; align-items: center; padding: 14px 20px; margin-bottom: 16px; }
.pm-healthbar > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pm-healthbar .btn { margin-left: auto; }
.pm-health-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.pm-ms-strip { list-style: none; margin: 0; padding: 2px 2px 8px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; }
.pm-ms { border: 1px solid var(--border); border-top: 4px solid var(--border-strong); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); scroll-snap-align: start; min-width: 0; }
.pm-ms.green { border-top-color: var(--success); }
.pm-ms.amber { border-top-color: var(--warn); }
.pm-ms.red { border-top-color: var(--danger); }
.pm-ms-top { display: flex; align-items: flex-start; gap: 4px; }
.pm-ms-top strong { flex: 1; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.pm-ms-top .pm-diamond { margin-top: 5px; }
.pm-ms-top .icon-btn { margin: -6px -8px 0 0; }
.pm-ms-foot { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-ms-why { color: var(--text-2); font-size: 12px; }
.pm-activity li { align-items: flex-start; }
.pm-activity .grow { font-size: 13px; overflow-wrap: anywhere; }
.pm-activity small { margin-top: 2px; }
.pm-members select { width: auto; min-width: 120px; }
.pm-add-member { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.pm-add-member select { flex: 1 1 180px; width: auto; }

/* Board */
.pm-board { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; scrollbar-width: thin; }
.pm-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 220px; max-height: calc(100vh - 250px); transition: border-color 0.15s, background 0.15s; min-width: 0; }
.pm-col > header { padding: 11px 14px 9px; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; border-top: 4px solid var(--c, var(--brand-line)); border-radius: var(--radius) var(--radius) 0 0; }
.pm-col > header strong { font-size: 14px; flex: 1; min-width: 0; }
.pm-col-count { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; }
.pm-col-count.over { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--surface)); background: var(--danger-soft); }
.pm-col > header small { flex-basis: 100%; }
.pm-col.over { border-color: var(--brand); background: var(--brand-softer); }
.pm-quick { padding: 8px 10px 0; }
.pm-quick input { padding: 7px 10px; font-size: 13px; background: var(--surface); border-style: dashed; }
.pm-quick input:focus { border-style: solid; }
.pm-col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; min-height: 60px; }
.pm-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 10px 10px 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 5px; cursor: grab; }
.pm-card[draggable='false'] { cursor: default; }
.pm-card:hover { border-color: var(--brand-line); }
/* Overdue shows in the card's red due date; the column already says the status. */
.pm-card.dragging { opacity: 0.45; }
.pm-card-top { display: flex; align-items: center; gap: 6px; min-height: 22px; }
.pm-card-top { flex-wrap: wrap; }
.pm-card-top .mono { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.pm-card-top .badge { font-size: 11px; padding: 0 7px; }
.pm-move-btn { margin: -6px -6px -6px auto; padding: 4px; }
.pm-card-title { font-weight: 700; color: var(--text); font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; }
.pm-card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 3px; }
.pm-meta { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.pm-blocked { font-size: 11.5px; color: var(--warn); font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.pm-drop-line { height: 3px; border-radius: 2px; background: var(--brand); margin: -2px 0; }
.pm-move-pop { position: fixed; right: auto; top: 0; left: 0; min-width: 210px; z-index: 65; }
.pm-move-pop button:disabled { cursor: default; opacity: 0.7; }
.pm-move-pop small { margin-left: auto; }
.pm-board-note { margin: 4px 0 0; }
.pm-board-note .ic { vertical-align: -3px; }
.pm-status-table input, .pm-status-table select { min-width: 0; }
.pm-status-table td.num input { width: 80px; text-align: right; }
.pm-status-table .row-actions { white-space: nowrap; }

/* List */
.pm-list td { vertical-align: middle; }
.pm-list select, .pm-list input[type='date'] { width: auto; min-width: 0; max-width: 190px; padding: 5px 8px; font-size: 13px; }
.pm-list input.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--surface)); }
.pm-list tr.pm-group th { background: var(--surface); text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--text); padding-top: 16px; border-bottom: 2px solid var(--border); }
.pm-list tbody + tbody tr.pm-group th { border-top: 1px solid var(--border); }
.pm-list tr.pm-sub td:first-child { padding-left: 36px; position: relative; }
.pm-list tr.pm-sub td:first-child::before { content: ''; position: absolute; left: 20px; top: 0; bottom: 50%; width: 10px; border-left: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); }
.pm-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; font-weight: 700; }
.pm-sort.on, .pm-sort:hover { color: var(--text); }

/* Timeline: a column per day, built with CSS grid */
.pm-tl-card { padding: 16px; }
.pm-tl-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; }
.pm-tl-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.pm-tl-swatch { width: 18px; height: 8px; border-radius: 4px; display: inline-block; }
.pm-tl-swatch.off { background: var(--surface-2); border: 1px solid var(--border); height: 12px; border-radius: 2px; }
.pm-tl-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); scrollbar-width: thin; }
.pm-tl { --label: 240px; --day: 20px; --row: 34px; position: relative; width: calc(var(--label) + var(--days) * var(--day)); }
.pm-tl-bg { position: absolute; top: 0; bottom: 0; left: var(--label); width: calc(var(--days) * var(--day)); display: grid; grid-template-columns: repeat(var(--days), var(--day)); pointer-events: none; }
.pm-tl-bg i { grid-row: 1; background: var(--surface-2); border-inline: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
.pm-tl-today { grid-row: 1; width: 2px; justify-self: center; background: var(--danger); z-index: 1; }
.pm-tl-row { display: flex; height: var(--row); border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); position: relative; }
.pm-tl-row.head { height: 40px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 3; }
.pm-tl-row.ms { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.pm-tl-label { position: sticky; left: 0; z-index: 2; flex: none; width: var(--label); display: flex; flex-direction: column; justify-content: center; padding: 0 12px; background: var(--surface); border-right: 1px solid var(--border); min-width: 0; }
.pm-tl-row.ms .pm-tl-label { background: var(--surface-2); }
.pm-tl-label a, .pm-tl-label strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; color: var(--text); }
.pm-tl-label small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-tl-row.sub .pm-tl-label { padding-left: 26px; }
/* Touch: 44 px rows, and the whole label cell (title and key) opens the task. */
@media (pointer: coarse) {
  .pm-tl { --row: 44px; }
  .pm-tl-label > a::after { content: ''; position: absolute; inset: 0; }
}
.pm-tl-track { flex: none; width: calc(var(--days) * var(--day)); display: grid; grid-template-columns: repeat(var(--days), var(--day)); align-items: center; position: relative; z-index: 1; }
.pm-tl-track.weeks span { grid-row: 1; border-left: 1px solid var(--border); padding: 0 6px; font-size: 11.5px; white-space: nowrap; overflow: hidden; align-self: stretch; display: flex; align-items: center; gap: 4px; }
.pm-tl-track.weeks small { color: var(--muted); }
.pm-tl-bar, .pm-tl-swatch { background: var(--border-strong); }
.pm-tl-bar { grid-row: 1; height: 14px; border-radius: 7px; min-width: 6px; }
.pm-tl-dot { grid-row: 1; justify-self: center; width: 12px; height: 12px; border-radius: 50%; background: var(--border-strong); }
.cat-todo.pm-tl-bar, .cat-todo.pm-tl-dot, .pm-tl-swatch.cat-todo { background: color-mix(in srgb, var(--muted) 45%, var(--surface)); }
.cat-active.pm-tl-bar, .cat-active.pm-tl-dot, .pm-tl-swatch.cat-active { background: var(--info); }
.cat-done.pm-tl-bar, .cat-done.pm-tl-dot, .pm-tl-swatch.cat-done { background: var(--success); }
.cat-cancelled.pm-tl-bar, .cat-cancelled.pm-tl-dot { background: repeating-linear-gradient(45deg, var(--border-strong) 0 4px, transparent 4px 8px); }
.pm-tl-bar.late, .pm-tl-dot.late, .pm-tl-swatch.late { box-shadow: 0 0 0 2px var(--danger); }
.pm-tl-swatch.late { background: var(--surface); }
.pm-tl-ms { grid-row: 1; justify-self: center; width: 14px; height: 14px; transform: rotate(45deg); background: var(--brand-text); border-radius: 2px; box-shadow: 0 0 0 2px var(--surface); }
.pm-tl-ms.deliverable { background: var(--accent); }
.pm-tl-ms.red { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--danger); }
.pm-tl-list { display: none; list-style: none; margin: 0; padding: 0; }
.pm-tl-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.pm-tl-list li:first-child { border-top: 0; }
.pm-tl-list li.ms { background: var(--surface-2); margin: 0 -16px; padding: 10px 16px; }
.pm-tl-list .grow { flex: 1; min-width: 0; }
.pm-tl-list strong { font-size: 14px; overflow-wrap: anywhere; }
.pm-tl-list small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.pm-tl-date { flex: none; width: 56px; font-weight: 700; font-size: 13px; color: var(--text-2); }

/* Task page */
.pm-task { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); gap: 16px; align-items: start; }
.pm-task > .stack { margin: 0; }
.pm-comments { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 12px; }
.pm-comment { display: flex; gap: 10px; }
.pm-comment .avatar { margin-top: 2px; }
.pm-comment .grow { flex: 1; min-width: 0; }
.pm-comment .icon-btn { padding: 2px; margin-left: 4px; vertical-align: middle; }
.pm-comment p { margin: 3px 0 0; color: var(--text-2); overflow-wrap: anywhere; }
.pm-mention { background: var(--brand-soft); color: var(--brand-text); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.pm-composer { display: flex; flex-direction: column; gap: 8px; }
.pm-composer textarea { min-height: 72px; }
/* Comments: written in the same editor as descriptions (smaller), shown formatted */
.pm-composer .rich-ed { margin: 0; }
.pm-composer .rich-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wys-compact .wys-area { min-height: 84px; max-height: 40vh; }
.pm-comment .rich.pm-comment-body { margin-top: 3px; color: var(--text-2); font-size: 14px; }
.pm-comment .pm-comment-body > * { margin-bottom: 8px; }
.pm-comment .pm-comment-body > :last-child { margin-bottom: 0; }
.pm-comment .pm-comment-body p { margin-top: 0; }
.wys-slash-item strong + small { font-family: inherit; }
.pm-history { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.pm-history small { display: block; }
details > summary h2 { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
details > summary { cursor: pointer; }
.pm-log-mini { display: grid; grid-template-columns: 1fr 76px; gap: 8px; margin-top: 10px; }
.pm-log-mini input[name='note'] { grid-column: 1; }
.pm-log-mini .btn { grid-column: 2; }

/* My work */
.pm-mywork li { flex-wrap: wrap; }
.pm-mywork select { width: auto; max-width: 180px; padding: 5px 8px; font-size: 13px; }
.pm-mywork.overdue { border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }

/* Effort sizes: the letters in a small box, the same everywhere (not a colour code). */
.pm-size { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 20px; padding: 0 5px; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface-2); color: var(--text-2); font-size: 11px; font-weight: 800; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.pm-size-none { border-style: dashed; color: var(--muted); }
.pm-list select.pm-size-select { max-width: 132px; }
.pm-size-cell small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; margin-top: 2px; }
.pm-size-table td input { min-width: 110px; width: 100%; }
.pm-track .check { display: flex; align-items: center; gap: 8px; min-height: 32px; font-weight: 600; }
.pm-track .hint { display: block; margin-top: 2px; }
.progress.over i { background: var(--danger); }

/* Timesheet */
.pm-ts-bar { align-items: center; }
.pm-ts-bar .btn { min-height: 44px; }
.pm-ts-range { font-size: 15px; white-space: nowrap; }
.pm-ts-who select { width: auto; min-width: 0; max-width: 260px; }
.pm-ts-card { padding: 0; }
.pm-ts-scroll { border-radius: var(--radius); }
.pm-ts { min-width: 760px; }
.pm-ts th, .pm-ts td { vertical-align: middle; }
.pm-ts thead th small { display: block; font-weight: 500; text-transform: none; letter-spacing: 0; }
.pm-ts thead th.pm-ts-today { color: var(--brand-text); box-shadow: inset 0 -3px 0 var(--brand); }
.pm-ts tbody th, .pm-ts tfoot th { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--text); min-width: 210px; max-width: 280px; white-space: normal; }
.pm-ts-proj { display: block; font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.pm-ts tbody th select { width: 100%; margin-top: 4px; padding: 5px 8px; font-size: 13px; min-height: 36px; }
.pm-ts tbody th small { display: block; font-weight: 500; font-size: 11.5px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-ts-task { display: block; font-weight: 500; margin-top: 2px; }
.pm-ts td input { width: 64px; min-height: 44px; padding: 6px; text-align: right; font-variant-numeric: tabular-nums; }
.pm-ts td input:disabled { background: var(--surface-2); color: var(--muted); }
.pm-ts tbody + tbody tr:first-child th, .pm-ts tbody + tbody tr:first-child td { border-top: 2px solid var(--border); }
.pm-ts-add td { padding-top: 2px; padding-bottom: 8px; }
.pm-ts-add .link { min-height: 36px; display: inline-flex; align-items: center; gap: 4px; }
.pm-ts tfoot td, .pm-ts tfoot th { border-top: 2px solid var(--border-strong); background: var(--surface); }
.pm-ts-total td.bad b { color: var(--danger); }
.pm-ts tfoot .pm-ts-dtr th, .pm-ts tfoot .pm-ts-dtr td { color: var(--text-2); background: var(--surface-2); font-weight: 500; border-top: 1px dashed var(--border-strong); }
.pm-ts-dtr th small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.pm-ts-over { display: inline-flex; margin-left: 4px; color: var(--warn); vertical-align: -1px; }
.pm-ts-save { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin: 12px 0 0; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.06); }
.pm-ts-save .btn { min-height: 44px; }
.pm-ts-note { margin: 12px 0 0; max-width: 900px; }
.pm-ts-note .ic { vertical-align: -2px; }
.pm-bu-unit { writing-mode: vertical-rl; transform: rotate(180deg); align-self: center; font-size: 11px; }
@media (max-width: 760px) {
  .pm-hide-phone { display: none; }
  .pm-ts-range { order: -1; flex: 1 1 100%; }
  .pm-ts-who { flex: 1 1 100%; }
  .pm-ts-who select { max-width: none; flex: 1; }
  .pm-ts tbody th, .pm-ts tfoot th { min-width: 150px; max-width: 170px; }
  .pm-ts td input { width: 58px; }
}

/* Quick filters, search and saved views (Board and List) */
.pm-filterbar input[type='search'] { flex: 1 1 200px; min-width: 0; max-width: 320px; }
.pm-chips { margin: 0 0 12px; }
.pm-chips .chip { min-height: 36px; }
.pm-chips-row { padding: 12px 16px 0; }
.pm-chips-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 12px; }
.pm-chips-line .pm-chips { margin: 0; }
.pm-chips-row .pm-chips { margin: 0; }
.pm-views-btn { gap: 6px; max-width: 260px; }
.pm-views-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-pop { position: fixed; right: auto; top: 0; left: 0; min-width: 230px; max-width: min(360px, calc(100vw - 16px)); z-index: 65; }
.pm-pop button small { display: block; font-size: 12px; }
.pm-pop button:disabled { cursor: default; opacity: 0.7; }
.pm-radio { border: 0; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; }
.pm-radio legend { font-weight: 600; font-size: 13px; color: var(--text-2); margin-bottom: 4px; padding: 0; }
.pm-radio .check { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.pm-list td.num small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; }
@media (max-width: 760px) { .pm-list td.num small { display: inline; margin-left: 6px; } .pm-list td.num small::before { content: '· '; } }

/* The task page's details */
.hd-props > .hint { display: block; margin: -6px 0 10px; color: var(--muted); font-size: 12px; }

/* Templates */
.pm-tpl-notice { margin-bottom: 16px; }
.pm-tpl-note { margin: 0; }
.pm-templates .row-actions { text-align: right; }

/* Milestone burn-up: an inline SVG with HTML labels around it */
.pm-burnup .card-head select { width: auto; max-width: min(320px, 60%); }
.pm-bu { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 220px auto; gap: 4px 8px; }
.pm-bu-y { display: flex; flex-direction: column; justify-content: space-between; font-size: 11.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.pm-bu-plot { position: relative; border-left: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); min-width: 0; }
.pm-bu-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.pm-bu-plot polyline, .pm-bu-plot line { fill: none; vector-effect: non-scaling-stroke; }
.pm-bu-grid { stroke: var(--border); stroke-width: 1; }
.pm-bu-scope { stroke: var(--text-2); stroke-width: 2; }
.pm-bu-done { stroke: var(--success); stroke-width: 3; }
.pm-bu-expected { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 4; }
.pm-bu-today { stroke: var(--danger); stroke-width: 1.5; }
.pm-bu-due { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.pm-bu-mark { position: absolute; bottom: 4px; transform: translateX(4px); font-size: 11px; font-weight: 700; color: var(--danger); background: var(--surface); padding: 0 3px; border-radius: 3px; white-space: nowrap; }
.pm-bu-x { grid-column: 2; position: relative; display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); min-height: 18px; }
.pm-bu-duelabel { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.pm-bu-legend { list-style: none; margin: 12px 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); }
.pm-bu-legend li { display: inline-flex; align-items: center; gap: 6px; }
.pm-bu-legend i { display: inline-block; width: 20px; height: 0; border-top: 2px solid; }
.pm-bu-legend i.scope { border-color: var(--text-2); }
.pm-bu-legend i.done { border-top-width: 3px; border-color: var(--success); }
.pm-bu-legend i.expected { border-top-style: dashed; border-color: var(--accent); }
.pm-bu-legend i.today { width: 2px; height: 14px; border: 0; background: var(--danger); }
.pm-bu-text { margin: 4px 0; }

/* For you (My work) */
.pm-notes { list-style: none; margin: 0; padding: 0; }
.pm-note { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.pm-note:first-child { border-top: 0; padding-top: 2px; }
.pm-note .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pm-note a { color: var(--text-2); }
.pm-note small { display: block; color: var(--muted); margin-top: 2px; }
.pm-note.unread a { color: var(--text); font-weight: 700; }
.pm-note-ic { flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--muted); }
.pm-note.unread .pm-note-ic { background: var(--brand-soft); color: var(--brand-text); }
.pm-note-read { flex: none; }
.pm-notes-more { margin: 8px 0 0; }
.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; }

/* Touch targets */
@media (pointer: coarse) {
  .pm-move-btn { min-width: 44px; min-height: 44px; margin: -14px -8px -5px auto; } /* ends at the top row: clear of the title */
  .pm-move-pop button, .pm-pop button { min-height: 44px; }
  .pm-chips .chip, .pm-views-btn, .pm-note-read { min-height: 44px; }
  .pm-note-read { min-width: 44px; }
}
@media (max-width: 760px) {
  .pm-chips .chip { min-height: 44px; flex: none; }
  /* One row of chips that scrolls sideways, so the board stays in view. */
  .pm-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -2px; padding: 2px; max-width: 100%; }
  .pm-chips-line { flex-wrap: nowrap; flex-direction: column; align-items: stretch; }
  .pm-filterbar input[type='search'] { max-width: none; flex-basis: 100%; }
  .pm-bu { grid-template-rows: 170px auto; }
  .pm-burnup .card-head { flex-wrap: wrap; }
  .pm-burnup .card-head select { max-width: 100%; flex: 1 1 100%; }
}
@media (max-width: 960px) {
  .pm-board { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(250px, 84vw); scroll-snap-type: x mandatory; }
  .pm-col { scroll-snap-align: start; max-height: none; }
  .pm-task { grid-template-columns: minmax(0, 1fr); }
  .pm-healthbar .btn { margin-left: 0; }
}
@media (max-width: 640px) {
  .pm-tabs a { padding: 10px 9px; }
  .pm-tabs a .ic { display: none; }
}
@media (max-width: 760px) {
  .pm-tl-scroll, .pm-tl-legend { display: none; }
  .pm-tl-list { display: block; }
  .pm-ms-strip { grid-auto-columns: minmax(220px, 82vw); }
  .pm-list tr.pm-group { display: block; }
  .pm-list tr.pm-group th { display: block; padding: 14px 0 6px; border: 0; white-space: normal; }
  .pm-list tr.pm-sub td:first-child { padding-left: 16px; }
  .pm-list tr.pm-sub td:first-child::before { left: 2px; }
  .pm-list select, .pm-list input[type='date'] { max-width: 60%; }
  .pm-mywork select { max-width: none; flex: 1 1 100%; }
}

/* Print status report: only the report, on one page. */
.pm-report { display: none; }
@media print {
  body.pm-printing > *:not(.pm-report) { display: none !important; }
  body.pm-printing .pm-report { display: block; color: #000; font-size: 11px; line-height: 1.35; }
  .pm-report header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid #5d0013; padding-bottom: 8px; margin-bottom: 10px; }
  .pm-report h1 { font-size: 18px; margin: 0; color: #000; display: block; }
  .pm-report header p { margin: 2px 0 0; }
  .pm-r-date { text-align: right; font-weight: 600; }
  .pm-r-head { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 8px; }
  .pm-r-head > div { border: 1px solid #ccc; border-radius: 6px; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
  .pm-r-head small { color: #555; text-transform: uppercase; font-size: 9px; letter-spacing: 0.06em; }
  .pm-r-head strong { font-size: 14px; }
  .pm-report h2 { font-size: 12px; margin: 10px 0 4px; color: #000; }
  .pm-report table { width: 100%; border-collapse: collapse; }
  .pm-report th, .pm-report td { text-align: left; padding: 3px 6px; border-bottom: 1px solid #ddd; vertical-align: top; }
  .pm-report footer { margin-top: 12px; color: #555; font-size: 9px; }
  @page { margin: 14mm; }
}
.pm-after-table { margin-top: 14px; }
.pm-phone-only { display: none; }
@media (max-width: 760px) { .toolbar > .pm-phone-only { display: block; } }
.pm-sort.asc::after { content: ' ▲'; }
.pm-sort.desc::after { content: ' ▼'; }

/* ----- Project Management 0.15: files, watchers, bulk edit, import, milestones, digest ----- */
.pm-files { list-style: none; margin: 0 0 10px; padding: 0; }
.pm-files li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.pm-files li:first-child { border-top: 0; padding-top: 0; }
.pm-files .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pm-files small { display: block; color: var(--muted); font-size: 12px; }
.pm-file-ic { flex: none; width: 30px; height: 30px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-2); }
.pm-file-add { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.pm-file-add label.btn { position: relative; }
.pm-file-add label.btn:focus-within { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.pm-file-add label.btn.busy { opacity: 0.6; cursor: progress; }
.crm-doc-count { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; color: var(--muted); font-size: 12px; font-weight: 500; }
.pm-ms-files { align-self: flex-start; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.pm-watch .pm-watch-n { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12px; line-height: 20px; text-align: center; }
.pm-watch.on { border-color: var(--brand); color: var(--brand-text); background: var(--brand-softer); }
.pm-watch.on .pm-watch-n { background: var(--brand-soft); color: var(--brand-text); }
.pm-watchers { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pm-watchers li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
/* The List: selection and the bulk bar, which stays at the bottom of the window while tasks are selected. */
.pm-list .pm-sel { width: 18px; height: 18px; margin: 0 10px 0 0; vertical-align: -3px; cursor: pointer; accent-color: var(--brand); }
.pm-list tr.pm-selected td { background: var(--brand-softer); }
.pm-selall { padding-top: 10px; padding-bottom: 0; }
.pm-selall .check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; min-height: 32px; cursor: pointer; }
.pm-selall input { width: 18px; height: 18px; accent-color: var(--brand); }
.pm-bulk { position: sticky; bottom: 0; z-index: 20; margin-top: 12px; }
.pm-bulk-in { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.12); }
.pm-bulk-count { white-space: nowrap; }
.pm-bulk-actions { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
/* Import */
.pm-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 14px; padding: 0; counter-reset: step; font-size: 13px; color: var(--muted); }
.pm-steps li { counter-increment: step; display: inline-flex; align-items: center; gap: 6px; }
.pm-steps li::before { content: counter(step); width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border-strong); font-size: 12px; font-weight: 700; }
.pm-steps li.on { color: var(--text); font-weight: 700; }
.pm-steps li.on::before { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.pm-imp-map { margin-bottom: 8px; }
.pm-imp-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.pm-imp-sample td, .pm-imp-sample th { font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-imp-rows td { vertical-align: top; }
.pm-imp-msg { display: block; font-size: 13px; }
.pm-imp-msg.bad { color: var(--danger); }
/* Milestones across projects and the forecast */
.pm-milestones td .pm-diamond { margin-right: 6px; }
.pm-milestones tr.pm-late td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.pm-forecast-table td.bad { color: var(--danger); font-weight: 600; }
.pm-forecast-table tr.pm-this-month td { background: var(--brand-softer); }
/* My work: the daily digest */
.pm-digest .card-head { flex-wrap: wrap; gap: 6px 16px; }
.pm-digest-pref { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; min-height: 32px; cursor: pointer; }
.pm-digest-pref input { width: 18px; height: 18px; accent-color: var(--brand); }
.pm-digest-sum { list-style: none; margin: 4px 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pm-digest-sum li { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; font-size: 13px; color: var(--text-2); }
.pm-digest-sum li strong { font-size: 16px; color: var(--text); margin-right: 4px; }
.pm-digest-sum li.is-bad strong { color: var(--danger); }
.pm-digest-sum li.is-warn strong { color: var(--warn); }
.pm-digest-more summary { cursor: pointer; font-weight: 600; font-size: 14px; min-height: 32px; display: flex; align-items: center; gap: 6px; list-style: none; }
.pm-digest-more summary::-webkit-details-marker { display: none; }
.pm-digest-more summary::before { content: '▸'; color: var(--muted); }
.pm-digest-more[open] summary::before { content: '▾'; }
.pm-digest-more h3 { font-size: 14px; margin: 12px 0 4px; }
.pm-digest-list { list-style: none; margin: 0; padding: 0; }
.pm-digest-list li { padding: 5px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.pm-digest-list li:first-child { border-top: 0; }
.pm-digest-list small { display: block; color: var(--muted); font-size: 12px; }
@media (pointer: coarse) {
  .pm-bulk .btn, .pm-watch, .pm-file-add .btn, .pm-ms-files { min-height: 44px; }
  .pm-files .icon-btn { min-width: 44px; min-height: 44px; }
  .pm-list .pm-sel, .pm-selall input, .pm-digest-pref input { width: 22px; height: 22px; }
  .pm-selall .check, .pm-digest-pref, .pm-digest-more summary { min-height: 44px; }
}
@media (max-width: 760px) {
  .pm-bulk { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; }
  .card:has(+ .pm-bulk:not([hidden])) { margin-bottom: 84px; }
  body:has(.pm-bulk:not([hidden])) #toast { bottom: 84px; }
  .pm-bulk-in { border-radius: 0; border-width: 1px 0 0; flex-wrap: nowrap; overflow-x: auto; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
  .pm-bulk-actions { flex-wrap: nowrap; flex: none; }
  .pm-bulk-in .btn { flex: none; }
  .pm-list .pm-sel { margin-right: 8px; }
  .pm-steps { gap: 4px 10px; }
  .pm-imp-actions { flex-wrap: wrap; }
  .pm-imp-actions .btn { flex: 1 1 auto; }
}

/* ===== Admin panel (0.16): Dashboard, Roles & permissions, Access grants, Settings center, Modules,
   Settings & branding. The Settings center and Roles & permissions styles are ATLAS's. ===== */
.block { display: block; }
.ok-text { color: var(--success); font-weight: 600; }
.bad-text { color: var(--danger); font-weight: 600; }
.ok-text svg, .bad-text svg { vertical-align: -2px; }
.table-scroll { overflow-x: auto; max-width: 100%; }

/* Dashboard */
.dash-section { margin-bottom: 18px; }
.dash-section > .card-head { margin-bottom: 10px; }
.dash-section > .card-head h2, .cols > .card .card-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.dash-sub { margin: 0 0 10px; }
.dash-roles { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.dash-role { padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.dash-role strong { color: var(--brand-text); margin-right: 2px; }
.dash-list { list-style: none; margin: 0; padding: 0; display: grid; }
.dash-list li { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--border); min-height: 44px; flex-wrap: wrap; }
.dash-list li:last-child { border-bottom: 0; }
.dash-list .mod-ic { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-text); }
.stats a.card.attention { border-color: color-mix(in srgb, var(--warn) 45%, var(--surface)); background: var(--warn-soft); }
.stats a.card.attention strong { color: var(--warn); }

/* Launcher: the Admin panel card leads the Administration tiles. */
.admin-panel-card { display: flex; align-items: center; gap: 16px; padding: 18px 20px; margin-bottom: 12px; background: var(--brand-softer); border: 1px solid var(--brand-line); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow); min-height: 44px; }
.admin-panel-card:hover { text-decoration: none; border-color: var(--brand); }
.admin-panel-card .ic-box { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); flex: none; }
.admin-panel-card strong { display: block; font-size: 17px; }
.admin-panel-card small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.admin-panel-card .grow { flex: 1; min-width: 0; }
.admin-panel-card .sys-open { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-text); font-weight: 600; white-space: nowrap; }
.hub-logo { display: block; max-height: 56px; max-width: 220px; object-fit: contain; background: #fff; border-radius: 10px; padding: 6px 10px; margin-bottom: 14px; }
@media (max-width: 600px) {
  .admin-panel-card { align-items: flex-start; }
  .admin-panel-card .sys-open { display: none; }
}

/* Roles & permissions (from ATLAS) */
.roles-matrix tbody th { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); background: none; }
.roles-matrix tbody th code { text-transform: none; letter-spacing: 0; background: none; color: var(--muted); padding: 0; }
.roles-matrix thead th:first-child { min-width: 260px; width: 320px; }
/* The permission names stay in view while a wide table scrolls sideways. */
.roles-matrix tbody th, .roles-matrix thead th:first-child { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--border); }
.roles-matrix tbody th { background: var(--surface); width: 320px; max-width: 320px; white-space: normal; }
.roles-matrix th[scope='row'] { text-align: left; font-weight: 500; min-width: 220px; }
.roles-matrix th[scope='row'] code { font-size: 11.5px; }
.roles-matrix thead th { font-size: 12.5px; white-space: normal; min-width: 92px; text-transform: none; letter-spacing: 0; }
.roles-matrix td.center { vertical-align: middle; }
.perm-box { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 44px; min-height: 44px; cursor: pointer; }
.perm-box input[type='checkbox'] { width: 18px; height: 18px; cursor: pointer; margin: 0; }
.perm-box input:disabled { cursor: not-allowed; }
.perm-default { font-size: 10.5px; color: var(--muted); line-height: 1; }
.perm-changed, .perm-changed-key { background: color-mix(in srgb, var(--warn) 16%, transparent); }
.perm-changed-key { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
.sticky-actions[hidden] { display: none; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; padding: 12px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
@media (max-width: 760px) {
  .roles-matrix thead th:first-child, .roles-matrix tbody th { min-width: 170px; width: 170px; max-width: 170px; }
  .roles-matrix th[scope='row'] { min-width: 170px; }
}

/* Access grants */
.cols.three { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); margin-bottom: 16px; }
.grant-help .card p { margin: 6px 0 0; }
.grant { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grant > span { min-width: 30px; }
.grant select { width: auto; min-width: 150px; min-height: 40px; }
@media (pointer: coarse) { .grant select { min-height: 44px; } }

/* Settings center (from ATLAS) */
details.config-area > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 44px; }
details.config-area > summary::-webkit-details-marker { display: none; }
details.config-area > summary::before { content: ''; width: 8px; height: 8px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform 0.15s; flex: none; }
details.config-area[open] > summary::before { transform: rotate(45deg); }
details.config-area > summary h3 { margin: 0; font-size: 16px; font-weight: 650; text-transform: none; letter-spacing: 0; color: var(--text); }
.module-head { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 14px 0 -4px; }
.module-head:first-child { margin-top: 0; }
details.config-area > summary .area-meta { color: var(--muted); font-size: 13px; }
/* A group's buttons sit beside its heading, outside the <summary> (no buttons inside a button). */
.config-area-wrap { position: relative; }
.config-area-wrap + .config-area-wrap, .module-head + .config-area-wrap { margin-top: 0; }
.area-actions { position: absolute; top: 14px; right: 20px; z-index: 1; display: flex; gap: 8px; }
details.config-area > summary { margin-right: 230px; }
details.config-area[open] > summary { margin-bottom: 12px; }
.check-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; min-height: 44px; }
.check-inline input { width: auto; margin: 0; }
.config-toolbar { align-items: center; }
.config-toolbar input[type='search'] { flex: 1 1 280px; max-width: 420px; }
.config-table td { vertical-align: top; }
.config-table td:first-child { min-width: 240px; }
.config-table small.block { margin-top: 2px; line-height: 1.4; }
.config-value { max-width: 320px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.config-table tr.is-changed td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.config-table .row-actions { white-space: nowrap; }
.history-entry { padding: 14px 18px; }
.history-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.history-head strong { margin-right: 4px; }
.change-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.change-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 14px; overflow-wrap: anywhere; }
.change-label { font-weight: 600; min-width: 200px; }
.change-from { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.change-to { color: var(--text); font-weight: 500; }
.import-area { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px 12px; margin: 0; }
.import-area legend { padding: 0 6px; }
@media (max-width: 720px) {
  .area-actions { position: static; justify-content: flex-end; margin-bottom: -6px; }
  details.config-area > summary { margin-right: 0; }
  .config-table td:first-child { min-width: 0; }
  .config-value { max-width: none; }
  .change-label { min-width: 0; flex-basis: 100%; }
  .history-head { flex-direction: column; }
}
@media (pointer: coarse) {
  .area-actions .btn, .config-table .btn.sm, .history-entry .btn.sm, .grant-table .btn { min-height: 44px; }
  .config-table .btn.ghost { min-width: 44px; }
}

/* Modules */
.module-row td { vertical-align: top; }
.module-row .desc { color: var(--muted); font-size: 13px; max-width: 520px; }
.mod-name { display: inline-flex; align-items: center; gap: 10px; }
.mod-name .mod-ic { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.module-row .switch { min-height: 44px; }

/* Settings & branding (swatches and the logo box from ATLAS) */
fieldset.days-field, fieldset.brand-field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.days-field > legend, fieldset.brand-field > legend { padding: 0; margin-bottom: 6px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; width: 108px; min-height: 44px; text-align: center; font-size: 12px; background: var(--surface); color: var(--text); }
.swatch i { width: 44px; height: 44px; border-radius: 50%; display: block; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.swatch small { font-size: 11px; }
.swatch:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.swatch:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--brand) 40%, transparent); outline-offset: 2px; }
.swatch input[type='radio'] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.brand-custom { margin-top: 14px; align-items: end; }
.color-pair { display: flex; gap: 8px; align-items: center; }
.color-pair input[type='color'] { width: 56px; height: 44px; padding: 2px; flex: none; cursor: pointer; }
.color-pair input:not([type='color']) { max-width: 140px; font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; }
.contrast-note { margin: 0; font-size: 13px; }
.logo-box { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand-custom + .grid { margin-top: 14px; }
.logo-box > div { min-width: 0; flex: 1 1 180px; }
.logo-box img { height: 64px; max-width: 200px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; background: #fff; }
.erase-card { border-color: color-mix(in srgb, var(--danger) 35%, var(--surface)); }

/* The sign-in page follows the brand colour: the ground is mixed from --brand, its gold from --accent. */
.auth-screen { background: color-mix(in srgb, var(--brand) 48%, #000); }
.auth-stage { background: radial-gradient(90% 70% at 15% 10%, color-mix(in srgb, var(--brand) 93%, #fff) 0%, color-mix(in srgb, var(--brand) 62%, #000) 55%, color-mix(in srgb, var(--brand) 48%, #000) 100%); }
.auth-kicker, .auth-modules { color: color-mix(in srgb, var(--accent) 62%, #fff); }
.auth-modules { border-top-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.auth-logo { height: 40px; max-width: 160px; object-fit: contain; margin-left: 8px; padding: 4px 8px; border-radius: 8px; background: #fff; }
:root[data-theme='dark'] .auth-panel input:focus { outline-color: color-mix(in srgb, var(--accent) 62%, #fff); border-color: color-mix(in srgb, var(--accent) 62%, #fff); }
.page-note { margin: 12px 0 0; max-width: 900px; }
@media (min-width: 761px) { .scroll-x > .card-head { padding: 18px 20px 4px; margin: 0; } }
.grant { flex-wrap: nowrap; }
.grant select { min-width: 0; }
@media (max-width: 760px) { .grant { flex-wrap: wrap; } }
:root[data-theme='dark'] .auth-panel { background: color-mix(in srgb, var(--brand) 14%, #141012); }

/* ===== Phones and tablets (0.18) =====
   One place for the phone and tablet rules that every screen shares: a page that never grows wider
   than the phone, tables that turn into cards up to tablet width, sideways scrollers that show there
   is more, 44 px touch targets, 16 px inputs (no iOS zoom), a 12 px floor for small text, form errors
   at their fields, dialogs that fit a landscape phone, and toasts that stay clear of the buttons. */

/* T1: one wide element can never make the page wider than the phone. clip (not hidden) keeps
   position: sticky working inside, and fixed bars, sheets and toasts are not clipped. */
main#app { overflow-x: clip; }
/* Scrollers contain their absolutely placed bits (screen-reader-only labels), which would otherwise
   sit at their place in the wide content and widen the page. */
.scroll-x, .table-scroll, .pm-ts-scroll, .pm-tl-scroll { position: relative; }
select { max-width: 100%; }
.toolbar > select, .toolbar > input, .toolbar > label.inline, .toolbar > .field { min-width: 0; max-width: 100%; }
.toolbar label.inline > input:not([type='checkbox']):not([type='radio']), .toolbar label.inline > select { min-width: 0; }
.cols > *, .stack > *, .grid > *, .tiles > *, .stats > *, .hd-layout > *, .pm-task > *, .req-detail > * { min-width: 0; }
.stats strong { overflow-wrap: normal; }
.notice:not(:has(> svg, > .ic)) { display: block; }
.notice:not(:has(> svg, > .ic)) > p + p { margin-top: 6px; }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) {
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats strong { display: block; white-space: nowrap; font-size: clamp(18px, 5.4vw, 22px); }
  /* A figure too long for half a row (₱1,234,567.89) takes the whole row (ui.js fitFigures). */
  .stats > .card.fig-wide { grid-column: 1 / -1; }
  .stats { grid-auto-flow: row dense; } /* the other tiles fill the hole a wide one leaves */
}
@media (max-width: 420px) { .grid.four { grid-template-columns: minmax(0, 1fr); } }
/* Forms: two columns on landscape phones and tablets, one on phones. */
@media (min-width: 601px) and (max-width: 960px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid > .span-3, .grid > .field.check { grid-column: 1 / -1; }
}
/* The clock's figures follow the width of their card, not of the screen, so they fit it (0.47). */
.clock-card { container-type: inline-size; }
.clock-time { font-size: clamp(36px, 17cqi, 72px); white-space: nowrap; }
@media (max-width: 760px) {
  .timeline li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .table.stackable.register td:first-child, .table.stackable.register td:first-child .cell-v { white-space: normal; }
  .ytd-table td:first-child, .ytd-table th:first-child { white-space: normal; min-width: 150px; }
}
.register td:first-child { min-width: 180px; max-width: 240px; white-space: normal; }
.register td:first-child strong { overflow-wrap: anywhere; }

/* The payroll register scrolls with its first column pinned: no padding beside it for figures to show through. */
@media (min-width: 761px) { .card.scroll-x:has(> .table.register) { padding-left: 0; padding-right: 0; } }

/* T2: wide tables (6 columns or more, marked .stack-md by ui.js) are cards up to 1024 px too, so a
   tablet or a landscape phone never hides their last columns. With the room a tablet has, each card
   is a grid: the title across the top, then the fields side by side, each label above its value. */
@media (min-width: 761px) and (max-width: 1024px) {
  .scroll-x:has(.table.stack-md) { overflow-x: visible; }
  .card.scroll-x:has(.table.stack-md) { padding: 0 20px 6px; }
  .table.stack-md thead { display: none; }
  .table.stack-md, .table.stack-md tbody, .table.stack-md tfoot { display: block; width: 100%; }
  .table.stack-md tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 20px; align-items: start; width: 100%; padding: 14px 2px; border-bottom: 1px solid var(--border); }
  .table.stack-md tbody tr:hover { background: none; }
  /* A shaded row (low stock, a picked task) is shaded as one card, not cell by cell. */
  .table.stack-md tr:is(.row-low, .pm-selected) > td { background: none; }
  .table.stack-md tr.row-low { background: var(--accent-soft); border-radius: 8px; padding-inline: 12px; }
  :root[data-theme='dark'] .table.stack-md tr.row-low { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
  .pm-list.stack-md tr.pm-selected { background: var(--brand-softer); }
  .table.stack-md td { display: block; padding: 0; border: 0; text-align: left; overflow-wrap: anywhere; min-width: 0; }
  .table.stack-md td::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
  .table.stack-md td:not([data-label])::before { content: none; }
  .table.stack-md td:first-child { grid-column: 1 / -1; font-size: 15px; }
  .table.stack-md td:first-child::before { content: none; }
  .table.stack-md td.is-empty { display: none; }
  .table.stack-md td.row-actions, .table.stack-md td:last-child:not([data-label]) { grid-column: 1 / -1; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
  /* The row's buttons share the title's row, on the right. */
  .table.stack-md tr:has(> td.row-actions:not(:first-child), > td:last-child:not([data-label]):not(:first-child)) > td:first-child { grid-column: 1 / -3; }
  .table.stack-md tr > :is(td.row-actions, td:last-child:not([data-label])):not(:first-child) { grid-row: 1; grid-column: -3 / -1; align-self: start; }
  /* Long text (a description, a ticket's subject) takes two fields' width. */
  .table.stack-md td:is([data-label='Detail'], [data-label='Description'], [data-label='Problem'], [data-label='Notes'], [data-label='Note']) { grid-column: span 2; }
  .table.stack-md .cell-v { text-align: left; min-width: 0; }
  .table.stack-md td.row-actions .link { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 12px; min-height: 44px; justify-content: center; }
  .table.stack-md td.row-actions .link.danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--surface)); }
  .table.stack-md tfoot tr { background: var(--brand-softer); border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
  .table.stack-md tfoot td { background: none; border: 0; }
  .table.stack-md td.num, .table.stack-md td.center { text-align: left !important; }
  .table.stack-md td small.clip { max-width: none; white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
  .table.stack-md tr.unread td:first-child, .table.stack-md tr.flag-row td:first-child { box-shadow: none; }
  .table.stack-md tr.unread, .table.stack-md tr.flag-row { box-shadow: inset 3px 0 0 var(--gold-bright); padding-left: 12px; }
  .table.stack-md .module-row td:not(:first-child) { display: grid; grid-template-columns: 140px minmax(0, 1fr); align-items: start; text-align: left; gap: 4px 12px; padding: 8px 0; }
  .pm-list.stack-md tr.pm-group { display: block; }
  .pm-list.stack-md tr.pm-group th { display: block; padding: 14px 0 6px; border: 0; white-space: normal; }
  .pm-list.stack-md tr.pm-sub td:first-child { padding-left: 16px; }
  .pm-list.stack-md tr.pm-sub td:first-child::before { left: 2px; }
  .pm-list.stack-md select, .pm-list.stack-md input[type='date'] { width: 100%; max-width: 100%; }
  .pm-list.stack-md td.num small { display: inline; margin-left: 6px; }
  .pm-list.stack-md td.num small::before { content: '· '; }
  .pm-milestones.stack-md tr.pm-late td:first-child { box-shadow: none; }
  .pm-milestones.stack-md tr.pm-late { box-shadow: inset 3px 0 0 var(--danger); padding-left: 12px; }
  .stack-md .grant { flex-wrap: wrap; }
  /* Access grants: wider fields, so each grant's picker shows its whole choice. */
  .grant-table.stack-md tr { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
  .grant-table.stack-md .grant select { flex: 1 1 100%; width: 100%; min-width: 0; }
  .card.scroll-x:has(.table.stack-md) > :is(.toolbar.pad, .muted.pad, h2.pad, .card-head.pad, .pm-chips-row) { padding-left: 0; padding-right: 0; }
  /* Service desk queue: the subject leads the card, then the ticket number. */
  .hd-table.stack-md td[data-label='Subject'] { order: -1; grid-column: 1 / -1; font-size: 15px; }
  .hd-table.stack-md td[data-label='Subject']::before { content: none; }
  .hd-table.stack-md td:first-child { font-size: 13px; }
  .hd-table.stack-md td:first-child .cell-v { display: flex; gap: 8px; align-items: baseline; }
  .hd-table.stack-md td:first-child small { display: inline; }
}
/* The filter row inside a list card lines up with the cards below it (no second indent). */
@media (max-width: 760px) {
  /* ...and so does the title of a list card that is empty (no table, so no card rules). */
  .card.scroll-x:not(:has(.table.stackable)) > h2 { padding: 16px 16px 0; }
  .table.stackable td.row-actions { gap: 8px; }
  .card.scroll-x:has(.table.stackable) > :is(.toolbar.pad, .muted.pad, h2.pad, .card-head.pad, .pm-chips-row) { padding-left: 0; padding-right: 0; }
  .table.stackable td::before { font-size: 12px; }
  /* Overdue milestones and flagged rows: the marker is on the card, clear of its text. */
  .pm-milestones.stackable tr.pm-late td:first-child { box-shadow: none; }
  .pm-milestones.stackable tr.pm-late { box-shadow: inset 3px 0 0 var(--danger); padding-left: 12px; }
  .table.stackable td small.clip { max-width: none; white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; text-align: left; }
  /* Emails and links: on their own line under the label, left-aligned, broken at sensible places. */
  .table.stackable td[data-label='Email'], .table.stackable td[data-label='Website'] { display: block; text-align: left; overflow-wrap: anywhere; }
  .table.stackable td[data-label='Email']::before, .table.stackable td[data-label='Website']::before { display: block; }
  /* Access grants: the label and current state on one row, the select under them. */
  .table.stackable td .grant { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: stretch; gap: 6px; width: 100%; }
  .table.stackable td:has(> .grant), .table.stackable td:has(> .cell-v > .grant) { display: block; text-align: left; }
  .table.stackable td:has(> .grant)::before, .table.stackable td:has(> .cell-v > .grant)::before { display: block; margin-bottom: 4px; }
  .table.stackable .grant select { width: 100%; }
  /* Admin modules: labels above their values. */
  .table.stackable .module-row td:not(:first-child) { grid-template-columns: minmax(0, 1fr); }
  .table.stackable .module-row td::before { grid-row: auto; }
  .table.stackable .module-row .desc { grid-column: 1; }
  /* Guide tables (Help & guides) read as text: the label above the value, left-aligned. */
  .guide-table.stackable td { display: block; text-align: left; }
  .guide-table.stackable td::before { display: block; margin-bottom: 2px; }
}

/* T3: sideways scrollers show that there is more (ui.js marks .more-left / .more-right), and the
   active tab or chip is scrolled into view when the page opens. */
.tabs.more-right, .pm-chips.more-right, .seg-btns.more-right, .crm-path.more-right, .wys .rich-bar.more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.tabs.more-left, .pm-chips.more-left, .seg-btns.more-left, .crm-path.more-left, .wys .rich-bar.more-left { -webkit-mask-image: linear-gradient(to right, transparent, #000 40px); mask-image: linear-gradient(to right, transparent, #000 40px); }
.tabs.more-left.more-right, .pm-chips.more-left.more-right, .seg-btns.more-left.more-right, .crm-path.more-left.more-right, .wys .rich-bar.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
/* Tables, boards and strips: a fade on the right edge only (a sticky first column stays crisp). */
:is(.scroll-x, .table-scroll, .pm-ts-scroll, .crm-board, .pm-board, .pm-ms-strip, .pm-tl-scroll, .pm-bulk-in):not(.card).more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), rgba(0, 0, 0, 0.15)); mask-image: linear-gradient(to right, #000 calc(100% - 32px), rgba(0, 0, 0, 0.15)); }
/* A card that scrolls keeps its frame (border, corners, shadow): its right edge gets an inner shade. */
.card.scroll-x.more-right { box-shadow: var(--shadow), inset -26px 0 20px -20px rgba(16, 24, 40, 0.22); }
:root[data-theme='dark'] .card.scroll-x.more-right { box-shadow: var(--shadow), inset -26px 0 20px -20px rgba(0, 0, 0, 0.7); }
/* Desktop: the asset register's eight columns fit the card with the sidebar open. */
@media (min-width: 1025px) and (max-width: 1440px) { #asset-table .table th, #asset-table .table td { padding-left: 10px; padding-right: 10px; } }
.scroll-hint { display: none; margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: right; }
@media (max-width: 1024px) { .scroll-hint:has(+ .more-right), .more-right + .scroll-hint { display: block; } }

/* T4: touch screens: every control at least 44 × 44 px. Checkboxes, radios and small links keep
   their look; their label or padding is the hit area. Desktops (a mouse) are unchanged. */
@media (pointer: coarse) {
  .btn, .btn.sm, .btn.small-btn, label.btn { min-height: 44px; }
  .btn.sm, .btn.small-btn { padding: 8px 14px; }
  .icon-btn, .round-btn, #menu-btn { min-width: 44px; min-height: 44px; }
  .round-btn { width: 44px; height: 44px; }
  .topbar .brand { min-height: 44px; }
  .user-btn { min-height: 44px; }
  #nav a, .menu-pop button, .menu-pop a, .crm-search-pop a { min-height: 44px; }
  .tabs a { min-height: 44px; }
  .chip { min-height: 44px; padding: 8px 14px; }
  input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='color']):not([type='file']), select { min-height: 44px; }
  input[type='color'] { min-height: 44px; min-width: 44px; }
  button.link { min-height: 44px; min-width: 44px; padding: 4px 8px; }
  a.back, .crumbs a, .card-head > a, .link-list li > a, .rel-actions .link, .hd-files .link, .pw-wrap .link, .auth-switch .link, .auth-foot .link, .cert-link,
  .pm-ts-add .link, .pm-ms-files, .geo-link { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
  a.back { margin-block: -8px -2px; }
  .card-head > a { margin-block: -10px; }
  .pw-wrap .link { justify-content: center; padding: 0 8px; right: 2px; }
  .seg label, .seg-btns button, .crm-seg button { min-height: 44px; }
  .seg-btns button { padding: 8px 12px; }
  .days label, .checks label, label.inline:has(> input[type='checkbox']), .field.check, .switch, .check-inline, .crm-checklist label, .pm-radio .check, .pm-track .check,
  .recovery .check, .appr-table label, .fb-type, .flow-people label, .pf-cats label { min-height: 44px; align-items: center; }
  .field.check input { margin-top: 0; }
  .crm-tick { min-width: 44px; min-height: 44px; margin: -10px -10px -10px 0; }
  .crm-tick input { width: 22px; height: 22px; }
  .crm-checklist .icon-btn { opacity: 1; color: var(--muted); }
  .sys-dots { gap: 0; }
  .sys-dots button { flex: 0 1 44px; min-width: 0; height: 44px; }
  .sys-dots { margin-inline: -16px; } /* the page's side padding too: eight 44 px dots fit a 360 px phone */
  .sys-arrows .icon-btn { width: 44px; height: 44px; }
  .modal header .icon-btn { width: 44px; height: 44px; }
  .pm-sel, .appr-table input[type='checkbox'] { width: 22px; height: 22px; }
  .perm-box { min-width: 44px; min-height: 44px; }
  details > summary { min-height: 44px; }
  .sp-actions .btn, .sp-submit { min-height: 48px; }
}
/* Work days: chips you can tap, four and three to a row on phones. */
@media (pointer: coarse) {
  .days { gap: 8px; }
  .days label { justify-content: center; min-width: 64px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); cursor: pointer; }
  .days label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
  .days label:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--brand) 30%, transparent); outline-offset: 2px; }
}

/* T6: inputs at 16 px on touch screens (iOS zooms into anything smaller), and nothing under 12 px. */
@media (pointer: coarse) {
  input:not([type='checkbox']):not([type='radio']):not([type='range']), select, textarea { font-size: max(16px, 1em) !important; }
}
@media (pointer: coarse), (max-width: 760px) {
  small { font-size: max(12px, 0.83em); }
  .mono { font-size: max(12px, 0.92em); }
  .nav-heading, .nav-module small, .side-foot, .menu-label, .sys-code, .admin-tile .count, .tabs .count, .nav-badge, .holder-count span, .hd-tile small, .hd-dl dt, .fb-meta dt,
  .balance-chips span, .cell-btn small, .swatch small, .flag, .rel-scopes code, .cscope, .rel-tally, .rel-meta, .ctype, .perm-default, .flex-tag, .date-box b,
  .pm-card-top .mono, .pm-card-top .badge, .pm-size, .pm-blocked, .pm-size-cell small, .pm-list td.num small, .pm-ts tbody th small, .pm-ts-dtr th small,
  .pm-tl-label small, .pm-tl-track.weeks span, .pm-bu-y, .pm-bu-x, .pm-bu-unit, .pm-bu-mark, .roles-matrix th[scope='row'] code, .pm-steps li::before { font-size: 12px; }
  .avatar.xs { font-size: 11px; }
  .pf-snippet, .editor-pane textarea { font-size: 16px; }
}

/* T5: form errors at their fields (ui.js formErrors), and dialogs that fit a landscape phone or a
   phone with the keyboard up: a compact header, the whole sheet scrolls, the buttons stay at its foot. */
.field-error { display: block; margin-top: 2px; color: var(--danger); font-size: 13px; font-weight: 600; }
.field-error::before { content: '! '; }
[aria-invalid='true']:not([type='checkbox']):not([type='radio']) { border-color: var(--danger) !important; box-shadow: 0 0 0 1px var(--danger); }
.form-error ul { margin: 4px 0 0; padding-left: 18px; }
.modal-body > .form-error { margin: 0 0 14px; }
.modal-body > .form-error[hidden] { display: none; }
@media (max-width: 960px) {
  .modal, .modal.wide { max-height: 92vh; max-height: 92dvh; }
}
@media (max-height: 500px) {
  .modal-backdrop { padding-top: 0; }
  .modal, .modal.wide { max-height: 100vh; max-height: 100dvh; overflow-y: auto; overscroll-behavior: contain; border-radius: 12px 12px 0 0; }
  .modal::before { display: none; }
  .modal { scroll-padding-block: 60px 68px; }
  .modal header { position: sticky; top: 0; z-index: 3; background: var(--surface); padding: 8px 12px 8px 16px; border-bottom-width: 1px; align-items: center; }
  .modal header h2 { font-size: 16px; }
  .modal-title p { display: none; }
  .modal-body { overflow: visible; flex: none; padding: 12px 16px; }
  .modal footer { position: sticky; bottom: 0; z-index: 2; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); }
  .modal footer .btn { min-height: 44px; }
}
/* Long forms: the save buttons stay at the bottom of a phone's or tablet's screen (Save, and Cancel
   at most: other actions stay in the page). */
@media (max-width: 1024px) {
  .save-bar { position: sticky; bottom: 0; z-index: 15; margin: 0 -16px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 18px rgba(16, 24, 40, 0.1); }
  .save-bar.actions { flex-wrap: nowrap; }
  .save-bar .btn { flex: 1 1 0; min-height: 46px; }
  .save-bar .btn.primary { flex-grow: 2; }
  form.stack:has(> .save-bar) { margin-bottom: 0; }
  /* A field scrolled into view (focus, the keyboard, a form error) stops above the bar. */
  html:has(.save-bar) { scroll-padding-bottom: 84px; }
}
@media (min-width: 761px) and (max-width: 1024px) {
  .save-bar .btn, .save-bar .btn.primary { flex: 0 0 auto; min-width: 160px; }
}
@media (max-height: 500px) and (max-width: 1024px) {
  .save-bar { padding-block: 6px calc(6px + env(safe-area-inset-bottom)); }
  .save-bar .btn { min-height: 44px; }
  html:has(.save-bar) { scroll-padding-bottom: 64px; }
}

/* T7: content first on phones. Filters fold into one "Filters" button with a count (ui.js). */
.filters-btn { display: none; }
.filters-btn .count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); font-size: 12px; line-height: 20px; text-align: center; }
.filters-btn .count[hidden] { display: none; }
@media (max-width: 760px), (max-height: 500px) and (max-width: 960px), (pointer: coarse) and (max-width: 1024px) {
  .toolbar.has-filters > .filters-btn { display: inline-flex; flex: 0 0 auto; }
  .toolbar.has-filters > input[type='search'] { flex: 1 1 0; min-width: 0; }
  .toolbar.has-filters:not(.filters-open) > .filter-item { display: none !important; }
  .toolbar.has-filters.filters-open > .filter-item { flex: 1 1 100%; }
  .toolbar.has-filters.filters-open > .filter-item.filter-extra { flex: 0 1 auto; }
  /* Open, the button looks pressed (like an active chip). */
  .filters-btn[aria-expanded='true'] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-text); }
}
/* On a tablet the open filters sit two to a row. */
@media (min-width: 761px) and (max-width: 1024px) and (pointer: coarse) {
  .toolbar.has-filters.filters-open > .filter-item:not(.filter-extra) { flex: 1 1 calc(50% - 8px); }
}
@media (max-width: 960px) {
  /* CRM records: the details first, then the activity. */
  .crm-record > .stack { display: contents; }
  .crm-record > .stack > :first-child, .crm-record > section:nth-child(2), .crm-record > .stack > #docs-card { order: -1; }
  /* Boards: each column scrolls on its own, so every column starts on the first screen. */
  .pm-col, .crm-col { max-height: max(340px, calc(100vh - var(--topbar) - 110px)); max-height: max(340px, calc(100dvh - var(--topbar) - 110px)); }
}
/* Service desk tickets keep two columns on tablets, the conversation first everywhere. */
@media (min-width: 761px) and (max-width: 960px) {
  .hd-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}
/* A linked task: its key stays on one line, the title wraps beside it. */
.link-list li > a:has(> .mono) { gap: 6px; }
.link-list li > a > .mono { flex-shrink: 0; white-space: nowrap; }

/* T8: sticky and fixed bars. A shorter top bar on a landscape phone; toasts at the top of a phone's
   screen, clear of the primary button, the bulk bar and the save bar at the bottom. */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --topbar: 48px; }
  .topbar .brand img.core-mark { height: 30px; width: 30px; }
  .page-head { margin-bottom: 12px; }
  .page-head p.muted { display: none; }
  .crm-board, .pm-board { scroll-margin-top: var(--topbar); }
}
/* Wherever toasts stay at the bottom, they rise above a bulk bar or an "Unsaved changes" bar. */
body:has(.pm-bulk:not([hidden]), .sticky-actions:not([hidden])) #toast { bottom: 96px; }
@media (max-width: 760px), (pointer: coarse) and (max-width: 1024px) {
  #toast { top: calc(var(--topbar) + 8px); bottom: auto; transform: translateY(-12px); }
  #toast.show { transform: none; }
  body:has(.pm-bulk:not([hidden]), .sticky-actions:not([hidden])) #toast { bottom: auto; }
}
@media (min-width: 761px) and (max-width: 1024px) and (pointer: coarse) {
  #toast { left: 50%; right: auto; transform: translate(-50%, -12px); max-width: min(560px, calc(100vw - 32px)); }
  #toast.show { transform: translate(-50%, 0); }
}
@media (max-height: 500px) {
  #toast { top: calc(var(--topbar) + 6px); bottom: auto; left: auto; right: 16px; max-width: min(420px, calc(100vw - 32px)); transform: translateY(-12px); }
  #toast.show { transform: none; }
  body:has(.pm-bulk:not([hidden]), .sticky-actions:not([hidden])) #toast { bottom: auto; }
}

/* ----- Per screen (0.18) ----- */
/* File pickers look like the app's buttons, in both themes. */
input[type='file'] { font-size: 14px; color: var(--muted); }
input[type='file']::file-selector-button { font: inherit; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 14px; margin-right: 12px; cursor: pointer; }
input[type='file']::file-selector-button:hover { background: var(--surface-2); }
@media (pointer: coarse) { input[type='file']::file-selector-button { min-height: 44px; } input[type='file'] { min-height: 52px; } }
.cert-field input[type='file'] { width: 100%; }
/* Page-head buttons on phones: an even two-column grid; a destructive button goes last and stays one cell. */
@media (max-width: 760px) {
  .page-head .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: stretch; }
  .page-head .actions > :only-child { grid-column: 1 / -1; }
  /* The main action comes first, across the row; a secondary left alone in its row takes the row too. */
  .page-head .actions > .btn.primary { grid-column: 1 / -1; order: -1; }
  .page-head .actions:not(:has(> :is(.btn.danger, #del, #delete))) > :nth-last-child(1 of :not(.btn.primary, .seg-btns)):nth-child(odd of :not(.btn.primary, .seg-btns)) { grid-column: 1 / -1; }
  .page-head .actions > :is(.btn.danger, .btn.ghost.danger, #del, #delete) { order: 10; }
  .page-head .actions > .seg-btns { grid-column: 1 / -1; justify-self: start; }
  .page-head .actions .btn { width: 100%; min-width: 0; white-space: normal; text-align: center; }
  .fb-page .page-head .actions { grid-auto-flow: row; grid-auto-columns: auto; }
  .fb-page .page-head .actions > #delete { grid-column: 1 / -1; }
}
/* Mailbox and other settings action rows: full width on phones, Save first. */
@media (max-width: 760px) {
  .form-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .form-actions .btn { width: 100%; }
  .pf-cats { flex-direction: column; gap: 0; }
  .pf-link input { flex-basis: 100%; }
  .pf-link .btn { flex: 1 1 0; }
}
/* HR: the payroll register on a phone shows the summary (pay, net) and "Details" for the rest. */
/* (button.ph-only: as specific as the touch rule that shows every button.link) */
.ph-only, button.ph-only { display: none; }
@media (max-width: 760px) {
  .ph-only, button.ph-only { display: inline-flex; }
  .table.stackable.register tbody tr:not(.show-detail) td.ph-detail { display: none; }
  .table.stackable.register tfoot td.ph-detail { display: none; }
}
/* Payroll setup: the tax brackets as small forms on phones. */
@media (max-width: 760px) {
  .tax-table thead { display: none; }
  .tax-table, .tax-table tbody { display: block; width: 100%; }
  .tax-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .tax-table td { display: flex; flex-direction: column; gap: 4px; padding: 0; border: 0; min-width: 0; }
  .tax-table td::before { content: attr(data-label); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
  .tax-table td.row-actions { justify-content: flex-end; align-items: flex-start; }
  .tax-table td.row-actions::before { content: none; }
  .tax-table .input-suffix input { min-width: 0; }
  .premium-table .input-suffix { max-width: none; }
}
/* Payslip on a phone's or tablet's screen: readable sizes (the printed payslip keeps its own, below). */
@media screen and (max-width: 1024px) {
  .payslip { font-size: 13px; }
  .payslip h3, .ps-table th, .ps-meta dt, .ps-fields dt, .ps-summary dt, .ps-net span, .ps-sign, .ps-table td small, .ps-company span, .ps-ref, .ps-net em { font-size: 12px; }
  .ps-conf, .ps-foot p { font-size: 12px; letter-spacing: 0.04em; }
  .ps-table td { padding: 6px 8px; }
  .ps-table th { padding: 6px 8px; }
}
/* Printed payslips are laid out at A4 width whatever the device (Save as PDF from a phone too). */
@media print {
  .payslip { width: 186mm; min-width: 186mm; max-width: 186mm; }
  .ps-head { flex-direction: row !important; }
  .ps-company > div { min-width: 0; }
  .ps-fields div { grid-template-columns: 105px minmax(0, 1fr) !important; }
}
/* HR: the time clock and My Home clock: the time on one line, AM/PM smaller. */
.clock-time .ampm { font-size: 0.42em; margin-left: 0.15em; letter-spacing: 0.02em; }
@media (max-width: 760px) {
  .clock-buttons .btn { flex: 1 1 0; }
  .balance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .balance strong { font-size: 26px; }
  .balance-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .balance-chips div { min-width: 0; }
  /* From / To filters: the label above the date, so both dates line up. */
  .toolbar > label.inline:has(> input[type='date']) { flex-direction: column; align-items: stretch; gap: 4px; font-size: 13px; }
  .geo-filters > label.inline { grid-column: auto; }
  .office-bar .small-btn, #use-here { width: 100%; justify-content: center; }
  #use-here + .geo-here { display: block; margin-top: 6px; }
}
:root[data-theme='dark'] .geo-map { border-color: var(--border-strong); background: #1f2937; }
/* The gold of tag lines (asset tags, ticket numbers): --gold-text, set with the theme colours at the top. */
.tag-line, .sp-kicker { color: var(--gold-text); }
:root[data-theme='dark'] .key-assigned { background: linear-gradient(90deg, var(--maroon), var(--gold-bright)); }
/* Assets: inventory row buttons share the card's width; the problem text shows three lines. */
@media (max-width: 760px) {
  .table.stackable td:last-child:not([data-label]) .btn { flex: 1 1 auto; }
  .my-report .btn, .asset-card-foot .btn, [data-report] { width: 100%; justify-content: center; }
  .table.stackable td.row-actions .link { flex: 1 1 auto; }
}
/* Service desk: the queue's phone cards lead with the subject. */
@media (max-width: 760px) {
  .hd-table.stackable tr { display: flex; flex-direction: column; }
  .hd-table.stackable td[data-label='Subject'] { order: -1; display: block; text-align: left; font-size: 15px; padding-bottom: 2px; }
  .hd-table.stackable td[data-label='Subject']::before { content: none; }
  .hd-table.stackable td[data-label='Subject'] .cell-v { text-align: left; }
  .hd-table.stackable td:first-child { display: flex; font-size: 13px; padding-bottom: 4px; gap: 6px; justify-content: flex-start; }
  .hd-table.stackable td:first-child .cell-v { display: flex; gap: 8px; align-items: baseline; }
  .hd-table.stackable td:first-child small { display: inline; }
  .hd-compose-bar label.inline { flex: 1 1 100%; }
}
/* Sales & CRM: the activity type picker and the deal's stages fit a phone. */
@media (max-width: 760px) {
  .crm-composer .crm-seg { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; }
  .crm-composer .crm-seg button { flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 12px; justify-content: center; }
  .crm-composer .crm-seg button + button { border-left: 1px solid var(--border); }
  .crm-composer-foot .field.inline { flex: 1 1 100%; }
  .crm-composer-foot .field.inline input, .crm-composer-foot .field.inline select { flex: 1; width: auto; min-width: 0; }
}
@media (max-width: 640px) {
  .crm-path { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .crm-path-break { display: none; }
  .crm-path button, .crm-path button:first-child, .crm-path button:last-child { clip-path: none; border-radius: 8px; border: 1px solid var(--border); padding: 9px 10px; white-space: normal; }
  .crm-path button.won, .crm-path button.lost { flex: none; }
  .crm-path button.won { grid-column: 1; }
}
/* Projects board on a phone: the board comes up sooner (the project's details are on its Overview). */
@media (max-width: 760px), (max-height: 500px) and (max-width: 960px) {
  #app:has(#board) .pm-head p.muted { display: none; }
  #app:has(#board) .pm-head h1 { margin-bottom: 0; }
  #app:has(#board) .pm-tabs { margin-bottom: 10px; }
  #app:has(#board) .pm-chips-line { margin-bottom: 6px; }
}
/* Projects: a milestone's note wraps inside its card; the burn-up's method folds away. */
.pm-ms .crm-due { white-space: normal; }
.pm-bu-method summary { color: var(--brand-text); font-weight: 600; font-size: 13px; }
/* The List's bulk bar on a phone or a landscape phone: the count, Actions and ×; everything else in the Actions sheet. */
.pm-bulk-menu, .pm-bulk-x { display: none; }
@media (max-width: 760px), (max-height: 500px) {
  .pm-bulk-in { flex-wrap: nowrap; overflow: visible; }
  .pm-bulk-in > .pm-bulk-actions, .pm-bulk-in > [data-bulk-clear] { display: none; }
  .pm-bulk-menu, .pm-bulk-x { display: inline-flex; }
  .pm-bulk-count { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .pm-bulk-sheet { display: grid; gap: 8px; }
  .pm-bulk-sheet .btn { width: 100%; justify-content: flex-start; }
}
@media (max-height: 500px) and (min-width: 761px) {
  .pm-bulk { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; }
  .pm-bulk-in { border-radius: 0; padding: 6px 16px calc(6px + env(safe-area-inset-bottom)); }
}
/* Projects: the timesheet on a phone, one day at a time. */
.pm-ts-phone { display: none; }
@media (max-width: 760px) {
  .pm-ts-card:has(.pm-ts-phone) .pm-ts-scroll { display: none; }
  .pm-ts-phone { display: block; padding: 12px 4px 16px; }
  .pm-ts-phone > :not(.pm-ts-days) { margin-inline: 12px; }
  .pm-ts-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin: 0 0 12px; }
  .pm-ts-days button { display: flex; flex-direction: column; align-items: center; gap: 0; min-height: 56px; padding: 4px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
  .pm-ts-days button small { font-size: 12px; font-weight: 500; color: var(--muted); }
  .pm-ts-days button b { font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
  .pm-ts-days button.today { border-color: var(--brand-line); }
  .pm-ts-days button[aria-selected='true'] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
  .pm-ts-days button[aria-selected='true'] small, .pm-ts-days button[aria-selected='true'] b { color: var(--brand-ink); }
  .pm-ts-days button.bad b { color: var(--danger); }
  .pm-ts-days button[aria-selected='true'].bad b { color: #fff; text-decoration: underline; }
  .pm-ts-dayhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 0 8px; }
  .pm-ts-dayhead h2 { margin: 0; font-size: 15px; }
  .pm-ts-rows { list-style: none; margin: 0; padding: 0; }
  .pm-ts-rows li { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 6px 12px; align-items: end; padding: 12px 0; border-top: 1px solid var(--border); }
  .pm-ts-rows li:first-child { border-top: 0; }
  .pm-ts-rows .pm-ts-row-head { min-width: 0; }
  /* The task picker takes the card's width (its title shows in full); the week's hours and the
     day's hours share the line under it. */
  .pm-ts-rows li:has(> .pm-ts-row-head > select) .pm-ts-row-head { display: contents; }
  .pm-ts-rows li:has(> .pm-ts-row-head > select) :is(.pm-ts-proj, select) { grid-column: 1 / -1; }
  .pm-ts-rows li:has(> .pm-ts-row-head > select) .pm-ts-row-head > small { grid-column: 1; align-self: end; padding-bottom: 12px; }
  .pm-ts-rows select { width: 100%; margin-top: 4px; }
  .pm-ts-rows .field { gap: 4px; }
  .pm-ts-rows .field input { width: 100%; text-align: right; font-variant-numeric: tabular-nums; }
  .pm-ts-rows small { display: block; color: var(--muted); }
  .pm-ts-rows .pm-ts-add-row { display: block; padding: 6px 0 2px; border-top: 0; }
  .pm-ts-phone-total { display: flex; justify-content: space-between; gap: 12px; margin: 10px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-weight: 600; }
  .pm-ts-phone-total.bad b { color: var(--danger); }
}
/* Projects setup: effort sizes as label + full-width input on phones. */
@media (max-width: 760px) {
  .pm-size-table thead { display: none; }
  .pm-size-table, .pm-size-table tbody, .pm-size-table tr, .pm-size-table td { display: block; width: 100%; }
  .pm-size-table tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .pm-size-table td { padding: 2px 0; border: 0; }
  .pm-size-table td input { min-width: 0; }
  .pm-steps li:not(.on) { display: none; }
  .pm-steps li.on::after { content: "(step " counter(step) " of 3)"; color: var(--muted); font-weight: 500; }
  .pm-imp-sample { display: none; }
}
/* Admin panel: roles on a phone (upright or on its side), one account type at a time (picked above the groups). */
.role-pick { display: none; }
@media (max-width: 760px), (max-height: 500px) and (max-width: 960px) {
  .role-pick { display: flex; position: sticky; top: var(--topbar); z-index: 6; margin: 0 -16px 16px; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--border); }
  .role-pick .field { flex: 1; }
  .roles-picking .roles-matrix .pick-hide { display: none; }
  .roles-picking .roles-matrix thead th:first-child, .roles-picking .roles-matrix tbody th { width: auto; min-width: 0; max-width: none; }
  .roles-picking .roles-matrix td, .roles-picking .roles-matrix thead th:not(:first-child) { width: 96px; }
  .roles-picking .roles-matrix tbody td { border-bottom: 1px solid var(--border); }
}
@media (max-height: 500px) and (max-width: 960px) { .role-pick { padding-block: 4px; } }
/* Admin panel: the Settings center's Open button sits inside its group's card. */
.config-area-wrap > .area-actions { top: 12px; right: 16px; }
@media (max-width: 720px) {
  .config-area-wrap > .area-actions { position: absolute; top: 12px; right: 12px; margin: 0; }
  .config-area-wrap > details.config-area > summary { margin-right: 96px; }
  .config-area-wrap:has(.area-actions .btn + .btn) > details.config-area > summary { margin-right: 0; margin-top: 44px; }
}
/* Admin panel: the dev log's filters wrap instead of running off the screen. */
@media (max-width: 760px) {
  .log-toolbar .seg-btns { flex-wrap: wrap; overflow: visible; max-width: 100%; }
  .log-toolbar .seg-btns button { border-bottom: 1px solid var(--border); margin-bottom: -1px; }
  .logo-box { flex-direction: column; align-items: flex-start; }
  .logo-box > div { flex: 0 0 auto; } /* (in a column, a 180 px basis was 180 px of height) */
  .logo-box img { order: -1; }
  .brand-field .hint + .field, .field + .hint + .field { margin-top: 12px; }
}
/* Sign-in on a landscape phone: the brand band shrinks to a strip so the form is on the first screen. */
@media (max-height: 500px) and (orientation: landscape) {
  .auth-screen { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); grid-template-rows: none; min-height: 100vh; }
  .auth-stage { padding: 20px 24px; gap: 12px; justify-content: flex-start; }
  .auth-intro h1 { font-size: 26px; }
  .auth-intro p:last-child, .auth-kicker, .auth-modules, .auth-stage-mark { display: none; }
  .auth-panel { padding: 16px 24px; gap: 12px; }
  .auth-card { gap: 12px; margin-block: 0; }
  .auth-card h2 { font-size: 22px; }
  .auth-panel input { height: 44px; }
  .auth-panel .btn.primary.block { min-height: 46px; }
  .auth-legal { padding-top: 10px; }
}
/* Public support page: body copy and labels a little larger on phones; the link wraps. */
.sp-url { display: block; flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-size: 14px; overflow-wrap: anywhere; word-break: break-all; }
@media (max-width: 760px) {
  .sp-privacy, .sp-foot { font-size: 13px; }
  .sp-card .field > span:first-child { font-size: 14px; }
  .sp-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .sp-actions .btn { width: 100%; }
  .sp-link .btn { width: 100%; }
}
/* A disabled button looks disabled, whatever its colour: every one the same, neutral and faded. */
.btn.primary:disabled, .btn.gold:disabled, .btn.danger:not(.ghost):disabled { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); opacity: 0.45; box-shadow: none; }
@media (pointer: coarse) { .row-actions a.link, td > a.link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; } }
@media (max-width: 760px) { .logo-box .stack.tight { align-items: flex-start; } }
@media (max-height: 500px) and (orientation: landscape) and (min-width: 600px) {
  .page-head { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .page-head .actions { flex: 0 1 auto; }
  .page-head .actions .btn { flex: 0 1 auto; }
}
/* Touch: text links in tables, lists and cards get a taller hit area without moving anything
   (vertical padding on an inline link grows only what can be tapped). ui.js fitHitAreas() sets how
   much for each link: up to 44 px, but only into the free space around it, so a hit area never
   covers another control or another link's text. */
@media (pointer: coarse) {
  a.hit { padding-block: var(--hit-t, 0px) var(--hit-b, 0px); }
  a.hit.hit-box { margin-block: calc(var(--hit-mt, 0px) - var(--hit-t, 0px)) calc(var(--hit-mb, 0px) - var(--hit-b, 0px)); }
  .topbar .brand { min-width: 44px; }
  .tabs a, .seg-btns button { min-width: 44px; justify-content: center; }
  .cell-btn, .pm-ts tbody th select, .req-days.edit select { min-height: 44px; }
  .pm-sel-hit { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: -11px 0 -11px -11px; vertical-align: middle; cursor: pointer; }
  .pm-sel-hit .pm-sel { margin: 0; }
  /* Lists of records (a title, a line of details, a date or a status): the whole row opens the
     record; the other links and controls in the row sit above it and keep their own place. */
  .crm-mini li:has(> .grow > a:first-child) { position: relative; }
  .crm-mini li > .grow > a:first-child::after { content: ''; position: absolute; inset: 0; }
  .crm-mini li:has(> .grow > a:first-child) :is(a, button, select, input, label, summary):not(.grow > a:first-child) { position: relative; z-index: 1; }
  /* Board cards (projects, pipeline): the whole card opens the task or deal; its Move button and
     other controls sit above. */
  .pm-card, .crm-card { position: relative; }
  .pm-card-title::after, .crm-card-title::after { content: ''; position: absolute; inset: 0; }
  :is(.pm-card, .crm-card) :is(button, select, input, label, a:not(.pm-card-title, .crm-card-title)) { position: relative; z-index: 1; }
  /* Lists of people (Direct reports): one name per row, each a 44 px row. */
  ul.comma-list li { display: block; }
  ul.comma-list li > a { display: inline-flex; align-items: center; min-height: 44px; }
  ul.comma-list li + li::before { content: none; }
}
/* The List's title beside its checkbox: a title that wraps stays in its own column. */
.pm-row-title { display: flex; align-items: flex-start; }
.pm-row-title > span { flex: 1; min-width: 0; }
.pm-row-title .pm-sel { margin-top: 1px; vertical-align: 0; }
@media (pointer: coarse) { .pm-row-title .pm-sel-hit { margin: -11px 0 -11px -11px; } }
/* A list of names that reads as one line on a desktop ("Juan Dela Cruz, Andrea Villanueva"). */
.comma-list { list-style: none; margin: 0; padding: 0; }
.comma-list li { display: inline; }
.comma-list li + li::before { content: ', '; }
/* A 44 px minimum width replaces the automatic one (the text's width): keep these from shrinking. */
@media (pointer: coarse) {
  .tabs a, .seg-btns button, .card-head > a, a.back, .crumbs a, button.link, .rel-actions .link, .hd-files .link, .pm-ts-add .link { flex-shrink: 0; }
}
/* Sales setup stages on a phone: the name on its own line, then the probability and the 44 px move/remove buttons. */
@media (max-width: 640px) {
  .crm-stage-table thead { display: none; }
  .crm-stage-table, .crm-stage-table tbody { display: block; width: 100%; }
  .crm-stage-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .crm-stage-table td { display: block; padding: 0 !important; border: 0; }
  .crm-stage-table td:first-child { grid-column: 1 / -1; }
  .crm-stage-table td.num { display: flex; align-items: center; gap: 6px; }
  .crm-stage-table td.num::before { content: 'Probability %'; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
  .crm-stage-table td.num input { width: 90px; }
  .crm-stage-table td.row-actions { display: flex; justify-content: flex-end; }
  .crm-stage-table .row-actions .icon-btn { width: auto; height: auto; }
}
@media (pointer: coarse) {
  .crm-path button, .crm-funnel-row { min-height: 44px; }
  .field > label.check, .pf-cats label { display: flex; align-items: center; min-height: 44px; }
}
/* Payroll setup: holiday premiums on a phone, the day's name above its two rates. */
@media (max-width: 640px) {
  .premium-table thead { display: none; }
  .premium-table, .premium-table tbody { display: block; width: 100%; }
  .premium-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .premium-table td { display: flex; flex-direction: column; gap: 4px; padding: 0 !important; border: 0; min-width: 0; }
  .premium-table td:first-child { grid-column: 1 / -1; font-weight: 600; }
  .premium-table td[data-label]::before { content: attr(data-label); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
}

/* ----- Projects lists: List size (Comfortable / Compact) -----
   Comfortable is the default. Compact tightens the rows for scanning long lists: less padding, a
   smaller type size, slimmer controls in the row, and the details under a title closer to it.
   On touch screens the controls keep their 44 px; only the spacing around them tightens. */
.pm-density { flex: none; }
.pm-density button { white-space: nowrap; }
.pm-density button.active { background: var(--brand); color: #fff; }
body.pm-compact :is(.pm-portfolio, .pm-milestones, .pm-list) td { padding-top: 5px; padding-bottom: 5px; font-size: 13px; line-height: 1.3; }
body.pm-compact :is(.pm-portfolio, .pm-milestones, .pm-list) td small { font-size: 11.5px; margin-top: 1px; }
body.pm-compact :is(.pm-portfolio, .pm-milestones, .pm-list) td.nowrap, body.pm-compact .pm-list td:nth-child(n+2) { white-space: nowrap; }
body.pm-compact .pm-list tr.pm-group th { padding-top: 8px; padding-bottom: 6px; }
body.pm-compact .pm-list select, body.pm-compact .pm-list input[type='date'] { padding-top: 2px; padding-bottom: 2px; font-size: 12.5px; }
body.pm-compact .pm-list .pm-size-cell small, body.pm-compact .pm-list td.num small { display: inline; margin-left: 6px; }
body.pm-compact :is(.pm-portfolio, .pm-milestones, .pm-list) .badge, body.pm-compact :is(.pm-portfolio, .pm-milestones, .pm-list) .pm-health { padding-top: 1px; padding-bottom: 1px; }
body.pm-compact .pm-portfolio .pm-progress .progress { height: 6px; }
body.pm-compact .pm-mywork .crm-mini li { padding: 4px 0; gap: 10px; font-size: 13px; line-height: 1.3; }
body.pm-compact .pm-mywork .crm-mini li:first-child { padding-top: 0; }
body.pm-compact .pm-mywork .crm-mini li small { font-size: 11.5px; }
body.pm-compact .pm-mywork select { padding-top: 2px; padding-bottom: 2px; font-size: 12.5px; }
body.pm-compact .pm-mywork .card-head { margin-bottom: 4px; }
@media (max-width: 760px) {
  /* Phones: rows are cards; compact keeps them cards with less room around and between the fields. */
  body.pm-compact :is(.pm-portfolio, .pm-milestones, .pm-list).stackable tr { padding-top: 6px; padding-bottom: 6px; }
  body.pm-compact :is(.pm-portfolio, .pm-milestones, .pm-list).stackable td { padding-top: 1px; padding-bottom: 1px; white-space: normal; }
}
@media (min-width: 761px) and (max-width: 1024px) {
  body.pm-compact :is(.pm-portfolio, .pm-milestones, .pm-list).stack-md tr { padding-top: 8px; padding-bottom: 8px; gap: 6px 16px; }
  body.pm-compact :is(.pm-portfolio, .pm-milestones, .pm-list).stack-md td { white-space: normal; }
}
@media (pointer: coarse) {
  .pm-density button { min-height: 44px; padding-left: 14px; padding-right: 14px; }
  body.pm-compact .pm-list select, body.pm-compact .pm-list input[type='date'], body.pm-compact .pm-mywork select { padding-top: 5px; padding-bottom: 5px; font-size: 16px; }
}

/* ----- Project icons: a picture or a letter on a coloured tile, beside the project's name ----- */
.pm-pc-gray { --pc: #64748b; }
.pm-pc-blue { --pc: #2563eb; }
.pm-pc-teal { --pc: #0f766e; }
.pm-pc-green { --pc: #15803d; }
.pm-pc-amber { --pc: #b45309; }
.pm-pc-red { --pc: #b91c1c; }
.pm-pc-violet { --pc: #6d28d9; }
.pm-pc-brand { --pc: var(--brand); }
.pm-picon { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 7px; background: var(--pc); color: #fff; font-weight: 700; line-height: 1; vertical-align: middle; }
.pm-picon .ic { width: 62%; height: 62%; }
.pm-picon-sm { width: 18px; height: 18px; border-radius: 5px; font-size: 10.5px; vertical-align: -4px; }
.pm-picon-md { width: 30px; height: 30px; font-size: 14px; }
.pm-picon-lg { width: 38px; height: 38px; border-radius: 9px; font-size: 18px; }
:root[data-theme='dark'] .pm-picon { box-shadow: inset 0 0 0 1px rgb(255 255 255 / 12%); }
h1.pm-title { display: flex; align-items: flex-start; flex-wrap: nowrap; gap: 12px; }
h1.pm-title > .pm-picon { margin-top: 1px; }
.pm-title-text { min-width: 0; }
@media (max-width: 760px) { h1.pm-title > .pm-picon-lg { width: 32px; height: 32px; border-radius: 8px; font-size: 15px; margin-top: 2px; } }
.pm-named { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.pm-named > div { min-width: 0; }
.pm-named > .pm-picon { margin-top: 1px; }
body.pm-compact .pm-named > .pm-picon-md { width: 22px; height: 22px; font-size: 11.5px; border-radius: 5px; }
.pm-proj-link { white-space: nowrap; }
/* The picker in the project form */
.pm-icon-pick { border: 0; padding: 0; margin: 0; min-width: 0; }
.pm-icon-pick legend { font-size: 13px; font-weight: 600; margin-bottom: 6px; padding: 0; }
.pm-icon-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.pm-glyphs { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; }
.pm-glyph, .pm-swatch { position: relative; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.pm-glyph { height: 38px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text-2); background: var(--surface); }
.pm-glyph input, .pm-swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.pm-glyph:hover { background: var(--surface-2); }
.pm-glyph:has(input:checked) { border-color: var(--brand); background: var(--brand-softer); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.pm-glyph:has(input:focus-visible), .pm-swatch:has(input:focus-visible) { outline: 2px solid var(--gold-bright, var(--brand)); outline-offset: 2px; }
.pm-glyph-letter { font-weight: 700; font-size: 13px; }
.pm-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pm-swatches.off { opacity: 0.45; }
.pm-swatch { width: 30px; height: 30px; }
.pm-swatch i { width: 24px; height: 24px; border-radius: 50%; background: var(--pc); }
.pm-swatch:has(input:checked) i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--pc); }
@media (pointer: coarse) {
  .pm-glyphs { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
  .pm-glyph { height: 44px; }
  .pm-swatch { width: 44px; height: 44px; }
  .pm-swatch i { width: 28px; height: 28px; }
}

/* ----- Formatted text: the task description editor and how it reads ----- */
.rich-ed { gap: 0; }
.rich-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.rich-head label { font-weight: 600; font-size: 13px; color: var(--text-2); }
.rich-tabs { display: inline-flex; gap: 2px; }
.rich-tabs button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.rich-tabs button[aria-selected='true'] { color: var(--brand); background: var(--brand-softer); }
.rich-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; border: 1px solid var(--border-strong); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--surface-2); }
.rich-bar.off { opacity: 0.5; }
.rich-tool { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 30px; border: 0; border-radius: 6px; background: none; color: var(--text-2); cursor: pointer; }
.rich-tool:hover:not(:disabled) { background: var(--surface); color: var(--text); }
.rich-tool:focus-visible { outline: 2px solid var(--brand-text); outline-offset: -2px; }
.rich-tool:disabled { opacity: 0.4; cursor: default; }
.rich-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--border-strong); }
.rich-ed textarea { border-radius: 0 0 8px 8px; min-height: 180px; resize: vertical; font-size: 14px; line-height: 1.55; }
.rich-ed.drop textarea { outline: 2px dashed var(--brand); outline-offset: -4px; background: var(--brand-softer); }
.rich-preview { min-height: 180px; max-height: 60vh; overflow: auto; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 0 0 8px 8px; background: var(--surface); }
.rich-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; }
.rich-foot .hint { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; font-size: 12px; }
.rich-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.pm-edit-task .grid.two { grid-template-columns: 1fr; }
/* How formatted text reads (the task page, the preview) */
.rich { font-size: 14.5px; line-height: 1.6; color: var(--text); overflow-wrap: anywhere; }
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich p, .rich ul, .rich ol, .rich blockquote, .rich pre, .rich figure { margin: 0 0 12px; }
.rich h3, .rich h4, .rich h5 { display: block; margin: 18px 0 8px; line-height: 1.3; color: var(--text); font-weight: 700; text-transform: none; letter-spacing: 0; }
.rich h3 { font-size: 19px; }
.rich h4 { font-size: 16.5px; }
.rich h5 { font-size: 14.5px; }
.rich ul, .rich ol { padding-left: 24px; }
.rich ul { list-style: disc; }
.rich ol { list-style: decimal; }
.rich ul ul { list-style: circle; }
.rich ul ul ul { list-style: square; }
.rich ol ol { list-style: lower-alpha; }
.rich li + li { margin-top: 4px; }
.rich li > ul, .rich li > ol { margin: 4px 0 0; }
.rich ul.rich-tasks { list-style: none; padding-left: 4px; }
.rich li.rich-task { display: block; }
.rich li.rich-task > input { width: 16px; height: 16px; margin: 0 6px 0 0; vertical-align: -3px; accent-color: var(--brand); }
.rich li.rich-task.done { color: var(--muted); text-decoration: line-through; }
.rich-inline-img { display: inline-block; max-height: 1.6em; max-width: 160px; vertical-align: middle; border-radius: 4px; border: 1px solid var(--border); }
.rich-table { overflow-x: auto; margin: 0 0 12px; }
.rich-table table { border-collapse: collapse; font-size: 13.5px; }
.rich-table th, .rich-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.rich-table th { background: var(--surface-2); font-weight: 600; }
.rich blockquote p + p { margin-top: 8px; }
.rich a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.rich code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; font-size: 0.9em; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }
.rich pre { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); overflow-x: auto; }
.rich pre code { padding: 0; border: 0; background: none; font-size: 13px; white-space: pre; }
.rich blockquote { padding: 2px 0 2px 14px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.rich blockquote p { margin: 0; }
.rich hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.rich del { color: var(--muted); }
.rich-img a { display: inline-block; max-width: 100%; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; background: var(--surface-2); line-height: 0; }
.rich-img img { display: block; max-width: 100%; max-height: 520px; width: auto; height: auto; object-fit: contain; }
.rich-img figcaption { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.rich-missing { font-size: 13px; color: var(--muted); font-style: italic; }
.pm-desc .card-head { margin-bottom: 8px; }
@media (pointer: coarse) {
  .rich-tool { width: 44px; height: 44px; }
  .rich-tabs button { min-height: 44px; padding: 0 14px; }
  .rich-ed textarea { font-size: 16px; }
}
@media (max-width: 760px) {
  .rich-foot .hint { display: none; }
  .rich-img img { max-height: 360px; }
}

/* ----- Profile pictures ----- */
.avatar.pic { padding: 0; overflow: hidden; background: var(--surface-2); }
.avatar.pic img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.menu-pop .who.who-pic { display: flex; align-items: center; gap: 12px; }
.menu-pop .who.who-pic > div { display: flex; flex-direction: column; min-width: 0; }
.avatar-edit { display: grid; grid-template-columns: 160px 1fr; gap: 20px; align-items: start; }
.avatar-stage { width: 160px; height: 160px; position: relative; }
.avatar-stage canvas, .avatar-stage .avatar { width: 160px; height: 160px; border-radius: 50%; display: block; }
.avatar-stage canvas { box-shadow: 0 0 0 1px var(--border-strong); }
.avatar-stage .avatar { font-size: 48px; display: grid; place-items: center; }
.avatar-stage .avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-side { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; min-width: 0; }
.avatar-side .field { width: 100%; }
.avatar-side input[type=range] { width: 100%; accent-color: var(--brand); }
.avatar-pick { cursor: pointer; }
.avatar-pick:focus-within { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.avatar-frame { display: grid; gap: 6px; width: 100%; }
@media (max-width: 560px) {
  .avatar-edit { grid-template-columns: 1fr; justify-items: center; }
  .avatar-side { align-items: stretch; width: 100%; }
}

/* ===== Notifications (0.23): the bell in the top bar, its panel, and #/notifications ===== */
.notif-box { position: relative; }
.notif-btn .notif-count { position: absolute; top: -4px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid var(--surface); font-variant-numeric: tabular-nums; }
.notif-btn .notif-count[hidden] { display: none; }
.notif-btn[aria-expanded='true'] { background: var(--brand-soft); color: var(--brand-text); border-color: var(--brand-line); }
.notif-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; width: 400px; max-width: calc(100vw - 20px); display: flex; flex-direction: column; max-height: min(640px, calc(100vh - var(--topbar) - 16px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.notif-pop[hidden] { display: none; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 2px; }
.notif-head h2 { margin: 0; font-size: 16px; }
.notif-close { display: none; }
.notif-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 16px 10px; border-bottom: 1px solid var(--border); }
.notif-tools .check-inline { min-height: 36px; font-size: 13px; }
.notif-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.notif-days, .notif-items { list-style: none; margin: 0; padding: 0; }
.notif-day h3 { margin: 0; padding: 10px 16px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.notif-item { display: flex; align-items: flex-start; border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: var(--brand-softer); }
.notif-open { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px 10px 16px; color: var(--text); }
.notif-open:hover { text-decoration: none; background: var(--surface-2); }
.notif-open:focus-visible { outline: 2px solid var(--brand-text); outline-offset: -2px; }
.notif-av { flex: none; }
.notif-mod { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.notif-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-title { font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; }
.notif-item.unread .notif-title { font-weight: 700; }
.notif-body { font-size: 12.5px; line-height: 1.4; color: var(--text-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-meta { font-size: 12px; color: var(--muted); }
.notif-dot { flex: none; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--accent); }
.notif-tick { flex: none; margin: 6px 8px 0 -4px; }
.notif-empty { padding: 28px 20px; text-align: center; color: var(--muted); }
.notif-empty p { margin: 6px 0 0; }
.notif-empty .ic { color: var(--border-strong); }
.notif-more { margin: 0; padding: 10px 16px; text-align: center; }
.notif-foot { border-top: 1px solid var(--border); padding: 10px 16px; text-align: center; font-weight: 600; }
.card.notif-page { padding: 0; overflow: hidden; }
.notif-page .toolbar { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif-page .notif-items { border-bottom: 1px solid var(--border); }
.notif-page .notif-day:last-child .notif-items { border-bottom: 0; }
.notif-page .notif-day h3 { padding-top: 14px; }
.notif-page .notif-body { -webkit-line-clamp: 3; }
.menu-pop .phone-only { display: none; }
/* Phones: the panel is a full-width sheet under the top bar; the theme button moves into the menu
   under your name, so the top bar keeps its five buttons in 360 px. */
@media (max-width: 600px) {
  .notif-pop { position: fixed; left: 0; right: 0; top: var(--topbar); width: auto; max-width: none; border-radius: 0 0 var(--radius) var(--radius); border-left: 0; border-right: 0; max-height: calc(100vh - var(--topbar)); max-height: calc(100dvh - var(--topbar)); }
  .notif-close { display: inline-grid; }
  #theme-btn { display: none; }
  .menu-pop .phone-only { display: flex; }
  .topbar { gap: 6px; }
}
@media (pointer: coarse) {
  .notif-open { min-height: 44px; }
  .notif-tick, .notif-close { min-width: 44px; min-height: 44px; }
  .notif-tick { margin: 2px 4px 0 -8px; }
  .notif-tools .check-inline { min-height: 44px; }
  .notif-foot a, .notif-more a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* The member list in the project form. */
.pm-form-members { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 12px; margin: 0; min-width: 0; }
.pm-form-members legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.pm-form-members legend small { font-weight: 500; }
.pm-form-members .pm-members { margin-bottom: 6px; }
.pm-members td .avatar { margin-right: 6px; vertical-align: middle; }
.pm-mem-empty { margin: 4px 0 8px; }
/* A project's own picture as its icon */
.pm-picon.pic { background: var(--surface-2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
.pm-picon.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pm-icon-own { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 10px; }
.pm-icon-own .btn { cursor: pointer; }
.pm-icon-upload:focus-within { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.pm-icon-own-note { flex-basis: 100%; }

/* ----- The visual description editor (public/js/richeditor.js) ----- */
.wys .rich-head { margin-bottom: 6px; }
.wys .rich-label { font-weight: 600; font-size: 13px; color: var(--text-2); }
.wys-box { position: relative; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); }
.wys-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.wys .rich-bar { position: sticky; top: 0; z-index: 2; border: 0; border-bottom: 1px solid var(--border); border-radius: 10px 10px 0 0; gap: 2px; padding: 4px 6px; }
.wys-style { width: auto; min-width: 0; height: 30px; padding: 2px 26px 2px 8px; font-size: 13px; border-color: transparent; background-color: transparent; }
.wys-style:hover { background-color: var(--surface); }
.rich-tool.on { background: var(--brand-softer); color: var(--brand); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 35%, transparent); }
.wys-area { min-height: 180px; max-height: 60vh; overflow-y: auto; padding: 12px 14px; outline: none; border-radius: 0 0 10px 10px; cursor: text; }
.wys-area > :first-child { margin-top: 0; }
.wys-area.is-empty::before { content: attr(data-placeholder); position: absolute; pointer-events: none; color: var(--muted); }
.wys-area a { cursor: text; }
.wys-area pre { white-space: pre-wrap; }
.wys-area li.rich-task > input { cursor: pointer; }
.wys-area .rich-table td, .wys-area .rich-table th { min-width: 80px; }
.wys-area figure.rich-img { position: relative; display: inline-block; max-width: 100%; margin: 4px 0 12px; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; line-height: 0; user-select: none; }
.wys-area figure.rich-img img { display: block; max-width: 100%; max-height: 360px; }
.wys-area figure.rich-img:hover, .wys-area figure.rich-img:focus-within { box-shadow: 0 0 0 2px var(--brand); }
.wys-img-del { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgb(0 0 0 / 65%); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.wys-area figure.rich-img:hover .wys-img-del, .wys-img-del:focus-visible { opacity: 1; }
.wys-area figure.uploading { display: block; padding: 14px; line-height: 1.4; background: var(--surface-2); }
.wys-uploading { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.wys-uploading .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--brand); animation: wys-spin 0.8s linear infinite; }
@keyframes wys-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .wys-uploading .spin { animation: none; } }
.wys.drop .wys-box { outline: 2px dashed var(--brand); outline-offset: -4px; }
.wys.too-long .wys-box { border-color: var(--danger); }
.wys.too-long .rich-count { color: var(--danger); font-weight: 600; }
.wys kbd { font-family: inherit; font-size: 11.5px; padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); }
.wys .rich-foot .hint { font-family: inherit; }
/* The menu over selected text */
.wys-bubble { position: absolute; z-index: 5; display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: var(--text); box-shadow: 0 6px 18px rgb(0 0 0 / 22%); }
.wys-bubble button { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--surface); cursor: pointer; }
.wys-bubble button:hover, .wys-bubble button.on { background: rgb(255 255 255 / 18%); }
/* The "/" menu */
.wys-slash { position: absolute; z-index: 6; width: 260px; max-height: 300px; overflow-y: auto; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: 0 10px 28px rgb(0 0 0 / 18%); }
.wys-slash-item { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.wys-slash-item strong { font-size: 13.5px; font-weight: 600; }
.wys-slash-item small { font-size: 12px; color: var(--muted); }
.wys-slash-item.on, .wys-slash-item:hover { background: var(--brand-softer); }
/* A table's rows and columns: the bar over the table at the cursor, and its menu */
.wys-tbar { position: absolute; z-index: 4; display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 6px 18px rgb(0 0 0 / 14%); }
.wys-tbar button { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--text-2); cursor: pointer; }
.wys-tbar button:hover, .wys-tbar button[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
.wys-tbar button:focus-visible, .wys-tmenu button:focus-visible { outline: 2px solid var(--brand-text); outline-offset: -2px; }
.wys-tbar .rich-sep { width: 1px; height: 18px; margin: 0 3px; background: var(--border); }
.wys-tmenu { position: fixed; z-index: 90; display: flex; flex-direction: column; min-width: 200px; max-height: calc(100vh - 16px); overflow-y: auto; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: 0 10px 28px rgb(0 0 0 / 18%); }
.wys-tmenu button { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 0; border-radius: 7px; background: none; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.wys-tmenu button:hover:not(:disabled), .wys-tmenu button:focus-visible { background: var(--brand-softer); }
.wys-tmenu button:disabled { color: var(--muted); cursor: default; }
.wys-tmenu button.danger:not(:disabled) { color: var(--danger); }
.wys-tmenu button[aria-checked]::before { content: ''; flex: none; width: 14px; text-align: center; }
.wys-tmenu button[aria-checked="true"]::before { content: '✓'; }
.wys-tmenu-sep { height: 1px; margin: 4px 6px; background: var(--border); }
.rich-table .ta-center { text-align: center; }
.rich-table .ta-right { text-align: right; }
/* Editing the description in place on the task page */
.pm-desc-edit .rich-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pm-desc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.pm-desc-actions small { margin-left: auto; }
.pm-desc-empty .link { font-size: 14px; }
@media (pointer: coarse) {
  .wys-style { height: 44px; font-size: 16px; }
  .wys-area { font-size: 16px; }
  .wys-slash-item { padding: 11px 12px; }
  .wys-img-del { opacity: 1; width: 36px; height: 36px; }
  .wys-tbar button { width: 44px; height: 44px; }
  .wys-tmenu button { padding: 12px; font-size: 15px; }
}
@media (max-width: 760px) {
  .wys-area { max-height: 50vh; }
  .wys .rich-foot .hint { display: none; }
}
/* Inside a form field, em is the red "required" star: not in formatted text. */
.field .rich em, .rich em { color: inherit; font-style: italic; margin: 0; }
.rich a { color: var(--brand-text, var(--brand)); }
@media (max-width: 760px) {
  /* Phones: the toolbar is one row that scrolls sideways, so the text keeps the screen. */
  .wys .rich-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: 6px; }
  .wys .rich-bar::-webkit-scrollbar { display: none; }
  .wys .rich-bar > * { flex: none; scroll-snap-align: start; }
  /* The table's bar keeps to adding rows and columns; deleting is in its menu (the … button). */
  .wys-tbar [data-top^="del"], .wys-tbar .rich-sep:first-of-type { display: none; }
}

/* Breadcrumbs on a project's pages and its tasks: Projects › project › view › parent › task */
.pm-crumbs { margin: 0 0 8px; font-size: 13px; }
.pm-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; margin: 0; padding: 0; list-style: none; }
.pm-crumbs li { display: inline-flex; align-items: center; min-width: 0; }
.pm-crumbs li + li::before { content: ''; flex: none; width: 5px; height: 5px; margin: 0 9px 0 6px; border-top: 1.5px solid var(--muted); border-right: 1.5px solid var(--muted); transform: rotate(45deg); opacity: 0.7; }
.pm-crumbs a, .pm-crumbs .crumb-cur { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 32ch; padding: 2px 4px; margin: 0 -4px; border-radius: 6px; color: var(--muted); font-weight: 500; }
.pm-crumbs a:hover { color: var(--brand-text); background: var(--surface-2); text-decoration: none; }
.pm-crumbs a:focus-visible, .pm-crumbs button:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 1px; }
.pm-crumbs .crumb-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-crumbs .crumb-text.mono { font-size: 12.5px; }
.pm-crumbs .crumb-cur { color: var(--text-2); font-weight: 600; margin-right: 0; }
.pm-crumbs .pm-picon-sm { width: 16px; height: 16px; font-size: 9.5px; border-radius: 4px; vertical-align: 0; }
.pm-crumbs .crumb-switch, .pm-crumbs .crumb-more button { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-left: 4px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; font: inherit; }
.pm-crumbs .crumb-switch:hover, .pm-crumbs .crumb-switch[aria-expanded='true'], .pm-crumbs .crumb-more button:hover { background: var(--surface-2); color: var(--text); }
.pm-crumbs .crumb-more { display: none; }
.pm-crumbs .crumb-more button { width: 28px; margin-left: 0; letter-spacing: 1px; font-weight: 700; }
@media (max-width: 760px) {
  /* Phones: Projects › … › the level above › here; tap … for the rest. */
  .pm-crumbs.can-fold:not(.open) .crumb-mid { display: none; }
  .pm-crumbs.can-fold:not(.open) .crumb-more { display: inline-flex; }
  .page-head > div:has(> .pm-crumbs) { min-width: 0; max-width: 100%; }
  .pm-crumbs ol { flex-wrap: nowrap; }
  .pm-crumbs.open ol { flex-wrap: wrap; }
  .pm-crumbs li { flex: 0 1 auto; }
  .pm-crumbs li:first-child, .pm-crumbs .crumb-more { flex: none; }
  .pm-crumbs li:first-child a { max-width: none; }
  .pm-crumbs li:last-child { flex: 0 2 auto; }
  .pm-crumbs a, .pm-crumbs .crumb-cur { max-width: 100%; }
}
@media (pointer: coarse) {
  .pm-crumbs a, .pm-crumbs .crumb-cur { min-height: 44px; }
  .pm-crumbs .crumb-switch, .pm-crumbs .crumb-more button { width: 44px; height: 44px; margin-left: 0; }
  .pm-crumbs { margin-block: -8px 0; }
}
.pm-subof { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.pm-subof a { font-weight: 500; }

/* Everyone's profile (0.32) */
.avatar.xl { width: 96px; height: 96px; font-size: 32px; }
.profile-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.profile-head .profile-id { flex: 1; min-width: 200px; }
.profile-head h1 { margin: 0; }
.profile-role { margin: 4px 0 0; font-size: 16px; font-weight: 600; color: var(--brand-text); }
.profile-role .muted { font-weight: 400; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.profile-grid .profile-access { grid-column: 1 / -1; }
.profile-grid > .card { margin: 0; }
.profile-public-note { margin-top: 16px; }
.profile-grid h2 { display: flex; align-items: center; gap: 8px; }
.profile-note { margin: 14px 0 0; }
.profile-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.access-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.access-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.access-list .mod-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.access-list li.shut .mod-ic { background: var(--surface-2); color: var(--muted); }
.access-list li.shut strong { color: var(--muted); }
.access-list .grow { min-width: 0; display: flex; flex-direction: column; }
.access-list small { color: var(--muted); font-size: 12.5px; }
.profile-public-note { display: flex; align-items: center; gap: 6px; }
a.person-link { color: inherit; text-decoration: none; }
a.person-link:hover { color: var(--brand-text); text-decoration: underline; }
@media (max-width: 760px) {
  .profile-grid, .access-list { grid-template-columns: minmax(0, 1fr); }
  .profile-head { gap: 14px; }
  .avatar.xl { width: 72px; height: 72px; font-size: 24px; }
  .profile-head .actions { width: 100%; }
}
a.hub-role { color: inherit; text-decoration: none; }
a.hub-role:hover { background: rgba(255, 255, 255, 0.26); }

/* ----- Admin panel → Security monitor (0.34) ----- */
:root { --chart-1: #a8263f; --chart-grid: #e5e7eb; --chart-base: #c4c8cf; }
:root[data-theme='dark'] { --chart-1: #e0607a; --chart-grid: #243044; --chart-base: #3b4a63; }
.dash-links { display: inline-flex; gap: 14px; flex-wrap: wrap; }
.mon-filter { display: flex; justify-content: flex-start; margin: -4px 0 14px; }
.mon-stats .card strong { font-size: 22px; }
.mon-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
.mon-checks .card { margin: 0; }
.mon-checks h2, .mon-checks + .cols h2 { font-size: 15px; }
.mon-list { list-style: none; margin: 0; padding: 0; }
.mon-check { display: grid; grid-template-columns: 118px minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--border); }
.mon-check:first-child { border-top: 0; padding-top: 2px; }
.mon-check .grow strong { display: block; font-size: 14px; }
.mon-check .grow small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.mon-check > a { white-space: nowrap; display: inline-flex; align-items: center; gap: 2px; }
.mon-state { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.mon-state.ok { color: var(--success); }
.mon-state.warn { color: var(--warn); }
.mon-state.bad { color: var(--danger); }
.mon-state.info { color: var(--muted); }
.mon-check.st-bad { background: linear-gradient(var(--danger-soft), var(--danger-soft)) no-repeat; background-size: 100% 100%; margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 6px; border-top-color: transparent; }
.mon-check.st-bad + .mon-check { border-top-color: transparent; }
@media (max-width: 560px) {
  .mon-check { grid-template-columns: minmax(0, 1fr) auto; }
  .mon-check .mon-state { grid-column: 1 / -1; }
}
.mon-rank-table td.mon-bar { width: 32%; min-width: 80px; }
.mon-rank-table tr.muted td { color: var(--muted); }
.mc-rank { display: block; height: 8px; border-radius: 0 4px 4px 0; background: transparent; }
.mc-rank i { display: block; height: 100%; background: var(--chart-1); border-radius: 0 4px 4px 0; }
.mon-route { font-size: 12px; overflow-wrap: anywhere; }
.mon-public ul { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; }
.mon-public summary { cursor: pointer; font-size: 13px; color: var(--brand-text); font-weight: 600; margin-top: 10px; }
.mon-token { margin: 14px 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); display: grid; gap: 8px; }
.mon-token p { margin: 0; font-size: 13px; }
.mon-token-value { display: block; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; font-size: 12.5px; overflow-wrap: anywhere; user-select: all; }
.mon-token .btn { justify-self: start; }

/* Small charts (public/js/charts.js): one series, one axis, hairline grid. */
.mchart { margin: 0; }
.mchart figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 10px; }
.mchart figcaption strong { font-size: 14px; }
.mc-plot { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.mc-y { display: flex; flex-direction: column; justify-content: space-between; height: 150px; font-size: 11px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; min-width: 24px; }
.mc-y span { line-height: 1; transform: translateY(-1px); }
.mc-y span:last-child { transform: translateY(1px); }
.mc-area { position: relative; height: 150px; outline-offset: 4px; border-radius: 2px; cursor: crosshair; }
.mc-area svg { display: block; width: 100%; height: 100%; overflow: visible; }
.mc-grid { stroke: var(--chart-grid); stroke-width: 1; }
.mc-base { stroke: var(--chart-base); stroke-width: 1; }
.mc-bar { fill: var(--chart-1); }
.mc-bar.on { fill: color-mix(in srgb, var(--chart-1) 70%, var(--surface)); }
.mc-line { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mc-wash { fill: var(--chart-1); opacity: 0.1; stroke: none; }
.mc-cross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--text-2); opacity: 0.45; pointer-events: none; }
.mc-tip { position: absolute; top: -6px; transform: translate(10px, -100%); background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap; pointer-events: none; z-index: 3; display: grid; gap: 1px; }
.mc-tip.flip { transform: translate(calc(-100% - 10px), -100%); }
.mc-tip strong { font-size: 14px; color: var(--text); }
.mc-tip span { color: var(--muted); }
.mc-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; text-align: center; padding: 0 12px; }
.mc-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin: 6px 0 0; padding-left: 32px; font-variant-numeric: tabular-nums; }
.mc-table { margin-top: 8px; }
.mc-table summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.mc-table .table-scroll { max-height: 260px; overflow-y: auto; margin-top: 6px; }
.mchart + .mchart { margin-top: 22px; }

/* ===== Responsive pass 3 (0.47) ===== */
/* Dialogs on a computer: no taller than the window; the form scrolls between its title and its
   buttons, so Save is always in view. */
@media (min-width: 961px) and (min-height: 501px) {
  .modal { display: flex; flex-direction: column; max-height: 86vh; max-height: 86dvh; }
  .modal header, .modal footer { flex: none; }
  .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
}
/* On a tablet (761–960px) a dialog sits in the middle of the screen at a readable width, instead
   of a sheet as wide as the screen. */
@media (min-width: 761px) and (max-width: 960px) and (min-height: 501px) {
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal, .modal.wide { max-width: 640px; border-radius: 16px; max-height: calc(100dvh - 48px); }
  .modal::before { display: none; }
  .modal footer { padding-bottom: 14px; }
  .modal footer .btn { flex: 0 0 auto; min-width: 120px; }
}
/* Touch screens: the last small links get a finger-sized hit area; tags that are only labels keep
   their size. */
@media (pointer: coarse) {
  .hub-role { min-height: 44px; padding: 8px 16px; }
  .dash-links a, .pm-files .grow > a { display: inline-flex; align-items: center; min-height: 44px; }
  .pm-tl-label a { display: block; padding-block: 10px 4px; }
  .appr-table td.check input, .appr-table th.check input { width: 24px; height: 24px; }
  span.chip { min-height: 0; padding: 5px 12px; }
}
/* Phones (0.47): the ticket's Reply / Internal note switch fits a 320px screen; a task's project name
   wraps under it in My work; on a project page the current breadcrumb (Overview, Board…) keeps its
   name while the project's is shortened. */
@media (max-width: 420px) {
  .seg.hd-mode { width: 100%; }
  .seg.hd-mode label { flex: 1 1 0; justify-content: center; white-space: normal; padding: 8px 10px; }
}
@media (max-width: 760px) {
  .pm-proj-link { white-space: normal; overflow-wrap: anywhere; }
  .pm-crumbs li:last-child { flex: 0 0 auto; max-width: 60%; }
}
@media (pointer: coarse) {
  .crm-stage-table .row-actions .icon-btn { width: 44px; height: 44px; min-width: 44px; }
  label.crm-tick { min-width: 44px; min-height: 44px; }
  .back { min-height: 44px; margin-top: -10px; margin-bottom: -4px; }
}

/* A feature on a module's roadmap (0.48): "Soon" beside its menu item, and its page. */
.nav-soon { flex: none; padding: 0 6px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; line-height: 16px; text-transform: uppercase; }
@media (min-width: 961px) { body.nav-mini .nav-soon { display: none; } }
.page-head h1 .soon-tag { vertical-align: middle; margin-left: 8px; font-size: 12px; }
.soon-card { display: flex; gap: 18px; align-items: flex-start; max-width: 760px; }
.soon-card h2 { margin: 0 0 8px; font-size: 16px; }
.soon-ic { flex: none; width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.soon-list { margin: 0 0 12px; padding-left: 18px; display: grid; gap: 6px; color: var(--text-2); }
@media (max-width: 560px) { .soon-card { flex-direction: column; gap: 12px; } }

/* Integrations on the CORE home (0.49): services CORE will connect to, coming soon. Cards in a grid
   (they are few, so no sliding row), or tiles in the compact view like the modules. */
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 16px; }
.int-grid .sys-card { min-height: 0; }
.sys-section.compact .int-grid { display: none; }

/* Integration cards (0.50): each in its own colour, with the link to come drawn at the top (CORE's
   mark, a dashed wire with a dot travelling along it, the service's icon) and chips for what it
   will bring. --int is the colour, --int-deep its darker end, --int-text the readable text. */
.int-blue { --int: #2f6fdb; --int-deep: #1d4fb0; --int-text: #1d4ed8; }
.int-teal { --int: #13998a; --int-deep: #0b6f64; --int-text: #0f766e; }
.int-orange { --int: #e8742a; --int-deep: #b9520f; --int-text: #b4480b; }
:root[data-theme='dark'] .int-blue { --int-text: #93c5fd; }
:root[data-theme='dark'] .int-teal { --int-text: #5eead4; }
:root[data-theme='dark'] .int-orange { --int-text: #fdba74; }
.sys-card.int-card { cursor: default; border-color: color-mix(in srgb, var(--int) 32%, var(--border)); box-shadow: 0 6px 18px color-mix(in srgb, var(--int) 12%, transparent);
  background: radial-gradient(120% 70% at 100% 0%, color-mix(in srgb, var(--int) 11%, transparent), transparent 60%), var(--surface); }
/* A field of small dots in the top corner, fading out. */
.sys-card.int-card::after { content: ''; position: absolute; top: 4px; right: 0; width: 150px; height: 110px; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--int) 30%, transparent) 1.2px, transparent 1.6px) 0 0 / 12px 12px;
  -webkit-mask-image: radial-gradient(110% 100% at 100% 0%, #000 20%, transparent 70%); mask-image: radial-gradient(110% 100% at 100% 0%, #000 20%, transparent 70%); }
.sys-card.int-card > * { position: relative; z-index: 1; }
.sys-card.int-card::before { height: 4px; background: linear-gradient(90deg, var(--int-deep), var(--int), color-mix(in srgb, var(--int) 45%, var(--surface))); }
.int-card .sys-top { align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.int-link { display: inline-flex; align-items: center; }
.int-core { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.int-core img { width: 22px; height: 22px; }
.int-core .on-dark, :root[data-theme='dark'] .int-core .on-light { display: none; }
:root[data-theme='dark'] .int-core .on-dark { display: block; }
.int-wire { position: relative; width: 28px; height: 2px; margin: 0 4px; background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--int) 55%, transparent) 0 4px, transparent 4px 8px); }
.int-dot { position: absolute; top: -3px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--int); box-shadow: 0 0 0 3px color-mix(in srgb, var(--int) 22%, transparent); animation: int-flow 2.6s ease-in-out infinite; }
@keyframes int-flow { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: calc(100% - 8px); opacity: 0; } }
.sys-card.int-card .sys-ic { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, var(--int), var(--int-deep)); color: #fff; border: 0; filter: none; box-shadow: 0 6px 14px color-mix(in srgb, var(--int) 32%, transparent); }
.int-card .int-badge { background: color-mix(in srgb, var(--int) 10%, var(--surface)); color: var(--int-text); border-color: color-mix(in srgb, var(--int) 35%, var(--surface)); }
.sys-card.int-card .sys-name { color: var(--text); }
.sys-card.int-card p { color: var(--text-2); }
.int-feats { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.int-feats li { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--int-text); background: color-mix(in srgb, var(--int) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--int) 25%, var(--surface)); }
.sys-card.int-card .sys-open { color: var(--muted); font-size: 13px; }
/* The compact tiles keep the colour: its bar on the left and the icon. */
.sys-mini.int-mini { background: linear-gradient(120deg, color-mix(in srgb, var(--int) 8%, var(--surface)), var(--surface) 70%); border-color: color-mix(in srgb, var(--int) 28%, var(--border)); }
.sys-mini.int-mini::before { background: linear-gradient(180deg, var(--int), var(--int-deep)); width: 4px; }
.sys-mini.int-mini .sys-ic { background: linear-gradient(135deg, var(--int), var(--int-deep)); color: #fff; border: 0; }
.sys-mini.int-mini strong { color: var(--text); }
.sys-mini.int-mini small { color: var(--int-text); }
@media (prefers-reduced-motion: reduce) { .int-dot { animation: none; left: calc(50% - 4px); } }

/* Favorite projects (0.51): the star beside a project's name, the Favorites cards at the top of the
   Projects overview, and the list in the side menu. */
.pm-fav { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; transition: color 0.14s, background 0.14s, transform 0.14s; }
.pm-fav:hover { background: var(--surface-2); border-color: var(--border); color: var(--accent); }
.pm-fav:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.pm-fav[aria-pressed='true'] { color: var(--accent); }
.pm-fav[aria-pressed='true'] .ic { fill: currentColor; }
.pm-fav:disabled { opacity: 0.5; cursor: progress; }
.pm-title .pm-fav { margin-left: 4px; align-self: center; }
.pm-fav-cell { position: relative; padding-right: 48px !important; }
.pm-fav-cell .pm-fav { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.pm-favs:empty { display: none; }
.pm-favs { margin: 16px 0; }
.pm-fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); gap: 12px; }
.pm-fav-card { position: relative; display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s; overflow: hidden; }
.pm-fav-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 35%, var(--surface))); }
.pm-fav-card:hover { border-color: var(--brand-line); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.pm-fav-main { flex: 1; min-width: 0; display: grid; gap: 10px; padding: 16px 48px 14px 16px; color: var(--text); }
.pm-fav-main:hover { text-decoration: none; }
.pm-fav-main strong { display: block; color: var(--brand-text); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-fav-main .pm-named > span { min-width: 0; }
.pm-fav-main small { display: block; color: var(--muted); font-size: 12px; }
.pm-fav-meta { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; min-height: 22px; }
.pm-fav-card > .pm-fav { position: absolute; top: 10px; right: 8px; }
.pm-fav-empty { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 14px; border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--text-2); font-size: 13px; background: var(--surface); }
.pm-fav-empty .ic { color: var(--accent); flex: none; }
/* In the side menu: under Favorites, each project with its icon. */
#nav a.nav-fav { gap: 10px; }
#nav a.nav-fav .pm-picon { flex: none; }
@media (pointer: coarse) { .pm-fav { width: 44px; height: 44px; } .pm-fav-cell { padding-right: 56px !important; } .pm-fav-main { padding-right: 56px; } }
@media (prefers-reduced-motion: reduce) { .pm-fav, .pm-fav-card { transition: none; } .pm-fav-card:hover { transform: none; } }
#pm-favs-h > .ic, .pm-fav-empty > .ic { color: var(--accent); fill: currentColor; }

/* Project keys and task links (0.52). */
.pm-key-chip { display: inline-block; padding: 0 7px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-text); font: 700 12px/20px var(--mono, ui-monospace, monospace); letter-spacing: 0.06em; vertical-align: 1px; }
.pm-key-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pm-key-row input { width: 92px; flex: none; text-transform: uppercase; font-family: var(--mono, ui-monospace, monospace); font-weight: 700; letter-spacing: 0.12em; text-align: center; }
.pm-key-row .hint { flex: 1 1 220px; margin: 0; overflow-wrap: anywhere; }
.pm-task-key { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--brand-text); font: 600 12.5px/20px var(--mono, ui-monospace, monospace); vertical-align: 1px; }
.pm-task-key:hover { text-decoration: none; border-color: var(--brand-line); background: var(--brand-softer); }
@media (pointer: coarse) { .pm-task-key { min-height: 32px; padding: 4px 10px; } }

/* Drag and drop files onto a task's Files card or a milestone's files (0.53): while files are
   dragged over CORE the card shows a dashed edge; over it, a veil says "Drop to attach". */
.pm-dropzone { position: relative; }
.pm-drop-veil { display: none; }
body.dragging-files .pm-dropzone { outline: 2px dashed color-mix(in srgb, var(--brand) 45%, var(--border)); outline-offset: 3px; }
.pm-dropzone.pm-drop-over .pm-drop-veil { display: grid; place-content: center; justify-items: center; gap: 4px; position: absolute; inset: 0; z-index: 5; border-radius: inherit;
  background: color-mix(in srgb, var(--brand-soft) 88%, transparent); border: 2px dashed var(--brand); color: var(--brand-text); text-align: center; pointer-events: none; }
.pm-drop-veil strong { font-size: 16px; }
.pm-drop-veil small { color: var(--text-2); }
.pm-dropzone.pm-uploading .pm-file-add .btn { opacity: 0.6; cursor: progress; }
@media (pointer: coarse) { .pm-drop-hint { display: none; } }
@media (prefers-reduced-motion: no-preference) { .pm-dropzone { transition: outline-color 0.15s; } }

/* File previews as their icons (0.54): a photo's thumbnail, a scanned PDF's first page (portrait,
   with a "PDF" tag), or a page drawing for a PDF without one. A preview opens larger on click. */
.pm-files li { align-items: center; }
.pm-file-thumb { position: relative; flex: none; width: 48px; height: 48px; display: grid; place-items: center; padding: 0; overflow: hidden; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.pm-file-thumb.pdf { width: 40px; height: 52px; border-radius: 6px; background: var(--surface); }
.pm-file-thumb.pdf.none { background: linear-gradient(180deg, var(--surface) 0 70%, color-mix(in srgb, var(--danger) 8%, var(--surface))); }
.pm-file-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.pm-thumb-tag { position: absolute; left: 0; right: 0; bottom: 0; padding: 1px 0; background: color-mix(in srgb, var(--danger) 88%, #000); color: #fff; font-size: 9px; font-weight: 800; letter-spacing: 0.06em; text-align: center; line-height: 12px; }
button.pm-file-thumb { cursor: zoom-in; transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s; }
button.pm-file-thumb:hover { border-color: var(--brand-line); box-shadow: var(--shadow); transform: translateY(-1px); }
button.pm-file-thumb:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { button.pm-file-thumb { transition: none; } button.pm-file-thumb:hover { transform: none; } }
.pm-preview-big { margin: 0; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.pm-preview-big img { max-width: 100%; max-height: 62vh; object-fit: contain; border-radius: 4px; box-shadow: var(--shadow); background: #fff; }


/* Many files on a task or a milestone (0.55): about five rows show; the list scrolls inside the
   card, with a fade at the top or bottom edge where more files wait. */
.pm-files-wrap { position: relative; }
.pm-files-wrap.scrolls .pm-files { max-height: 352px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-gutter: stable; margin-bottom: 4px; padding-right: 6px; border-radius: var(--radius-sm); }
.pm-files-wrap.scrolls .pm-files:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.pm-files-wrap.scrolls.more-below .pm-files { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); }
.pm-files-wrap.scrolls.more-above .pm-files { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 40px); mask-image: linear-gradient(to bottom, transparent, #000 40px); }
.pm-files-wrap.scrolls.more-above.more-below .pm-files { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 40px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to bottom, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
.pm-files-more { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; }
.pm-files-wrap:not(.more-below) .pm-files-more .ic { transform: rotate(180deg); }
@media (max-width: 760px) { .pm-files-wrap.scrolls .pm-files { max-height: 300px; } }

/* Kinds of files (0.56): the tag on a document's icon in its colour. */
.pm-thumb-tag.tag-blue { background: #2b5fb8; }
.pm-thumb-tag.tag-green { background: #1f7a45; }
.pm-thumb-tag.tag-orange { background: #c4501c; }
.pm-thumb-tag.tag-gray { background: #5b6472; }
.pm-file-thumb.none:has(.tag-blue) { color: #2b5fb8; }
.pm-file-thumb.none:has(.tag-green) { color: #1f7a45; }
.pm-file-thumb.none:has(.tag-orange) { color: #c4501c; }
:root[data-theme='dark'] .pm-file-thumb.none:has(.tag-blue) { color: #93b4ef; }
:root[data-theme='dark'] .pm-file-thumb.none:has(.tag-green) { color: #7fd1a0; }
:root[data-theme='dark'] .pm-file-thumb.none:has(.tag-orange) { color: #f2a37c; }
.pm-file-thumb.pdf.none:not(:has(.tag-red)) { background: var(--surface); }

/* Task comments (0.58): conversation bubbles, threads of replies, emoji reactions, edit in place. */
.pm-comments { gap: 16px; margin-bottom: 16px; }
.pm-thread { display: grid; gap: 6px; }
.pm-thread-list, .pm-replies ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pm-comment { align-items: flex-start; }
.pm-comment > .avatar { margin-top: 4px; width: 30px; height: 30px; font-size: 11px; }
.pm-c-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.pm-c-bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; padding: 8px 12px 10px; }
.pm-comment.own .pm-c-bubble { background: color-mix(in srgb, var(--brand-soft) 55%, var(--surface)); border-color: color-mix(in srgb, var(--brand-line) 55%, var(--border)); }
.pm-c-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.pm-c-head strong { font-size: 13.5px; }
.pm-c-head time, .pm-c-edited { color: var(--muted); font-size: 12px; }
.pm-c-tools { margin-left: auto; display: inline-flex; gap: 2px; opacity: 0; transition: opacity 0.12s; }
.pm-comment:hover .pm-c-tools, .pm-comment:focus-within .pm-c-tools { opacity: 1; }
@media (hover: none) { .pm-c-tools { opacity: 1; } }
.pm-c-tools .icon-btn { width: 28px; height: 28px; padding: 0; margin: 0; }
.pm-c-body .rich.pm-comment-body { margin-top: 2px; color: var(--text); }
.pm-c-body .pm-mini-composer { margin-top: 6px; }
.pm-comment.deleted .pm-c-bubble { background: transparent; border-style: dashed; padding: 6px 12px; font-size: 13px; }
.pm-c-gone { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.pm-c-foot { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; padding-left: 4px; }
/* Reactions: a chip per emoji with its count (yours highlighted), and + to add one. */
.pm-reacts { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pm-react { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pm-react .pm-emoji { font-size: 14px; line-height: 1; }
.pm-react:hover:not(:disabled) { border-color: var(--brand-line); }
.pm-react.on { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-text); }
.pm-react:disabled { cursor: default; }
.pm-react-add { position: relative; display: inline-flex; }
.pm-react-pick, .pm-c-reply, .pm-more-replies { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border-radius: 999px; border: 1px solid transparent; background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pm-react-pick:hover, .pm-c-reply:hover, .pm-more-replies:hover, .pm-react-pick[aria-expanded='true'] { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.pm-react-pick:focus-visible, .pm-c-reply:focus-visible, .pm-react:focus-visible, .pm-more-replies:focus-visible, .pm-react-pop button:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.pm-react-pop { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 20; display: flex; gap: 2px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow-lg); }
.pm-react-pop[hidden] { display: none; }
.pm-react-pop button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; font-size: 19px; line-height: 1; cursor: pointer; transition: transform 0.12s, background 0.12s; }
.pm-react-pop button:hover { background: var(--surface-2); transform: scale(1.18); }
/* A thread: its replies under the first comment, along a line. */
.pm-replies { margin-left: 15px; padding-left: 21px; border-left: 2px solid var(--border); display: grid; gap: 8px; }
.pm-replies .pm-comment > .avatar, .pm-replies .pm-c-gone { width: 26px; height: 26px; font-size: 10px; }
.pm-more-replies { justify-self: start; }
.pm-reply-slot:empty { display: none; }
.pm-reply-slot { margin-left: 38px; }
.pm-mini-composer { display: grid; gap: 6px; }
.pm-mini-composer .rich-ed { margin: 0; }
.pm-mini-composer .rich-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pm-mini-composer .wys-area { min-height: 60px; }
@media (pointer: coarse) { .pm-react, .pm-react-pick, .pm-c-reply, .pm-more-replies { height: 36px; padding: 0 12px; } .pm-react-pop button { width: 42px; height: 42px; } .pm-c-tools .icon-btn { width: 40px; height: 40px; } }
@media (max-width: 560px) { .pm-replies { margin-left: 6px; padding-left: 12px; } .pm-reply-slot { margin-left: 0; } .pm-react-pop { left: auto; right: -40px; } }
@media (prefers-reduced-motion: reduce) { .pm-react-pop button, .pm-c-tools { transition: none; } .pm-react-pop button:hover { transform: none; } }

/* Timeline export (0.59): the Export menu, and the printed report on landscape pages. */
.pm-export { position: relative; display: inline-flex; }
.pm-export-pop { min-width: 300px; }
.pm-export-pop button { align-items: flex-start; }
.pm-export-pop strong { display: block; font-size: 14px; }
.pm-export-pop small { display: block; color: var(--muted); font-size: 12px; white-space: normal; }
.pm-export-pop .ic { margin-top: 2px; flex: none; }
@media (max-width: 560px) { .pm-export-pop { right: auto; left: 0; min-width: min(300px, calc(100vw - 32px)); } }
@page gantt { size: A4 landscape; margin: 10mm; }
@media print {
  body.pm-printing .pm-gantt-report { page: gantt; font-size: 10px; }
  .pm-gantt-report .pm-g-chart { margin: 8px 0 10px; break-inside: avoid; page-break-inside: avoid; }
  .pm-gantt-report .pm-g-chart svg { display: block; width: 100%; height: auto; border: 1px solid #ddd; border-radius: 4px; }
  .pm-gantt-report .pm-g-chart figcaption { font-size: 9px; color: #555; margin-top: 2px; text-align: right; }
  .pm-gantt-report h2 { break-after: avoid; page-break-after: avoid; }
  .pm-gantt-report tr { break-inside: avoid; page-break-inside: avoid; }
  .pm-gantt-report tr.late td:last-child { color: #c62828; font-weight: 600; }
  .pm-gantt-report td.mono { font-family: ui-monospace, Menlo, Consolas, monospace; white-space: nowrap; }
  .pm-gantt-report thead { display: table-header-group; }
}

/* ---------- Project automations (0.61): recurring tasks and the run log ---------- */
.pm-recs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pm-rec { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.pm-rec.paused { background: var(--surface-2); }
.pm-rec.paused .pm-rec-title, .pm-rec.paused .pm-rec-when { color: var(--muted); }
.pm-rec-ic { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-text); }
.pm-rec.paused .pm-rec-ic { background: var(--surface); color: var(--muted); }
.pm-rec-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.pm-rec-main p { margin: 0; overflow-wrap: anywhere; }
.pm-rec-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.pm-rec-title { font-size: 15px; }
.pm-rec-when { display: flex; align-items: flex-start; gap: 6px; font-weight: 500; }
.pm-rec-when svg { flex: none; margin-top: 3px; }
.pm-rec-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.pm-rec-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.pm-rec-warn { color: var(--warn); text-decoration: line-through; }
.pm-rec-actions { flex: none; display: flex; align-items: center; gap: 4px; }
.pm-repeats { text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.pm-rec-sched { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 14px; display: grid; gap: 12px; }
.pm-rec-sched legend { padding: 0 6px; font-weight: 600; }
.pm-rec-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: start; }
.pm-rec-row .field { margin: 0; }
.pm-rec-every-in, .pm-rec-due { display: flex; align-items: center; gap: 8px; }
.pm-rec-every-in input { width: 80px; }
.pm-rec-due input { width: 80px; flex: none; }
.pm-rec-due span { color: var(--text-2); font-size: 14px; }
.pm-rec-days { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-day { position: relative; cursor: pointer; }
.pm-day input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pm-day span { display: grid; place-items: center; min-width: 48px; min-height: 40px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 999px; font-weight: 500; color: var(--text-2); background: var(--surface); }
.pm-day input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.pm-day input:focus-visible + span { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.pm-rec-preview { margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--info-soft); display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.pm-rec-preview.muted { background: var(--surface-2); }
.pm-runs td small { display: block; }
.pm-run-note { min-width: 200px; max-width: 420px; overflow-wrap: anywhere; color: var(--text-2); }
#pm-recurring { margin-bottom: 16px; }
@media (max-width: 560px) {
  .pm-rec { padding: 12px; gap: 10px; }
  .pm-rec-ic { display: none; }
  .pm-day span { min-width: 44px; }
}

/* ---------- Automation rules (0.62) ---------- */
#pm-rules { margin-bottom: 16px; }
.pm-rule-ic { background: var(--accent-soft); color: var(--gold-text, var(--brand-text)); }
.pm-rule-steps { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 4px; }
.pm-rule-steps li { display: flex; gap: 8px; align-items: baseline; overflow-wrap: anywhere; }
.pm-rule-k { flex: none; display: inline-block; min-width: 46px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 600; text-align: center; color: var(--text-2); }
.pm-rule-part { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px 14px; margin: 0; display: grid; gap: 10px; }
.pm-rule-part legend { padding: 0 6px; display: flex; align-items: center; gap: 6px; }
.pm-rule-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pm-rule-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pm-rule-row select { width: auto; min-width: 140px; max-width: 100%; flex: 0 1 auto; }
.pm-rule-row input:not([type=checkbox]), .pm-rule-row textarea { flex: 1 1 160px; min-width: 0; }
.pm-rule-row .pm-rule-wide { flex: 1 1 260px; }
.pm-rule-row .icon-btn { margin-left: auto; }
.pm-rule-row .check { min-height: 40px; }
.pm-rule-form .stack { display: grid; gap: 14px; }
@media (max-width: 560px) {
  .pm-rule-row select { flex: 1 1 100%; }
}
.pm-rule-part > .btn { justify-self: start; }

/* Admin panel → Modules: Coming soon, shown or hidden (0.63) */
.roadmap-card { margin-top: 20px; }
.roadmap-card .card-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.roadmap-group th { background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: 8px; padding-bottom: 8px; }
.roadmap-card tr.module-row:has(input:not(:checked)) .mod-name { opacity: .6; }

/* ---------- Tools on the CORE home (0.64) ---------- */
.int-red { --int: #d64545; --int-deep: #a32424; --int-text: #b42323; }
/* PhilGEPS (0.69): a deep indigo, apart from Microsoft 365's blue. */
.int-indigo { --int: #4453c9; --int-deep: #2c3592; --int-text: #3730a3; }
:root[data-theme='dark'] .int-indigo { --int-text: #a5b4fc; }
:root[data-theme='dark'] .int-red { --int-text: #fca5a5; }
.sys-card.tool-card { cursor: pointer; text-decoration: none; color: inherit; }
.sys-card.tool-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px color-mix(in srgb, var(--int) 20%, transparent); }
.sys-card.tool-card .sys-open { color: var(--int-text); font-weight: 600; }
.sys-mini.tool-mini { text-decoration: none; color: inherit; }

/* ---------- PDF Studio (0.64) ---------- */
.ps-title { display: flex; align-items: center; gap: 10px; }
.ps-logo { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #d64545, #a32424); box-shadow: 0 6px 14px rgba(214, 69, 69, .3); }
.ps-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.ps-main { display: grid; gap: 16px; min-width: 0; }
.ps-side { display: grid; gap: 16px; position: sticky; top: 76px; }
.ps-drop { display: flex; align-items: center; gap: 16px; padding: 22px; border: 2px dashed var(--border-strong); background: color-mix(in srgb, var(--brand) 3%, var(--surface)); flex-wrap: wrap; transition: border-color .15s, background .15s; }
.ps-drop.over, .dragging-files .ps-drop { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.ps-drop small { display: block; color: var(--muted); margin-top: 4px; }
.ps-drop-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.ps-pick { color: var(--brand-text); font-weight: 600; text-decoration: underline; cursor: pointer; }
.ps-pick:focus-within { outline: 2px solid var(--brand-text); outline-offset: 2px; border-radius: 4px; }
.ps-busy { width: 100%; margin: 0; display: flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 500; }
.ps-busy progress { width: 140px; height: 8px; accent-color: var(--brand); }
.ps-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ps-selected { font-weight: 600; margin-right: 4px; }
.ps-grid { list-style: none; margin: 0; padding: 4px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.ps-page { position: relative; display: grid; gap: 6px; padding: 8px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: grab; transition: box-shadow .12s, border-color .12s; }
.ps-page:hover, .ps-page:focus-within { border-color: var(--border-strong); box-shadow: var(--shadow); }
.ps-page.sel { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 35%, transparent); }
.ps-page.dragging { opacity: .4; }
.ps-page.drop-before { box-shadow: -4px 0 0 0 var(--brand); }
.ps-page.drop-after { box-shadow: 4px 0 0 0 var(--brand); }
.ps-paper { position: relative; width: 100%; max-height: 220px; margin: 0 auto; border-radius: 4px; background: #fff; border: 1px solid #d9dce3; box-shadow: 0 2px 6px rgba(15, 23, 42, .08); display: grid; place-items: center; overflow: hidden; }
.ps-paper img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: transform .2s; }
.ps-paper img.pic { inset: 6%; width: 88%; height: 88%; }
.ps-export fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.ps-export legend { padding: 0; margin-bottom: 6px; font-weight: 500; font-size: 14px; }
.ps-paper.blank { color: #7a8091; font-size: 13px; text-align: center; place-content: center; gap: 2px; }
.ps-lines { display: grid; gap: 5px; width: 78%; align-content: start; padding: 10px 0; transition: transform .2s; }
.ps-lines b { font-size: 9px; line-height: 1.25; color: #2b2f3a; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 4px; overflow-wrap: anywhere; }
.ps-lines i { display: block; height: 4px; border-radius: 2px; background: #e3e6ec; }
.ps-lines i.short { width: 60%; }
.ps-tag { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: .03em; color: #fff; background: #6b7280; }
.ps-paper .ps-tag { position: absolute; left: 6px; bottom: 6px; }
.ps-red { background: #c43c3c; } .ps-blue { background: #2f6fdb; } .ps-green { background: #1f8a4c; } .ps-orange { background: #d4661c; } .ps-teal { background: #13867a; } .ps-gray { background: #6b7280; }
.ps-turned { position: absolute; top: 6px; right: 6px; display: inline-flex; align-items: center; gap: 2px; font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 4px; background: rgba(15, 23, 42, .7); color: #fff; }
.ps-foot { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ps-check { display: grid; place-items: center; min-width: 28px; min-height: 28px; cursor: pointer; }
.ps-no { flex: none; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.ps-from { min-width: 0; font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-from small { display: block; color: var(--muted); font-weight: 400; }
.ps-tools { display: flex; justify-content: space-between; gap: 2px; }
.ps-tools .icon-btn { width: 30px; height: 30px; }
.ps-tip { margin: 10px 4px 0; }
.ps-srcs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ps-src { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--border); }
.ps-src:first-child { border-top: 0; }
.ps-src-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ps-src-main strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-src-main small { color: var(--muted); }
.ps-src-main small b { color: var(--warn); font-weight: 600; }
.ps-warn { color: var(--warn) !important; display: flex; gap: 4px; align-items: flex-start; }
.ps-src-act { display: flex; align-items: center; gap: 2px; flex: none; }
.ps-export { display: grid; gap: 12px; }
.ps-export h2 { margin: 0; }
.ps-export .field { margin: 0; }
.ps-radio { display: grid; gap: 2px; }
.ps-more { border-top: 1px solid var(--border); padding-top: 10px; display: grid; gap: 10px; }
.ps-more summary { cursor: pointer; font-weight: 600; }
.ps-more[open] > summary { margin-bottom: 4px; }
.ps-num { gap: 10px; }
.ps-skip { align-self: end; }
.ps-go { display: flex; gap: 8px; flex-wrap: wrap; }
.ps-go .btn.primary { flex: 1; justify-content: center; }
.ps-how ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--text-2); }
@media (max-width: 1100px) {
  .ps-layout { grid-template-columns: 1fr; }
  .ps-side { position: static; }
}
@media (max-width: 560px) {
  .ps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ps-drop { padding: 16px; }
  .ps-page { padding: 6px; }
}

/* ---------- PDF Studio page editor and signing (0.65) ---------- */
.ps-paper img.ps-svg { position: absolute; inset: auto; left: 50%; top: 50%; width: 100%; height: 100%; translate: -50% -50%; object-fit: fill; }
.ps-edited { position: absolute; right: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: #1d4ed8; color: #fff; }
.ps-edited.signed { background: #15803d; }
.ps-record { font-size: 13px; align-items: flex-start; }
body.ps-editing { overflow: hidden; }
.ps-editor { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
.ps-ed-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.ps-ed-title { display: grid; }
.ps-ed-title small { font-size: 12px; }
.ps-ed-nav { display: flex; gap: 2px; }
.ps-ed-tools { display: flex; gap: 4px; padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--surface); overflow-x: auto; }
.ps-ed-tool { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; min-width: 70px; padding: 6px 8px; border: 1px solid transparent; border-radius: 10px; background: none; color: var(--text-2); font-size: 11px; font-weight: 500; cursor: pointer; }
.ps-ed-tool span { white-space: nowrap; }
.ps-ed-tool:hover { background: var(--surface-2); }
.ps-ed-tool.on { background: var(--brand-soft); color: var(--brand-text); border-color: color-mix(in srgb, var(--brand) 35%, var(--surface)); }
.ps-ed-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 0; }
.ps-ed-stage { overflow: auto; padding: 16px; background: color-mix(in srgb, var(--text) 6%, var(--bg)); display: flex; justify-content: center; align-items: flex-start; }
.ps-ed-page { position: relative; background: #fff; box-shadow: 0 4px 18px rgba(15, 23, 42, .18); flex: none; touch-action: none; user-select: none; overflow: hidden; }
.ps-ed-page[data-tool="text"], .ps-ed-page[data-tool="date"], .ps-ed-page[data-tool="check"], .ps-ed-page[data-tool="cross"], .ps-ed-page[data-tool="sign"] { cursor: crosshair; }
.ps-ed-page[data-tool="box"], .ps-ed-page[data-tool="highlight"] { cursor: cell; }
.ps-ed-bg { position: absolute; left: 50%; top: 50%; pointer-events: none; }
.ps-ed-note { padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--warning, #b45309) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warning, #b45309) 35%, transparent); }
.ps-ed-item { position: absolute; cursor: move; outline: 1px dashed transparent; }
.ps-ed-item:hover { outline-color: color-mix(in srgb, var(--brand) 50%, transparent); }
.ps-ed-item.sel { outline: 2px solid var(--brand); outline-offset: 1px; }
.ps-ed-text, .ps-ed-replaced { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 12px; min-height: 1em; }
.ps-ed-replaced { background: #fff; padding: 0 1px; }
.ps-ed-highlight { opacity: .4; }
.ps-ed-image img { width: 100%; height: 100%; display: block; pointer-events: none; }
.ps-ed-mark { display: grid; place-items: center; }
.ps-ed-mark svg { width: 100%; height: 100%; stroke-width: 3; }
.ps-ed-grip { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; border-radius: 3px; background: var(--brand); border: 2px solid #fff; cursor: nwse-resize; }
.ps-ed-run { position: absolute; padding: 0; border: 1px solid color-mix(in srgb, #1d4ed8 45%, transparent); background: color-mix(in srgb, #1d4ed8 8%, transparent); border-radius: 2px; cursor: text; }
.ps-ed-run:hover, .ps-ed-run:focus-visible { background: color-mix(in srgb, #1d4ed8 20%, transparent); }
.ps-ed-run.locked { border-style: dotted; background: transparent; cursor: not-allowed; }
.ps-ed-side { border-left: 1px solid var(--border); background: var(--surface); padding: 16px; overflow-y: auto; display: grid; gap: 12px; align-content: start; }
.ps-ed-side h3 { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 15px; }
.ps-ed-side .field { margin: 0; }
.ps-ed-styles { display: flex; gap: 16px; }
.ps-ed-colors { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ps-ed-color { position: relative; }
.ps-ed-color input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.ps-ed-color i { display: block; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-strong); }
.ps-ed-color input:checked + i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
.ps-ed-colors input[type=color] { width: 34px; height: 30px; padding: 0; border: 1px solid var(--border-strong); border-radius: 6px; background: none; }
/* The signature pad */
.ps-sig-tabs { margin-bottom: 12px; }
.ps-sig-canvas, .ps-sig-up { width: 100%; height: auto; aspect-ratio: 3 / 1; border: 1px solid var(--border-strong); border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.ps-sig-up { cursor: default; background: repeating-conic-gradient(#f1f3f6 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.ps-sig-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.ps-ink { position: relative; }
.ps-ink input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.ps-ink i { display: block; width: 24px; height: 24px; border-radius: 50%; }
.ps-ink input:checked + i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
.ps-sig-fonts { display: grid; gap: 8px; margin-top: 10px; }
.ps-sig-font { position: relative; display: block; border: 1px solid var(--border-strong); border-radius: 10px; background: #fff; cursor: pointer; }
.ps-sig-font input { position: absolute; opacity: 0; }
.ps-sig-font canvas { width: 100%; height: auto; display: block; }
.ps-sig-font:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 35%, transparent); }
.ps-sig-saved { max-width: 100%; max-height: 160px; display: block; margin: 0 auto; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.ps-sig-keep { margin-top: 12px; }
@media (max-width: 900px) {
  .ps-ed-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .ps-ed-side { border-left: 0; border-top: 1px solid var(--border); max-height: 38vh; }
  .ps-ed-tool { min-width: 58px; }
  .ps-ed-tool span { font-size: 10px; }
}
.ps-page, .ps-paper { min-width: 0; }
.ps-paper img.ps-svg { max-width: none; }
.ps-page { grid-template-columns: minmax(0, 1fr); }
.ps-grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }
.ps-tools { flex-wrap: wrap; justify-content: center; }
.ps-tools .icon-btn { width: 28px; height: 28px; }
@media (max-width: 560px) { .ps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- PDF Studio, after visual QA (0.65.1) ---------- */
@font-face { font-family: 'CORE Sign Vibes'; src: url('../fonts/GreatVibes-Regular.woff2') format('woff2'); font-display: block; }
@font-face { font-family: 'CORE Sign Dancing'; src: url('../fonts/DancingScript-SemiBold.woff2') format('woff2'); font-display: block; }
@font-face { font-family: 'CORE Sign Caveat'; src: url('../fonts/Caveat-SemiBold.woff2') format('woff2'); font-display: block; }
/* Cards: each page in a slot of the same height, shaped as the page (no squashing), footers aligned. */
.ps-page { align-content: start; }
.ps-slot { height: 210px; display: grid; place-items: center; }
.ps-paper { width: min(100%, calc(210px * var(--r, 0.707))); aspect-ratio: var(--r, 0.707); max-height: none; container-type: inline-size; }
.ps-paper img.ps-svg { object-fit: fill; }
/* What the page editor added, drawn on the card. */
.ps-marks { position: absolute; inset: 0; pointer-events: none; }
.ps-marks > * { position: absolute; display: block; }
.ps-marks img { object-fit: contain; }
.ps-marks i.highlight { mix-blend-mode: multiply; opacity: .85; }
.ps-marks b { font-weight: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.ps-marks b.replaced { background: #fff; white-space: nowrap; }
.ps-marks i.mark { display: grid; place-items: center; }
.ps-marks i.mark svg { width: 100%; height: 100%; }
.ps-edited { right: auto; left: 6px; top: 6px; bottom: auto; }
/* Card buttons: one row of six on cards, bigger targets on touch screens. */
.ps-tools { flex-wrap: nowrap; gap: 0; justify-content: space-between; }
.ps-tools .icon-btn { width: 26px; height: 28px; }
@media (pointer: coarse), (max-width: 560px) {
  .ps-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
  .ps-tools .icon-btn { width: 100%; height: 40px; }
  .ps-check { min-width: 40px; min-height: 40px; }
  .ps-check input { width: 20px; height: 20px; }
  .ps-bar .btn { min-height: 40px; }
  .ps-drop-words { display: none; }
  .ps-pick { text-transform: capitalize; }
}
/* The side column scrolls by itself, so Download stays in reach. */
@media (min-width: 1101px) { .ps-side { max-height: calc(100vh - 92px); overflow-y: auto; overscroll-behavior: contain; padding-bottom: 4px; } }
/* Tablets and phones: a download bar along the bottom. */
.ps-mobilebar { display: none; }
@media (max-width: 1100px) {
  .ps-mobilebar { display: flex; align-items: center; gap: 8px; position: sticky; bottom: 0; z-index: 5; margin-top: 16px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-radius: 12px 12px 0 0; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--border); }
  .ps-mobilebar .muted { flex: 1; }
}
/* Busy: a spinner, without moving the page. */
.ps-drop { position: relative; }
.ps-busy { position: absolute; left: 22px; right: 22px; bottom: 6px; font-size: 13px; }
.ps-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--brand) 25%, transparent); border-top-color: var(--brand); animation: ps-spin .8s linear infinite; display: inline-block; }
@keyframes ps-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ps-spin { animation-duration: 3s; } }
.ps-export input[type=range] { accent-color: var(--brand); }
.ps-more:not([open]) { gap: 0; }
/* The editor: wrapping tool labels on phones, zoom, a shorter side panel. */
.ps-ed-zoom { display: flex; align-items: center; gap: 2px; }
.ps-ed-zoom .icon-btn { font-size: 18px; font-weight: 600; }
.ps-ed-zoom .btn { min-width: 56px; justify-content: center; }
.ps-ed-stage { justify-content: safe center; }
.ps-ed-highlight { opacity: .85; mix-blend-mode: multiply; }
@media (max-width: 900px) {
  .ps-ed-tool { min-width: 64px; max-width: 76px; }
  .ps-ed-tool span { white-space: normal; text-align: center; line-height: 1.15; }
  .ps-ed-side { max-height: 30vh; }
  .ps-ed-top { gap: 6px; padding: 8px 10px; }
  .ps-ed-title small { display: none; }
}
/* Signature dialog: the typed styles shorter, all three in view. */
.ps-sig-font canvas { width: auto; max-width: 100%; height: 72px; margin: 0 auto; }
.ps-ink i, .ps-ed-color i { box-sizing: border-box; border: 1px solid var(--border-strong); }
/* Dark mode: the chosen tool and the selected card stand out. */
:root[data-theme='dark'] .ps-ed-tool.on { background: var(--brand); color: #fff; border-color: var(--brand); }
:root[data-theme='dark'] .ps-page.sel { border-color: var(--brand-text); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-text) 45%, transparent); }
:root[data-theme='dark'] .ps-drop-ic, :root[data-theme='dark'] .ps-logo { background: var(--brand); color: #fff; }

/* ---------- PDF Studio on phones and small tablets (0.66.1) ---------- */
/* The page editor by touch: a swipe on the page scrolls it (it was held still, so the bottom of a
   page could not be reached on a phone); the drawing tools (white-out, highlight) and the things
   you added still follow the finger. pdf-editor.js places text, marks and signatures on a tap. */
.ps-ed-page:not([data-tool="box"], [data-tool="highlight"]) { touch-action: pan-x pan-y; }
.ps-ed-item, .ps-ed-grip { touch-action: none; }
.ps-ed-stage { overscroll-behavior: contain; }
.ps-ed-word { display: contents; }
/* What is being uploaded: on one line, inside the drop zone (a long file name ran over the words
   above it, and pushed the progress bar out of the box). */
.ps-busy { width: auto; }
.ps-busy-text { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-busy progress { flex: none; }
.ps-busy .ps-spin { flex: none; }
.ps-main { grid-template-columns: minmax(0, 1fr); }
@media (pointer: coarse) {
  /* A tick is 8 px across on a phone: what you added takes a finger from a little around it, and
     the resize handle stands clear of its corner (it covered small things, which then only grew). */
  .ps-ed-item::before { content: ''; position: absolute; inset: -12px; }
  .ps-ed-grip { right: -24px; bottom: -24px; width: 22px; height: 22px; border-radius: 50%; box-shadow: 0 1px 4px rgba(15, 23, 42, .35); }
  .ps-ed-grip::after { content: ''; position: absolute; inset: -2px -12px -12px -2px; }
  .ps-ed-color i { width: 34px; height: 34px; }
  .ps-ed-colors { gap: 10px; }
  .ps-ed-colors input[type=color] { width: 44px; height: 38px; }
  .ps-ink i { width: 32px; height: 32px; }
  .ps-ink { padding: 6px; margin: -6px 0; }
  .ps-sig-tabs button { min-height: 44px; padding: 0 14px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
  /* Ticks and choices: the whole line is the target. */
  :is(.ps-export, .ps-ed-side, .ps-sig-modal, .ps-setup-modal) .check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
  :is(.ps-export, .ps-ed-side, .ps-sig-modal, .ps-setup-modal) .check input { flex: none; width: 20px; height: 20px; margin: 0; }
  .ps-sig-keep { margin-top: 4px; }
  .ps-record { align-items: flex-start; padding-block: 10px; }
  .ps-pick { display: inline-flex; align-items: center; min-height: 44px; }
  .ps-more > summary { min-height: 44px; display: flex; align-items: center; gap: 8px; }
  .ps-more > summary::before { content: ''; width: 8px; height: 8px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform .15s; flex: none; margin-inline: 3px 5px; }
  .ps-more[open] > summary::before { transform: rotate(45deg); }
  .ps-more > summary::-webkit-details-marker { display: none; }
  .ps-more[open] > summary { margin-bottom: 0; }
}
@media (max-width: 1100px) {
  /* Pages are selected all the way down a long grid: what to do with them stays in view. */
  .ps-pages-card > .card-head:has(.ps-selected) { position: sticky; top: var(--topbar); z-index: 4; margin: -8px -12px 8px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .ps-pages-card, .ps-side > section { scroll-margin-top: calc(var(--topbar) + 8px); }
  .ps-mobilebar .btn { flex: 0 1 auto; min-width: 0; white-space: nowrap; }
  .ps-mobilebar .muted { white-space: nowrap; }
}
@media (max-width: 560px) {
  /* The selection's buttons in one row that slides sideways (they took three rows of the screen). */
  .ps-pages-card > .card-head:has(.ps-selected) { flex-wrap: nowrap; }
  .ps-pages-card > .card-head:has(.ps-selected) > h2 { display: none; }
  .ps-bar:has(.ps-selected) { flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -12px; padding-inline: 12px; }
  .ps-bar:has(.ps-selected)::-webkit-scrollbar { display: none; }
  .ps-bar:has(.ps-selected) > * { flex: none; }
  /* The drop zone: the picture beside the words; what is being uploaded on a line of its own. */
  .ps-drop { flex-wrap: wrap; align-items: flex-start; gap: 12px; }
  .ps-drop > div { flex: 1; min-width: 0; }
  .ps-drop-ic { width: 44px; height: 44px; border-radius: 14px; }
  .ps-busy { position: static; flex: 0 0 100%; width: 100%; min-width: 0; }
  .ps-busy progress { width: 84px; }
  /* Two cards across a 320 px screen: three buttons fit a row (44 px each ran out of the card). */
  .ps-tools .icon-btn { min-width: 0; }
  /* A long file name on two lines. */
  .ps-src-main strong { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .ps-go .btn { flex: 1; justify-content: center; }
  .ps-mobilebar { gap: 6px; padding-inline: 10px; }
  .ps-mobilebar .btn.primary { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 389px) { .ps-mobilebar .muted { display: none; } }

/* The page editor on a phone: one row of buttons at the top (page, undo, done), the tools in a row
   that slides sideways, zoom over the corner of the page, and a shorter panel underneath. */
@media (max-width: 560px) {
  .ps-editor { --ps-ed-top: 52px; --ps-ed-tools: 66px; }
  .ps-ed-top { flex-wrap: nowrap; height: var(--ps-ed-top); padding: 3px 8px; gap: 2px; }
  .ps-ed-nav { display: contents; }
  #ed-prev { order: 1; }
  .ps-ed-title { order: 2; white-space: nowrap; min-width: 44px; text-align: center; }
  #ed-next { order: 3; }
  .ps-ed-top .spacer { order: 4; }
  #ed-undo { order: 5; padding-inline: 12px; margin-right: 4px; }
  #ed-done { order: 6; }
  .ps-ed-word { display: block; position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ps-ed-tools { height: var(--ps-ed-tools); padding: 4px 6px; gap: 2px; overflow-y: hidden; scrollbar-width: none; }
  .ps-ed-tools::-webkit-scrollbar { display: none; }
  .ps-ed-tool { flex: none; width: 68px; min-width: 0; max-width: none; padding: 5px 2px; justify-content: flex-start; }
  .ps-ed-tool span { font-size: 10.5px; }
  .ps-ed-zoom { position: absolute; z-index: 3; top: calc(var(--ps-ed-top) + var(--ps-ed-tools) + 8px); right: 8px; gap: 0; border-radius: 999px; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(6px); box-shadow: var(--shadow); }
  .ps-ed-zoom .icon-btn { min-width: 40px; min-height: 40px; border-radius: 999px; }
  .ps-ed-zoom .btn { min-width: 50px; min-height: 40px; padding-inline: 4px; border-color: transparent; background: none; }
  .ps-ed-stage { padding: 58px 12px 16px; }
  .ps-ed-side { max-height: 26vh; max-height: 26dvh; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); gap: 8px; }
  .ps-ed-side:has(.field) { max-height: 42vh; max-height: 42dvh; }
  .ps-ed-side textarea { min-height: 0; height: 72px; }
  .ps-ed-side .grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ps-ed-side .grid.two > * { grid-column: auto; }
  .ps-ed-side p { margin: 0; }
  .ps-ed-side .btn { width: 100%; justify-content: center; }
  /* The signature pad: the three ways side by side, across the sheet. */
  .ps-sig-tabs { display: flex; }
  .ps-sig-canvas.tall { aspect-ratio: 2 / 1; }
  .ps-sig-tabs button { flex: 1; justify-content: center; }
}
/* A phone on its side: the tools on one short row, the panel beside the page (underneath it left
   the page a strip 140 px tall), and a signature pad that fits the screen with its buttons. */
@media (max-height: 500px) and (orientation: landscape) and (min-width: 561px) {
  .ps-ed-top { flex-wrap: nowrap; padding: 2px 10px; gap: 6px; }
  .ps-ed-title small { display: none; }
  .ps-ed-tools { padding: 2px 8px; gap: 2px; scrollbar-width: none; }
  .ps-ed-tools::-webkit-scrollbar { display: none; }
  .ps-ed-tool { flex: none; flex-direction: row; gap: 5px; min-width: 0; max-width: none; min-height: 40px; padding: 4px 9px; }
  .ps-ed-tool span { white-space: nowrap; font-size: 11.5px; }
  .ps-ed-body { grid-template-columns: minmax(0, 1fr) min(280px, 36vw); grid-template-rows: minmax(0, 1fr); }
  .ps-ed-side { border-top: 0; border-left: 1px solid var(--border); max-height: none; padding: 10px 12px; gap: 8px; }
  .ps-ed-side textarea { min-height: 0; height: 60px; }
  .ps-ed-side p { margin: 0; }
  .ps-sig-modal .modal-title p { display: none; }
  .ps-sig-modal .modal-body { padding-block: 10px; }
  .ps-sig-tabs { margin-bottom: 8px; }
  .ps-sig-canvas, .ps-sig-up { width: min(100%, max(300px, calc((100vh - 268px) * 3))); width: min(100%, max(300px, calc((100dvh - 268px) * 3))); margin-inline: auto; }
  .ps-sig-row { margin-top: 4px; }
  .ps-sig-keep { margin-top: 0; }
  .ps-sig-fonts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ps-mobilebar { padding-block: 4px calc(4px + env(safe-area-inset-bottom)); }
}

/* ===== Document Management (0.67): the browser, a document, sharing, Document control, the share page ===== */
.dm-page { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 20px; align-items: start; }
.dm-main-col { min-width: 0; }
.dm-side { position: sticky; top: calc(var(--topbar) + 16px); min-width: 0; }
.dm-tree { padding: 12px 10px; }
.dm-tree > summary { list-style: none; font-weight: 700; display: flex; align-items: center; gap: 8px; padding: 2px 6px 8px; cursor: default; color: var(--text); }
.dm-tree > summary::-webkit-details-marker { display: none; }
.dm-tree-list, .dm-tree-list ul { list-style: none; margin: 0; padding: 0; }
.dm-tree-list ul { padding-left: 14px; }
.dm-node { display: flex; align-items: center; gap: 2px; border-radius: var(--radius-sm); }
.dm-node a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; padding: 6px 6px; color: var(--text-2); border-radius: var(--radius-sm); font-weight: 500; }
.dm-node a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-node a .ic { color: var(--accent); }
.dm-node a:hover { background: var(--surface-2); text-decoration: none; }
.dm-node.on a { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.dm-tog, .dm-tog-sp { width: 22px; height: 26px; flex: none; }
.dm-tog { display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 6px; padding: 0; }
.dm-tog:hover { background: var(--surface-2); color: var(--text); }
.dm-hold-dot { color: var(--danger); display: inline-flex; }
.dm-tree-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 12px 6px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); min-height: 26px; }
.dm-tree-add { padding: 3px; }
.dm-tree-none { margin: 2px 8px 0; }
.dm-quota { margin: 14px 6px 2px; padding-top: 12px; border-top: 1px solid var(--border); }
.dm-quota small { color: var(--muted); font-size: 12px; }
.dm-meter { height: 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-bottom: 6px; }
.dm-meter span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

.dm-ic { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.dm-ic.f-folder { background: var(--accent-soft); color: var(--gold-text); }
.dm-ic.f-pdf { background: color-mix(in srgb, #dc2626 12%, var(--surface)); color: #b91c1c; }
.dm-ic.f-word, .dm-ic.f-rtf, .dm-ic.f-opendocument { background: color-mix(in srgb, #2563eb 12%, var(--surface)); color: #1d4ed8; }
.dm-ic.f-excel { background: color-mix(in srgb, #16a34a 13%, var(--surface)); color: #15803d; }
.dm-ic.f-powerpoint { background: color-mix(in srgb, #ea580c 13%, var(--surface)); color: #c2410c; }
.dm-ic.f-image { background: color-mix(in srgb, #9333ea 12%, var(--surface)); color: #7e22ce; }
.dm-ic.f-email { background: color-mix(in srgb, #0891b2 12%, var(--surface)); color: #0e7490; }
:root[data-theme='dark'] .dm-ic.f-pdf { color: #fca5a5; }
:root[data-theme='dark'] .dm-ic.f-word, :root[data-theme='dark'] .dm-ic.f-rtf, :root[data-theme='dark'] .dm-ic.f-opendocument { color: #93c5fd; }
:root[data-theme='dark'] .dm-ic.f-excel { color: #86efac; }
:root[data-theme='dark'] .dm-ic.f-powerpoint { color: #fdba74; }
:root[data-theme='dark'] .dm-ic.f-image { color: #d8b4fe; }
:root[data-theme='dark'] .dm-ic.f-email { color: #67e8f9; }

.dm-toolbar input[type='search'] { flex: 1 1 260px; max-width: 420px; }
.dm-drop { margin-bottom: 16px; padding: 16px 20px; flex-wrap: nowrap; }
.dm-drop > div, .sh-drop > div { flex: 1; min-width: 0; }
.dm-finfo { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: -8px 0 16px; color: var(--muted); font-size: 13px; }
.dm-list-card { padding: 0; overflow: hidden; }
.dm-list-head, .dm-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px 84px 112px 150px; gap: 12px; align-items: center; padding: 0 16px; }
.dm-list-card:has(.dm-list.trash) .dm-list-head, .dm-list.trash .dm-row { grid-template-columns: minmax(0, 1fr) 64px 84px 112px 150px 230px; }
.dm-list-head { padding-top: 10px; padding-bottom: 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.dm-list { list-style: none; margin: 0; padding: 0; }
.dm-row { border-bottom: 1px solid var(--border); min-height: 64px; }
.dm-row:last-child { border-bottom: 0; }
.dm-row:hover { background: var(--brand-softer); }
.dm-main { display: flex; align-items: center; gap: 12px; padding: 10px 0; color: var(--text); min-width: 0; }
a.dm-main:hover { text-decoration: none; }
a.dm-main:hover strong { color: var(--brand-text); }
.dm-name { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dm-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-name small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.dm-badges:empty { display: none; }
.dm-badges .badge { font-size: 11px; padding: 0 7px; }
.dm-col { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-acts { display: flex; gap: 6px; justify-content: flex-end; overflow: visible; }
.dm-empty h2 { margin-top: 6px; }
.dm-empty p { max-width: 520px; margin: 0 auto; }
.dm-queue { margin-bottom: 16px; }
.dm-q-list, .sh-sent { list-style: none; margin: 0; padding: 0; }
.dm-q { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--border); }
.dm-q:last-child { border-bottom: 0; }
.dm-q .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dm-q small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.dm-q progress { display: block; width: 100%; max-width: 320px; height: 8px; accent-color: var(--brand); margin-top: 6px; }
.dm-q-ic { width: 20px; flex: none; display: grid; place-items: center; padding-top: 1px; color: var(--muted); }
.dm-q.done .dm-q-ic { color: var(--success); }
.dm-q.refused .dm-q-ic, .dm-refused { color: var(--danger) !important; }
.dm-dup { color: var(--warn) !important; }
.dm-up-names { margin: 0 0 12px; padding-left: 18px; max-height: 160px; overflow: auto; }
.dm-up-progress { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; }
.dm-up-progress progress { flex: 1; height: 8px; accent-color: var(--brand); }
.dm-pop { right: 0; left: auto; top: calc(100% + 6px); }
.menu-pop .danger-item { color: var(--danger); }

.dm-doc-head { align-items: flex-start; }
.dm-doc-title { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.dm-doc-title .dm-ic { width: 48px; height: 48px; border-radius: 14px; margin-top: 2px; }
.dm-doc-title h1 { overflow-wrap: anywhere; }
.dm-doc-sub { margin: 4px 0 6px; color: var(--muted); overflow-wrap: anywhere; }
.dm-doc-title .dm-badges { margin: 0; }
.dm-received { align-items: center; }
.dm-received > div { flex: 1; }
.dm-msg { margin-top: 6px !important; font-style: italic; color: var(--text-2); }
.notice .actions { margin-left: auto; }
.dm-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px 20px; margin: 0; }
.dm-dl dt { font-size: 12px; font-weight: 600; color: var(--muted); }
.dm-dl dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.dm-dl dd small { display: block; }
.dm-facts { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.dm-versions, .dm-events, .dm-who, .dm-links, .dm-grants { list-style: none; margin: 0; padding: 0; }
.dm-versions li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.dm-versions li:last-child { border-bottom: 0; }
.dm-versions .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dm-versions small { display: block; color: var(--muted); font-size: 12px; }
.dm-vno { width: 40px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 700; font-size: 13px; }
.dm-vno.cur { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-text); }
.dm-sha { opacity: 0.8; }
.dm-versions .actions { flex-wrap: nowrap; }
.dm-events li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.dm-events li:last-child { border-bottom: 0; }
.dm-events .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dm-events small { display: block; color: var(--muted); font-size: 12px; }
.dm-ev-ic { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.dm-ev-ic.ext { background: var(--accent-soft); color: var(--gold-text); }
.dm-who li { display: flex; gap: 8px; align-items: center; padding: 6px 0; }
.dm-who .grow { flex: 1; min-width: 0; }
.dm-who small { color: var(--muted); }

.dm-share-modal .modal-body { min-height: 320px; }
.dm-tabs { display: flex; width: 100%; margin-bottom: 16px; }
.dm-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 10px; font-family: inherit; font-size: 13px; font-weight: 600; }
.dm-tabs button.active { background: var(--brand); color: var(--brand-ink); }
.dm-grant { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.dm-grant .grow { flex: 1 1 160px; min-width: 0; }
.dm-grant small { display: block; color: var(--muted); font-size: 12px; }
.dm-grant select { width: auto; padding: 6px 8px; }
.dm-grant input[type='date'] { width: 150px; padding: 6px 8px; }
.dm-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.dm-add-grant { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0; }
.dm-add-grant select { width: auto; flex: 1 1 140px; }
.dm-add-grant #dm-g-target { flex: 2 1 220px; }
.dm-inherit { margin: 10px 0 14px; }
.dm-rules { margin: 0 0 14px; padding: 12px 14px 12px 30px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-2); }
.dm-rules li + li { margin-top: 4px; }
.dm-made { border: 1px solid color-mix(in srgb, var(--success) 40%, var(--surface)); background: var(--success-soft); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px; }
.dm-made p { margin: 0; }
.dm-made .sp-link { margin: 10px 0 6px; }
.dm-links li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.dm-links .grow { flex: 1 1 240px; min-width: 0; }
.dm-links small { display: block; color: var(--muted); font-size: 12px; }
.dm-newlink { margin-top: 8px; }
.dm-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 8px; margin-bottom: 14px; }
.dm-mode { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; }
.dm-mode:has(input:checked) { border-color: var(--brand); background: var(--brand-softer); }
.dm-mode small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.dm-mode input { margin-top: 3px; }

/* Document control */
.dc-card .grid { margin-top: 4px; }
.dc-num { display: flex; align-items: center; gap: 8px; }
.dc-num input { max-width: 160px; }
.dc-def { font-size: 12px; }
.dc-switch { display: flex; flex-direction: column; gap: 2px; padding: 8px 0 12px; }
.dc-switch small { padding-left: 44px; }
.dc-sub { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.dc-families { list-style: none; margin: 0; padding: 0; }
.dc-families li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.dc-families .grow { flex: 1; min-width: 0; }
.dc-families small { display: block; color: var(--muted); margin-top: 3px; }
.dc-exts { display: flex !important; flex-wrap: wrap; gap: 4px; margin-top: 6px !important; }
.dc-exts code { font-size: 11.5px; }
.dc-locked { background: var(--danger-soft); margin: 0 -20px; padding-left: 20px !important; padding-right: 20px !important; border-bottom: 0 !important; border-radius: 0 0 var(--radius) var(--radius); }
.dc-locked code { background: var(--surface); color: var(--danger); }
.dc-cls { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px 12px; margin: 16px 0 0; display: grid; gap: 8px; }
.dc-cls legend { font-weight: 600; font-size: 13px; color: var(--text-2); padding: 0 6px; }
.dc-cls small { display: block; }
.dc-save { margin-top: 16px; }
.dc-problems { margin: 8px 0 0; padding-left: 18px; color: var(--danger); }

/* The share page (/share/<token>) */
.share-page .sp-head-inner { gap: 12px; }
.sh-calm { text-align: center; padding: 12px 0; }
.sh-calm-ic { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: var(--brand-soft); color: var(--brand-text); margin-bottom: 10px; }
.sh-pw { max-width: 380px; margin: 8px 0 14px; }
.sh-note { margin: 6px 0 14px; padding: 10px 14px; border-left: 4px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-2); }
.sh-meta { color: var(--muted); margin: 0 0 16px; }
.sh-meta .ic { margin-right: 4px; }
.sh-docs { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); }
.sh-docs li { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.sh-docs li:last-child { border-bottom: 0; }
.sh-docs .grow { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.sh-docs small { display: block; color: var(--muted); font-size: 12.5px; }
.sh-ic { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.sh-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sh-up { display: grid; gap: 14px; }
.sh-drop { margin-top: 4px; }
.sh-sent { margin-top: 16px; }
:root[data-theme='dark'] .sh-ic, :root[data-theme='dark'] .sh-calm-ic { background: var(--brand); color: #fff; }

@media (max-width: 1100px) {
  .dm-page { grid-template-columns: 210px minmax(0, 1fr); gap: 16px; }
  .dm-list-head, .dm-row { grid-template-columns: minmax(0, 1fr) 56px 76px 100px; }
  .dm-list-card:has(.dm-list.trash) .dm-list-head, .dm-list.trash .dm-row { grid-template-columns: minmax(0, 1fr) 56px 76px 100px 220px; }
  .dm-owner, .dm-list-head > span:nth-child(5) { display: none; }
}
@media (max-width: 960px) {
  .dm-page { grid-template-columns: minmax(0, 1fr); }
  .dm-side { position: static; }
  .dm-tree > summary { cursor: pointer; padding-bottom: 2px; }
  .dm-tree > summary::after { content: '▾'; margin-left: auto; color: var(--muted); }
  .dm-tree:not([open]) > summary::after { content: '▸'; }
  .dm-tree[open] > summary { padding-bottom: 8px; }
}
@media (max-width: 560px) {
  .dm-list-head { display: none; }
  .dm-row, .dm-list.trash .dm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 10px 14px; min-height: 0; }
  .dm-main { flex: 1 0 100%; padding: 0; }
  .dm-row .dm-col { font-size: 12px; color: var(--muted); padding-left: 48px; }
  .dm-row .dm-col:empty { display: none; }
  .dm-row .dm-col ~ .dm-col { padding-left: 0; }
  .dm-row .dm-ver::after, .dm-row .dm-size::after { content: ' ·'; }
  .dm-row .dm-size:empty, .dm-folder-row .dm-ver, .dm-folder-row .dm-size { display: none; }
  .dm-acts { flex: 1 0 100%; padding: 6px 0 0 48px !important; justify-content: flex-start; flex-wrap: wrap; }
  .dm-toolbar input[type='search'] { max-width: none; }
  .dm-doc-title .dm-ic { width: 40px; height: 40px; }
  .dm-doc-actions { width: 100%; }
  .dm-doc-actions .btn { flex: 1 1 auto; }
  .dm-versions li { flex-wrap: wrap; }
  .dm-versions .actions { width: 100%; padding-left: 52px; }
  .dm-grant select, .dm-grant input[type='date'] { flex: 1 1 130px; width: auto; }
  .dm-grant { padding: 12px 0; }
  .dm-received { flex-wrap: wrap; }
  .dc-locked { margin: 0 -16px; }
  .dc-switch small { padding-left: 0; }
  .sh-docs li { align-items: flex-start; }
  .sh-acts { width: 100%; padding-left: 52px; }
  .sh-acts .btn { flex: 1 1 auto; }
}
@media (pointer: coarse) {
  .dm-node a, .dm-tog { min-height: 40px; }
}

/* ----- Document circulation and Forms & downloads (0.70; public/js/views/forms.js) ----- */
.form-groups { display: grid; gap: 16px; }
.form-groups > .card { margin: 0; }
.form-group { padding: 0; overflow: hidden; }
.form-group-title { font-size: 14px; font-weight: 700; letter-spacing: 0.02em; margin: 0; padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.form-list { list-style: none; margin: 0; padding: 0; }
.form-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--border); }
.form-item:first-child { border-top: 0; }
.form-item[hidden], .form-group[hidden] { display: none; }
.form-item .grow { flex: 1; min-width: 0; }
.form-ic { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); }
.form-title { font-weight: 600; overflow-wrap: anywhere; }
.form-code, .fm-code { display: inline-block; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fm-code { margin-top: 3px; width: max-content; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.form-desc { display: block; color: var(--text-2); margin-top: 3px; line-height: 1.45; }
.form-meta { display: block; margin-top: 3px; }
.form-item .btn { flex: none; }
.home-forms { grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); align-items: start; }
#forms-section .form-groups .card { box-shadow: var(--shadow); }
@media (max-width: 600px) {
  .form-item { flex-wrap: wrap; padding: 12px 14px; gap: 10px 12px; }
  .form-item .grow { flex-basis: calc(100% - 52px); }
  .form-item .btn { margin-left: 52px; }
}
.fm-stats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.fm-stat { text-align: left; font: inherit; cursor: pointer; border: 1px solid var(--border); background: var(--surface); }
.fm-stat:hover { border-color: var(--brand-line); }
.fm-stat.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.fm-stat small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-stat .fm-stat-more { display: block; margin-top: 4px; }
.fm-stat .fm-stat-word { color: var(--muted); font-size: 13px; }
.fm-filters { padding: 14px 14px 0; }
.fm-filters input[type='search'] { flex: 1 1 240px; max-width: none; min-width: 0; }
.fm-table th, .fm-table td { padding-left: 8px; padding-right: 8px; vertical-align: top; }
.fm-table th:first-child, .fm-table td:first-child { padding-left: 14px; }
.fm-table td { font-size: 13.5px; }
.fm-table td:first-child { min-width: 150px; }
.fm-table .fm-cur { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.fm-table .fm-aud small { color: var(--text-2); }
.fm-versions { width: 112px; max-width: 100%; font-size: 13px; padding: 5px 6px; }
.fm-actions { white-space: nowrap; }
.fm-actions .btn, .fm-actions .fm-more { display: flex; width: 100%; justify-content: center; }
.fm-actions .fm-more > summary { width: 100%; justify-content: center; }
.fm-actions .fm-more { margin-top: 6px; }
.fm-actions .btn { gap: 6px; }
@media (min-width: 761px) {
  .fm-act-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .fm-actions { width: 48px; }
}
.fm-more { display: inline-block; position: relative; }
.fm-more > summary { list-style: none; cursor: pointer; }
.fm-more > summary::-webkit-details-marker { display: none; }
.fm-more .fm-menu { min-width: 230px; }
.fm-more:not([open]) .fm-menu { display: none; }
.fm-menu .danger-text, .fm-menu .danger-text svg { color: var(--danger); }
.fm-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fm-aud-field { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px 12px; margin: 0; }
.fm-aud-field legend { font-weight: 600; font-size: 13px; color: var(--text-2); padding: 0 4px; }
.fm-aud-field .field.check { margin: 4px 0; }
.fm-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 12px; margin-top: 4px; }
.fm-checks[hidden] { display: none; }
@media (max-width: 960px) { .fm-actions { white-space: normal; } }
@media (max-width: 760px) {
  .fm-table td .fm-versions { width: 100%; }
  .fm-actions .cell-v { display: flex; gap: 8px; justify-content: flex-end; }
  .fm-actions .btn, .fm-actions .fm-more { display: inline-flex; width: auto; }
  .fm-actions .fm-more { margin: 0; }
}
@media (max-width: 600px) {
  .fm-pair { grid-template-columns: 1fr; }
  .fm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
:root[data-theme='dark'] .form-ic { color: color-mix(in srgb, var(--brand) 35%, #fff); background: color-mix(in srgb, var(--brand) 30%, var(--surface)); }

/* ----- CUSTOM APP → Events (0.71): Find guest, the guest sheet, Tables, Event control, Setup. Phone
   first: every control at least 48 px high, inputs 16 px (no zoom on focus), nothing wider than the
   screen; meters and badges carry words, never colour alone. ----- */
.ca-head h1 { display: flex; align-items: center; gap: 8px; }
.ca-switch-ev select { min-height: 44px; font-size: 16px; max-width: 100%; }
.ca-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.ca-event { display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.ca-event:hover { border-color: var(--brand-line); text-decoration: none; }
.ca-event-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 16px; }
.ca-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 12px; }
.ca-search input { width: 100%; font-size: 16px; min-height: 48px; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.ca-chips { margin: 10px 0 12px; }
.ca-chips .chip { min-height: 44px; }
.ca-results { padding: 6px 0; }
.ca-list { list-style: none; margin: 0; padding: 0; }
.ca-list > li + li { border-top: 1px solid var(--border); }
.ca-guest { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 10px 16px; background: none; border: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer; flex-wrap: wrap; }
.ca-guest:hover, .ca-guest:focus-visible { background: var(--surface-2); }
.ca-guest .grow { flex: 1 1 180px; min-width: 0; }
.ca-guest strong { display: block; font-size: 15px; overflow-wrap: anywhere; }
.ca-guest small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.ca-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.ca-none { padding: 12px 16px; margin: 0; }
.ca-meter { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: 8px; flex-wrap: wrap; }
.ca-meter i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: inline-block; }
.ca-meter i.on { background: var(--brand-text); border-color: var(--brand-text); }
.ca-meter i.res { border: 2.5px solid var(--info); background: transparent; }
.ca-count { font-size: 12px; color: var(--text-2); display: block; }
.ca-table .ca-meter { margin: 2px 0; }
.ca-sheet.modal { max-width: 560px; }
.ca-who p { margin: 6px 0; }
.ca-step { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.ca-step h3 { margin: 0 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.ca-step p { margin: 4px 0 8px; }
.btn.ca-big { min-height: 48px; width: 100%; font-size: 16px; margin-top: 8px; }
.ca-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.ca-actions .btn { min-height: 44px; }
.ca-notice { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--text); margin: 10px 0; }
.ca-notice svg { color: var(--warn); flex: none; margin-top: 2px; }
.ca-tables { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.ca-table { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.ca-table .grow { flex: 1; min-width: 0; }
.ca-table small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.ca-table.on { border: 2px solid var(--brand-text); background: var(--brand-softer); }
.ca-table:disabled { cursor: not-allowed; opacity: 0.62; }
.ca-tno { font-weight: 700; font-size: 15px; min-width: 64px; }
.ca-chairs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 10px 0 0; }
.ca-chair { min-height: 48px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
.ca-chair.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.ca-chair:disabled { text-decoration: line-through; color: var(--muted); background: var(--surface-2); cursor: not-allowed; }
.ca-others, .ca-history, .ca-issue { margin-top: 12px; }
.ca-others summary, .ca-history summary, .ca-issue summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 6px; }
.ca-history ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.ca-tgrid > .card, .ca-events > .card { margin-top: 0; }
.ca-tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 10px; }
.ca-tcard { display: flex; flex-direction: column; gap: 6px; text-align: left; font: inherit; color: var(--text); cursor: pointer; padding: 14px 16px; min-height: 48px; }
.ca-tcard:hover { border-color: var(--brand-line); }
.ca-tcard.full, .ca-tcard.off { opacity: 0.7; }
.ca-tcard-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 15px; }
.ca-tcard small { color: var(--muted); }
.ca-chairlist { list-style: none; margin: 0; padding: 0; }
.ca-chairlist li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 40px; border-bottom: 1px solid var(--border); }
.ca-cn { font-weight: 700; min-width: 2em; text-align: center; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--brand-text); font: inherit; font-weight: 600; cursor: pointer; text-align: left; min-height: 36px; }
.ca-stats { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
.ca-flags { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 10px; }
.ca-flags .switch { min-height: 44px; }
.ca-poll input { max-width: 160px; font-size: 16px; min-height: 44px; }
.ca-form { display: grid; gap: 12px; }
.ca-form input, .ca-form select, .ca-form textarea, #ca-ind textarea { font-size: 16px; }
#ca-ind textarea { width: 100%; }
.ca-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ca-checks { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 4px 12px; }
.ca-issue-row { padding: 8px 0; display: grid; gap: 8px; }
.ca-issue-g { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ca-issue-g .actions { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; }
.ca-pv ul { margin: 4px 0 8px; }
.ca-ttable td, .ca-ttable th { white-space: nowrap; }
@media (max-width: 600px) {
  .ca-pair { grid-template-columns: 1fr; }
  .ca-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ca-guest { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .ca-table, .ca-chair, .ca-guest { transition: none; }
}

/* ===== CUSTOM APP Tier 1 (0.72): My queue, the live bar, the guest page links, the room plan ===== */
.ca-sticky { position: sticky; top: var(--topbar); z-index: 20; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin: -8px 0 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 14px; }
.ca-sticky .grow { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.ca-sticky [data-age], .ca-live-bar [data-age] { color: var(--muted); font-size: 13px; }
.ca-sticky.stale, .ca-live-bar.stale { background: var(--warn-soft); border-color: transparent; }
.ca-sticky.stale [data-age], .ca-live-bar.stale [data-age] { color: var(--warn); font-weight: 700; }
.ca-q-sec { margin-bottom: 14px; }
.ca-q-sec h2 { display: flex; gap: 6px; align-items: baseline; }
.ca-n { color: var(--muted); font-weight: 500; font-size: 14px; }
.ca-qlist { list-style: none; margin: 0; padding: 0; }
.ca-qlist > li + li { border-top: 1px solid var(--border); }
.ca-qcard { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; min-height: 56px; padding: 10px 4px; background: none; border: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.ca-qcard:hover, .ca-qcard:focus-visible { background: var(--surface-2); }
.ca-qcard .grow { flex: 1 1 180px; min-width: 0; }
.ca-qcard strong { display: block; font-size: 15px; overflow-wrap: anywhere; }
.ca-qcard small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.ca-chip { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 9px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.ca-wait { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 9px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.ca-wait.amber { background: var(--warn-soft); color: var(--warn); }
.ca-wait.red { background: var(--danger-soft); color: var(--danger); }
.ca-moved { display: flex; padding: 10px 4px; opacity: 0.62; background: var(--surface-2); }
.ca-moved .grow { min-width: 0; }
.ca-moved strong { display: block; text-decoration: line-through; }
.ca-moved small { display: block; color: var(--text-2); font-size: 13px; }
.ca-empty-q { margin: 4px 0; font-size: 15px; }
.ca-ref { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius-sm); padding: 10px 14px; margin: 8px 0; }
.ca-ref p { margin: 4px 0; }
.ca-ref-g { padding-bottom: 8px; }
.ca-why { display: block; color: var(--text-2); font-size: 12px; margin-top: 2px; }
.ca-sub { margin: 10px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.ca-give select { min-height: 48px; font-size: 16px; max-width: 100%; }
.ca-health-row { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.ca-health-row span { display: flex; flex-direction: column; gap: 2px; min-width: 130px; }
.ca-health-row small { color: var(--muted); font-size: 12px; }
.ca-qr { text-align: center; }
.ca-qr svg { width: min(320px, 100%); height: auto; background: #fff; padding: 8px; border-radius: 8px; }
.ca-work select { min-height: 44px; font-size: 16px; max-width: 100%; }
.btn.ca-48 { min-height: 48px; font-size: 15px; }
.btn.ca-sq { width: 44px; min-height: 44px; padding: 0; justify-content: center; font-size: 18px; }

/* The room plan: CORE's tokens; a seated chair is solid brand with initials, a reservation hatched
   in the accent, an open chair a hollow ring; preferred tables gold, employee tables dashed. */
.ca-room { --seat: var(--brand); --seat-ink: #fff; --floor: var(--surface-2); --floor-line: var(--border); display: grid; gap: 10px; }
:root[data-theme='dark'] .ca-room { --seat: var(--brand-text); --seat-ink: var(--bg); }
.ca-room-card > h2 { margin-bottom: 10px; }
.ca-live-bar { display: inline-flex; align-items: center; gap: 6px; justify-self: start; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; }
.ca-room-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 14px; align-items: start; }
.ca-room-plan { padding: 0; overflow: hidden; margin: 0; }
.ca-room-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.ca-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); }
.ca-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ca-legend svg { flex: none; }
.ca-zoom { display: flex; gap: 4px; }
.ca-plan { display: block; width: 100%; height: auto; max-height: 74vh; background: var(--floor); touch-action: manipulation; cursor: default; user-select: none; -webkit-user-select: none; }
.ca-plan.zoomed { touch-action: none; cursor: grab; }
.ca-plan:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.ca-floorline { stroke: var(--floor-line); stroke-width: 1; }
.ca-zone { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.5; }
.ca-zone.ca-stage { fill: var(--brand-soft); stroke: var(--brand-line); stroke-width: 2; }
.ca-zone-l { fill: var(--text-2); font-size: 13px; font-weight: 700; letter-spacing: 0.14em; }
.ca-zone-s { fill: var(--muted); font-size: 10px; }
.ca-tbl { cursor: pointer; }
.ca-t-top { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.5; }
.ca-t-top.ca-t-pref, .ca-type-preferred .ca-t-top { fill: var(--accent-soft); stroke: color-mix(in srgb, var(--accent) 70%, var(--surface)); }
.ca-t-top.ca-t-emp, .ca-type-employee .ca-t-top { stroke-dasharray: 4 3; }
.ca-type-mixed .ca-t-top { stroke-dasharray: 1 3; stroke-linecap: round; stroke-width: 2.5; }
.ca-t-top.ca-t-rec, .ca-tbl.rec .ca-t-top { stroke: var(--accent); stroke-width: 3; }
.ca-tbl.sel .ca-t-top { stroke: var(--brand-text); stroke-width: 3.5; }
.ca-t-ring { fill: none; stroke: none; }
.ca-tbl.kbd .ca-t-ring { stroke: var(--accent); stroke-width: 3; stroke-dasharray: 6 4; }
.ca-tbl.out { opacity: 0.34; }
.ca-t-num { fill: var(--text); font-size: 15px; font-weight: 700; }
.ca-t-count { fill: var(--muted); font-size: 9.5px; font-weight: 600; }
.ca-tbl.full .ca-t-count { fill: var(--brand-text); font-weight: 800; }
.ca-t-lock { fill: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: 0.06em; }
.ca-rank { fill: var(--accent); }
.ca-rank-t { fill: #fff; font-size: 12px; font-weight: 800; }
.ca-chair { stroke-width: 1.5; }
.ca-c-open { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.5; }
.ca-c-res { stroke: var(--accent); stroke-width: 1.5; }
.ca-hatch-bg { fill: var(--surface); }
.ca-hatch-fg { fill: var(--accent); }
.ca-c-seat { fill: var(--seat); stroke: var(--seat); }
.ca-c-pick { stroke: var(--accent); stroke-width: 4; }
.ca-c-ini { fill: var(--seat-ink); font-size: 7px; font-weight: 700; pointer-events: none; }
.ca-hit { fill: transparent; cursor: pointer; }
.ca-room-side { display: grid; gap: 14px; min-width: 0; }
.ca-panel { padding: 14px; display: grid; gap: 10px; margin: 0; min-width: 0; }
.ca-panel h2 { margin: 0; font-size: 15px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ca-panel h2 small { font-weight: 500; color: var(--muted); font-size: 12px; }
.ca-room-q { width: 100%; font-size: 16px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.ca-room-guests { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 320px; overflow: auto; }
.ca-room-guest { width: 100%; text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; min-height: 52px; cursor: pointer; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 2px 10px; align-items: center; }
.ca-room-guest:hover { border-color: var(--brand-line); }
.ca-room-guest[aria-pressed='true'] { border-color: var(--brand-text); border-width: 2px; background: var(--brand-soft); }
.ca-av { grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); font-weight: 700; font-size: 12px; color: var(--text-2); }
.ca-gn { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-gm { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-recs { display: grid; gap: 6px; }
.ca-rec { width: 100%; font: inherit; color: inherit; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; min-height: 52px; cursor: pointer; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.ca-rec:hover { border-color: var(--accent); }
.ca-rec-n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 12px; }
.ca-rec-left { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ca-tview { display: grid; gap: 10px; }
.ca-tview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ca-tview-head strong { font-size: 16px; }
.ca-pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 8px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.ca-pill.same { background: var(--success-soft); color: var(--success); border-color: transparent; }
.ca-dial { position: relative; width: 100%; max-width: 300px; aspect-ratio: 1; margin: 0 auto; }
.ca-dial-top { position: absolute; inset: 30%; border-radius: 50%; background: var(--surface-2); border: 1.5px solid var(--border-strong); display: grid; place-items: center; text-align: center; font-size: 12px; color: var(--muted); }
.ca-dial-top strong { display: block; font-size: 22px; color: var(--text); }
.ca-dchair { position: absolute; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; border: 2px solid var(--border-strong); background: var(--surface); color: var(--text-2); display: grid; place-items: center; padding: 0; }
.ca-dchair.seated { background: var(--seat); border-color: var(--seat); color: var(--seat-ink); }
.ca-dchair.reserved { background: repeating-linear-gradient(45deg, var(--accent-soft) 0 4px, var(--surface) 4px 8px); border-color: var(--accent); color: var(--text); }
.ca-dchair.pick { box-shadow: 0 0 0 4px var(--accent); }
.ca-dchair:focus-visible, .ca-rec:focus-visible, .ca-room-guest:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ca-who { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.ca-who li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; }
.ca-who .ca-cn { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; min-width: 0; }
.ca-inds { display: flex; flex-wrap: wrap; gap: 4px; }
.ca-confirm { display: grid; gap: 8px; background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: var(--radius-sm); padding: 10px 12px; }
@media (max-width: 1020px) { .ca-room-layout { grid-template-columns: minmax(0, 1fr); } .ca-plan { max-height: none; } }
@media (prefers-reduced-motion: reduce) { .ca-qcard, .ca-rec, .ca-dchair, .ca-room-guest, .ca-t-top { transition: none; } }
@media print { .ca-room-side, .ca-zoom, .ca-live-bar { display: none; } .ca-room-layout { grid-template-columns: 1fr; } }
/* CUSTOM APP Tier 2 (0.73): groups, walk-ins and substitutes, the exceptions inbox, paper reconciliation */
.ca-qli { display: flex; align-items: stretch; gap: 2px; }
.ca-qli > .ca-qcard, .ca-qli > .ca-guest { flex: 1 1 auto; min-width: 0; }
.ca-pick { display: flex; align-items: center; justify-content: center; flex: none; width: 48px; min-height: 56px; cursor: pointer; }
.ca-pick input { width: 22px; height: 22px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.ca-q-tip { margin: -4px 0 6px; }
.ca-groupbar { position: sticky; bottom: 8px; z-index: 15; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding: 10px 12px; background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.ca-groupbar .grow { flex: 1 1 140px; font-weight: 600; }
.ca-groupbar .btn { min-height: 44px; }
.ca-split { font-weight: 600; margin: 4px 0 10px; }
.ca-walkin-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 0; }
.ca-walkin-row .btn { min-height: 44px; }
.ca-approval { border-left: 3px solid var(--warn); padding-left: 10px; }
.ca-inbox-list { list-style: none; margin: 0; padding: 0; }
.ca-inbox-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 2px; }
.ca-inbox-item + .ca-inbox-item { border-top: 1px solid var(--border); }
.ca-inbox-item .grow { flex: 1 1 220px; min-width: 0; }
.ca-inbox-item strong { display: block; overflow-wrap: anywhere; }
.ca-inbox-item small { display: block; color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.ca-inbox-item .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ca-inbox-item .small-btn { min-height: 40px; }
.ca-banner { border: 1px solid var(--danger); background: var(--danger-soft); }
.ca-banner svg { color: var(--danger); }
.ca-tables-card > summary { cursor: pointer; list-style: none; }
.ca-tables-card > summary::-webkit-details-marker { display: none; }
.ca-tables-card > summary h2 { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.ca-tables-card > summary h2::after { content: '▸'; font-size: 14px; color: var(--muted); }
.ca-tables-card[open] > summary h2::after { content: '▾'; }
.ca-tact { white-space: nowrap; }
.ca-tact select { min-height: 36px; max-width: 11em; }
@media (max-width: 640px) { .ca-tact { white-space: normal; } }
.ca-move-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; }
.ca-move-list .grow { flex: 1 1 150px; min-width: 0; }
.ca-move-list small { display: block; color: var(--muted); }
.ca-move-list select { min-height: 44px; max-width: 100%; }
.ca-moved-ok { opacity: 0.6; }
.ca-cards { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.ca-recovery { border-left: 4px solid var(--warn); padding: 10px 12px; margin: 0; }
.ca-recovery p { margin: 4px 0; }
#ca-reconcile textarea { width: 100%; font: 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.ca-seat-choice { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 12px 4px; margin: 0 0 12px; }
.ca-seat-choice legend { padding: 0 4px; font-size: 13px; color: var(--text-2); }
.ca-seat-choice .field.check { margin: 4px 0; }
