:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e2e5ea;
  --text: #1c2430;
  --muted: #667085;
  --accent: #e8890c;
  --accent-strong: #c26f00;
  --accent-soft: #fff3e0;
  --nav-bg: #1f2a37;
  --nav-text: #c9d1db;
  --nav-active: #ffffff;
  --ok: #1a7f4b;
  --ok-soft: #e4f5ec;
  --warn: #a15c00;
  --warn-soft: #fff4db;
  --danger: #c2362b;
  --danger-soft: #fde9e7;
  --info: #2459b8;
  --info-soft: #e6eefc;
  --neutral-soft: #eef0f3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: 'IBM Plex Sans Thai', 'Noto Sans Lao', 'Sarabun', 'Leelawadee UI', 'Noto Sans Thai', 'Phetsarath OT', system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161c;
    --surface: #1a2029;
    --surface-2: #202733;
    --border: #2e3644;
    --text: #e6e9ee;
    --muted: #98a2b3;
    --accent: #f29a26;
    --accent-strong: #ffb24d;
    --accent-soft: #3a2a12;
    --nav-bg: #0d1117;
    --ok: #4cc38a;
    --ok-soft: #173326;
    --warn: #f0b552;
    --warn-soft: #3a2d12;
    --danger: #f07167;
    --danger-soft: #3b1c1a;
    --info: #7aa7ff;
    --info-soft: #1b2a47;
    --neutral-soft: #262d39;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0; line-height: 1.3; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.boot, .loading { padding: 48px; text-align: center; color: var(--muted); }

/* ------------------------------------------------ layout */
.shell { display: grid; grid-template-columns: 232px 1fr; grid-template-rows: 56px 1fr; min-height: 100vh; }
.topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: var(--nav-bg); color: #fff;
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; white-space: nowrap; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; }
.topbar .spacer { flex: 1; }
.project-picker { display: flex; align-items: center; gap: 8px; min-width: 0; }
.project-picker label { font-size: .8rem; color: var(--nav-text); white-space: nowrap; }
.project-picker select {
  background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px; padding: 6px 10px; font: inherit; font-size: .9rem; max-width: 280px;
}
.project-picker select option { color: #111; }
.prefs { display: flex; gap: 6px; }
.prefs select {
  background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px; padding: 4px 8px; font: inherit; font-size: .82rem; min-height: 32px; width: auto;
}
.prefs select option { color: #111; }
.login-lang { display: flex; justify-content: flex-end; gap: 4px; margin: -8px -6px 12px 0; }
.login-lang button { background: none; border: 1px solid transparent; border-radius: 999px; padding: 3px 10px; font: inherit; font-size: .82rem; color: var(--muted); cursor: pointer; }
.login-lang button:hover { border-color: var(--border); }
.login-lang button.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--nav-text); white-space: nowrap; }
.user-chip strong { color: #fff; font-weight: 600; }
.user-chip button { background: none; border: 1px solid rgba(255,255,255,.2); color: var(--nav-text); border-radius: 7px; padding: 4px 10px; cursor: pointer; font: inherit; font-size: .8rem; }
.user-chip button:hover { color: #fff; border-color: rgba(255,255,255,.4); }

.sidenav { background: var(--nav-bg); padding: 8px 10px 24px; border-top: 1px solid rgba(255,255,255,.06); }
.sidenav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 2px 0; border-radius: 8px;
  color: var(--nav-text); font-size: .95rem;
}
.sidenav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.sidenav a.active { background: rgba(232,137,12,.18); color: var(--nav-active); box-shadow: inset 3px 0 0 var(--accent); }
.sidenav .nav-icon { width: 20px; text-align: center; opacity: .9; }
.sidenav .nav-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #7d8794; padding: 14px 12px 4px; }
.sidenav .badge-count { margin-left: auto; background: var(--accent); color: #fff; font-size: .72rem; border-radius: 999px; padding: 0 7px; font-weight: 600; }

main#view { padding: 24px 28px 48px; min-width: 0; max-width: 1280px; width: 100%; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 8px 12px; position: static; }
  .topbar .spacer { display: none; }
  .project-picker { order: 3; width: 100%; }
  .project-picker select { flex: 1; max-width: none; }
  .user-chip { margin-left: auto; }
  .prefs { order: 4; }
  .user-chip .role { display: none; }
  .sidenav {
    display: flex; overflow-x: auto; gap: 4px; padding: 6px 10px;
    position: sticky; top: 0; z-index: 15; scrollbar-width: none;
  }
  .sidenav::-webkit-scrollbar { display: none; }
  .sidenav .nav-group { display: none; }
  .sidenav a { white-space: nowrap; padding: 7px 12px; font-size: .88rem; flex-shrink: 0; }
  .sidenav a.active { box-shadow: inset 0 -2px 0 var(--accent); }
  main#view { padding: 16px 16px 40px; }
  .table-wrap > table { min-width: 620px; }
}

/* ------------------------------------------------ page parts */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.back { font-size: .85rem; color: var(--muted); display: inline-block; margin-bottom: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 16px 20px 0; }
.section-title { font-size: 1rem; margin: 20px 0 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); color: inherit; display: block; }
a.stat:hover { text-decoration: none; border-color: var(--accent); }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.7rem; font-weight: 700; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .value.small { font-size: 1.25rem; }
.stat.alert .value { color: var(--danger); }
.stat.attention .value { color: var(--accent-strong); }

.info-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 24px; margin: 0; }
.info-list div { min-width: 0; }
.info-list dt { color: var(--muted); font-size: .8rem; }
.info-list dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ------------------------------------------------ tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-weight: 600; color: var(--muted); font-size: .8rem; background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.muted, .muted { color: var(--muted); }
tr.low td { background: var(--danger-soft); }
tfoot td { font-weight: 600; background: var(--surface-2); }
.nowrap { white-space: nowrap; }
table.compact td { white-space: nowrap; }
table.compact th, table.compact td { padding: 8px 10px; }
.code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .85em; color: var(--muted); }
.empty { padding: 32px; text-align: center; color: var(--muted); }
.empty.error { color: var(--danger); }

/* ------------------------------------------------ badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.approved { background: var(--info-soft); color: var(--info); }
.badge.partial { background: var(--accent-soft); color: var(--accent-strong); }
.badge.issued, .badge.active { background: var(--ok-soft); color: var(--ok); }
.badge.rejected { background: var(--danger-soft); color: var(--danger); }
.badge.cancelled, .badge.closed, .badge.on_hold, .badge.inactive { background: var(--neutral-soft); color: var(--muted); }

/* ------------------------------------------------ buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: .92rem;
  padding: 8px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  white-space: nowrap; min-height: 38px;
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 12px; font-size: .85rem; min-height: 32px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 6px 8px; border-radius: 6px; }
.icon-btn:hover { color: var(--danger); background: var(--danger-soft); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: .85rem; font-weight: 500; color: var(--muted); }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.field.check > span { color: var(--text); }
input, select, textarea {
  font: inherit; font-size: .95rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; width: 100%; min-height: 38px;
}
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; min-height: 70px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.form-error { color: var(--danger); font-size: .9rem; margin: 10px 0 0; }

.search { max-width: 320px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 999px; color: var(--muted); font-size: .88rem; border: 1px solid transparent; }
.tabs a:hover { text-decoration: none; background: var(--surface); border-color: var(--border); }
.tabs a.active { background: var(--text); color: var(--surface); }

/* line editor */
table.lines td { padding: 8px; }
table.lines select { min-width: 220px; }
table.lines input.qty, table.lines input.price, input.line-input { width: 110px; text-align: right; }
.qty-wrap { display: inline-flex; align-items: center; gap: 6px; }
.qty-wrap .unit { color: var(--muted); font-size: .85rem; min-width: 32px; text-align: left; }
td.warn, .warn-text { color: var(--danger); font-weight: 600; }

/* ความคืบหน้า / รายงานประจำวัน */
:root { --series-plan: #2a78d6; --series-actual: #eb6834; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --series-plan: #3987e5; --series-actual: #d95926; } }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) { .form-grid.three { grid-template-columns: 1fr; } }
.prewrap { white-space: pre-wrap; margin: 0; }
.report-list { display: grid; gap: 10px; }
.report-card { display: flex; gap: 14px; padding: 12px; margin: 0; color: inherit; align-items: stretch; }
.report-card:hover { text-decoration: none; border-color: var(--accent); }
.report-thumb { width: 96px; min-height: 72px; flex-shrink: 0; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-size: 1.4rem; }
.report-thumb img { width: 100%; height: 100%; object-fit: cover; }
.report-body { min-width: 0; flex: 1; }
.report-top { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.report-text { margin: 4px 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.report-meta { font-size: .82rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo-grid.picker:empty { display: none; }
.photo-grid.picker { margin-top: 10px; }
.photo { position: relative; margin: 0; border-radius: 8px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.photo figcaption { font-size: .82rem; padding: 6px 8px; }
.photo .photo-cap { border: none; border-top: 1px solid var(--border); border-radius: 0; font-size: .82rem; min-height: 32px; }
.photo-open { all: unset; cursor: zoom-in; display: block; }
.photo-open:focus-visible { outline: 2px solid var(--accent); }
.photo-del { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.photo-del:hover { background: var(--danger); }
.photo-add { cursor: pointer; }
dialog.lightbox { width: min(1100px, calc(100vw - 24px)); background: #111; }
dialog.lightbox img { display: block; max-width: 100%; max-height: 80vh; margin: 0 auto; }
.lightbox-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; color: #eee; font-size: .9rem; }
.pct-bar { position: relative; height: 10px; border-radius: 999px; background: var(--neutral-soft); min-width: 100px; }
.pct-bar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--series-actual); }
.pct-bar .plan-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); }
.scurve { position: relative; }
.scurve-plot { position: relative; }
.scurve svg { width: 100%; height: auto; display: block; overflow: visible; }
.scurve .grid { stroke: var(--border); stroke-width: 1; }
.scurve .axis { fill: var(--muted); font-size: 11px; }
.scurve .today { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.scurve .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.scurve .series.plan { stroke: var(--series-plan); stroke-dasharray: 6 4; }
.scurve .series.actual { stroke: var(--series-actual); }
.scurve .dot.actual { fill: var(--series-actual); stroke: var(--surface); stroke-width: 2; }
.scurve .end-label { font-size: 12px; font-weight: 600; fill: var(--text); }
.scurve .crosshair { stroke: var(--muted); stroke-width: 1; }
.scurve .hit { fill: transparent; cursor: crosshair; }
.chart-legend { display: flex; gap: 16px; margin: 0 0 8px; font-size: .85rem; color: var(--text); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ln { display: inline-block; width: 22px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 4px; }
.ln.plan { border-color: var(--series-plan); border-top-style: dashed; }
.ln.actual { border-color: var(--series-actual); }
.chart-tip { position: absolute; top: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 8px 10px; font-size: .85rem; pointer-events: none; white-space: nowrap; }
.scurve details { margin-top: 10px; font-size: .88rem; }
.scurve summary { cursor: pointer; color: var(--muted); }

/* BOQ */
.wi-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; padding: 16px 20px 12px; }
.wi-head h2 { margin: 0; }
#boqTable tbody td:first-child, #planTable td:first-child { min-width: 160px; }
tr.group td { background: var(--surface-2); border-top: 2px solid var(--border); }
.meter { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.meter-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; display: flex; }
.meter .seg.issued { background: var(--ok); }
.meter .seg.reserved { background: repeating-linear-gradient(45deg, var(--ok), var(--ok) 3px, var(--ok-soft) 3px, var(--ok-soft) 6px); }
.meter.near .seg.issued { background: var(--accent); }
.meter.near .seg.reserved { background: repeating-linear-gradient(45deg, var(--accent), var(--accent) 3px, var(--accent-soft) 3px, var(--accent-soft) 6px); }
.meter.over .seg.issued { background: var(--danger); }
.meter.over .seg.reserved { background: repeating-linear-gradient(45deg, var(--danger), var(--danger) 3px, var(--danger-soft) 3px, var(--danger-soft) 6px); }
.meter-pct { font-size: .8rem; font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; color: var(--muted); }
.meter.over .meter-pct { color: var(--danger); font-weight: 700; }
.meter.near .meter-pct { color: var(--accent-strong); font-weight: 600; }
.legend { font-size: .8rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.legend .sw { display: inline-block; width: 14px; height: 8px; border-radius: 4px; margin-left: 6px; }
.legend .sw.issued { background: var(--ok); }
.legend .sw.reserved { background: repeating-linear-gradient(45deg, var(--ok), var(--ok) 3px, var(--ok-soft) 3px, var(--ok-soft) 6px); }
.form-error { white-space: pre-line; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: .9rem; }
.timeline li::before { content: ''; position: absolute; left: 5px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ''; position: absolute; left: 8.5px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .when { color: var(--muted); font-size: .8rem; }

.notice { padding: 12px 14px; border-radius: 8px; font-size: .9rem; margin-bottom: 14px; }
.notice.info { background: var(--info-soft); color: var(--info); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.danger { background: var(--danger-soft); color: var(--danger); }

/* ------------------------------------------------ login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--nav-bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 14px; padding: 28px 26px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.login-card .brand { color: var(--text); font-size: 1.15rem; margin-bottom: 4px; }
.login-card p.sub { color: var(--muted); margin: 0 0 20px; font-size: .9rem; }
.login-card form { display: grid; gap: 14px; }

/* ------------------------------------------------ dialog & toast */
dialog.dialog { border: none; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0,0,0,.3); }
dialog.dialog::backdrop { background: rgba(15, 20, 28, .55); }
.dlg-form { padding: 22px 22px 18px; }
.dlg-form h2 { margin-bottom: 16px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: min(440px, calc(100vw - 32px)); }
.toast { background: #1c2430; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: .92rem; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: toast-in .2s ease-out; }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* เฟส 4 */
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.steps { display: flex; gap: 10px; flex-wrap: wrap; list-style: none; counter-reset: step; padding: 0; margin: 0 0 16px; }
.steps li { counter-increment: step; flex: 1 1 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; font-size: .88rem; color: var(--muted); }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; margin-right: 8px; font-size: .8rem; }
.export-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.export-card { display: flex; flex-direction: column; margin: 0; }
.export-card h2 { margin: 0 0 4px; }
.export-card p { margin: 0 0 12px; font-size: .88rem; flex: 1; }
.export-card .btn { align-self: flex-start; }
.note-input { width: 100%; min-width: 120px; }
#countTable .line-input { width: 96px; }
#countTable td:nth-child(1) { white-space: nowrap; }
#countTable td:nth-child(2) { min-width: 180px; }
#countTable .note-input { min-width: 100px; }
#countTable td:last-child { min-width: 140px; }
.bars { position: relative; }
.bars-plot { position: relative; overflow-x: auto; }
@media (max-width: 600px) { .bars svg { min-width: 560px; } }
.bars svg { width: 100%; height: auto; display: block; overflow: visible; }
.bars .grid { stroke: var(--border); stroke-width: 1; }
.bars .baseline { stroke: var(--muted); stroke-width: 1; }
.bars .axis { fill: var(--muted); font-size: 11px; }
.bars .bar { fill: var(--series-plan); }
.bars .bar-g.active .bar { fill: var(--series-plan-hover, var(--series-plan)); opacity: .8; }
.bars .hit { fill: transparent; }
.bars details { margin-top: 10px; font-size: .88rem; }
.bars summary { cursor: pointer; color: var(--muted); }
.share { display: flex; align-items: center; gap: 8px; }
.share-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; }
.share-bar span { display: block; height: 100%; border-radius: 999px; background: var(--series-plan); }
.share .muted { min-width: 44px; text-align: right; font-size: .8rem; font-variant-numeric: tabular-nums; }
.exec-table td { vertical-align: top; }
.exec-table td:first-child { min-width: 190px; }

/* ------------------------------------------------ print */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .topbar, .sidenav, .no-print, .actions, #toasts, .back { display: none !important; }
  .shell { display: block; }
  main#view { padding: 0; max-width: none; }
  .card { box-shadow: none; border: none; padding: 0; margin-bottom: 12px; }
  .print-only { display: block; }
  th { background: #eee !important; color: #000; }
  .badge { border: 1px solid #999; background: none !important; color: #000 !important; }
  tr.low td { background: none; }
  .signatures { display: grid !important; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 48px; text-align: center; font-size: 11pt; }
  .signatures .line { border-top: 1px dotted #000; margin-top: 48px; padding-top: 4px; }
  .blind-print .sys-col { display: none !important; }
  .blind-print .line-input { border: 1px solid #000; color: transparent; }
  .bars .bar { fill: #555; }
  .share-bar span { background: #555; }
}
