:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #172841;
  background: #f3f6fb;
  --navy: #142746;
  --blue: #2057ae;
  --line: #dce4ef;
  --muted: #53647d;
  --soft: #f4f7fb;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #709ced; outline-offset: 3px; }
a { color: #174784; }
h1, h2, h3, p { margin: 0 0 .65rem; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.65rem, 4vw, 2.25rem); letter-spacing: -.035em; line-height: 1.18; }
h2 { font-size: 1.16rem; }
h3 { font-size: 1rem; }
p { line-height: 1.5; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.topbar { background: var(--navy); color: white; }
.shell { max-width: 1280px; margin-inline: auto; padding-inline: 30px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 1.1rem; font-weight: 760; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: #315485; font-size: 1.3rem; }
#account-email { color: #dce8fa; font-size: .9rem; overflow-wrap: anywhere; }
main.shell { padding-block: 26px 42px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.scope-bar, .page-top, .toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.scope-bar { margin-bottom: 26px; }
#scope:empty { display: none; }
.scope-label { color: var(--muted); font-size: .88rem; font-weight: 700; }
.scope-label select { max-width: min(260px, 65vw); min-height: 40px; }
.page-top > div > p, .page-top > h2 { margin-bottom: 0; }
.panel { background: white; border: 1px solid var(--line); border-radius: 15px; }
.login { max-width: 450px; margin: 40px auto; padding: 26px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; max-width: 100%; padding: 8px 13px; border: 1px solid #cfd9e8; border-radius: 9px; background: white; color: var(--navy); font-weight: 680; text-decoration: none; text-align: center; }
.primary { background: var(--blue); border-color: var(--blue); color: white; }
.danger { color: #962b24; background: #fff8f6; border-color: #e8c6bd; }
.ghost { background: transparent; border-color: #7185a4; color: white; }
.btn[aria-pressed="true"], .btn[aria-current="page"], .btn[aria-selected="true"] { background: #e8f0ff; color: #173e7e; border-color: #a8bce6; }
.wide { width: 100%; }
.field { display: block; margin: 12px 0; font-weight: 650; }
input:not([type="checkbox"]), select, textarea { padding: 8px 10px; border: 1px solid #aebed0; border-radius: 8px; min-height: 42px; color: inherit; background: white; }
.field input:not([type="checkbox"]), .field select, .field textarea { display: block; width: 100%; margin-top: 5px; }
textarea { resize: vertical; min-height: 76px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); flex: none; margin: 0; }
.check { font-weight: 650; }
.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.stat { padding: 14px 16px; }
.stat span { display: block; color: var(--muted); font-size: .83rem; }
.stat strong { display: block; margin-top: 5px; overflow-wrap: anywhere; }
.queue { padding: 15px; }
.source-fetch { padding: 15px; margin-bottom: 15px; }
.source-fetch h2 { margin: 0; }
.table-scroll { overflow-x: auto; }
.table-scroll table { width: 100%; border-collapse: collapse; text-align: left; }
.table-scroll caption { padding: 8px; font-weight: 700; text-align: left; }
.table-scroll :is(th, td) { padding: 8px; border-bottom: 1px solid var(--line); }
.filters { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.filters .btn { font-size: .88rem; }
.toolbar { padding: 12px 2px; }
.record-grid { display: grid; grid-template-columns: 24px minmax(100px, 1fr) minmax(95px, 1fr) minmax(90px, .75fr) minmax(132px, 1.2fr) 84px; align-items: center; gap: 12px; padding: 9px 10px; }
.table-head { border-radius: 7px; color: var(--muted); background: var(--soft); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .045em; }
.record { min-height: 62px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.record:first-child { border-top: 0; }
.record-meta { display: block; color: var(--muted); font-size: .8rem; margin-top: 3px; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.pill { display: inline-flex; padding: 4px 8px; border-radius: 15px; font-size: .77rem; font-weight: 700; background: #edf2f8; color: #344860; }
.pill.ok { background: #e2f5eb; color: #175d42; }
.pill.watch { background: #fff0cc; color: #624404; }
.pill.bad { background: #ffebe7; color: #8a2c23; }
.feedback, .notice { padding: 10px 13px; border-radius: 9px; background: #e8f0ff; color: #174877; }
.feedback:empty, .dialog-error:empty, #job-note:empty { display: none; }
.feedback.error, .dialog-error { color: #8a2c23; }
.feedback.error { background: #ffebe7; }
.notice { background: #fff5de; color: #634608; }
.empty { padding: 16px 3px; color: var(--muted); margin: 0; }
.more { margin-top: 12px; }
.detail-summary { margin: 16px 0; }
.detail-summary .row { margin-top: 10px; }
.detail-summary .actions { margin-top: 14px; }
.mobile-tabs { display: none; }
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; touch-action: pan-y; }
.proof { min-width: 0; padding: 14px; background: #eaf0f9; border: 1px solid var(--line); border-radius: 12px; }
.proof p { margin-bottom: 8px; }
.proof .field { margin: 0 0 10px; }
.proof-tools { margin-top: 9px; }
.preview { background: white; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.preview:empty { display: none; }
.preview img { display: block; max-width: 100%; height: auto; max-height: 580px; object-fit: contain; margin: auto; }
.preview iframe { display: block; width: 100%; height: clamp(380px, 55vh, 620px); border: 0; }
.invoice-xml { padding: 12px; overflow-wrap: anywhere; }
.invoice-xml dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 12px; }
.invoice-xml dt { font-weight: 600; }
.invoice-xml dd { margin: 0; }
.invoice-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; }
.jobs-panel, .customer-panel { padding: 15px; margin-top: 15px; }
.jobs, .approval-item { padding: 0; margin: 0; list-style: none; }
.job, .customer { padding: 11px 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 9px; overflow-wrap: anywhere; }
.job + .job, .customer + .customer { border-top: 1px solid var(--line); }
.job-description, .customer-description { flex: 1 1 200px; min-width: 0; }
.search input { min-width: 0; width: min(310px, 100%); flex: 0 1 310px; }
dialog { width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 24px); border: 1px solid var(--line); border-radius: 14px; padding: 19px; color: inherit; }
dialog::backdrop { background: #142746a0; }
.approval-item { margin: 10px 0; border: 1px solid var(--line); border-radius: 9px; padding: 10px; min-width: 0; overflow-wrap: anywhere; }
.approval-item label { margin-bottom: 8px; }
.actions { justify-content: flex-end; }
.zoom-dialog { width: min(1000px, calc(100% - 24px)); }
.zoom-tools { margin: 9px 0; }
.zoom-content { max-height: 70dvh; overflow: auto; background: var(--soft); }
.zoom-content img { display: block; max-width: none; height: auto; min-width: 100%; }
.zoom-content img[data-zoom="1"] { width: 100%; }
.zoom-content img[data-zoom="2"] { width: 150%; }
.zoom-content img[data-zoom="3"] { width: 200%; }
.zoom-content img[data-zoom="4"] { width: 300%; }
@media (max-width: 720px) {
  .shell { padding-inline: 12px; }
  .bar { min-height: 60px; }
  .brand { font-size: 1rem; gap: 7px; }
  .brand-mark { width: 30px; height: 30px; }
  #account-email { display: none; }
  main.shell { padding-top: 15px; }
  .scope-bar { gap: 10px; margin-bottom: 19px; }
  .login { margin-top: 20px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 13px 0; }
  .stat { padding: 9px; font-size: .85rem; }
  .stat:last-child { grid-column: 1 / -1; }
  .queue { padding: 10px; }
  .filters { gap: 6px; }
  .filters .btn { padding-inline: 8px; }
  .toolbar { font-size: .88rem; }
  .table-head { display: none; }
  .record-grid { grid-template-columns: 20px minmax(0, 1fr) auto; padding: 9px 0; gap: 5px 8px; }
  .record .person { grid-column: 2 / -1; grid-row: 2; font-size: .83rem; color: var(--muted); }
  .record .amount { grid-column: 3; grid-row: 1; text-align: right; }
  .record .state { grid-column: 2; grid-row: 3; gap: 4px; }
  .record .open { grid-column: 3; grid-row: 3; justify-self: end; }
  .record .open .btn { padding-inline: 8px; }
  .mobile-tabs { display: flex; margin-bottom: 9px; }
  .compare { display: block; }
  .proof { padding: 9px; }
  .proof[data-mobile-inactive] { display: none; }
  .preview iframe { height: 390px; }
}
