/* MLC Software Solutions: Plus Jakarta Sans, indigo/purple accent, navy sidebar with tinted icon tiles. */
:root {
  --brand-pink: #f2528f;
  --brand-green: #16a56c;
  --brand-blue: #2f7bea;
  --bg: #f4f5fb;
  --panel: #ffffff;
  --panel-2: #fafafe;
  --ink: #1b1d3a;
  --ink-strong: #15173a;
  --ink-2: #4a4f72;
  --ink-3: #5a5f82;
  --muted: #7a7fa3;
  --faint: #b5b9d4;
  --line: #e6e8f2;
  --line-2: #eff0f7;
  --field-line: #dcdfee;
  --accent: #6246ea;
  --accent-strong: #4b32d8;
  --accent-hover: #4128c2;
  --accent-soft: #eeebff;
  --brand: #10b981;
  --side: #151833;
  --side-ink: #d6dae0;
  --side-label: #7d83ad;
  --ok: #047857; --ok-bg: #e9fbf2; --ok-line: #bfefd9; --ok-dot: #10b981;
  --warn: #a34e05; --warn-bg: #fff6e0; --warn-line: #fce0a6; --warn-dot: #f59e0b;
  --bad: #be123c; --bad-bg: #ffe4e9; --bad-line: #fecdd6; --bad-dot: #f43f5e;
  --info: #0369a1; --info-bg: #e0f2fe;
  --muted-bg: #f4f5fb;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(21, 23, 58, .04);
  --header-h: 72px;
  --side-w: 264px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { font-size: 14px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14.5px/1.5 'Plus Jakarta Sans', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
h1 { font-size: 34px; margin: 0; font-weight: 800; letter-spacing: -.03em; color: var(--ink-strong); line-height: 1.15; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 800; letter-spacing: -.01em; color: var(--ink-strong); }
h3 { font-size: 14.5px; margin: 0; font-weight: 700; color: var(--ink-strong); }
code { font: 13px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--muted-bg); padding: 2px 6px; border-radius: 6px; }
button { font: inherit; }
input::placeholder, textarea::placeholder { color: #8a8fb0; }
.hint { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.loading { padding: 70px 20px; text-align: center; color: var(--muted); font-weight: 600; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.empty b { display: block; margin-bottom: 6px; font-size: 16px; color: var(--ink-strong); }
.empty p { margin: 0 0 16px; }
.bad-text { color: var(--bad) !important; font-weight: 700; }
.warn-text { color: var(--warn) !important; font-weight: 700; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin: 4px 0; font-weight: 600; }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-weight: 700; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px; border: 1px solid var(--field-line);
  background: var(--panel); color: var(--ink-strong); border-radius: var(--radius-sm); font-weight: 700; font-size: 14.5px; cursor: pointer; white-space: nowrap;
  text-decoration: none !important; transition: border-color .12s, background .12s, box-shadow .12s;
}
.btn:hover { border-color: #c3c7df; background: #fcfcff; color: var(--ink-strong); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 8px 20px rgba(98, 70, 234, .28); }
.btn.pri:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.danger { background: #e11d48; border-color: #e11d48; color: #fff; }
.btn.danger:hover { background: #be123c; border-color: #be123c; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--muted-bg); }
.btn.small { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; justify-content: center; height: 46px; }
.btn.on { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 8px; border: 1px solid transparent; border-radius: 12px;
  background: none; color: var(--ink-2); cursor: pointer; text-decoration: none !important; font-size: 15px;
}
.icon-btn:hover { background: var(--panel); border-color: var(--line); color: var(--ink-strong); }
.icon-btn.danger:hover { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; border-color: transparent; }
.count { display: inline-block; min-width: 20px; padding: 1px 8px; margin-left: 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 12px; font-weight: 800; text-align: center; line-height: 18px; }
:focus-visible { outline: 3px solid rgba(98, 70, 234, .35); outline-offset: 2px; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
/* one meaning everywhere: ok good/done · warn attention soon · bad problem · info open/in progress · gap missing · muted inactive */
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-dot); color: #fff; }
.pill.info { background: var(--accent-soft); color: var(--accent-strong); }
.pill.gap { background: #f6f7fb; color: var(--ink-2); border: 1.5px dashed #a9b0cc; padding: 1.5px 9.5px; }
.pill.muted { background: #f1f2f7; color: var(--muted); }

/* ---------- forms ---------- */
input, select, textarea {
  font: inherit; font-size: 14.5px; color: var(--ink); width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); min-height: 46px;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(98, 70, 234, .25); border-color: var(--accent); }
/* dense editing grids keep shorter fields */
:is(table.grid-edit, table.hb-table, .tpl-item, .fb-row, .hb-hz, .hb-flow-line) :is(input, select, textarea) { min-height: 40px; padding: 8px 12px; }
input:disabled, select:disabled, textarea:disabled { background: var(--panel-2); color: var(--ink-3); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); margin: 0; }
input[type=search] { max-width: 260px; }
label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-strong); margin-bottom: 6px; }
.req { color: var(--bad); }
.field { min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field.compact label { margin-bottom: 4px; font-size: 12px; }
.field.missing input, .field.missing select, .field.missing textarea, .field.missing .chips { border-color: #f59eb0; background: #fff8fa; }
.field .hint { margin-top: 5px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); margin: 0; cursor: pointer; font-size: 14px; }
.check.small { font-size: 13px; color: var(--ink-2); }
.checks { display: flex; flex-wrap: wrap; gap: 10px 20px; padding: 6px 0; }
.readonly { padding: 9px 12px; min-height: 42px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel-2); color: var(--ink-3); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.with-link { display: flex; gap: 6px; align-items: center; }
.ref-link { color: var(--muted); display: inline-flex; padding: 6px; border-radius: 8px; }
.ref-link:hover { background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px; min-height: 46px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px 3px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 13px; font-weight: 700; }
.chip-x { border: 0; background: none; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; border-radius: 50%; }
.chip-x:hover { background: rgba(0, 0, 0, .08); }
.chip-add { width: auto; min-height: 32px; padding: 4px 10px; border-style: dashed; color: var(--ink-2); flex: 0 1 200px; font-size: 13px; font-weight: 600; }
.whys { display: grid; gap: 8px; }
.why { display: flex; align-items: center; gap: 10px; }
.why-n { flex: 0 0 56px; font-size: 12px; font-weight: 800; color: var(--muted); }
.rows-edit .btn { margin-top: 10px; }
table.grid-edit { width: 100%; border-collapse: collapse; }
table.grid-edit th { text-align: left; font-size: 12px; color: var(--muted); padding: 4px; font-weight: 700; }
table.grid-edit td { padding: 3px; vertical-align: top; }
table.grid-edit .n { width: 28px; color: var(--muted); font-size: 12px; text-align: center; padding-top: 12px; }
table.grid-edit .act { width: 130px; white-space: nowrap; }

/* ---------- header ---------- */
header.top {
  position: sticky; top: 0; z-index: 30; height: var(--header-h); display: flex; align-items: center; gap: 18px; padding: 0 28px 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink-strong); font-weight: 800; font-size: 18px; letter-spacing: -.02em; text-decoration: none !important; min-width: 0; }
.brand:hover { color: var(--ink-strong); }
.brand img { max-height: 40px; max-width: 150px; object-fit: contain; }
.logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: #fff; flex: none; }
.brand-name { white-space: nowrap; }
.company-pill { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid #d5f5e6; background: #ecfdf5; color: #047857; font-size: 14px; font-weight: 700; max-width: 280px; margin: 0; }
.company-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; }
.company-pill .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.company-pill select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 700; padding: 0 18px 0 0; min-height: 0; height: 36px; width: auto; max-width: 220px; cursor: pointer; }
.company-pill select:focus { outline: none; }
.company-pill svg { position: absolute; right: 12px; pointer-events: none; }
.top-menus { display: flex; gap: 6px; margin-left: 6px; }
.menu-wrap { position: relative; }
.menu-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font-size: 14.5px; font-weight: 600; cursor: pointer; }
.menu-btn:hover { background: var(--muted-bg); color: var(--ink-strong); }
.menu-btn.on { background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.menu { display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 50; min-width: 270px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(21, 23, 58, .16); }
.menu.right { left: auto; right: 0; }
.menu.open { display: block; }
.menu a, .menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 10px; color: var(--ink); text-align: left; cursor: pointer; text-decoration: none !important; font-size: 14px; font-weight: 600; }
.menu a:hover, .menu button:hover { background: var(--muted-bg); color: var(--ink-strong); }
.menu a svg, .menu button svg { color: var(--muted); }
.menu-head { padding: 8px 12px 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px; }
.menu-head b, .menu-head span { display: block; }
.menu-head span { color: var(--muted); font-size: 13px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-weight: 800; font-size: 16px; cursor: pointer; }
.bell { position: relative; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.bell .dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad-dot); border: 2px solid #fff; box-sizing: content-box; }
.brand .mlc-icon { flex: none; display: block; }
.company-pill .co-logo { height: 22px; max-width: 64px; object-fit: contain; border-radius: 4px; flex: none; }
.bell .badge { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad-dot); color: #fff; font-size: 10.5px; font-weight: 800; line-height: 18px; text-align: center; border: 2px solid #fff; box-sizing: content-box; }
.hamburger { display: none; }

/* ---------- layout: top menu bar, no sidebar ---------- */
.shell { min-height: calc(100vh - var(--header-h) - 60px); }
main { display: block; min-width: 0; max-width: 1560px; margin: 0 auto; padding: 30px 40px 48px; outline: none; }
.app-foot { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px 20px 26px; color: var(--muted); font-size: 12px; font-weight: 600; }
.app-foot .mlc-mark { flex: none; display: block; }
.top-menus .menu-btn { text-decoration: none !important; }
.top-menus .menu-btn svg { color: var(--muted); }
.top-menus .menu-btn.on svg { color: var(--accent-strong); }
/* a drop-down of tiles: one tile per page in the group */
.menu.mega { min-width: 520px; padding: 12px; }
.menu.mega.wide { min-width: 760px; }
.mega-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.menu.mega.wide .mega-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.menu .mega-tile { display: flex; align-items: flex-start; gap: 12px; padding: 10px; border-radius: 12px; }
.menu .mega-tile .page-icon { width: 38px; height: 38px; border-radius: 10px; }
.menu .mega-tile svg { color: inherit; }
.mega-tile .mt-text { display: flex; flex-direction: column; min-width: 0; }
.mega-tile .mt-text b { font-size: 14px; color: var(--ink-strong); }
.mega-tile .mt-text span { font-size: 12.5px; font-weight: 500; color: var(--muted); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.menu .mega-tile.on { background: var(--accent-soft); }
/* phones: the menu button opens this panel */
.mobile-nav { display: none; }
.scrim { display: none; }
.company-pill .co-logo.placeholder { height: 26px; max-width: 70px; cursor: pointer; opacity: .9; }

/* ---------- page parts ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 22px; }
.ph-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ph-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-head h1 { font-size: 36px; }
/* each page's accent: the sidebar tint, with a deeper icon colour for a white background */
.page-icon { width: 44px; height: 44px; flex: none; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; }
.page-icon svg { stroke-width: 2; }
.page-icon.t-indigo { background: rgba(129, 140, 248, .18); color: #4f46e5; }
.page-icon.t-emerald { background: rgba(52, 211, 153, .16); color: #059669; }
.page-icon.t-sky { background: rgba(56, 189, 248, .16); color: #0284c7; }
.page-icon.t-orange { background: rgba(251, 146, 60, .16); color: #ea580c; }
.page-icon.t-pink { background: rgba(244, 114, 182, .16); color: #db2777; }
.page-icon.t-violet { background: rgba(167, 139, 250, .18); color: #7c3aed; }
.page-icon.t-teal { background: rgba(45, 212, 191, .16); color: #0d9488; }
.page-icon.t-blue { background: rgba(96, 165, 250, .16); color: #2563eb; }
.page-icon.t-rose { background: rgba(251, 113, 133, .16); color: #e11d48; }
.page-icon.t-amber { background: rgba(251, 191, 36, .16); color: #d97706; }
.page-icon.t-fuchsia { background: rgba(232, 121, 249, .16); color: #c026d3; }
.page-icon.t-cyan { background: rgba(34, 211, 238, .16); color: #0891b2; }
.page-icon.t-lime { background: rgba(163, 230, 53, .16); color: #65a30d; }
.crumbs { font-size: 13px; font-weight: 600; color: var(--muted); }
.crumbs .sep { color: var(--faint); margin: 0 6px; }
.crumbs a { color: inherit; }
.crumbs a:hover { color: var(--accent); text-decoration: none; }
.rec-head .crumbs { grid-column: 1 / -1; }
.page-sub { font-size: 15px; color: var(--ink-3); }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-actions .btn { height: 46px; padding: 0 18px; }
.page-head .back { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.tabs { display: inline-flex; align-items: center; gap: 6px; padding: 5px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.tab { display: inline-flex; align-items: center; height: 40px; padding: 0 18px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: 14.5px; text-decoration: none !important; }
.tab:hover { background: var(--muted-bg); color: var(--ink-strong); }
.tab.on { background: var(--ink-strong); color: #fff; font-weight: 700; }
.tab.on .count { background: rgba(255, 255, 255, .18); color: #fff; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; }
.card.narrow { max-width: 780px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; flex: 1; display: flex; align-items: center; }
.banner { padding: 12px 16px; border-radius: 14px; margin-bottom: 16px; font-size: 14px; }
.banner.info { background: #f1efff; border: 1px solid #ddd6fe; color: #2e1f7a; }
.banner.warn { background: #fffaeb; border: 1px solid #fde8b0; color: #7a4b00; }
.toolbar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar > .search { width: 260px; }
.toolbar select { width: auto; }
.yearnav { display: inline-flex; align-items: center; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.yearnav .year { min-width: 80px; text-align: center; font-weight: 800; font-size: 14.5px; color: var(--ink-strong); }
.yearnav .icon-btn { min-width: 34px; height: 34px; border-radius: 9px; }
.yearnav .check { margin: 0 8px 0 6px; }
.yearnav .btn.small { height: 34px; }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--muted-bg); border: 1px solid var(--line); flex-wrap: wrap; }
.seg-btn { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 14px; cursor: pointer; }
.seg-btn:hover { color: var(--ink-strong); }
.seg-btn.on { background: #fff; color: var(--ink-strong); font-weight: 700; box-shadow: 0 1px 3px rgba(21, 23, 58, .12); }
.seg-btn .count { background: var(--bad-bg); color: var(--bad); }
.seg-btn:not(.on) .count { background: #e8eaf4; color: var(--ink-2); }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 14px 16px; margin-bottom: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.filters .field { width: 200px; }
.filters select, .filterbar select { background: var(--muted-bg); border-color: var(--line); height: 46px; border-radius: 12px; font-weight: 600; }
.verify { display: inline-flex; align-items: center; gap: 8px; }
.verify-info { font-size: 13px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 13px; color: var(--ink-3); margin-bottom: 12px; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); max-height: calc(100vh - 260px); }
.card .table-wrap { max-height: none; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
table.data th { position: sticky; top: 0; z-index: 1; background: var(--panel-2); text-align: left; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 14px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
table.data th.sorted.asc::after { content: " ▲"; font-size: 9px; }
table.data th.sorted.desc::after { content: " ▼"; font-size: 9px; }
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; max-width: 380px; overflow-wrap: break-word; color: var(--ink); }
table.data:not(.compact) tr > :first-child { padding-left: 20px; }
table.data:not(.compact) tr > :last-child { padding-right: 20px; }
table.data td:first-child, table.data td.nowrap { white-space: nowrap; }
table.data td:first-child a { font-weight: 700; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover td { background: #fafafe; }
/* people: coloured initials */
.person { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.person .av { width: 30px; height: 30px; flex: none; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 800; }
table.data.compact .person .av { width: 26px; height: 26px; border-radius: 8px; font-size: 10.5px; }
table.data tbody tr.group td { background: #f5f5fc; font-weight: 800; color: var(--accent-strong); cursor: default; padding: 9px 14px; font-size: 12.5px; letter-spacing: .02em; }
table.data tbody tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--bad-dot); }
table.data tbody tr.inactive td { color: var(--muted); }
table.data td.c, table.data th.c { text-align: center; }
table.data td.act { white-space: nowrap; text-align: right; width: 1%; }
table.data td.act .btn { margin-left: 4px; }
table.data td.mod { color: var(--muted); font-size: 12.5px; white-space: nowrap; font-weight: 600; }
table.data.compact td { padding: 9px 12px; }
table.data.compact td:first-child { white-space: normal; }
table.data.compact th { position: static; padding: 9px 12px; }
.list-summary { margin: 10px 4px; font-size: 13px; color: var(--muted); }
.col-choose { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 16px; }

/* ---------- dialogs & toasts ---------- */
dialog.dlg { border: 0; border-radius: 20px; padding: 0; width: min(600px, calc(100vw - 32px)); box-shadow: 0 30px 70px rgba(21, 23, 58, .3); color: var(--ink); }
dialog.dlg.wide { width: min(880px, calc(100vw - 32px)); }
dialog.dlg.xwide { width: min(1240px, calc(100vw - 32px)); }
/* bulk document upload */
.du .grid { margin-bottom: 14px; }
.du .imp-drop { margin-bottom: 14px; }
.du-table { max-height: 46vh; margin-top: 10px; }
.du-table td { vertical-align: top; }
.du-table :is(input, select) { min-height: 38px; padding: 6px 10px; font-size: 13.5px; }
.du-table select { min-width: 140px; }
.du-file { max-width: 220px; }
.du-file > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.du-file .pill { margin-top: 4px; }
input.du-rev { width: 64px; }
input.missing { border-color: #f59eb0; background: #fff8fa; }
.du-foot { display: flex; align-items: center; gap: 12px; margin-top: 14px; min-height: 46px; }
dialog.dlg::backdrop { background: rgba(21, 23, 58, .45); }
.dlg-hd { display: flex; align-items: center; justify-content: space-between; padding: 20px 28px; border-bottom: 1px solid var(--line); font-weight: 800; font-size: 18px; color: var(--ink-strong); }
.dlg-bd { padding: 22px 28px; max-height: 68vh; overflow: auto; }
.dlg-bd .field + .field { margin-top: 14px; }
.dlg-ft { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 28px; border-top: 1px solid var(--line); background: var(--panel-2); border-radius: 0 0 20px 20px; }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: 480px; padding: 12px 18px; border-radius: 12px; background: var(--ink-strong); color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 12px 30px rgba(21, 23, 58, .28); opacity: 0; transform: translateY(8px); transition: .18s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.toast.bad { background: var(--bad); }
.secret { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.secret code { font-size: 18px; padding: 8px 14px; letter-spacing: .04em; }

/* ---------- record page ---------- */
.rec-head { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: center; margin-bottom: 20px; }
.rec-head .back { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 13px; width: max-content; }
.rec-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rec-title h1 { font-size: 30px; }
.rec-sub { grid-column: 1; color: var(--ink-3); font-size: 15px; }
.rec-meta { grid-column: 1; color: var(--muted); font-size: 13px; }
.rec-actions { grid-column: 2; grid-row: 2 / span 3; display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.rec-form .card h2 { color: var(--ink-strong); }
.comments .comment { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.c-meta { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.c-body { white-space: pre-wrap; }
.comment-add { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; }
.history .h-item { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.history ul { margin: 6px 0 0; padding-left: 18px; }
.history li { margin: 2px 0; font-size: 13.5px; }
.h-meta { font-size: 13.5px; }
.h-field { font-weight: 700; }
.h-old { color: var(--muted); text-decoration: line-through; }
.h-new { color: var(--ink); }
.doc-panel .doc-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 20px; margin-bottom: 14px; }
.fact span { display: block; font-size: 12px; color: var(--muted); font-weight: 700; }
.fact b { font-weight: 600; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
details.revs summary { cursor: pointer; font-weight: 700; margin: 6px 0; color: var(--ink-2); }

/* checklists (inspections, audits) */
.insp-summary { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.insp-sec { border: 1px solid var(--line); border-radius: 14px; margin: 14px 0; overflow: hidden; }
.insp-sec.off { opacity: .7; }
.insp-sec-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 11px 14px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.insp-sec-head h3 { color: var(--accent-strong); }
.insp-item { padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.insp-item:last-child { border-bottom: 0; }
.insp-item.failed { background: #fff7f9; }
.insp-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.insp-text { flex: 1; }
.insp-detail:not(:empty) { padding: 10px 0 4px; display: grid; gap: 10px; }
.insp-detail .btn { width: max-content; }
.seg.res .seg-btn { min-width: 64px; justify-content: center; height: 36px; }
.seg.res .seg-btn.on.ok { background: var(--ok-bg); color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok-line); }
.seg.res .seg-btn.on.bad { background: var(--bad-dot); color: #fff; }
.seg.res .seg-btn.on.muted { background: #fff; color: var(--ink-strong); }
table.data.audit td { vertical-align: middle; }
table.data.audit td.el { min-width: 240px; font-weight: 600; }
table.data.audit tr.nc td { background: #fff7f9; }
table.data.audit textarea { min-height: 38px; }
table.data.audit tbody tr { cursor: default; }

/* template & form builders */
.tpl-sec { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; background: var(--panel-2); }
.tpl-sec-head { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; }
.tpl-title { font-weight: 700; }
.tpl-item, .fb-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.tpl-item .n, .fb-row .n { flex: 0 0 26px; text-align: right; color: var(--muted); font-size: 12px; font-weight: 700; }
.fb-row { display: grid; grid-template-columns: 26px minmax(200px, 2fr) 160px minmax(140px, 1fr) 110px auto; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.fb-row.heading .fb-label { font-weight: 800; }
.fb-row select { width: 160px; }
.fb-btns { white-space: nowrap; }
.fb-heading { grid-column: 1 / -1; margin: 10px 0 0; color: var(--accent-strong); }

/* ---------- dashboard ---------- */
.dash-head .quick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tiles, .stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.tile, .stat { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none !important; }
.tile:hover { border-color: #cfc8fb; color: var(--ink); }
.tile span, .stat .st-label { display: flex; align-items: center; gap: 8px; order: -1; color: var(--ink-2); font-size: 13px; font-weight: 700; }
.tile span::before, .stat .st-label i { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #c7cbe0; flex: none; }
.tile b, .stat .st-value { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -.03em; color: var(--ink-strong); }
.stat .st-cap { font-size: 12.5px; color: var(--muted); }
.tile.bad b, .stat.bad .st-value { color: var(--bad); }
.tile.bad span::before, .stat.bad .st-label i { background: var(--bad-dot); }
.tile.warn b, .stat.warn .st-value { color: #b45309; }
.tile.warn span::before, .stat.warn .st-label i { background: var(--warn-dot); }
.tile.ok b, .stat.ok .st-value { color: var(--ok); }
.tile.ok span::before, .stat.ok .st-label i { background: var(--ok-dot); }
.stat.gap .st-value { color: #334155; }
.stat.gap .st-label i { background: transparent; border: 2px dashed #64748b; }
.tile.hero, .stat.hero { background: var(--accent); border-color: var(--accent); color: #fff; }
.tile.hero b, .tile.hero span, .stat.hero .st-value, .stat.hero .st-label { color: #fff; }
.tile.hero span::before, .stat.hero .st-label i { display: none; }
.stat .meter { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.stat .meter i { display: block; height: 8px; border-radius: 999px; background: #fff; }
.stat { min-width: 0; }
a.stat, button.stat { cursor: pointer; font: inherit; text-align: left; transition: border-color .12s, box-shadow .12s; }
a.stat:hover, button.stat:hover { border-color: #cfc8fb; box-shadow: 0 6px 18px rgba(98, 70, 234, .08); color: var(--ink); }
a.stat.hero:hover { border-color: var(--accent-hover); background: var(--accent-hover); color: #fff; }
.stat.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.stat.hero .st-label { opacity: .85; }
.stat.hero .st-cap { color: rgba(255, 255, 255, .85); }
.stat.info .st-value { color: var(--accent-strong); }
.stat.info .st-label i { background: var(--accent); }
.fb-field { display: block; margin: 0; }
ul.open-list { list-style: none; margin: 0; padding: 0; }
ul.open-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
ul.open-list li:last-child { border-bottom: 0; }
ul.open-list a { font-weight: 600; color: var(--ink); }
ul.open-list .count.zero { background: #eef0f7; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dash-grid .col { min-width: 0; }
ul.plain, ul.activity, ul.insp-today, ul.notes { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 9px 0; border-bottom: 1px solid var(--line-2); }
ul.activity li { padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
ul.insp-today li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
ul.insp-today .pill { min-width: 76px; justify-content: center; }
.recalls li a { font-weight: 600; }
ul.notes li a { display: block; padding: 14px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; color: var(--ink); text-decoration: none; }
ul.notes li.unread a { border-left: 4px solid var(--accent); }
ul.notes li.unread b { color: var(--accent-strong); }
.n-body { white-space: pre-line; color: var(--ink-3); margin: 2px 0; }

/* ---------- schedules ---------- */
table.data.sched td.task-col, table.data.sched th.task-col { min-width: 270px; max-width: 420px; }
table.data.sched th.c { text-align: center; min-width: 78px; }
table.data.sched th.now { color: var(--accent-strong); background: #f1efff; }
table.data.sched th .sub { font-size: 10px; font-weight: 600; text-transform: none; letter-spacing: 0; }
table.data.sched tbody tr { cursor: default; }
td.cell, span.cell { text-align: center; font-size: 12.5px; font-weight: 700; cursor: pointer; }
td.cell { padding: 6px !important; }
td.cell::before { content: attr(data-x); }
span.cell { display: inline-block; min-width: 50px; padding: 3px 8px; border-radius: 8px; }
.cell.done { color: var(--ok); }
.cell.due { color: var(--warn); }
.cell.overdue { color: #fff; }
td.cell.done, td.cell.due, td.cell.overdue, td.cell.future, td.cell.notyet { background-clip: content-box; }
td.cell > * { pointer-events: none; }
td.cell.done { background: var(--ok-bg); box-shadow: inset 0 0 0 6px #fff, inset 0 0 0 7px var(--ok-line); border-radius: 12px; }
td.cell.due { background: var(--warn-bg); box-shadow: inset 0 0 0 6px #fff, inset 0 0 0 7px var(--warn-line); }
td.cell.overdue { background: var(--bad-dot); box-shadow: inset 0 0 0 6px #fff; }
td.cell.na { background: repeating-linear-gradient(135deg, #fbfbfe, #fbfbfe 4px, #f1f2f8 4px, #f1f2f8 8px); cursor: default; color: var(--faint); }
span.cell.done { background: var(--ok-bg); box-shadow: inset 0 0 0 1px var(--ok-line); }
span.cell.due { background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn-line); }
span.cell.overdue { background: var(--bad-dot); }
td.cell:hover { filter: brightness(.97); }
.daystrip { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-bottom: 18px; }
.day { display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: 10px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); font-size: 11px; text-decoration: none !important; }
.day b { font-size: 14px; color: var(--ink-strong); }
.day.done { background: var(--ok-bg); border-color: var(--ok-line); }
.day.fail { background: var(--bad-bg); border-color: var(--bad-line); }
.day.missed { background: #fff7f9; border-style: dashed; border-color: #f59eb0; }
.day.today { border: 2px solid var(--accent); }

/* ---------- training matrix ---------- */
.filterbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px; margin-bottom: 22px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.filterbar .searchbox { flex: 1 1 260px; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 12px; background: var(--muted-bg); border: 1px solid var(--line); margin: 0; color: var(--muted); }
.filterbar .searchbox input { border: 0; background: transparent; min-height: 0; height: 40px; padding: 0; outline: none; font-weight: 500; max-width: none; }
.filterbar .searchbox:focus-within { border-color: #a99bf5; box-shadow: 0 0 0 3px rgba(98, 70, 234, .15); }
.filterbar select { width: 200px; }
.filterbar select.set { border-color: #c9bffa; background: var(--accent-soft); color: var(--accent-strong); }
.filterbar .yearnav { background: var(--muted-bg); padding: 5px; }
.filterbar .seg-btn { height: 36px; }
.filterbar .check { margin: 0 4px; }
.filterbar > .link { font-size: 13.5px; }
.fb-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.fb-note { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.seg .seg-btn .count.bad { background: var(--bad-bg); color: var(--bad); }
.report-controls { align-items: flex-end; }
.report-controls .field label { margin-bottom: 4px; }
/* list card: table plus a footer strip */
.list-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.list-card > .table-wrap { border: 0; border-radius: 0; }
.list-card > .empty, .list-card > .table-wrap > .empty { border: 0; border-radius: 0; }
.list-foot { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; padding: 12px 20px; background: var(--panel-2); border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
.list-foot:empty { display: none; }
.list-foot .key { display: inline-flex; align-items: center; gap: 8px; }
.tm { border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.tm-scroll { overflow: auto; max-height: calc(100vh - var(--header-h) - 48px); }
.tm-grid { display: grid; gap: 8px; align-items: center; padding: 10px 20px; border-bottom: 1px solid var(--line-2); background: var(--panel); }
.tm-head { align-items: end; padding: 16px 20px 14px; background: var(--panel-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.tm-head > :first-child { position: sticky; left: 0; z-index: 1; background: inherit; }
.tm-h { font-size: 12px; font-weight: 800; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.tm-h.right { text-align: right; }
.tm-col { display: flex; flex-direction: column; gap: 5px; align-items: center; text-align: center; min-width: 0; }
.tm-group { padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tm-name { font-size: 13.5px; font-weight: 700; color: var(--ink-strong); line-height: 1.2; }
a.tm-name { color: var(--ink-strong); }
a.tm-name:hover { color: var(--accent); text-decoration: none; }
.tm-every { font-size: 11.5px; color: #8a8fb0; }
.tm-emp { display: flex; align-items: center; gap: 12px; min-width: 0; position: sticky; left: 0; z-index: 1; background: inherit; }
.tm-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tm-who a, .tm-role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-av { width: 38px; height: 38px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 13.5px; font-weight: 800; }
.tm-emp a { font-size: 14.5px; font-weight: 700; color: var(--ink-strong); }
.tm-emp .tm-role { font-size: 12.5px; color: var(--muted); }
.tm-cell { display: flex; justify-content: center; }
.tm-btn { width: 100%; max-width: 112px; height: 40px; border-radius: 10px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tm-btn.c { border: 1px solid var(--ok-line); background: var(--ok-bg); color: var(--ok); }
.tm-btn.d { border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.tm-btn.o { border: 0; background: var(--bad-dot); color: #fff; font-weight: 800; }
.tm-btn.n { border: 1.5px dashed #a9b0cc; background: #f6f7fb; color: var(--ink-2); }
.tm-btn:hover { filter: brightness(.97); }
.tm-btn:disabled { cursor: default; }
.tm-x { width: 100%; max-width: 112px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--faint); }
.tm-key { display: inline-flex; align-items: center; gap: 8px; }
.tm-pct { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.tm-pct b { font-size: 14px; font-weight: 800; }
.tm-bar { width: 100%; height: 6px; border-radius: 999px; background: #eef0f7; overflow: hidden; }
.tm-bar i { display: block; height: 6px; border-radius: 999px; }
.tm-legend { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 14px 20px; background: var(--panel-2); font-size: 13px; color: var(--ink-3); }
.tm-legend .tm-btn { width: auto; height: auto; padding: 3px 10px; font-size: 12px; cursor: default; border-radius: 8px; }
.tm-none { padding: 48px 20px; text-align: center; background: var(--panel); }
.tm-none b { display: block; font-size: 16px; color: var(--ink-strong); }
.tm-none .hint { display: block; margin: 6px 0 14px; font-size: 14px; }

/* ---------- setup ---------- */
.setup-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.setup-card { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none !important; }
.setup-card:hover { border-color: #cfc8fb; box-shadow: 0 8px 24px rgba(98, 70, 234, .08); color: var(--ink); }
.setup-card b { font-size: 16px; color: var(--ink-strong); }
.setup-card span { color: var(--muted); font-size: 13.5px; }
.lists-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.lists-left .search { width: 100%; max-width: none; margin-bottom: 10px; }
ul.pick { list-style: none; margin: 0; padding: 6px; max-height: calc(100vh - 270px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
ul.pick li { padding: 9px 12px; border-radius: 10px; cursor: pointer; }
ul.pick li b, ul.pick li span { display: block; }
ul.pick li b { font-size: 14px; font-weight: 700; }
ul.pick li span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
ul.pick li:hover { background: var(--muted-bg); }
ul.pick li.on { background: var(--accent-soft); }
ul.pick li.on b { color: var(--accent-strong); }
table.values td.act { width: 210px; }
table.values tbody tr, table.data.alerts tbody tr, table.data.perms tbody tr, table.data.companies tbody tr { cursor: default; }
.setup-steps { display: grid; gap: 18px; }
.setup-step { display: flex; gap: 14px; align-items: flex-start; }
.setup-step b { font-size: 15.5px; color: var(--ink-strong); }
.setup-step p { margin: 4px 0 10px; }
.setup-step .btn-row { margin-bottom: 0; }
.pack-tabs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 16px; margin: 14px 0; }
details.pack-detail { margin-top: 12px; }
details.pack-detail summary { cursor: pointer; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }
input.days { width: 80px; }
.logo-preview { display: flex; align-items: center; justify-content: center; width: 270px; height: 100px; border: 1px dashed var(--field-line); border-radius: 12px; background: #fff; margin-bottom: 10px; }
.logo-preview img { max-width: 250px; max-height: 84px; object-fit: contain; }

/* ---------- reports ---------- */
.report-controls .field { width: auto; min-width: 160px; }
.chart-card { position: relative; }
.chart-wrap { position: relative; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart text { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; }
svg.chart text.num { font-variant-numeric: tabular-nums; }
svg.chart .hit { outline: none; cursor: default; }
svg.chart .hit:focus-visible { fill: rgba(98, 70, 234, .06); }
.chart-legend .key { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; }
.chart-legend i, .chart-tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); pointer-events: none; opacity: 0; transition: opacity .1s; z-index: 5; min-width: 160px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(21, 23, 58, .16); font-size: 13px; }
.chart-tip.show { opacity: 1; }
.chart-tip div { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.chart-tip .tot { border-top: 1px solid var(--line-2); margin-top: 4px; padding-top: 4px; font-weight: 800; }
table.num-table td.n { text-align: right; font-variant-numeric: tabular-nums; }
table.num-table tr.total td { font-weight: 800; background: var(--panel-2); }
table.num-table tbody tr { cursor: default; }

/* ---------- HACCP / food safety plan builder ---------- */
.hb-start { text-align: center; padding: 18px 6px 8px; }
.hb-start h3 { font-size: 18px; }
.hb-start-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; margin-top: 16px; text-align: left; }
.hb-opt { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; font: inherit; color: var(--ink); text-align: left; }
.hb-opt:hover:not(:disabled) { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.hb-opt b { font-size: 16px; color: var(--ink-strong); }
.hb-opt span { color: var(--muted); font-size: 13.5px; }
.hb-top { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.hb-steps { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.hb-step { position: relative; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink-2); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.hb-step:hover { border-color: #c3c7df; }
.hb-step.on { background: var(--ink-strong); border-color: var(--ink-strong); color: #fff; }
.hb-step .dot { position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--warn-dot); border: 2px solid #fff; }
.hb-guide { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 16px; border-radius: 14px; background: #f1efff; border: 1px solid #ddd6fe; color: #2e1f7a; font-size: 14px; }
.hb-guide svg { flex: none; margin-top: 2px; color: var(--accent); }
.hb-h { margin: 20px 0 10px; color: var(--ink-strong); font-size: 15px; }
.hb-body .grid { margin-bottom: 10px; }
table.hb-table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; }
table.hb-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 4px; }
table.hb-table td { padding: 3px; vertical-align: top; }
table.hb-table td.act { width: 124px; white-space: nowrap; }
.row-btns { white-space: nowrap; }
.hb-flow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.hb-flow-row { display: flex; gap: 8px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; background: #fff; }
.hb-flow-row.input { margin-left: 26px; background: var(--panel-2); border-style: dashed; }
.hb-flow-row .n { flex: 0 0 22px; color: var(--muted); font-size: 12px; font-weight: 700; padding-top: 10px; text-align: right; }
.hb-flow-fields { flex: 1; display: grid; gap: 6px; min-width: 0; }
.hb-flow-line { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.hb-flow-line .hb-step-name { flex: 1 1 200px; font-weight: 700; }
.hb-flow-line select { width: auto; flex: 0 1 200px; }
.hb-flow-preview { position: sticky; top: calc(var(--header-h) + 14px); padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fff; max-height: calc(100vh - 130px); overflow: auto; }
svg.flow-svg { width: 100%; height: auto; display: block; }
svg.flow-svg text { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; }
.hb-hz-step { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; overflow: hidden; }
.hb-hz-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--panel-2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hb-hz-head h4 { margin: 0; font-size: 14.5px; color: var(--ink-strong); }
.hb-hz { display: grid; grid-template-columns: 124px minmax(160px, 2fr) 100px minmax(160px, 2fr) 100px 156px 40px; gap: 8px; align-items: start; padding: 10px 14px; border-top: 1px solid var(--line-2); }
.hb-hz:first-child { border-top: 0; }
.hb-hz.sig { background: #fffbf2; }
.hb-hz .field label { font-size: 11.5px; }
.hb-hz .hz-del { margin-top: 22px; }
.hb-pc { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; background: #fff; }
.hb-pc-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.hb-pc-head .hb-pc-name { font-weight: 800; font-size: 15px; }
.hb-pc-head select { width: 180px; }
.hb-pc-hz { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-bottom: 10px; font-size: 13.5px; }
.hb-sub { margin-top: 10px; }
.hb-sub > b { font-size: 13px; color: var(--ink-2); }
details.hb-more { margin: -4px 0 10px; }
details.hb-more summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 6px; }

/* printable plan */
.hd { max-width: 900px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 44px 52px; color: #1c211d; font-size: 13px; line-height: 1.5; font-family: 'Plus Jakarta Sans', system-ui, sans-serif; }
.hd h1 { font-size: 30px; margin: 6px 0 18px; font-weight: 800; color: #15173a; }
.hd h2 { font-size: 15px; margin: 0 0 8px; padding-bottom: 5px; border-bottom: 2px solid var(--accent); color: var(--accent-strong); text-transform: uppercase; letter-spacing: .05em; font-weight: 800; }
.hd h3 { font-size: 13.5px; margin: 14px 0 6px; }
.hd p { margin: 6px 0; }
.hd ul { margin: 6px 0; padding-left: 20px; }
.hd-cover { text-align: center; padding: 30px 0 34px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.hd-kicker { font-size: 12.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.hd-logo { max-width: 260px; max-height: 120px; object-fit: contain; margin: 4px auto 16px; display: block; }
.hd-company { font-size: 15px; }
.hd-meta { margin-top: 12px; font-size: 12px; color: var(--muted); }
.hd-sec { margin-bottom: 24px; }
.hd-ref { font-size: 11.5px; color: var(--muted); margin: -4px 0 8px; }
.hd-dl { display: grid; grid-template-columns: 150px 1fr; gap: 3px 12px; margin: 6px 0 10px; }
.hd-dl dt { font-weight: 700; }
.hd-dl dd { margin: 0; }
table.hd-table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 12px; }
table.hd-table th { background: var(--accent); color: #fff; text-align: left; padding: 6px 8px; font-weight: 700; border: 1px solid var(--accent); }
table.hd-table td { padding: 5px 8px; border: 1px solid #d7dbeb; vertical-align: top; }
table.hd-table tbody tr:nth-child(even) td { background: #f8f8fd; }
table.hd-small-table { font-size: 11px; }
table.hd-small-table td.step { font-weight: 700; background: #f3f2fd !important; }
table.hd-small-table tr.pc td:not(.step) { background: #fff8e6 !important; }
table.hd-sign td { height: 34px; }
.hd-flow { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.hd-flow svg { max-width: 640px; margin: 0 auto; }
.hd-small { font-size: 11.5px; color: var(--muted); }
.hd-foot { margin-top: 30px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); text-align: center; }
.hd-made { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; }
.hd-made .mlc-logo { width: 120px; height: auto; display: block; }

/* ---------- import ---------- */
.imp-step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.imp-step-head h2 { margin: 0; }
.imp-n { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 800; font-size: 14px; }
.imp-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 16px; border: 2px dashed var(--field-line); border-radius: 16px; background: var(--panel-2); cursor: pointer; text-align: center; color: var(--ink-2); }
.imp-drop:hover, .imp-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.imp-summary { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.imp-results .table-wrap { max-height: 440px; }
table.imp-map select { min-width: 230px; }
table.imp-map tbody tr { cursor: default; }
ol.steps { margin: 6px 0 10px; padding-left: 22px; }
ol.steps li { margin: 4px 0; }

/* ---------- sign-in ---------- */
body.auth-mode { background: radial-gradient(1200px 600px at 10% -10%, #e8e3ff 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #d9fbe9 0%, transparent 55%), var(--bg); }
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-wrap { width: min(440px, 100%); display: flex; flex-direction: column; align-items: center; gap: 18px; }
.auth-logo .mlc-logo { display: block; width: 320px; max-width: 100%; height: auto; }
.auth-app { font-size: 18px; font-weight: 800; color: var(--ink-strong); margin-top: -6px; }
.auth-card { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 32px; box-shadow: 0 24px 60px rgba(21, 23, 58, .1); }
.auth-card h1 { margin: 0 0 10px; font-size: 30px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card form .check { margin: 4px 0 14px; }
.auth-card .card { border: 0; padding: 0; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; color: var(--ink-strong); }

/* the last menus open toward the left so they stay on screen */
.top-menus > .menu-wrap:nth-last-child(-n+2) .menu { left: auto; right: 0; }
@media (max-width: 1500px) { .brand-name { display: none; } }

/* ---------- the eye: quick look at a document ---------- */
table.data th.eye-col, table.data td.eye-col { width: 44px; padding-left: 8px; padding-right: 0; }
.icon-btn.eye { min-width: 34px; height: 34px; border-radius: 10px; color: var(--accent-strong); background: var(--accent-soft); }
.icon-btn.eye:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
dialog.dlg.preview .dlg-bd { max-height: none; padding: 0; background: #525659; }
.preview-frame { display: block; width: 100%; height: 76vh; border: 0; background: #525659; }
.preview-img { display: flex; align-items: center; justify-content: center; max-height: 76vh; overflow: auto; padding: 16px; }
.preview-img img { max-width: 100%; max-height: calc(76vh - 32px); object-fit: contain; background: #fff; }
dialog.dlg.preview .dlg-bd > .empty { margin: 24px; }
/* Excel and Word, shown as a simplified read-only view */
.preview-office { background: #fff; height: 76vh; display: flex; flex-direction: column; }
.pv-note { display: flex; align-items: center; gap: 6px; padding: 8px 16px; font-size: 12.5px; color: #2e1f7a; background: #f5f3ff; border-bottom: 1px solid #ddd6fe; flex: none; }
.pv-pad { padding: 12px 16px; margin: 0; }
.pv-sheet { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.pv-tabs { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); background: var(--panel-2); flex: none; overflow-x: auto; }
.pv-tab { border: 1px solid var(--line); border-bottom: 0; background: #fff; padding: 6px 12px; border-radius: 8px 8px 0 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.pv-tab.on { background: var(--accent-soft); color: var(--accent-strong); border-color: #c9c3f7; }
.pv-scroll { overflow: auto; flex: 1; min-height: 0; }
table.pv-grid { border-collapse: collapse; font-size: 12.5px; font-family: Calibri, 'Segoe UI', Arial, sans-serif; }
table.pv-grid th { position: sticky; top: 0; background: #f1f2f6; color: #6b7190; font-weight: 600; font-size: 11px; padding: 3px 8px; border: 1px solid #dcdfe8; z-index: 1; }
table.pv-grid tbody th { position: sticky; left: 0; text-align: right; min-width: 34px; }
table.pv-grid td { border: 1px solid #e3e6ee; padding: 3px 8px; min-width: 64px; max-width: 380px; vertical-align: top; white-space: pre-wrap; color: #1f2333; }
.pv-doc { overflow: auto; flex: 1; padding: 28px 48px 40px; font-family: Calibri, 'Segoe UI', Arial, sans-serif; font-size: 14px; line-height: 1.5; color: #1f2333; max-width: 980px; margin: 0 auto; width: 100%; }
.pv-doc h2 { font-size: 20px; margin: 18px 0 8px; }
.pv-doc h3 { font-size: 16px; margin: 16px 0 6px; }
.pv-doc p { margin: 0 0 8px; }
.pv-doc ul { margin: 0 0 8px; padding-left: 24px; }
.pv-hf { font-size: 12px; color: #6b7190; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 16px; }
.pv-doc .pv-hf:last-child { border-bottom: 0; border-top: 1px solid var(--line); padding: 8px 0 0; margin: 20px 0 0; }
table.pv-table { border-collapse: collapse; width: 100%; margin: 6px 0 14px; font-size: 13px; }
table.pv-table td { border: 1px solid #c9cdd8; padding: 5px 8px; vertical-align: top; }
.src-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.steps-banner { padding: 12px 16px; margin-bottom: 16px; border-radius: 14px; background: #ecfdf5; border: 1px solid #bfefd9; color: #065f46; font-size: 14px; }
table.doc-src td.act { white-space: nowrap; }
table.doc-src td.act .btn + .btn { margin-left: 6px; }
table.doc-src tr.focus td { background: #fff8e1; }
.tight-row { margin-top: 0; }
.files .backend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-2); }
.files .backend > span { flex: 1; min-width: 240px; }
.src-line .icon-btn.eye { min-width: 28px; height: 28px; }
.doc-facts .fact b .icon-btn.eye { margin-left: 6px; vertical-align: middle; }
.lib-files .icon-btn.eye { min-width: 28px; height: 28px; margin-right: 6px; vertical-align: middle; }
.el-doc { display: inline-flex; align-items: center; gap: 6px; margin: 2px 14px 2px 0; }
.el-doc .icon-btn.eye, td.file-cell .icon-btn.eye, .revs td .icon-btn.eye { min-width: 28px; height: 28px; vertical-align: middle; }
td.file-cell { white-space: nowrap; }
td.file-cell .icon-btn.eye { margin-right: 6px; }

/* ---------- dashboard tiles ---------- */
.dash-tiles { display: grid; gap: 18px; margin-bottom: 30px; }
.tile-group h2 { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.dash-tile { position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  color: var(--ink); text-decoration: none !important; transition: border-color .12s, box-shadow .12s, transform .12s; min-height: 86px; }
.dash-tile:hover { border-color: #c9c3f7; box-shadow: 0 10px 24px rgba(21, 23, 58, .08); transform: translateY(-1px); color: var(--ink); }
.dash-tile .page-icon { width: 46px; height: 46px; border-radius: 13px; }
.dt-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-right: 26px; }
.dt-text b { font-size: 15.5px; color: var(--ink-strong); }
.dt-text span { font-size: 12.5px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dt-badge { position: absolute; top: 12px; right: 12px; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 800; line-height: 26px; text-align: center; }
.dash-section { font-size: 20px; margin: 4px 0 14px; }

/* ---------- instructions ---------- */
.help-btn { margin-left: 4px; color: var(--accent-strong) !important; }
.help-panel { flex-basis: 100%; background: #f5f3ff; border: 1px solid #ddd6fe; border-radius: 16px; padding: 14px 18px 12px; color: #2e1f7a; font-size: 14px; }
.rec-head .help-panel { grid-column: 1 / -1; margin-top: 4px; }
.help-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.help-head b { flex: 1; }
.help-panel ol { margin: 0; padding-left: 22px; display: grid; gap: 5px; line-height: 1.5; }
.page-tools { display: flex; gap: 8px; justify-content: flex-end; margin: -10px 0 12px; }

/* ---------- record: bottom buttons, photos, back-end files ---------- */
.rec-bottom { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; position: sticky; bottom: 0; z-index: 5; margin: 6px 0 0; padding: 14px 18px;
  background: rgba(255, 255, 255, .96); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 -6px 20px rgba(21, 23, 58, .06); }
.btn-row.tight { display: flex; gap: 6px; flex-wrap: wrap; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 14px; }
.thumb { position: relative; width: 112px; height: 112px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--muted-bg); display: flex; align-items: center; justify-content: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.pending .icon-btn { position: absolute; top: 4px; right: 4px; min-width: 28px; height: 28px; background: rgba(255, 255, 255, .92); border-color: var(--line); }
.thumb-file { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; font-size: 11.5px; text-align: center; color: var(--ink-3); word-break: break-word; }
.backend { margin-top: 16px; padding: 14px 16px; border: 1px dashed #c8c3ec; border-radius: 14px; background: #faf9ff; }
.backend h3 { flex: 1; display: flex; align-items: center; gap: 4px; }
.readonly.stamp { display: flex; align-items: center; gap: 6px; }
input.signature { font-family: 'Segoe Script', 'Brush Script MT', cursive; font-size: 17px; }
.split-banner { display: flex; align-items: flex-start; gap: 12px; }
.split-banner > div { flex: 1; }
.type-info { margin-bottom: 6px; }

/* ---------- internal audit score and audit schedule ---------- */
.audit-score { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; }
.as-score { display: flex; flex-direction: column; align-items: center; min-width: 120px; padding: 8px 14px; border-radius: 12px; background: var(--muted-bg); }
.as-score b { font-size: 34px; line-height: 1.1; color: var(--ink-strong); }
.as-score span { font-size: 12px; font-weight: 700; color: var(--muted); }
.as-score.ok { background: var(--ok-bg); }
.as-score.ok b { color: var(--ok); }
.as-score.warn { background: var(--warn-bg); }
.as-score.warn b { color: var(--warn); }
.as-score.bad { background: var(--bad-bg); }
.as-score.bad b { color: var(--bad); }
.as-counts { flex: 1; }
.audit-score > .hint { flex-basis: 100%; }
table.audit-sched td.el { font-weight: 600; min-width: 220px; }
table.audit-sched td.ev { color: var(--ink-3); font-size: 13px; max-width: 320px; }
table.audit-sched tr.due td.el a { color: var(--bad); }
.seg.res.wrap { flex-wrap: wrap; }
.seg-btn.ok.on { background: var(--ok-bg); color: var(--ok); }
.seg-btn.warn.on { background: var(--warn-bg); color: var(--warn); }
.seg-btn.bad.on { background: var(--bad-dot); color: #fff; }

/* ---------- charts (lab trends) ---------- */
.chart-card .card-head { flex-wrap: wrap; }
.chart { width: 100%; height: auto; display: block; font-family: inherit; }
.chart .gl { stroke: #e9ebf3; stroke-width: 1; }
.chart .axis { font-size: 11px; fill: var(--muted); }
.chart .val { font-size: 11px; font-weight: 800; }
.chart .val.bad { fill: var(--bad); }
.chart .bar.ok { fill: #9fb6d9; }
.chart .bar.bad { fill: var(--bad-dot); }
.chart .hit { fill: transparent; }
.chart .bar-g:hover .hit { fill: rgba(98, 70, 234, .06); }
.chart circle { cursor: pointer; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .sw.ok { background: #9fb6d9; }
.legend .sw.bad { background: var(--bad-dot); }
.lab-rows input, .lab-rows select { min-height: 38px; padding: 6px 10px; font-size: 13.5px; }
.lab-rows .wide-in { min-width: 220px; }
.num-in { width: 110px; }
input.missing { border-color: #f59eb0; background: #fff8fa; }

/* ---------- OSHA 300A / 300 ---------- */
.osha-form .o-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--ink-strong); padding-bottom: 10px; margin-bottom: 10px; }
.osha-form .o-title b { display: block; font-size: 20px; }
.osha-form .o-title span { color: var(--ink-3); }
.o-year { font-weight: 800; font-size: 16px; }
.o-note { font-size: 12.5px; color: var(--ink-3); }
.osha-form h3 { margin: 16px 0 8px; }
.o-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.o-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.o-grid.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.o-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.o-box b { font-size: 26px; color: var(--ink-strong); }
.o-box span { font-size: 12px; color: var(--ink-3); }
.o-box .o-col { font-weight: 800; color: var(--muted); }
.o-dl { display: grid; grid-template-columns: 300px 1fr; gap: 6px 14px; margin: 0; }
.o-dl dt { color: var(--ink-3); font-size: 13px; }
.o-dl dd { margin: 0; border-bottom: 1px solid var(--line); min-height: 22px; font-weight: 600; }
.o-sign { margin-top: 22px; font-weight: 600; }
table.o-log td { vertical-align: top; font-size: 12.5px; }

/* ---------- setup: permissions, template library, logos ---------- */
.perms-wrap { max-height: 70vh; }
table.perms th { font-size: 12px; white-space: normal; min-width: 104px; vertical-align: bottom; }
table.perms td.pg { font-weight: 600; white-space: nowrap; }
table.perms select { min-height: 34px; padding: 4px 8px; font-size: 13px; }
table.perms select.lvl-none { color: var(--muted); }
table.perms select.lvl-full { color: var(--ok); font-weight: 700; }
.lib-load { margin-bottom: 14px; }
table.lib input, table.lib select { min-height: 34px; padding: 5px 9px; font-size: 13.5px; }
table.lib td:nth-child(3) { min-width: 260px; }
.lib-files { white-space: nowrap; }
.lib-file { display: inline-flex; align-items: center; gap: 3px; margin-right: 6px; padding: 2px 7px; border-radius: 7px; font-size: 11.5px; font-weight: 800; text-decoration: none !important; }
.lib-file.pdf { background: var(--bad-bg); color: var(--bad); }
.lib-file.source { background: var(--accent-soft); color: var(--accent-strong); }
.logo-preview img { max-width: 260px; max-height: 110px; display: block; margin-bottom: 6px; }
.logo-cell { border: 0; background: none; padding: 0; cursor: pointer; }
.logo-cell img { height: 34px; max-width: 90px; object-fit: contain; display: block; }
.hd-logo.placeholder { opacity: .85; }

/* ---------- small screens ---------- */
@media (max-width: 1200px) {
  .menu.mega.wide { min-width: 560px; }
  .menu.mega.wide .mega-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hb-flow { grid-template-columns: 1fr; }
  .hb-flow-preview { position: static; max-height: none; }
  .hb-hz { grid-template-columns: 124px minmax(0, 1fr) 100px; }
  .dash-grid { grid-template-columns: 1fr; }
  .lists-layout { grid-template-columns: 1fr; }
  .fb-row { grid-template-columns: 26px 1fr 150px; }
  .fb-row .fb-opts, .fb-row .check, .fb-row .fb-btns { grid-column: 2 / -1; }
}
@media (max-width: 980px) {
  .hamburger { display: inline-flex; }
  .top-menus, .brand-name { display: none; }
  .mobile-only { display: flex !important; }
  /* the menu drops down from the header as a full-width panel */
  .mobile-nav { display: block; position: fixed; z-index: 40; left: 0; right: 0; top: var(--header-h); max-height: calc(100vh - var(--header-h)); overflow-y: auto;
    background: var(--panel); border-bottom: 1px solid var(--line); box-shadow: 0 18px 40px rgba(21, 23, 58, .18); padding: 8px 14px 18px;
    transform: translateY(-110%); visibility: hidden; transition: transform .2s, visibility .2s; }
  body.nav-open .mobile-nav { transform: none; visibility: visible; }
  .mobile-nav a { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 10px; color: var(--ink); font-weight: 600; text-decoration: none !important; }
  .mobile-nav a.on { background: var(--accent-soft); color: var(--accent-strong); }
  .mobile-nav .page-icon { width: 32px; height: 32px; border-radius: 9px; }
  .mn-label { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 14px 6px 4px; }
  body.nav-open .scrim { display: block; position: fixed; inset: var(--header-h) 0 0 0; z-index: 35; background: rgba(21, 23, 58, .35); }
  header.top { gap: 10px; padding: 0 14px; }
  main { padding: 20px 16px 60px; }
  h1 { font-size: 28px; }
  .rec-head { grid-template-columns: 1fr; }
  .rec-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; }
  .insp-row { flex-direction: column; align-items: stretch; }
  .company-pill { max-width: 170px; }
  .page-head h1 { font-size: 28px; }
  .page-icon { width: 38px; height: 38px; }
  .table-wrap { max-height: none; }
  .tm-scroll { max-height: none; }
  input[type=search], .toolbar > .search { max-width: none; width: 100%; }
  .hd { padding: 22px 16px; }
  .hd-sec { overflow-x: auto; }
  .hd-dl { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stats .stat.hero { grid-column: 1 / -1; }
  .stat { padding: 14px 16px; }
  .stat .st-value { font-size: 28px; }
  .filterbar .fb-field, .filterbar select, .filterbar .yearnav, .filterbar .seg { width: 100%; }
  .tile-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dash-tile { padding: 12px; gap: 10px; min-height: 0; }
  .dash-tile .page-icon { width: 38px; height: 38px; }
  .dt-text span { display: none; }
  .o-grid, .o-grid.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .o-dl { grid-template-columns: 1fr; }
  .rec-bottom { padding: 10px; }
  .fb-tools { margin-left: 0; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* Setup › Document Control (editable files): the row buttons wrap instead of running off the card */
table.doc-src td.act { white-space: normal; width: 1%; }
table.doc-src .act-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; min-width: 300px; }
table.doc-src .act-btns .btn { margin: 0; }
/* fields laid out side by side in a dialog line up at the top */
.dlg-bd .grid > .field + .field { margin-top: 0; }

/* ---------- document builder: pages like Word, spreadsheets like Excel ---------- */
.saved-ind { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--ok); }
.saved-ind::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok-dot); }
.saved-ind.busy { color: var(--ink-3); }
.saved-ind.busy::before { background: var(--warn-dot); }
.saved-ind.bad { color: var(--bad); }
.saved-ind.bad::before { background: var(--bad-dot); }
.bd-head .rec-title .page-icon { width: 40px; height: 40px; border-radius: 12px; flex: none; }
.bd-head .rec-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bd-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec-actions .bd-actions { margin-left: 10px; }
.bd-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.bd-kind { width: 30px; height: 30px; border-radius: 9px; }
.dot-warn { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn-dot); margin-left: 2px; }
.bd-toolbar { position: sticky; top: var(--header-h); z-index: 6; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 6px 8px; margin-bottom: 14px;
  background: rgba(255, 255, 255, .97); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 18px rgba(21, 23, 58, .06); }
.tb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 34px; height: 34px; padding: 0 7px; border: 1px solid transparent; border-radius: 9px;
  background: none; color: var(--ink-2); cursor: pointer; font-size: 13px; font-weight: 600; }
.tb-btn:hover { background: var(--muted-bg); color: var(--ink-strong); }
.tb-btn.on { background: var(--accent-soft); color: var(--accent-strong); border-color: #d9d1fb; }
.tb-btn.wide { padding: 0 9px; }
.tb-glyph { font-size: 16px; font-family: Georgia, 'Times New Roman', serif; line-height: 1; }
.tb-glyph.it { font-style: italic; font-weight: 600; }
.tb-glyph.un { text-decoration: underline; font-weight: 600; }
.tb-glyph.st { text-decoration: line-through; font-weight: 600; }
.tb-glyph.small { font-family: inherit; font-size: 12.5px; font-weight: 700; }
.tb-sep { width: 1px; height: 22px; background: var(--line); margin: 0 5px; }
.tb-sel { width: auto; min-height: 0; height: 34px; padding: 0 8px; border-radius: 9px; font-size: 13px; background: var(--panel); border-color: var(--field-line); }
.tb-sel.small { width: 64px; }
.tb-menu { min-width: 250px; }
.tb-menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 4px 0; }
.tb-menu button { padding: 8px 12px; font-size: 13.5px; }
.tb-check { margin-left: 8px !important; }
.swatches { display: grid; grid-template-columns: repeat(6, 28px); gap: 6px; padding: 4px; }
.swatches .swatch, .menu .swatches .swatch { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; border: 1px solid #c9cde0; cursor: pointer; padding: 0; color: var(--muted); }
.menu .swatches .swatch.none { background: #fff; }
.swatch:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.swatch.none { background: #fff; font-size: 13px; }
.bd-desk { background: #e9ebf3; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 16px 40px; overflow-x: auto; margin-bottom: 14px; }
.bd-desk.sheet { padding: 14px 16px; background: var(--panel-2); }
.bd-paper { position: relative; display: flex; flex-direction: column; width: 8.5in; min-height: 11in; box-sizing: border-box; margin: 0 auto; padding: 0.45in 0.75in 0.4in; background: #fff;
  box-shadow: 0 2px 4px rgba(21, 23, 58, .08), 0 12px 32px rgba(21, 23, 58, .10); border-radius: 3px; }
.bd-paper > .bd-edit { flex: 1; }
/* the fixed footer sits at the foot of the page */
.bd-ftr-wrap { margin: 22px 0 0; cursor: pointer; border-radius: 4px; user-select: none; }
.bd-ftr-wrap:hover, .bd-hdr-wrap:hover { outline: 2px dashed #c7bdfa; outline-offset: 4px; }
.bd-ftr-wrap.sheet { max-width: 900px; margin: 0 auto; }
.bd-desk.sheet.foot { margin-top: 4px; }
.bd-hdr-wrap { user-select: none; }
.bd-paper.landscape { width: 11in; min-height: 8.5in; }
.bd-hdr-wrap { margin: 0 0 22px; cursor: pointer; border-radius: 4px; }
.bd-hdr-wrap:hover { outline: 2px dashed #c7bdfa; outline-offset: 4px; }
.bd-hdr-wrap.sheet { max-width: 900px; margin: 0 auto; }
.bd-edit { min-height: 7in; outline: none; caret-color: var(--accent); }
.bd-edit:empty::before { content: "Start typing here…"; color: #a0a5bf; }
.bd-edit .bd-table td { min-width: 20px; }
.bd-edit .bd-table td:focus-within { box-shadow: inset 0 0 0 2px #c7bdfa; }
.bd-edit .bd-pb { height: 22px; margin: 10px 0; border-top: 2px dashed #b8bdd6; position: relative; user-select: none; }
.bd-edit .bd-pb::after { content: "Page break"; position: absolute; top: -11px; left: 50%; transform: translateX(-50%); padding: 0 10px; background: #fff; color: #8a90b0;
  font: 700 11px 'Plus Jakarta Sans', system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.bd-edit img.bd-img { cursor: pointer; }
.bd-edit img.picked { outline: 3px solid var(--accent); outline-offset: 2px; }
.bd-imgbar { position: absolute; z-index: 7; display: flex; align-items: center; gap: 4px; padding: 5px 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 28px rgba(21, 23, 58, .16); }
.bd-imgbar .hint { margin-right: 4px; font-size: 12px; white-space: nowrap; }
/* spreadsheet */
.ss-fxrow { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ss-name { width: 110px; min-height: 0; height: 36px; padding: 0 10px; font-weight: 700; font-size: 13px; background: var(--panel-2); text-align: center; }
.ss-fxlabel { font: italic 700 14px Georgia, serif; color: var(--muted); }
.ss-fx { flex: 1; min-height: 0; height: 36px; padding: 0 12px; font-size: 14px; background: #fff; font-family: Calibri, 'Segoe UI', Arial, sans-serif; }
.ss-wrap { position: relative; overflow: auto; max-height: calc(100vh - 300px); min-height: 320px; background: #fff; border: 1px solid var(--line); border-radius: 12px; outline: none; }
.ss-wrap:focus-visible { box-shadow: 0 0 0 3px rgba(98, 70, 234, .2); }
.ss-grid { border-collapse: collapse; table-layout: fixed; font-family: Calibri, Carlito, 'Segoe UI', Arial, sans-serif; font-size: 10pt; color: #16181d; user-select: none; }
.ss-grid th { position: sticky; top: 0; z-index: 2; height: 26px; background: #f3f4f9; border: 1px solid #dfe2ec; color: var(--ink-3); font: 600 12px 'Plus Jakarta Sans', system-ui, sans-serif; text-align: center; }
.ss-grid th.ss-rh { position: sticky; left: 0; z-index: 1; width: 46px; }
.ss-grid th.ss-corner { left: 0; z-index: 3; cursor: pointer; }
.ss-grid th.on { background: #e4defd; color: var(--accent-strong); }
.ss-grid .ss-ch { cursor: pointer; }
.ss-grid .ss-rh { cursor: pointer; }
.ss-resize { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 4; }
.ss-resize:hover { background: rgba(98, 70, 234, .35); }
.ss-grid td { height: 22px; padding: 1px 4px; overflow: hidden; white-space: nowrap; text-overflow: clip; vertical-align: bottom; cursor: cell; line-height: 1.3; }
.ss-grid td.sel { background-image: linear-gradient(rgba(98, 70, 234, .12), rgba(98, 70, 234, .12)); }
.ss-grid td.cur { box-shadow: inset 0 0 0 2px var(--accent); }
.ss-grid td.err { color: var(--bad); }
.ss-input { position: absolute; z-index: 5; min-height: 0; padding: 1px 4px; border: 2px solid var(--accent); border-radius: 0; background: #fff; font: 10pt Calibri, Carlito, 'Segoe UI', Arial, sans-serif;
  box-shadow: 0 4px 14px rgba(21, 23, 58, .18); outline: none; }
.ss-tabs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 6px 0 0; }
.ss-tab { height: 32px; padding: 0 14px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; background: var(--panel-2); font-weight: 600; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.ss-tab.on { background: #fff; color: var(--accent-strong); font-weight: 800; box-shadow: inset 0 3px 0 var(--accent); }
.ss-tab.add { font-size: 17px; padding: 0 12px; }
.ss-del { margin-left: 10px; font-size: 12.5px; }
.ss-hint { margin: 8px 0 14px; }
/* organization chart */
.oc-bar { margin-bottom: 14px; }
.oc-sheet { overflow: hidden; }
.oc-hdr { max-width: 980px; margin: 0 auto 18px; cursor: default; }
.bd-ftr-wrap.oc-hdr { margin: 22px auto 0; }
.oc-hdr:hover, .bd-ftr-wrap.oc-hdr:hover { outline: 0; }
.oc-scroll { overflow-x: auto; padding: 8px 4px 16px; }
.oc-canvas { min-height: 160px; border-radius: 14px; }
.oc-canvas.drop-top { background: #f6f4ff; outline: 2px dashed #c7bdfa; }
.oc-canvas .oc-node { cursor: grab; transition: box-shadow .12s, transform .12s; }
.oc-canvas .oc-node:hover { box-shadow: 0 6px 18px rgba(21, 23, 58, .12); }
.oc-canvas .oc-node.dragging { opacity: .45; }
.oc-canvas .oc-node.drop { outline: 3px solid var(--accent); outline-offset: 2px; transform: scale(1.04); }
.oc-roles-key .oc-key { margin-top: 10px; }
.oc-note { max-width: 760px; margin: 18px auto 0; }
.print-only { display: none; }
.oc-people-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.oc-people-head h2 { margin: 0 10px 0 0; }
.oc-people .list-foot .btn { margin-right: 2px; }
.oc-table td { vertical-align: middle; }
.oc-table tbody tr { cursor: default; }
.oc-table input, .oc-table select { min-height: 38px; padding: 7px 10px; font-size: 14px; }
.oc-table tr.flash td { background: #f1efff; transition: background .3s; }
.oc-namecell { display: flex; align-items: center; gap: 8px; min-width: 220px; }
.oc-mini { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; }
.oc-mini.av { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); font-size: 11px; font-weight: 800; }
.oc-rolecell { white-space: nowrap; }
.oc-rolecell .check { margin-right: 10px; }
.oc-pick { display: grid; gap: 4px; max-height: 50vh; overflow: auto; margin-top: 12px; }
.oc-pick-row { padding: 8px 10px; border-radius: 10px; }
.oc-pick-row:hover { background: var(--muted-bg); }
.oc-pick-row.done { opacity: .6; }
.oc-photo-big { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; }
@media (max-width: 980px) {
  .bd-paper { width: 100%; min-height: 0; padding: 18px 16px 30px; }
  .bd-paper.landscape { width: 100%; }
  .bd-desk { padding: 10px 6px 20px; }
  .bd-toolbar { position: static; }
  .rec-actions .bd-actions { margin-left: 0; }
  .bd-hdr-wrap { overflow-x: auto; }
  .bd-hdr-wrap .bd-hdr { min-width: 560px; }
}

/* ---------- print ---------- */
@media print {
  .bd-toolbar, .bd-tools, .bd-imgbar, .ss-toolbar, .ss-fxrow, .ss-tabs, .ss-hint, .oc-note { display: none !important; }
  .print-only { display: block; }
  .bd-desk { background: none; border: 0; padding: 0; }
  .bd-paper { box-shadow: none; width: auto; min-height: 0; padding: 0; }
  .oc-sheet { border: 0; padding: 0; }
  .oc-scroll { overflow: visible; }
  .oc-canvas .oc-node { box-shadow: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  header.top, .mobile-nav, .app-foot, .help-panel, .help-btn, .rec-bottom, .page-tools, .toolbar, .rec-actions, .btn, .icon-btn, .tabs, .filters, .filterbar, .list-foot .hint, .comment-add, .legend .hint, .scrim, .back, .chip-x, .chip-add, .no-print, .hb-top, .page-actions { display: none !important; }
  .o-break { break-before: page; }
  .osha-form { border: 0 !important; padding: 0 !important; }
  .tm-scroll { max-height: none; overflow: visible; }
  .tm-legend .hint { display: none; }
  body { background: #fff; font-size: 11.5px; }
  main { padding: 0; }
  .shell { display: block; }
  .card, .table-wrap, .tile, .stat, .tm { border-color: #ccc; break-inside: avoid; }
  .table-wrap, .tm { max-height: none; overflow: visible; }
  table.data th { position: static; }
  input, select, textarea { border: 0; padding: 0; min-height: 0; background: none; }
  textarea { resize: none; }
  a { color: inherit; }
  .hd { border: 0; box-shadow: none; padding: 0; max-width: none; font-size: 10.5pt; }
  .hd-break { break-before: page; }
  table.hd-table { font-size: 9pt; }
  table.hd-table tr { break-inside: avoid; }
  .hd h2 { break-after: avoid; }
  .hd-cover { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; break-after: page; border: 0; }
  @page { size: letter; margin: 0.6in 0.6in 0.7in; }
}

/* ---------- per-company features (Setup › Companies › Features) ---------- */
.feature-list { display: grid; gap: 10px; margin: 8px 0 20px; }
.feature-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; font-weight: 400; }
.feature-row:hover { border-color: var(--field-line); background: var(--panel-2); }
.feature-row input[type=checkbox] { margin-top: 2px; flex: none; }
.feature-text { display: grid; gap: 3px; min-width: 0; }
.feature-text b { color: var(--ink-strong); font-size: 14.5px; }
.feature-text .hint { font-size: 13px; }
.feature-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.feature-tag { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #f1f2f7; color: var(--muted); }
.feature-tag.custom { background: var(--accent-soft); color: var(--accent-strong); }
.feature-tag[hidden] { display: none; }
.empty-note { padding: 16px; border: 1.5px dashed #a9b0cc; border-radius: var(--radius-sm); color: var(--ink-2); text-align: center; }
.btn .count-badge { display: inline-block; min-width: 18px; height: 18px; padding: 0 6px; margin-left: 6px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-strong); font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }
