/* FORBOZE ERP Enterprise | Design system
   Corporate premium: deep navy, white, graphite grays and a single restrained accent.
   Light and dark themes through tokens. WCAG 2.2 AA contrast targets. */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f7;
  --border: #dbe2ec;
  --border-strong: #c3cddb;
  --text: #0c1a2e;
  --text-2: #3f4f66;
  --muted: #627189;
  --navy: #0b1f3a;
  --navy-2: #13305a;
  --side-bg: #08162b;
  --side-text: #c7d2e3;
  --side-muted: #7f90aa;
  --side-active: #ffffff;
  --side-hover: rgba(255, 255, 255, .06);
  --side-active-bg: rgba(255, 255, 255, .10);
  --accent: #1d56c9;
  --accent-hover: #1847a8;
  --accent-soft: #e8effc;
  --gold: #b48a2c;
  --btn-primary: #0b1f3a;
  --btn-primary-hover: #13305a;
  --btn-primary-text: #ffffff;
  --green: #17683f; --green-bg: #e3f3ea;
  --amber: #7d5300; --amber-bg: #fcf0d6;
  --red: #a6261b; --red-bg: #fce7e5;
  --blue: #1a4fb8; --blue-bg: #e6edfb;
  --gray: #475467; --gray-bg: #edf0f4;
  --focus: 0 0 0 3px rgba(29, 86, 201, .38);
  --shadow-sm: 0 1px 2px rgba(12, 26, 46, .06);
  --shadow: 0 1px 3px rgba(12, 26, 46, .07), 0 6px 18px rgba(12, 26, 46, .05);
  --shadow-lg: 0 18px 50px rgba(8, 22, 43, .22);
  --radius: 10px;
  --radius-sm: 7px;
  --side-w: 256px;
  --side-w-collapsed: 72px;
  --top-h: 60px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #08111f;
  --surface: #0f1a2c;
  --surface-2: #0c1626;
  --surface-3: #15233a;
  --border: #1f2e47;
  --border-strong: #2c3e5c;
  --text: #e8eef7;
  --text-2: #b9c5d8;
  --muted: #8796ae;
  --side-bg: #050c18;
  --accent: #6b9bf5;
  --accent-hover: #8db2f8;
  --accent-soft: rgba(107, 155, 245, .14);
  --btn-primary: #3c6fdc;
  --btn-primary-hover: #4d7fe8;
  --green: #6fd3a0; --green-bg: rgba(52, 168, 107, .16);
  --amber: #f2c46b; --amber-bg: rgba(226, 165, 46, .15);
  --red: #ff9d94; --red-bg: rgba(225, 77, 63, .17);
  --blue: #9dbcf9; --blue-bg: rgba(84, 137, 240, .17);
  --gray: #b3bfd1; --gray-bg: rgba(148, 163, 184, .14);
  --focus: 0 0 0 3px rgba(107, 155, 245, .45);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #08111f; --surface: #0f1a2c; --surface-2: #0c1626; --surface-3: #15233a;
    --border: #1f2e47; --border-strong: #2c3e5c; --text: #e8eef7; --text-2: #b9c5d8; --muted: #8796ae;
    --side-bg: #050c18; --accent: #6b9bf5; --accent-hover: #8db2f8; --accent-soft: rgba(107, 155, 245, .14);
    --btn-primary: #3c6fdc; --btn-primary-hover: #4d7fe8;
    --green: #6fd3a0; --green-bg: rgba(52, 168, 107, .16); --amber: #f2c46b; --amber-bg: rgba(226, 165, 46, .15);
    --red: #ff9d94; --red-bg: rgba(225, 77, 63, .17); --blue: #9dbcf9; --blue-bg: rgba(84, 137, 240, .17);
    --gray: #b3bfd1; --gray-bg: rgba(148, 163, 184, .14); --focus: 0 0 0 3px rgba(107, 155, 245, .45);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 8px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -.01em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.strong { font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.skip { position: absolute; left: 12px; top: -48px; background: var(--surface); padding: 8px 14px; border-radius: 6px; z-index: 100; box-shadow: var(--shadow); }
.skip:focus { top: 12px; }
[hidden] { display: none !important; }

/* App shell */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar-collapsed .app { grid-template-columns: var(--side-w-collapsed) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; scrollbar-width: thin; scrollbar-color: #24344f transparent; z-index: 40; }
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 16px; border-bottom: 1px solid rgba(255, 255, 255, .06); min-height: var(--top-h); }
.brand-mark { width: 36px; height: 36px; flex: none; border-radius: 9px; background: linear-gradient(145deg, #1a3a6b, #0b1f3a); border: 1px solid rgba(255, 255, 255, .14); display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 13px; letter-spacing: .02em; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand-text { min-width: 0; }
.brand-text strong { display: block; color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { display: block; font-size: 11px; color: var(--side-muted); letter-spacing: .08em; text-transform: uppercase; }
.nav { padding: 10px 10px 24px; flex: 1; }
.nav__section { margin-top: 10px; }
.nav__title { display: flex; width: 100%; align-items: center; justify-content: space-between; background: none; border: 0; color: var(--side-muted); font: inherit; font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; padding: 8px 10px 6px; cursor: pointer; border-radius: 6px; }
.nav__title:hover { color: var(--side-text); }
.btn.search-toggle { display: none; }
.nav__section.is-closed .nav__list { display: none; }
.nav__list { list-style: none; margin: 0; padding: 0; }
.nav__link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--side-text); font-size: 13.5px; font-weight: 500; text-decoration: none; position: relative; }
.nav__link:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.nav__link.is-active { background: var(--side-active-bg); color: var(--side-active); }
.nav__link.is-active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav__abbr { display: none; }
.nav__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__foot { padding: 14px 18px; font-size: 11px; color: var(--side-muted); border-top: 1px solid rgba(255, 255, 255, .06); }
.sidebar-collapsed .brand-text, .sidebar-collapsed .nav__title, .sidebar-collapsed .nav__label, .sidebar-collapsed .sidebar__foot { display: none; }
.sidebar-collapsed .sidebar__brand { justify-content: center; padding: 12px; }
.sidebar-collapsed .nav__section.is-closed .nav__list { display: block; }
.sidebar-collapsed .nav__section { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .05); }
.sidebar-collapsed .nav__link { justify-content: center; padding: 8px 0; }
.sidebar-collapsed .nav__abbr { display: grid; place-items: center; width: 36px; height: 28px; border-radius: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--side-text); }
.sidebar-collapsed .nav__link.is-active .nav__abbr { color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 24px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(140%) blur(8px); border-bottom: 1px solid var(--border); }
.topbar__search { position: relative; flex: 1; max-width: 520px; }
.topbar__search input { width: 100%; height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; }
.topbar__search input:focus { background: var(--surface); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.quick-results { position: absolute; top: 42px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 420px; overflow: auto; padding: 6px; }
.quick-results a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 6px; color: var(--text); }
.quick-results a:hover, .quick-results a.is-focus { background: var(--surface-3); text-decoration: none; }
.quick-results .qr-type { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.quick-results .qr-group { font-size: 11px; font-weight: 600; color: var(--muted); padding: 8px 10px 4px; text-transform: uppercase; letter-spacing: .07em; }
.clock-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--green-bg); color: var(--green); white-space: nowrap; }
.clock-chip.is-off { background: var(--gray-bg); color: var(--gray); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; margin-left: 4px; }
:root[data-theme="dark"] .badge { color: #2a0a07; }
.badge.is-zero { background: var(--gray-bg); color: var(--gray); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--navy); color: #fff; font-size: 12px; font-weight: 600; flex: none; }
:root[data-theme="dark"] .avatar { background: #2a4a7f; }
.menu-wrap { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 999px; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: var(--surface-3); }
.usermenu__name { font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.dropdown a, .dropdown button.dropdown__item { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--text); font: inherit; background: none; border: 0; cursor: pointer; }
.dropdown a:hover, .dropdown button.dropdown__item:hover { background: var(--surface-3); text-decoration: none; }
.dropdown__head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown__head strong { display: block; }
.dropdown__sep { border-top: 1px solid var(--border); margin: 6px 0; }
.notif-panel { width: 380px; max-width: calc(100vw - 24px); padding: 0; }
.notif-panel__head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 420px; overflow: auto; }
.notif-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif-item:hover { background: var(--surface-2); text-decoration: none; }
.notif-item.is-unread { background: var(--accent-soft); }
.notif-item .prio { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.notif-item time { display: block; font-size: 12px; color: var(--muted); }
.notif-panel__foot { padding: 10px 14px; text-align: center; }

.page { padding: 24px 28px 48px; max-width: 1600px; width: 100%; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; list-style: none; padding: 0; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--border-strong); }
.crumbs a { color: var(--muted); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head__title { min-width: 0; }
.page-head__title .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.page-sub { color: var(--text-2); margin: 6px 0 0; max-width: 760px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.demo-banner { background: #7d5300; color: #fff; text-align: center; font-size: 12.5px; font-weight: 600; padding: 6px 12px; letter-spacing: .02em; }

/* Cards and grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; }
.card + .card { margin-top: 16px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card__head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid > .card + .card { margin-top: 0; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }
.section-gap { margin-top: 16px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.kpi { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; color: var(--text); box-shadow: var(--shadow-sm); position: relative; transition: border-color .15s, transform .15s; }
a.kpi:hover { border-color: var(--border-strong); text-decoration: none; transform: translateY(-1px); }
.kpi__label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi__value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi__meta { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.kpi--red { border-left: 3px solid var(--red); }
.kpi--amber { border-left: 3px solid #d39a2a; }
.kpi--green { border-left: 3px solid #2f9a63; }
.kpi--blue { border-left: 3px solid var(--accent); }
.chart-box { position: relative; height: 260px; }
.chart-box--sm { height: 200px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 550; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn--primary { background: var(--btn-primary); border-color: var(--btn-primary); color: var(--btn-primary-text); }
.btn--primary:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn--accent { color: #071022; }
.btn--danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.btn--danger:hover { background: var(--red-bg); }
.btn--success { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, var(--border)); }
.btn--success:hover { background: var(--green-bg); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--text); }
.btn--sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn--lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn.is-loading { opacity: .7; pointer-events: none; }
.inline-form { display: inline; margin: 0; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Pills */
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--gray-bg); color: var(--gray); }
.pill--green { background: var(--green-bg); color: var(--green); }
.pill--amber { background: var(--amber-bg); color: var(--amber); }
.pill--red { background: var(--red-bg); color: var(--red); }
.pill--blue { background: var(--blue-bg); color: var(--blue); }
.pill--navy { background: var(--navy); color: #fff; }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
.table th.num { text-align: right; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr.is-alert td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.table tr.is-warn td:first-child { box-shadow: inset 3px 0 0 #d39a2a; }
.table tfoot td { font-weight: 600; background: var(--surface-2); }
.table .actions { text-align: right; white-space: nowrap; }
.table--compact td { padding: 8px 12px; }
.table a.sort { color: inherit; display: inline-flex; gap: 4px; align-items: center; }
.sort-mark { font-size: 9px; }
.row-link { font-weight: 600; }
.cell-sub { display: block; font-size: 12px; color: var(--muted); }

/* Toolbar, filters, pagination */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.toolbar .field { margin: 0; }
.toolbar input[type="search"], .toolbar input[type="text"], .toolbar select, .toolbar input[type="date"] { height: 34px; }
.toolbar .grow { flex: 1 1 220px; min-width: 180px; }
.toolbar label { font-size: 11.5px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager__info { color: var(--muted); font-size: 12.5px; }
.pager__links { display: flex; gap: 6px; align-items: center; }
.pager__page { font-size: 12.5px; color: var(--text-2); padding: 0 6px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; grid-column: span 6; min-width: 0; }
.span-12 { grid-column: span 12; } .span-9 { grid-column: span 9; } .span-8 { grid-column: span 8; } .span-6 { grid-column: span 6; }
.span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; } .span-2 { grid-column: span 2; }
label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.req { color: var(--red); }
input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="number"], input[type="password"], input[type="date"], input[type="datetime-local"], input[type="time"], input[type="search"], input[type="file"], select, textarea {
  width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; transition: border-color .12s, box-shadow .12s;
}
input[type="file"] { padding: 6px; }
textarea { min-height: 76px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input[readonly] { background: var(--surface-2); color: var(--text-2); }
.has-error input, .has-error select, .has-error textarea, [aria-invalid="true"] { border-color: var(--red); }
.field-error { color: var(--red); font-size: 12.5px; margin: 0; font-weight: 500; }
.help { color: var(--muted); font-size: 12.5px; margin: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer; padding-top: 22px; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.form-section { padding: 18px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.form-section__title { font-size: 13px; font-weight: 600; margin-bottom: 12px; color: var(--text); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }

/* Line items editor */
.lines td { vertical-align: top; }
.lines input, .lines select { min-height: 34px; padding: 6px 9px; font-size: 13.5px; }
.lines .col-product { min-width: 240px; }
.lines .col-num { width: 130px; }
.totals { display: grid; grid-template-columns: auto 160px; gap: 6px 16px; justify-content: end; padding: 14px 18px; font-variant-numeric: tabular-nums; }
.totals dt { color: var(--muted); text-align: right; }
.totals dd { margin: 0; text-align: right; font-weight: 600; }
.totals .grand { font-size: 16px; color: var(--text); }

/* Key value, tabs, progress, alerts */
.kv { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.kv--1 { grid-template-columns: 1fr; }
.kv--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kv__row { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.kv dt { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 10px 12px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.tab__count { display: inline-grid; place-items: center; min-width: 20px; height: 18px; border-radius: 999px; background: var(--surface-3); font-size: 11px; padding: 0 6px; color: var(--text-2); }
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; min-width: 80px; }
.progress__bar { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.progress__bar--green { background: #2f9a63; }
.progress__bar--amber { background: #d39a2a; }
.alert { padding: 12px 14px; border-radius: 9px; border: 1px solid; margin-bottom: 14px; font-size: 13.5px; }
.alert--success { background: var(--green-bg); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.alert--warning { background: var(--amber-bg); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.alert--danger { background: var(--red-bg); color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.alert--info { background: var(--blue-bg); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 30%, transparent); }
.alert strong { color: inherit; }
.flash-stack { position: fixed; top: 72px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.flash-stack .alert { margin: 0; box-shadow: var(--shadow-lg); display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; background-color: var(--surface); }
.flash-stack .alert--success { background: color-mix(in srgb, var(--green-bg) 100%, var(--surface)); }
.flash-close { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; font-weight: 600; padding: 0 2px; }
.empty { text-align: center; padding: 44px 20px; }
.empty__title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.empty__text { color: var(--muted); max-width: 460px; margin: 0 auto 14px; }

/* Timeline (history) and audit diff */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline .t-head { font-weight: 600; }
.timeline .t-meta { color: var(--muted); font-size: 12.5px; }
.diff { width: 100%; border-collapse: collapse; font-size: 13px; }
.diff th, .diff td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.diff th { background: var(--surface-2); font-size: 12px; color: var(--muted); }
.diff .old { background: var(--red-bg); }
.diff .new { background: var(--green-bg); }
.hash { font-family: var(--mono); font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }

/* Permission matrix */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.matrix th:first-child { background: var(--surface-2); z-index: 2; }
.matrix input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }
.matrix select { min-height: 30px; padding: 3px 26px 3px 8px; font-size: 12px; width: auto; }
.matrix .na { color: var(--border-strong); }
.matrix .ovr-allow { background: var(--green-bg); }
.matrix .ovr-deny { background: var(--red-bg); }

/* Calendar */
.cal-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal-day { min-height: 118px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.is-other { background: var(--surface-2); }
.cal-day.is-other .cal-date { color: var(--muted); }
.cal-day.is-today .cal-date { background: var(--accent); color: #fff; }
.cal-date { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 999px; font-size: 12px; font-weight: 600; margin-bottom: 4px; padding: 0 5px; }
.cal-entry { display: block; font-size: 12px; line-height: 1.3; padding: 4px 6px; border-radius: 5px; margin-bottom: 3px; background: var(--blue-bg); color: var(--blue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid currentColor; }
.cal-entry:hover { text-decoration: none; filter: brightness(.97); }
.cal-entry--maintenance { background: var(--amber-bg); color: var(--amber); }
.cal-entry--task { background: var(--gray-bg); color: var(--gray); }
.cal-entry--late { background: var(--red-bg); color: var(--red); }
.cal-more { font-size: 11.5px; color: var(--muted); }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); overflow-x: auto; }
.cal-week .cal-day { min-height: 340px; }
.cal-week .cal-entry { white-space: normal; }

/* Briefing and modal */
dialog.modal { border: 0; padding: 0; border-radius: 14px; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(5, 12, 24, .55); }
.modal__head { padding: 18px 20px 10px; }
.modal__body { padding: 0 20px 16px; color: var(--text-2); }
.modal__foot { padding: 14px 20px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); background: var(--surface-2); }
.briefing-list { list-style: none; margin: 12px 0 0; padding: 0; }
.briefing-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.briefing-list li:last-child { border-bottom: 0; }
.briefing-sentence { font-size: 15px; color: var(--text); line-height: 1.55; }

/* Guest layout (login, installer, kiosk) */
.guest { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 520px); background: var(--surface); }
.guest__visual { position: relative; background: var(--side-bg); color: #fff; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 40px; }
.guest__visual img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.guest__visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5, 12, 24, .45) 0%, rgba(5, 12, 24, .15) 40%, rgba(5, 12, 24, .88) 100%); }
.guest__visual > * { position: relative; z-index: 1; }
.guest__claim { max-width: 520px; }
.guest__claim h2 { font-size: 30px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; margin-bottom: 10px; }
.guest__claim p { color: #cbd6e6; font-size: 15px; }
.guest__credit { font-size: 11px; color: #9fb0c8; }
.guest__panel { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 5vw, 64px); }
.guest__panel h1 { font-size: 24px; margin-bottom: 6px; }
.guest__panel .lead { color: var(--text-2); margin-bottom: 24px; }
.guest__panel form > * + * { margin-top: 14px; }
.guest__foot { margin-top: 28px; font-size: 12px; color: var(--muted); }
.guest-brand { display: flex; align-items: center; gap: 12px; }
.guest-brand strong { font-size: 15px; }
.guest-brand span:not(.brand-mark) { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #9fb0c8; }
.otp-input { font-family: var(--mono); font-size: 22px !important; letter-spacing: .4em; text-align: center; }
.qr { background: #fff; padding: 12px; border-radius: 10px; display: inline-block; border: 1px solid var(--border); }
.qr img, .qr canvas, .qr table { display: block; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; font-family: var(--mono); font-size: 14px; background: var(--surface-2); padding: 14px; border-radius: 8px; border: 1px solid var(--border); }
.kiosk { min-height: 100vh; display: grid; place-items: center; background: var(--side-bg); padding: 24px; }
.kiosk__panel { width: min(520px, 100%); background: var(--surface); border-radius: 16px; padding: 32px; box-shadow: var(--shadow-lg); }
.kiosk__time { font-size: 44px; font-weight: 650; text-align: center; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kiosk__date { text-align: center; color: var(--muted); margin-bottom: 20px; }
.kiosk__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kiosk__actions .btn { height: 52px; font-size: 15px; }
.big-status { text-align: center; padding: 18px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.big-status .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.big-status .value { font-size: 30px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* Utilities */
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; }
.list-plain li:last-child { border-bottom: 0; }
.list-plain.card__body { padding: 6px 18px; }
.list-plain li > span:first-child { min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--surface-3); font-size: 12.5px; }
.chip form { display: inline; }
.chip button { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.split { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.mt-0 { margin-top: 0 !important; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-16 { margin-bottom: 16px; }
.w-auto { width: auto !important; }
.text-red { color: var(--red); } .text-green { color: var(--green); } .text-amber { color: var(--amber); }
.legend-note { font-size: 12px; color: var(--muted); }

/* Print */
.diff tr.is-changed td:last-child { background: var(--amber-bg); }
.diff code { white-space: pre-wrap; font-family: var(--mono); }

.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.section-gap + .section-title, .section-title.section-gap { margin-top: 24px; }

/* Grid and flex children must be allowed to shrink below their content width (charts, long values) */
.grid > *, .stack > *, .kv dd { min-width: 0; }
.kv dd { overflow-wrap: anywhere; }
.chart-box canvas { max-width: 100%; }

h1 .mono, h2 .mono { font-size: .92em; letter-spacing: 0; }

/* Report hub cards and collapsible cards */
a.report-card { display: block; color: inherit; text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease; }
a.report-card:hover { border-color: var(--accent); text-decoration: none; }
a.report-card h2 { color: var(--text); }
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card[open] > summary { border-bottom: 1px solid var(--border); }
details.card:not([open]) > summary { border-bottom: 0; }

@media print {
  .sidebar, .topbar, .page-actions, .toolbar, .pager, .flash-stack, .no-print, .demo-banner { display: none !important; }
  .app { display: block; }
  body { background: #fff; color: #000; }
  .card { border: 0; box-shadow: none; }
  .page { padding: 0; }
}

/* Responsive */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .app, .sidebar-collapsed .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; visibility: hidden; }
  .sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-lg); visibility: visible; }
  .sidebar-collapsed .brand-text, .sidebar-collapsed .nav__title, .sidebar-collapsed .nav__label, .sidebar-collapsed .sidebar__foot { display: block; }
  .sidebar-collapsed .nav__link { justify-content: flex-start; padding: 7px 10px; }
  .sidebar-collapsed .nav__abbr { display: none; }
  .sidebar-collapsed .nav__title { display: flex; }
  .scrim { position: fixed; inset: 0; background: rgba(5, 12, 24, .5); z-index: 35; }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guest { grid-template-columns: 1fr; }
  .guest__visual { min-height: 220px; padding: 24px; }
  .guest__claim h2 { font-size: 22px; }
}
@media (max-width: 720px) {
  .topbar { padding: 0 12px; gap: 6px; }
  .topbar__search { display: none; }
  .btn.search-toggle { display: inline-flex; }
  .topbar__search.is-open { display: block; position: absolute; left: 12px; right: 12px; top: 12px; max-width: none; }
  .usermenu__name, .hide-sm { display: none !important; }
  .page { padding: 16px 16px 40px; }
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .field { grid-column: 1 / -1; }
  .kv, .kv--3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi__value { font-size: 22px; }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
  .card__body { padding: 14px; }
  .toolbar { padding: 12px 14px; }
  .toolbar > * { flex: 1 1 100%; }
  .cal-day { min-height: 74px; padding: 4px; }
  .cal-entry { font-size: 10.5px; padding: 2px 4px; }
  .flash-stack { right: 16px; left: 16px; width: auto; top: 68px; }
  .guest__panel { padding: 28px 20px; }
  h1 { font-size: 20px; }
  .totals { grid-template-columns: auto 120px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
