:root {
  color-scheme: light;
  --navy: #14283d;
  --deep: #0d1b2a;
  --ice: #ddf3fa;
  --accent: #659fbd;
  --blue: #235879;
  --ink: #172e44;
  --muted: #536b80;
  --line: #dce5ec;
  --page: #f4f7fa;
  --white: #ffffff;
  --danger: #8e2d37;
  font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
a { color: var(--blue); }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #2784b4; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 3.2vw, 2.7rem); line-height: 1.1; letter-spacing: -.045em; }
h2 { font-size: 1.12rem; letter-spacing: -.015em; }
h3 { font-size: 1rem; }
small, .muted { color: var(--muted); }
.loading { padding: 40px; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0,1fr); }
.sidebar { background: var(--deep); color: #ecf7fc; display: flex; flex-direction: column; padding: 25px 16px 18px; position: sticky; top: 0; height: 100dvh; }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; padding: 0 8px; font-weight: 700; line-height: 1.23; letter-spacing: -.015em; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; color: var(--deep); background: var(--ice); border-radius: 9px; flex: 0 0 auto; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.nav { margin-top: 34px; display: grid; gap: 5px; }
.nav a { display: flex; align-items: center; gap: 11px; color: #bccee0; text-decoration: none; border-radius: 7px; padding: 10px 12px; font-size: .94rem; }
.nav a:hover, .nav a[aria-current="page"] { color: #fff; background: #203b50; }
.nav a[aria-current="page"] { box-shadow: inset 3px 0 #8cc9dd; font-weight: 650; }
.icon { width: 18px; height: 18px; display: inline-block; vertical-align: middle; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.side-bottom { margin-top: auto; padding-top: 20px; }
.account { display: flex; align-items: center; gap: 9px; border-top: 1px solid #304355; padding: 15px 6px 2px; }
.avatar { background: #284b62; color: #e7f7ff; border-radius: 50%; height: 32px; width: 32px; flex: 0 0 auto; display: grid; place-items: center; font-weight: 700; }
.account-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.account small { color: #a9bccd; display: block; text-transform: capitalize; }
.account button { margin-left: auto; color: #cde9f3; background: transparent; border: 0; padding: 5px; }
.workspace { min-width: 0; }
.topbar { min-height: 64px; background: var(--white); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 10px clamp(18px, 3.3vw, 46px); gap: 10px; font-size: .86rem; }
.topbar strong { font-weight: 650; }
.top-date { color: var(--muted); white-space: nowrap; }
.content { width: 100%; max-width: 1550px; margin: 0 auto; padding: 30px clamp(18px, 3.3vw, 46px) 55px; }
.heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 15px; margin-bottom: 24px; }
.heading p { margin-top: 8px; color: var(--muted); }
.buttons { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.button { color: var(--ink); background: var(--white); border: 1px solid #cbd9e4; border-radius: 7px; text-decoration: none; font-weight: 650; line-height: 1.25; min-height: 38px; padding: 9px 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.button:hover { background: #edf6fa; }
.button.primary { color: white; background: #194464; border-color: #194464; }
.button.primary:hover { background: #235779; }
.button.danger { color: var(--danger); }
.button.small { font-size: .85rem; min-height: 31px; padding: 6px 9px; }
.button:disabled { opacity: .6; cursor: wait; }
.metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; margin-bottom: 22px; }
.metric { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 15px 16px; color: var(--ink); text-decoration: none; display: grid; grid-template-columns: 37px 1fr auto; align-items: center; gap: 11px; min-height: 83px; }
.metric:hover { border-color: #82b4cd; box-shadow: 0 2px 8px #14283d12; }
.metric-icon { background: #e7f4f9; color: #285c79; border-radius: 8px; height: 37px; width: 37px; display: grid; place-items: center; }
.metric small { display: block; font-weight: 650; }
.metric strong { font-size: 1.48rem; letter-spacing: -.04em; display: block; line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; }
.metric-arrow { color: #698599; }
.layout { display: grid; grid-template-columns: minmax(0,2.2fr) minmax(235px,1fr); align-items: start; gap: 15px; }
.stack { display: grid; gap: 15px; min-width: 0; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.panel-head { padding: 15px 17px; display: flex; gap: 10px; justify-content: space-between; align-items: center; border-bottom: 1px solid #e8edf2; }
.panel-head a { font-size: .87rem; font-weight: 650; }
.panel-body { padding: 16px 17px; }
.quick-entry { padding: 13px 0; display: flex; text-decoration: none; align-items: center; gap: 11px; color: var(--ink); }
.quick-entry + .quick-entry { border-top: 1px solid var(--line); }
.quick-entry:hover strong { text-decoration: underline; }
.quick-entry small { display: block; }
.quick-entry > .icon:last-child { margin-left: auto; color: var(--muted); }
.quick-entry:first-child { padding-top: 0; }
.quick-entry:last-child { padding-bottom: 0; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; font-size: .91rem; }
thead { color: #4b6479; background: #f7fafc; }
th { font-weight: 650; }
td, th { padding: 11px 15px; border-bottom: 1px solid #e8edf2; }
tr:last-child td { border-bottom: 0; }
td a { font-weight: 650; text-decoration: none; }
td a:hover { text-decoration: underline; }
.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }
.empty .button { margin-top: 14px; }
.badge { display: inline-block; border-radius: 30px; padding: 3px 8px; background: #e8edf2; color: #3b5368; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.badge.done { background: #e1f3ec; color: #215e4b; }
.badge.active { background: #e1f0f9; color: #245375; }
.badge.warn { background: #faeddb; color: #764b14; }
.badge.stop { background: #f8e7e9; color: #822f3b; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; margin-bottom: 14px; }
.filters > label:first-of-type { flex: 1 1 210px; }
label { display: grid; gap: 5px; color: var(--ink); font-size: .88rem; font-weight: 650; }
input:not([type=checkbox]), select, textarea { min-width: 0; width: 100%; border: 1px solid #bdcedc; border-radius: 6px; padding: 8px 9px; background: white; color: var(--ink); font-weight: 400; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--blue); margin: 0; }
textarea { resize: vertical; min-height: 80px; }
.check { display: flex; align-items: start; gap: 9px; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .form-actions { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: end; margin-top: 5px; gap: 8px; }
.form-note { font-size: .88rem; color: var(--muted); }
.scan-drop { border: 1px dashed #91aabd; border-radius: 8px; padding: 12px; }
.scan-drop p { margin-bottom: 0; }
.form-error { color: var(--danger); font-weight: 650; grid-column: 1 / -1; }
.pager { display: flex; align-items: center; gap: 9px; justify-content: end; padding: 12px 15px; border-top: 1px solid var(--line); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(155px,1fr)); gap: 12px 16px; margin: 0; }
.detail-grid dt { font-size: .79rem; color: var(--muted); font-weight: 650; }
.detail-grid dd { margin: 3px 0 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.banner { padding: 10px 13px; border: 1px solid #c1deec; background: #eaf6fb; color: #264c64; border-radius: 7px; }
.banner.warning { background: #fff7e9; border-color: #efdbad; color: #6c4719; }
.record-list { list-style: none; margin: 0; padding: 0; }
.record-list li + li { border-top: 1px solid var(--line); }
.record-list li { padding: 10px 0; overflow-wrap: anywhere; }
.record-list li:first-child { padding-top: 0; }
.record-list li:last-child { padding-bottom: 0; }
.line-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.memo { white-space: pre-wrap; overflow-wrap: anywhere; }
.media-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.evidence { background: #f1f5f8; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; min-width: 0; }
.evidence img { width: 100%; height: 230px; display: block; object-fit: contain; background: #e6edf2; }
.evidence .empty { min-height: 150px; display: grid; place-items: center; }
.evidence figcaption { padding: 9px 11px; font-size: .84rem; }
.evidence a { display: block; }
figure { margin: 0; }
details { margin-top: 12px; }
summary { cursor: pointer; font-weight: 650; }
.version-table td { white-space: normal; overflow-wrap: anywhere; }
.hash { font: .78rem ui-monospace, monospace; overflow-wrap: anywhere; }
.zoom { width: min(900px, 94vw); }
.image-layer { position: relative; width: max-content; max-width: 100%; margin-inline: auto; }
.image-layer.enlarged, .image-layer.enlarged img { max-width: none; max-height: none; }
.image-layer img { display: block; max-width: 100%; max-height: 70vh; }
.image-layer canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.image-layer canvas.selecting { touch-action: none; pointer-events: auto; cursor: crosshair; }
.annotation-entry { padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.annotation-record { margin-top: 9px; }
.annotation-actions { margin-top: 6px; }
.zoom-frame { overflow: auto; max-height: 72vh; background: #e6edf2; }
dialog { width: min(620px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); box-shadow: 0 16px 60px #0d1b2a45; }
dialog::backdrop { background: #0d1b2a88; }
.dialog-head { position: sticky; top: 0; background: white; z-index: 1; }
.dialog-body { padding: 17px; }
.card-entry { border: 1px solid var(--line); border-radius: 8px; padding: 11px; margin: 0 0 10px; min-width: 0; }
.card-entry legend { font-weight: 650; padding: 0 5px; }
.notices { position: fixed; bottom: 18px; right: 18px; z-index: 5; display: grid; gap: 7px; width: min(440px, calc(100% - 36px)); }
.notice { background: var(--deep); color: white; padding: 11px 14px; border-radius: 8px; box-shadow: 0 2px 14px #0d1b2a30; }
.notice.error { background: #762e39; }
.sign-in { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.sign-brand { padding: clamp(25px,6vw,80px); background: linear-gradient(145deg,#f8fcff 0%,#ddf3fa 75%,#bedff0 100%); color: var(--deep); display: flex; flex-direction: column; justify-content: center; gap: clamp(25px,5vw,60px); }
.sign-logo { display: block; width: min(100%, 600px); }
.sign-logo img { display: block; width: 100%; height: auto; }
.sign-brand h1 { font-size: clamp(2.2rem,5.5vw,4.8rem); max-width: 660px; }
.sign-brand p { color: #405d75; margin-top: 14px; }
.sign-form { display: grid; place-items: center; padding: 36px 22px; }
.sign-form .panel { width: min(100%,420px); padding: 28px; }
.sign-form h2 { font-size: 1.7rem; }
.sign-form form { display: grid; gap: 13px; margin-top: 18px; }
.sign-form .button { margin-top: 3px; }
.invoice-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.totals { display: grid; gap: 5px; max-width: 290px; margin: 0 0 0 auto; }
.totals div { display: flex; justify-content: space-between; gap: 10px; }
.totals div:last-child { font-weight: 700; border-top: 1px solid var(--line); padding-top: 6px; }
#print-area { display: none; }
.portal-shell { max-width: 1030px; }
.portal-brand { display: block; width: min(100%, 390px); height: auto; margin-bottom: 25px; }
.portal-approval + .portal-approval { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 18px; }
.portal-decision, .portal-shell .media-grid { margin-top: 12px; }
.portal-report-card { break-inside: avoid; }
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0,1fr); }
  .sidebar { padding-left: 11px; padding-right: 11px; }
  .shell { grid-template-columns: 188px minmax(0,1fr); }
}
@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { position: static; padding: 10px 12px; height: auto; display: grid; grid-template-columns: 1fr auto; }
  .sidebar .brand { padding: 0; }
  .sidebar .brand br { display: none; }
  .sidebar .brand-mark { width: 30px; height: 30px; }
  .nav { margin-top: 10px; display: flex; overflow: auto; grid-row: 2; grid-column: 1 / -1; gap: 4px; }
  .nav a { white-space: nowrap; font-size: .83rem; padding: 8px; }
  .nav a[aria-current="page"] { box-shadow: inset 0 -2px #8cc9dd; }
  .nav .icon, .account small, .account .avatar { display: none; }
  .side-bottom { padding: 0; margin: 0; }
  .account { border: 0; padding: 0; }
  .account-name { max-width: 90px; }
  .topbar { min-height: 42px; }
  .content { padding-top: 20px; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .metric { padding: 9px; gap: 7px; min-height: 70px; grid-template-columns: 28px 1fr; }
  .metric-icon { width: 28px; height: 28px; }
  .metric-arrow { display: none; }
  .metric strong { font-size: 1.25rem; }
  .sign-in { grid-template-columns: 1fr; align-content: start; }
  .sign-brand { gap: 20px; padding: 22px; }
}
@media (max-width: 400px) {
  .form-grid { grid-template-columns: minmax(0,1fr); }
  .metric { grid-template-columns: 1fr; }
  .metric-icon { display: none; }
}
@media print {
  body.printing #app, body.printing dialog, body.printing .notices { display: none !important; }
  body.printing #print-area { display: block; padding: 20px; color: #000; }
  body.printing #print-area h1 { margin-bottom: 15px; }
  body.printing #print-area h2 { margin-top: 18px; }
  body.printing #print-area p { margin-top: 7px; }
  body.printing #print-area dt { color: #222; }
  body { background: white; }
}
