/* SuperJaew Office — ใช้สีและตัวอักษรตาม CI */
:root {
  --navy: #14213d;
  --navy-2: #22315a;
  --yellow: #ffc93c;
  --surface: #ffffff;
  --page: #f5f6f8;
  --ink: #14213d;
  --ink-muted: #5b6475;
  --line: #dfe3ea;
  --line-strong: #c5ccd8;
  --success: #1f7a52;
  --success-bg: #e6f4ec;
  --danger: #b93a26;
  --danger-bg: #fbeae6;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 40px;
  --shadow-card: 0 1px 2px rgba(20, 33, 61, .06);
  --display: 'Mitr', 'IBM Plex Sans Thai', sans-serif;
  --body: 'IBM Plex Sans Thai', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--page); color: var(--ink); font: 400 15px/1.6 var(--body); }
h1, h2, h3 { font-family: var(--display); font-weight: 500; margin: 0; line-height: 1.3; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.boot { padding: 64px; text-align: center; color: var(--ink-muted); }
.muted { color: var(--ink-muted); }
.small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- โครงหน้า ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #fff; padding: var(--space-4) var(--space-3); display: flex; flex-direction: column; gap: var(--space-4); position: sticky; top: 0; height: 100vh; }
.wordmark { font: 500 20px/1.2 var(--display); display: flex; align-items: center; gap: 8px; padding: 0 var(--space-2); }
.wordmark small { display: block; font: 300 13px/1.2 var(--display); opacity: .8; }
.sparkle { width: 14px; height: 14px; fill: var(--yellow); flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-md); text-decoration: none; color: rgba(255, 255, 255, .82); }
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a.active { background: #fff; color: var(--navy); font-weight: 500; }
.nav svg, .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-foot { margin-top: auto; font-size: 13px; padding: 0 var(--space-2); }
.side-foot p { opacity: .8; }
.side-foot button { background: none; border: 0; color: #fff; padding: 6px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.main { padding: var(--space-4) var(--space-5) var(--space-5); min-width: 0; max-width: 1280px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.head .sub { color: var(--ink-muted); margin-top: 2px; }
.row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }

/* ---------- ปุ่ม ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--navy); }
.btn.primary { background: var(--yellow); border-color: var(--yellow); color: var(--navy); font-weight: 600; }
.btn.primary:hover { border-color: var(--navy); }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.danger { color: var(--danger); border-color: #e6b8ae; }
.btn.danger:hover { border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { min-height: 32px; padding: 4px 12px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: none; padding: 6px; border-radius: var(--radius-sm); cursor: pointer; color: var(--ink-muted); }
.icon-btn:hover { color: var(--danger); background: var(--danger-bg); }

/* ---------- ฟอร์ม ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 13px; color: var(--ink-muted); font-weight: 500; }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, textarea.input {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface);
}
textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
input[readonly], textarea[readonly] { background: var(--page); }
.grid { display: grid; gap: var(--space-3); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--navy); }
.hint { font-size: 13px; color: var(--ink-muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4); box-shadow: var(--shadow-card); }
.card + .card { margin-top: var(--space-3); }
.card > h2 { margin-bottom: var(--space-3); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-3); }

/* ---------- รายการเอกสาร ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: var(--space-3); }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--ink-muted); border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs button.active { color: var(--navy); border-bottom-color: var(--yellow); }
.filters { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(3, minmax(130px, 1fr)) auto; gap: var(--space-2); margin-bottom: var(--space-3); align-items: end; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-weight: 500; font-size: 13px; color: var(--ink-muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.list th.num { text-align: right; }
.list td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list tr:last-child td { border-bottom: 0; }
.list tbody tr.click { cursor: pointer; }
.list tbody tr.click:hover { background: #fafbfc; }
.docno { font-family: var(--display); font-weight: 500; white-space: nowrap; }
.docno.draft { color: var(--ink-muted); font-family: var(--body); font-style: italic; }
.type { font-size: 13px; color: var(--ink-muted); }
.empty { padding: var(--space-5) var(--space-4); text-align: center; color: var(--ink-muted); }
.empty .btn { margin-top: var(--space-3); }
.more { display: flex; justify-content: center; padding: var(--space-3); }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.pill.draft { background: var(--page); color: var(--ink-muted); border-color: var(--line); }
.pill.wait { background: #fff; color: var(--navy); border-color: var(--navy); }
.pill.done { background: var(--success-bg); color: var(--success); }
.pill.late { background: var(--danger-bg); color: var(--danger); }
.pill.void { background: var(--page); color: var(--ink-muted); text-decoration: line-through; }

/* ---------- หน้ากรอกเอกสาร ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-4); align-items: start; }
.summary { position: sticky; top: var(--space-4); }
.summary .card { padding: var(--space-3) var(--space-4); }
.summary table { width: 100%; border-collapse: collapse; }
.summary th { text-align: left; font-weight: 400; padding: 4px 0; color: var(--ink-muted); }
.summary td { text-align: right; padding: 4px 0; font-variant-numeric: tabular-nums; }
.summary tr.strong th, .summary tr.strong td { color: var(--ink); font-weight: 600; border-top: 1px solid var(--line); padding-top: 8px; }
.total-bar { margin-top: var(--space-2); padding: 12px 16px; background: var(--yellow); color: var(--navy); border-radius: var(--radius-md); }
.total-bar .lbl { font-size: 13px; font-weight: 500; }
.total-bar .amt { font: 600 28px/1.2 var(--display); font-variant-numeric: tabular-nums; }
.total-bar .words { font-size: 13px; }
.actions { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
.actions .btn { width: 100%; }
.saved-at { font-size: 13px; color: var(--ink-muted); text-align: center; }

table.lines { width: 100%; border-collapse: collapse; }
.lines th { text-align: left; font-size: 13px; font-weight: 500; color: var(--ink-muted); padding: 0 6px 6px; }
.lines td { padding: 4px 6px; vertical-align: top; }
.lines .c-desc { width: 46%; }
.lines .c-qty { width: 11%; }
.lines .c-unit { width: 11%; }
.lines .c-price { width: 15%; }
.lines .c-amt { width: 13%; padding-top: 12px; }
.lines input, .lines textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; }
.lines textarea { min-height: 40px; height: 40px; }
.lines input.n { text-align: right; }
.add-line { margin-top: var(--space-2); }
.picker { border: 1px solid var(--line); border-radius: var(--radius-md); max-height: 340px; overflow: auto; }
.picker label { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: center; }
.picker label:last-child { border-bottom: 0; }
.picker label:hover { background: var(--page); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 8px 16px; cursor: pointer; }
.seg button.active { background: var(--navy); color: #fff; }
.radios { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.notice { padding: 12px 16px; border-radius: var(--radius-md); background: var(--page); border: 1px solid var(--line); font-size: 14px; }
.notice.warn { background: #fff8e4; border-color: #f2d48a; }
.notice.bad { background: var(--danger-bg); border-color: #efc0b6; color: var(--danger); }

/* ---------- หน้าดูเอกสารที่ออกแล้ว ---------- */
.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-4); align-items: start; }
.paper-frame { width: 100%; height: 1180px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.facts dt { color: var(--ink-muted); }
.facts dd { margin: 0; text-align: right; }
.rel { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rel a { text-decoration: none; display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.rel a:hover { border-color: var(--navy); }
.history { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.history li { padding: 8px 0 8px 18px; border-left: 2px solid var(--line); position: relative; }
.history li::before { content: ''; position: absolute; left: -5px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--navy); }
.history .when { font-size: 12px; color: var(--ink-muted); }

/* ---------- เข้าสู่ระบบ ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { background: var(--navy); color: #fff; padding: var(--space-5); display: flex; flex-direction: column; justify-content: space-between; }
.login-art h1 { font-size: 40px; font-weight: 300; line-height: 1.25; max-width: 12ch; }
.login-art h1 strong { font-weight: 600; color: var(--yellow); }
.login-art .docs-chain { display: flex; gap: 10px; flex-wrap: wrap; font: 400 15px var(--display); }
.login-art .docs-chain span { padding: 6px 14px; border: 1px solid rgba(255, 255, 255, .4); border-radius: 999px; }
.login-form { display: flex; align-items: center; justify-content: center; padding: var(--space-5) var(--space-3); background: var(--surface); }
.login-form form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: var(--space-3); }

/* ---------- กล่องโต้ตอบ / แจ้งเตือน ---------- */
dialog { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(560px, calc(100vw - 32px)); color: var(--ink); }
dialog::backdrop { background: rgba(20, 33, 61, .45); }
dialog form { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
dialog .foot { display: flex; justify-content: flex-end; gap: var(--space-2); }
.secret { font: 500 20px/1.4 ui-monospace, Menlo, monospace; padding: 12px 16px; background: var(--page); border-radius: var(--radius-md); user-select: all; word-break: break-all; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
#toast div { background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 999px; box-shadow: 0 6px 20px rgba(20, 33, 61, .25); }
#toast div.bad { background: var(--danger); }


/* ---------- รายจ่าย ---------- */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 18px; text-align: center; color: var(--ink-muted); margin-bottom: var(--space-3); background: var(--surface); }
.dropzone.over { border-color: var(--navy); background: #fff8e4; color: var(--navy); }
.sumcard { margin-bottom: var(--space-3); padding: 0; }
.sumcard summary { display: flex; justify-content: space-between; gap: 12px; padding: 14px 20px; cursor: pointer; list-style: none; }
.sumcard summary::-webkit-details-marker { display: none; }
.sumcard summary strong { font: 500 18px var(--display); }
.sumcard[open] summary { border-bottom: 1px solid var(--line); }
.review { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.filepane { position: sticky; top: var(--space-4); padding: var(--space-3); }
.filetabs { margin-bottom: var(--space-2); overflow-x: auto; flex-wrap: nowrap; }
.filetabs button { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.fileview { height: 62vh; min-height: 360px; background: #2b3346; border-radius: var(--radius-md); overflow: hidden; display: flex; }
.fileview iframe { flex: 1; border: 0; background: #fff; }
.imgwrap { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 8px; }
.imgwrap img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .15s; background: #fff; }
.imgwrap.zoomed { display: block; }
.imgwrap.zoomed img { max-width: none; max-height: none; width: 180%; }
.empty-file { flex: 1; display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; color: #fff; background: var(--page); }
.empty-file p { color: var(--ink); }
.mono { font: 13px/1.6 ui-monospace, Menlo, 'IBM Plex Sans Thai', monospace; }
pre.raw { white-space: pre-wrap; background: var(--page); padding: 12px; border-radius: var(--radius-md); max-height: 240px; overflow: auto; }
.from-ocr { margin-left: 8px; font-style: normal; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 999px; background: #fff3cc; color: #7a5a00; }
.review .notice { margin-bottom: var(--space-3); }
.paid-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 16px; padding: 12px 16px; background: var(--yellow); border-radius: var(--radius-md); }
.paid-row strong { font: 600 22px var(--display); }
.confirm-card { border-color: var(--navy); }
@media (max-width: 1100px) {
  .review { grid-template-columns: 1fr; }
  .filepane { position: static; }
  .fileview { height: 55vh; }
}


/* ---------- ภาพรวมและกระทบยอด ---------- */
:root { --c-income: #4A6CB5; --c-expense: #C58500; }
.range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: var(--space-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 14px; }
.chips button:hover { border-color: var(--navy); }
.chips button.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.range .custom { display: flex; align-items: center; gap: 8px; }
.range .custom input { min-height: 34px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.range-label { color: var(--ink-muted); font-size: 14px; margin-left: auto; }
.todo { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-3); }
.todo a { text-decoration: none; padding: 8px 14px; border-radius: var(--radius-md); background: #fff8e4; border: 1px solid #f2d48a; font-size: 14px; }
.todo a b { font-family: var(--display); font-weight: 500; margin-left: 4px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-3); }
.card + .tiles, .card + #pv .tiles { margin-top: var(--space-3); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile strong { font: 500 26px/1.2 var(--display); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile strong.sm { font-size: 17px; }
.tile.hero { background: var(--yellow); border-color: var(--yellow); }
.tile.hero.neg { background: var(--danger-bg); border-color: #efc0b6; }
.tile.hero.neg strong { color: var(--danger); }
.t-label { font-size: 14px; font-weight: 500; color: var(--ink-muted); display: flex; align-items: center; gap: 6px; }
.tile.hero .t-label { color: var(--navy); }
.t-label i, .legend i, .chart-tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.legend i.line, .chart-tip i.line { height: 2px; width: 14px; border-radius: 1px; background: var(--ink); vertical-align: middle; }
.t-sub { font-size: 13px; color: var(--ink-muted); }
.tile.hero .t-sub { color: var(--navy); }
.delta { font-size: 13px; margin-top: auto; padding-top: 6px; }
.chart-card { padding-bottom: var(--space-3); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-host { position: relative; margin: 4px 0 8px; }
.chart-host svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart-host .axis { font: 12px var(--body); fill: var(--ink-muted); }
.chart-tip { position: absolute; display: none; pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: 10px 12px; font-size: 13px; box-shadow: 0 6px 20px rgba(20, 33, 61, .14); min-width: 180px; z-index: 2; }
.chart-tip strong { display: block; margin-bottom: 4px; }
.chart-tip div { display: flex; align-items: center; gap: 6px; }
.chart-tip b { margin-left: auto; padding-left: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin-top: var(--space-3); }
.dash-grid .card + .card { margin-top: 0; }
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 14px; display: block; }
.hb-bar { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.hb-val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hb-val small { color: var(--ink-muted); margin-left: 6px; display: inline-block; min-width: 32px; }
.meter { height: 10px; background: var(--page); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin: 8px 0 6px; }
.meter span { display: block; height: 100%; background: var(--navy); border-radius: 999px; }
.meter.sm { height: 6px; margin: 6px 0 0; }
table.compact td, table.compact th { padding: 8px 10px; }
.late-text { color: var(--danger); }
.acc-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: var(--space-3); }
.acc-row .tabs { margin-bottom: 0; flex: 1; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--yellow); color: var(--navy); font-size: 12px; text-align: center; }
.nowrap { white-space: nowrap; }
td.in { color: var(--success); font-weight: 500; }
tr.dup td { opacity: .45; }
details.card > summary { cursor: pointer; }
dialog .chips { margin-bottom: 4px; }
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .range-label { margin-left: 0; width: 100%; }
  .hbars li { grid-template-columns: 1fr auto; }
  .hbars .hb-track { grid-column: span 2; order: 3; }
}


/* ---------- พนักงาน ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--navy); color: #fff; font: 500 15px var(--display); flex: none; object-fit: cover; }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.who { display: flex; gap: 10px; align-items: center; }
.profile + .alerts { margin-top: var(--space-3); }
.profile { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.profile-main { flex: 1; min-width: 240px; }
.profile-main h1 { font-size: 24px; }
.profile-main p { color: var(--ink-muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.alerts li { padding: 8px 12px; border-radius: var(--radius-md); background: #fff8e4; border: 1px solid #f2d48a; font-size: 14px; }
.alerts li.bad { background: var(--danger-bg); border-color: #efc0b6; color: var(--danger); }
.alerts a { text-decoration: none; }
.facts.wide { grid-template-columns: minmax(110px, auto) 1fr; }
.facts.wide dd { text-align: left; }
.big-num { font: 500 28px/1.3 var(--display); margin-top: 4px; }
.big-num small { font: 400 14px var(--body); color: var(--ink-muted); }
.upload-row { align-items: end; margin-bottom: var(--space-3); padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.doc-group { padding: 12px 0; border-bottom: 1px solid var(--line); }
.doc-group:last-child { border-bottom: 0; }
.doc-group h3 { font-size: 15px; margin-bottom: 6px; }
.doc-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 4px 0; }
.doc-row a:first-child { font-weight: 500; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.checklist li.done label span { color: var(--ink-muted); text-decoration: line-through; }
.checklist li.late .small { color: var(--danger); font-weight: 500; }
.secret-val { font-variant-numeric: tabular-nums; letter-spacing: .03em; }

/* ---------- จอเล็ก ---------- */
@media (max-width: 1100px) {
  .editor, .viewer { grid-template-columns: 1fr; }
  .summary { position: static; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field:first-child { grid-column: span 2; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: minmax(0, 1fr); }
  .filters .field:first-child { grid-column: auto; }
  .dropzone { display: none; }
  .head .row { width: 100%; }
  .head .row .btn { flex: 1 1 auto; }
  .side { position: static; height: auto; padding: var(--space-3); gap: var(--space-2); }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav a { white-space: nowrap; }
  .side-foot { display: none; }
  .main { padding: var(--space-3) 16px var(--space-5); }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: var(--space-4) 16px; gap: var(--space-3); }
  .login-art h1 { font-size: 28px; }
  .lines thead { display: none; }
  .lines tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .lines td { padding: 0; width: auto !important; }
  .lines td.c-desc { grid-column: span 2; }
  .paper-frame { height: 80vh; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
