:root {
  color-scheme: light;
  --ink: #182236;
  --muted: #52627a;
  --paper: #fff;
  --canvas: #f3f5f8;
  --border: #dce3ec;
  --nav: #142034;
  --nav-text: #d5dfed;
  --accent: #ad4300;
  --accent-soft: #fff0e5;
  --focus: #1b72bd;
  --good: #14634d;
  --good-soft: #e3f4eb;
  --warn: #77500b;
  --warn-soft: #fff0cf;
  --bad: #a12c28;
  --bad-soft: #fdeceb;
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
a { color: var(--accent); }
button, input, select { font: inherit; }
button { cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, .table-scroll:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.65rem, 3.1vw, 2.16rem); line-height: 1.14; letter-spacing: -.04em; margin-bottom: .36rem; }
h2 { font-size: 1.13rem; line-height: 1.27; margin-bottom: .25rem; }
h3 { font-size: 1rem; margin-bottom: .65rem; }
strong, b { font-weight: 680; }
small { display: block; color: var(--muted); font-size: .79rem; }
.skip { position: fixed; left: .8rem; top: -5rem; z-index: 5; background: white; padding: .5rem; }
.skip:focus { top: .8rem; }
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--nav); color: white; min-height: 100vh; height: 100dvh; position: sticky; top: 0; display: flex; flex-direction: column; gap: 1.4rem; padding: 1.4rem 1rem; overflow: auto; }
.brand { display: flex; align-items: center; gap: .7rem; line-height: 1.2; }
.brand strong { font-size: 1.08rem; letter-spacing: .015em; }
.brand small { margin-top: .24rem; color: inherit; opacity: .82; font-size: .73rem; }
.brand-mark { display: grid; place-items: center; width: 40px; flex: 0 0 40px; height: 40px; border-radius: 10px; background: #f4a768; color: #2d1e16; font-weight: 800; font-size: 1.24rem; }
.brand-link { text-decoration: none; color: white; }
.company-switch { display: flex; align-items: end; gap: .35rem; }
.company-switch .field { flex: 1; min-width: 0; }
.company-switch span { color: var(--nav-text); }
.company-switch select { background: #223249; border-color: #485975; color: white; }
.sidebar nav { display: flex; flex-direction: column; gap: .29rem; }
.sidebar nav a { color: var(--nav-text); text-decoration: none; min-height: 41px; padding: .56rem .6rem; border-radius: 7px; display: flex; align-items: center; gap: .67rem; font-size: .89rem; white-space: nowrap; }
.sidebar nav a:hover { background: #293b56; color: white; }
.sidebar nav a[aria-current] { color: #fff5eb; background: #384155; box-shadow: inset 3px 0 #f4a768; font-weight: 670; }
.sidebar nav b { width: 1.05rem; text-align: center; color: #f4a768; font-size: 1.05rem; }
.sidebar-footer { margin-top: auto; border-top: 1px solid #43536a; padding: .85rem .35rem 0; }
.sidebar-footer small { color: var(--nav-text); }
.account-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .5rem; font-size: .8rem; }
.account-actions a { color: var(--nav-text); padding: .2rem 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem clamp(1rem,3vw,2.55rem); background: var(--paper); border-bottom: 1px solid var(--border); }
.topbar strong { display: block; font-size: .92rem; }
.topbar span, .topbar time { color: var(--muted); font-size: .8rem; }
.content { max-width: 1580px; margin: 0 auto; padding: 1.75rem clamp(1rem,3vw,2.55rem) 3rem; }
.page-heading, .section-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1.35rem; margin-bottom: 1.2rem; }
.page-heading p, .section-heading p { margin: 0; color: var(--muted); max-width: 75ch; }
.section-heading p { font-size: .88rem; }
.heading-actions, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.panel, .stat { min-width: 0; padding: 1.18rem; background: var(--paper); border: 1px solid var(--border); border-radius: 11px; box-shadow: 0 2px 4px #17243a05; }
.panel + .panel, .stack-gap { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(2,minmax(0,1fr)); }
.grid > .panel { margin: 0; }
.overview { grid-template-columns: 1.45fr 1fr; }
.stats { display: grid; grid-template-columns: repeat(auto-fit,minmax(155px,1fr)); gap: .85rem; margin-bottom: 1rem; }
.stat { display: flex; flex-direction: column; min-height: 104px; }
.stat span { color: var(--muted); font-size: .85rem; font-weight: 630; }
.stat strong { margin-top: .16rem; font-size: clamp(1.15rem,2.4vw,1.75rem); letter-spacing: -.035em; overflow-wrap: anywhere; }
.stat small { margin-top: .14rem; }
.quick-list { display: grid; gap: .46rem; }
.quick-list a { text-decoration: none; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 7px; }
.quick-list a:hover { background: var(--accent-soft); }
.field { display: grid; gap: .3rem; min-width: 0; align-content: start; }
.field span { color: var(--muted); font-size: .81rem; font-weight: 640; }
.field input, .field select { height: 40px; width: 100%; min-width: 0; border: 1px solid #aab7c8; border-radius: 6px; padding: .44rem .53rem; color: var(--ink); background: white; }
.field input[type=file] { height: auto; }
.field input[readonly] { background: var(--canvas); }
.check { display: flex; gap: .45rem; align-items: center; font-size: .88rem; }
.check input { width: 1rem; height: 1rem; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(165px,1fr)); gap: .8rem; align-items: end; }
.stack { display: grid; gap: .8rem; }
.form-footer { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.filters { display: flex; flex-wrap: wrap; gap: .65rem; align-items: end; margin-bottom: .9rem; }
.filters .field { flex: 1 0 130px; max-width: 300px; }
.button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 7px; min-height: 36px; padding: .38rem .8rem; white-space: nowrap; font-weight: 660; font-size: .84rem; line-height: 1.2; text-decoration: none; }
.button.primary { background: var(--accent); color: white; }
.button.primary:hover { background: #8c3600; }
.button.secondary { border-color: #b9c4d1; background: white; color: var(--ink); }
.button.secondary:hover { background: #eef2f7; }
.button.link { padding-inline: .25rem; color: var(--accent); background: transparent; }
.button.danger { border-color: #d6a7a5; color: var(--bad); background: white; }
.button.sidebar-button { color: white; border-color: #61728a; background: #263750; }
.button.text-button { min-height: 0; padding: .15rem 0; background: none; color: var(--nav-text); text-decoration: underline; font-weight: 450; font-size: inherit; }
.chip { display: inline-flex; padding: .17rem .54rem; font-size: .76rem; border-radius: 999px; font-weight: 650; white-space: nowrap; }
.chip.neutral { color: #3b4c63; background: #eaf0f6; }
.chip.good, .success { color: var(--good); background: var(--good-soft); }
.chip.warn { color: var(--warn); background: var(--warn-soft); }
.chip.bad, .error { color: var(--bad); background: var(--bad-soft); }
.notice { border-radius: 7px; padding: .7rem .85rem; margin: 0 0 1rem; overflow-wrap: anywhere; }
.empty { margin: 0; background: var(--canvas); border-radius: 7px; padding: 1rem; color: var(--muted); }
.table-scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; font-size: .86rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .63rem .68rem; vertical-align: middle; border-bottom: 1px solid var(--border); }
th { color: #40536c; background: var(--canvas); font-size: .75rem; white-space: nowrap; }
td { overflow-wrap: anywhere; }
td > small { margin-top: .12rem; }
td:first-child { min-width: 96px; }
tr:last-child td { border-bottom: 0; }
details { margin: .65rem 0; }
summary { color: var(--accent); cursor: pointer; font-weight: 640; font-size: .88rem; }
details > :not(summary) { margin-top: .7rem; }
.help { margin: .5rem 0; color: var(--muted); font-size: .83rem; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--nav); }
.auth-card { width: min(100%,420px); border-radius: 13px; background: white; padding: 1.65rem; box-shadow: 0 9px 30px #0004; }
.auth-card .brand { margin-bottom: 1.45rem; }
.auth-card p { color: var(--muted); }
.auth-card form + form { margin-top: .9rem; }
.slip { margin: 1.4rem auto; padding: 2rem; max-width: 760px; background: white; border: 1px solid var(--border); border-radius: 10px; }
.slip-meta { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; padding: .8rem 0; margin-bottom: .8rem; border-block: 1px solid var(--border); }
.slip-meta p { margin: 0; }
.slip .strong-row td { font-weight: 720; background: var(--good-soft); color: var(--good); }
.slip-controls { display: flex; gap: .65rem; flex-wrap: wrap; }
.audit-details { white-space: pre-wrap; max-width: 620px; word-break: break-word; }
@media (max-width: 1050px) {
  .overview { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 760px) {
  .app { display: block; }
  .sidebar { position: static; height: auto; min-height: 0; gap: .65rem; padding: .8rem 1rem; display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .sidebar nav { grid-column: 1/-1; flex-direction: row; overflow: auto; padding-bottom: .25rem; }
  .sidebar nav a { gap: .37rem; padding: .5rem .55rem; }
  .sidebar nav a[aria-current] { box-shadow: inset 0 -3px #f4a768; }
  .sidebar-footer { grid-column: 1/-1; padding: .42rem .35rem 0; display: flex; gap: .42rem .6rem; align-items: center; flex-wrap: wrap; font-size: .83rem; }
  .account-actions { margin: 0 0 0 auto; }
  .topbar { padding: .55rem 1rem; }
  .topbar time { display: none; }
  .content { padding: 1.15rem .85rem 2rem; }
  .grid { grid-template-columns: minmax(0,1fr); }
  .slip { margin: .7rem; padding: .95rem; }
}
@media (max-width: 385px) {
  .stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stat { padding: .72rem; }
  .form-grid { grid-template-columns: minmax(0,1fr); }
}
@media print {
  @page { margin: 13mm; }
  body { background: white; }
  .slip { border: 0; border-radius: 0; padding: 0; margin: 0; max-width: none; }
  .slip-controls, .notice, .no-print { display: none !important; }
  .table-scroll { overflow: visible; }
  tr { break-inside: avoid; }
  .slip th, .slip td { padding: .38rem .5rem; }
}
