body { background: var(--sand-light); }
.boot { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--navy-900); color: var(--sky); font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.boot img { width: 180px; height: auto; }
.login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px 16px; background: var(--navy-900); }
.login-card { box-sizing: border-box; width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 28px 24px; display: grid; gap: 16px; box-shadow: var(--shadow); }
@media (min-width: 480px) { .login-card { padding: 36px; } }
.login-logo { width: 200px; max-width: 100%; height: auto; display: block; }
.login-card h1 { font-size: 26px; margin-top: 6px; }
.login-card .field input { font-size: 16px; padding: 13px 14px; min-height: 48px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 68px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: var(--navy-100); color: var(--navy-800); font: 600 12px var(--font-body); padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.pw-toggle:focus-visible { outline: 2px solid var(--terra); outline-offset: 1px; }
.login-card .btn-lg { min-height: 50px; font-size: 16px; }
.login-foot { font-size: 12.5px; color: var(--text-soft); margin: 0; }
.error-text:empty { display: none; }
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--navy-900); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden; }
.side-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 20px 20px 16px; border-bottom: 1px solid var(--line-dark); }
.side-brand img { height: 20px; width: auto; max-width: 100%; }
.side-brand span { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--sky); }
.side-nav { padding: 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #C9D4E6; text-decoration: none; font-size: 14px; font-weight: 500; }
.side-nav a:hover { background: var(--navy-800); color: #fff; }
.side-nav a.active { background: var(--navy-800); color: #fff; box-shadow: inset 3px 0 0 var(--terra); }
.side-nav .ic { width: 18px; text-align: center; color: var(--sky); font-size: 14px; }
.side-nav .pill { margin-left: auto; background: var(--terra); color: #fff; font-family: var(--font-mono); font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.side-nav .pill:empty { display: none; }
.side-sep { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--sky); padding: 16px 12px 6px; opacity: .8; }
.side-foot { margin-top: auto; padding: 16px 20px; border-top: 1px solid var(--line-dark); display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--sky); }
.linkish { background: none; border: 0; color: #fff; cursor: pointer; font-size: 13px; text-decoration: underline; padding: 0; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(250, 247, 242, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 12px 24px; display: flex; align-items: center; gap: 16px; }
.burger { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.scan { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.scan:focus-within { outline: 2px solid var(--terra); outline-offset: 1px; }
.scan input { border: 0; outline: 0; padding: 10px 0; flex: 1; font-size: 14px; letter-spacing: .06em; background: transparent; min-width: 0; }
.scan-ic { color: var(--text-soft); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.view { padding: 24px; display: grid; gap: 20px; align-content: start; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi .v { font-family: var(--font-display); font-size: 30px; font-weight: 800; line-height: 1; margin-top: 6px; color: var(--navy-900); }
.kpi .v.bad { color: var(--bad); }
.kpi .v.ok { color: var(--ok); }
.kpi .s { font-size: 12px; color: var(--text-soft); margin-top: 6px; }
.cols { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1100px) { .cols, .cols-3 { grid-template-columns: 1fr; } }
.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.counter { background: var(--navy-900); color: #fff; border-radius: 16px; padding: 18px 20px; display: grid; gap: 10px; }
.counter .eyebrow { color: var(--sky); }
.counter .tok { font-family: var(--font-display); font-size: 56px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.counter .tok.idle { color: var(--navy-700); }
.counter .who { font-weight: 600; font-size: 16px; }
.counter .what { color: var(--sky); font-size: 13px; }
.counter .btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.counter .btn-ghost { border-color: var(--line-dark); color: #fff; }
.counter .btn-ghost:hover { background: var(--navy-800); }
.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.flow li { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 10px; color: var(--text-soft); }
.flow li b { width: 24px; height: 24px; border-radius: 50%; background: var(--navy-100); color: var(--navy-800); font-family: var(--font-mono); font-size: 11px; font-weight: 500; display: grid; place-items: center; flex: none; }
.flow li.now { border-color: var(--terra); color: var(--text); box-shadow: 0 0 0 2px var(--terra-soft); }
.flow li.now b { background: var(--terra); color: #fff; }
.flow li.done { color: var(--text); }
.flow li.done b { background: var(--ok); color: #fff; }
.modal-card .flow { grid-template-columns: repeat(5, 1fr); gap: 4px; }
.modal-card .flow li { padding: 6px 8px; font-size: 11px; gap: 6px; }
.modal-card .flow li b { width: 18px; height: 18px; font-size: 9px; }
.counter .status { font-size: 13px; color: #fff; background: var(--navy-800); border: 1px solid var(--line-dark); border-radius: 10px; padding: 8px 10px; }
.counter .status.ok { background: #1F3D2A; border-color: #2F5A3C; }
.counter .status.warn { background: #4A2E12; border-color: #7A4A1A; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--text); }
.pill-btn.active { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.pill-btn .c { font-family: var(--font-mono); font-size: 11px; margin-left: 6px; opacity: .8; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.search { width: min(100%, 320px); }
.ref { font-family: var(--font-mono); font-weight: 500; letter-spacing: .04em; color: var(--navy-900); }
.overdue { color: var(--bad); font-weight: 600; }
.detail-head { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.detail-head .ref-big { font-family: var(--font-display); font-size: 34px; font-weight: 800; letter-spacing: .01em; color: var(--navy-900); }
.detail-head svg { height: 44px; width: 220px; display: block; }
.back { color: var(--text-soft); text-decoration: none; font-size: 13px; }
.back:hover { color: var(--terra-deep); }
.dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0; }
.dl dt { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-soft); }
.dl dd { margin: 2px 0 0; font-weight: 600; }
.stage-actions { display: grid; gap: 8px; }
.stage-actions .btn { justify-content: flex-start; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.timeline li:first-child { border-top: 0; }
.timeline .d { width: 12px; height: 12px; border-radius: 50%; background: var(--navy-800); margin-top: 5px; margin-left: 4px; }
.timeline .d.exception { background: #EF9F27; }
.timeline .d.terminal { background: var(--ok); }
.timeline .d.bad { background: var(--bad); }
.timeline .d.system { background: #B4B2A9; }
.timeline .t { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-soft); }
.timeline .n { color: var(--text-soft); font-size: 13px; }
.msg { border-top: 1px solid var(--line-soft); padding: 10px 0; font-size: 13.5px; }
.msg:first-child { border-top: 0; }
.msg .m { font-family: var(--font-mono); font-size: 11px; color: var(--text-soft); display: flex; gap: 10px; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 130px 1fr 36px; gap: 10px; align-items: center; font-size: 13px; }
.bar .track { height: 10px; background: var(--sand); border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--navy-800); border-radius: 999px; }
.bar .fill.docs_needed { background: #EF9F27; } .bar .fill.issued { background: var(--ok); } .bar .fill.rejected { background: var(--bad); } .bar .fill.processing { background: #BA7517; } .bar .fill.submitted { background: var(--info); }
.spark { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; height: 110px; padding-top: 10px; }
.spark .col { display: grid; gap: 2px; align-items: end; height: 100%; grid-template-rows: 1fr auto; }
.spark .stack { display: flex; gap: 2px; align-items: flex-end; height: 100%; }
.spark .b { flex: 1; border-radius: 3px 3px 0 0; min-height: 2px; }
.spark .b.a { background: var(--navy-800); } .spark .b.i { background: var(--ok); }
.spark .lab { font-family: var(--font-mono); font-size: 9px; color: var(--text-soft); text-align: center; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-soft); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); font-size: 14px; align-items: center; }
.list li:first-child { border-top: 0; }
.list a { color: inherit; text-decoration: none; }
.list a:hover .ref { color: var(--terra-deep); }
.modal { position: fixed; inset: 0; background: rgba(12, 18, 32, .55); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-card { background: #fff; border-radius: 18px; padding: 26px; width: min(100%, 520px); display: grid; gap: 14px; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal-card h2 { font-size: 22px; }
.modal-card .btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--navy-100); color: var(--navy-800); border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 13px; font-weight: 500; }
.chip.scan { background: #EEEDFE; color: #3C3489; }
.chip button { border: 0; background: rgba(0,0,0,.08); color: inherit; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 13px; line-height: 1; }
.chip .src { font-family: var(--font-mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; opacity: .7; }
.scan-tabs { display: flex; gap: 6px; }
.cam { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam .guide { position: absolute; left: 5%; right: 5%; bottom: 8%; height: 26%; border: 2px solid var(--terra); border-radius: 8px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; }
.cam .guide span { background: var(--terra); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 6px 6px 0 0; transform: translateY(2px); }
.scan-res { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; background: var(--sand-light); }
.scan-res.ok { border-color: var(--ok); }
.scan-res.warn { border-color: #EF9F27; }
.scan-meta { font-family: var(--font-mono); font-size: 12px; color: var(--text-soft); }
.scan-meta.bad { color: var(--bad); }
.plist { list-style: none; margin: 0; padding: 0; }
.plist li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.plist li:first-child { border-top: 0; }
.file-drop { border: 2px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; color: var(--text-soft); font-size: 14px; cursor: pointer; }
.file-drop:hover, .file-drop.over { border-color: var(--terra); background: var(--terra-soft); color: var(--terra-deep); }
.file-drop input { display: none; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s var(--ease); }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .burger { display: block; }
  .view { padding: 16px; }
  .flow { grid-template-columns: 1fr 1fr; }
  .modal-card .flow { grid-template-columns: 1fr; }
  .detail-head { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
}
@media print { .side, .topbar, .toast, .modal { display: none !important; } .shell { grid-template-columns: 1fr; } }
