/* RFI Management System — staff app + customer portal */
:root {
  --navy: #0d2463; --brand: #173a8a; --brand-ink: #ffffff; --accent: #e3262d; --steel: #2f6a8c;
  --bg: #f3f5fa; --surface: #ffffff; --surface-2: #f7f9fc; --line: #d8deea; --line-strong: #b9c2d4;
  --ink: #14203a; --muted: #5d6880; --tint: #e9effb; --focus: #f2a900;
  --ok-bg: #d9f2e3; --ok-ink: #14532d; --warn-bg: #fff0c9; --warn-ink: #6b4a00; --bad-bg: #fde2df; --bad-ink: #8f1d15; --info-bg: #dbe7ff; --info-ink: #0d2463; --neutral-bg: #e6e9f0; --neutral-ink: #36415a;
  --bar: #2f6a8c; --shadow: 0 8px 30px rgba(13, 36, 99, .14); --radius: 10px; --side: 248px;
  --font: 'Inter', 'Noto Sans Lao', 'Noto Sans Thai', 'Noto Sans SC', 'Lao UI', 'Leelawadee UI', 'Phetsarath OT', 'Microsoft YaHei', system-ui, sans-serif;
}
:root[data-theme="dark"] {
  --navy: #0b1220; --brand: #7aa2f7; --brand-ink: #0b1220; --accent: #ff6b6b; --steel: #6fb3d9;
  --bg: #0e1526; --surface: #161f33; --surface-2: #1b2640; --line: #2a3654; --line-strong: #3b4a70;
  --ink: #e6ebf5; --muted: #9aa7c0; --tint: #1f2c4a; --focus: #ffd166;
  --ok-bg: #143d29; --ok-ink: #9be7b8; --warn-bg: #45360c; --warn-ink: #ffd98a; --bad-bg: #4a1c1a; --bad-ink: #ffb3ad; --info-bg: #1c2f5c; --info-ink: #b8ccff; --neutral-bg: #27324d; --neutral-ink: #c3cde0;
  --bar: #6fb3d9; --shadow: 0 8px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
body.lao { line-height: 1.7; }
h1, h2, h3, p { margin: 0; } h1, h2, h3 { line-height: 1.25; text-wrap: balance; }
a { color: var(--brand); }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.muted { color: var(--muted); } .small { font-size: 13px; } .nowrap { white-space: nowrap; } .right { text-align: right; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row.end { justify-content: flex-end; } .row.between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 14px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* buttons + inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--tint); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); } .btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--bad-ink); border-color: var(--bad-ink); } .btn.danger:hover { background: var(--bad-bg); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn[disabled], .busy { opacity: .55; cursor: not-allowed; pointer-events: none; }
.link { background: none; border: 0; padding: 2px; font: inherit; font-weight: 600; font-size: inherit; color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link.danger { color: var(--bad-ink); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--ink); font: inherit; font-size: 17px; cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--tint); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=number], input[type=tel], textarea, select {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
textarea { resize: vertical; min-height: 70px; }
input:hover, textarea:hover, select:hover { border-color: var(--steel); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.field { min-width: 0; } .field label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 5px; }
.field .alt { display: block; font-weight: 400; font-size: 12px; color: var(--muted); } .req { color: var(--accent); }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; } .grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.span2 { grid-column: span 2; } .span-all { grid-column: 1 / -1; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }

/* layout */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--navy); color: #dfe6f7; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; text-decoration: none; }
.brand img { height: 34px; max-width: 60px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px; }
.brand-mark { width: 32px; height: 32px; border-radius: 50%; border: 6px solid #7aa2f7; border-right-color: var(--accent); border-bottom-color: var(--accent); flex: none; }
.brand b { display: block; font-size: 15px; line-height: 1.2; } .brand small { color: #9fb0d6; font-size: 11.5px; }
.nav { padding: 6px 10px 18px; display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #cfd8ee; text-decoration: none; font-weight: 500; font-size: 14px; }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a[aria-current="page"] { background: #fff; color: #0d2463; font-weight: 700; }
.nav .ico { width: 18px; text-align: center; opacity: .9; }
.nav-group { margin: 16px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8fa0c8; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.top .search { flex: 1; max-width: 460px; } .top .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; padding: 7px 11px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.dot { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.user-chip { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.user-chip:hover { background: var(--tint); } .user-chip small { color: var(--muted); font-size: 11.5px; }
.content { padding: 22px 24px 60px; max-width: 1500px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: 24px; letter-spacing: -.01em; } .page-head p { color: var(--muted); margin-top: 3px; }
.menu-btn { display: none; }
.pop { position: absolute; right: 16px; top: 58px; width: min(400px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 40; }
.pop-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.notif { display: block; width: 100%; text-align: left; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; cursor: pointer; }
.notif:hover { background: var(--tint); } .notif.unread { border-left: 3px solid var(--brand); font-weight: 600; } .notif small { display: block; color: var(--muted); font-weight: 400; }
.menu-item { display: block; width: 100%; text-align: left; padding: 10px 14px; border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; } .menu-item:hover { background: var(--tint); }

/* cards, tables */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card > h2, .card > .row > h2 { font-size: 16px; } .card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--steel); margin: 0 0 8px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); display: block; }
a.stat:hover { border-color: var(--brand); } .stat b { display: block; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; } .stat span { color: var(--muted); font-size: 13px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
.data th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data tbody tr:last-child td { border-bottom: 0; } .data tr.clickable { cursor: pointer; } .data tr.clickable:hover { background: var(--tint); }
.data .num { text-align: right; font-variant-numeric: tabular-nums; } .data .clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-sort { border: 0; background: none; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; padding: 0; font-weight: 700; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.tone-ok { background: var(--ok-bg); color: var(--ok-ink); } .tone-warn { background: var(--warn-bg); color: var(--warn-ink); } .tone-bad { background: var(--bad-bg); color: var(--bad-ink); }
.tone-info { background: var(--info-bg); color: var(--info-ink); } .tone-neutral { background: var(--neutral-bg); color: var(--neutral-ink); }
.empty { text-align: center; padding: 44px 16px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); display: grid; gap: 8px; justify-items: center; }
.empty b { color: var(--ink); font-size: 16px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 13px; flex-wrap: wrap; } .pager-btns { display: flex; gap: 10px; align-items: center; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.count { font-size: 11.5px; background: var(--neutral-bg); color: var(--neutral-ink); border-radius: 9px; padding: 0 7px; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; align-items: end; }
.kv { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: 6px 14px; margin: 0; } .kv dt { color: var(--muted); font-size: 13.5px; } .kv dd { margin: 0; font-weight: 500; white-space: pre-wrap; overflow-wrap: anywhere; }
.meter { height: 8px; border-radius: 4px; background: var(--neutral-bg); overflow: hidden; } .meter span { display: block; height: 100%; background: var(--bar); border-radius: 4px; }
.bars { display: grid; gap: 7px; } .bar-row { display: grid; grid-template-columns: minmax(80px, 30%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); } .bar-track { height: 12px; display: block; } .bar-fill { display: block; height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 0; }
.bar-row:hover .bar-fill { filter: brightness(1.2); } .bar-value { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 34px; text-align: right; }
.list-plain { list-style: none; margin: 0; padding: 0; } .list-plain li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: center; } .list-plain li:last-child { border-bottom: 0; }

/* RFI form */
.form-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }
.section-nav { position: sticky; top: 76px; display: grid; gap: 4px; } .section-nav a { padding: 8px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 13.5px; border-left: 3px solid var(--line); }
.section-nav a:hover { color: var(--brand); border-left-color: var(--brand); background: var(--tint); }
.section { scroll-margin-top: 76px; } .section > h2 { font-size: 17px; color: var(--brand); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.two-col { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 18px; align-items: start; }
.svc { display: grid; gap: 8px; } .svc-row { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: var(--surface); } .svc-row.on { border-color: var(--brand); background: var(--tint); }
.svc-row .check b { font-weight: 600; } .svc-row small { color: var(--muted); display: block; font-size: 12px; } .svc-extra { margin-top: 8px; display: grid; gap: 8px; }
.svc-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--neutral-bg); color: var(--neutral-ink); font-size: 11.5px; font-weight: 700; flex: none; }
.item { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--surface); } .item + .item { margin-top: 10px; } .item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 700; }
.with-unit { display: grid; grid-template-columns: minmax(0, 1fr) 84px; gap: 6px; }
.officer { background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 8px; padding: 10px; margin-top: 10px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 24px; margin: 20px -24px -60px; display: flex; justify-content: flex-end; gap: 10px; z-index: 10; }
.combo { position: relative; } .combo-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 15; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow); max-height: 280px; overflow: auto; margin-top: 4px; }
.combo-opt { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--ink); font: inherit; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); } .combo-opt:hover, .combo-opt:focus { background: var(--tint); } .combo-opt small { color: var(--muted); display: block; }
.picked { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--surface-2); }

/* documents */
.docgroup { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); } .docgroup + .docgroup { margin-top: 14px; }
.docgroup > h3 { margin: 0; padding: 10px 14px; background: #a3b523; color: #1f2a00; font-size: 14.5px; text-transform: none; letter-spacing: 0; } .docgroup > h3 small { display: block; font-weight: 500; font-size: 12.5px; }
.doc { padding: 12px 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; } .doc-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.doc-name b { display: block; } .doc-name small { color: var(--muted); display: block; font-size: 12.5px; } .doc-name .rednote { color: var(--accent); font-weight: 600; }
.doc-file { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; } .doc-meta { color: var(--muted); font-size: 12.5px; }
.callout { border-radius: 8px; padding: 9px 12px; font-size: 13.5px; } .callout.info { background: var(--info-bg); color: var(--info-ink); } .callout.warn { background: var(--warn-bg); color: var(--warn-ink); } .callout.bad { background: var(--bad-bg); color: var(--bad-ink); } .callout.ok { background: var(--ok-bg); color: var(--ok-ink); }
.yn { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; } .yn button { border: 0; background: var(--surface); color: var(--muted); font: inherit; font-weight: 700; font-size: 12.5px; padding: 6px 12px; cursor: pointer; min-width: 46px; } .yn button + button { border-left: 1px solid var(--line-strong); }
.yn button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); } .timeline li { position: relative; padding: 0 0 14px 14px; } .timeline li::before { content: ''; position: absolute; left: -21px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--steel); border: 2px solid var(--surface); }
.timeline .when { color: var(--muted); font-size: 12.5px; }
.comment { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); } .comment.customer { border-left: 4px solid var(--steel); } .comment-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }

/* modal + toast */
.modal-back { position: fixed; inset: 0; background: rgba(8, 15, 35, .55); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; width: min(540px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow); } .modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); } .modal-head h2 { font-size: 17px; }
.modal-body { padding: 18px; overflow: auto; display: grid; gap: 14px; } .modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.preview-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; } .preview-img { max-width: 100%; max-height: 70vh; margin: 0 auto; display: block; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 11px 14px; border-radius: 8px; box-shadow: var(--shadow); font-weight: 600; font-size: 14px; background: var(--ok-bg); color: var(--ok-ink); border: 1px solid currentColor; } .toast.bad { background: var(--bad-bg); color: var(--bad-ink); }
.linkbox { display: flex; gap: 8px; } .linkbox input { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

/* login + portal */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--navy), #173a8a); }
.login { width: min(400px, 100%); background: var(--surface); border-radius: 14px; padding: 28px; display: grid; gap: 14px; box-shadow: var(--shadow); } .login h1 { font-size: 21px; } .login .err { color: var(--bad-ink); font-weight: 600; font-size: 14px; }
.portal-top { background: var(--surface); border-bottom: 3px solid var(--navy); } .portal-top .in { max-width: 880px; margin: 0 auto; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.portal-top .brand { color: var(--ink); padding: 0; } .portal-top .brand small { color: var(--muted); } .portal { max-width: 880px; margin: 0 auto; padding: 20px 16px 60px; display: grid; gap: 16px; }
.portal h1 { font-size: clamp(22px, 5vw, 30px); color: var(--brand); } .steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; list-style: none; margin: 0; padding: 0; }
.steps li { border-top: 4px solid var(--line); padding-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); } .steps li.on { border-top-color: var(--brand); color: var(--brand); } .steps li.past { border-top-color: var(--steel); color: var(--ink); }
.ref-box { font-size: 24px; font-weight: 700; letter-spacing: .04em; padding: 10px 16px; border: 2px dashed var(--steel); border-radius: 8px; display: inline-block; user-select: all; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; } .side { position: fixed; left: 0; top: 0; bottom: 0; width: var(--side); z-index: 60; transform: translateX(-100%); transition: transform .18s; } .shell.nav-open .side { transform: none; box-shadow: var(--shadow); }
  .menu-btn { display: inline-grid; } .form-layout { grid-template-columns: 1fr; } .section-nav { display: none; } .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } .content { padding: 16px 14px 60px; } .top { padding: 8px 12px; } .top .search { display: none; } .user-chip small { display: none; }
  .sticky-actions { margin: 20px -14px -60px; padding: 10px 14px; } .kv { grid-template-columns: 1fr; gap: 0 0; } .kv dd { margin-bottom: 8px; } .steps li span { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ══════════ Theme from the Sitthi Logistics logo: blue #2B3990 · red #E8262D · orange #F58220 ══════════ */
:root {
  --navy: #1d2766; --brand: #2b3990; --brand-2: #3f4fb5; --accent: #e8262d; --orange: #f58220; --steel: #2b3990;
  --bg: #f4f5fb; --surface-2: #f8f9fd; --line: #dfe2f0; --line-strong: #bfc5df; --ink: #171c3a; --muted: #5f6787; --tint: #eceefa; --focus: #f58220;
  --info-bg: #e3e7fb; --info-ink: #232f7c; --warn-bg: #ffecd6; --warn-ink: #8a4300; --bar: #2b3990;
  --shadow: 0 10px 34px rgba(29, 39, 102, .16); --shadow-sm: 0 1px 2px rgba(29, 39, 102, .06), 0 2px 8px rgba(29, 39, 102, .05);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme="dark"] {
  --navy: #0d1130; --brand: #8fa0ff; --brand-2: #aab7ff; --accent: #ff6b70; --orange: #ffa55c; --steel: #9fb0ff;
  --bg: #0e1128; --surface: #171b3a; --surface-2: #1d2247; --line: #2c3263; --line-strong: #404887; --ink: #e9ebfa; --muted: #a1a8cf; --tint: #232a59; --bar: #8fa0ff;
}
.side { background: linear-gradient(180deg, #232e7d 0%, #1a2260 100%); }
.brand { padding: 16px 16px 12px; } .brand img { height: auto; width: 100%; max-width: 172px; background: #fff; border-radius: 10px; padding: 8px 12px; }
.nav a[aria-current="page"] { background: #fff; color: #2b3990; box-shadow: inset 4px 0 0 var(--accent); }
.nav a { transition: background-color .15s, color .15s, transform .15s var(--ease); } .nav a:hover { transform: translateX(2px); }
.top { box-shadow: var(--shadow-sm); border-bottom-color: transparent; backdrop-filter: saturate(1.2) blur(8px); background: color-mix(in srgb, var(--surface) 92%, transparent); }
.portal-top { border-bottom: 3px solid var(--brand); position: relative; } .portal-top::after { content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; background: linear-gradient(90deg, var(--accent) 0 34%, var(--orange) 34% 50%, var(--brand) 50%); }
.portal-top .brand img { max-width: 120px; padding: 0; border-radius: 0; } .portal-top .brand b { display: none; }
.login-wrap { background: radial-gradient(1200px 600px at 10% -10%, #3f4fb5 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #e8262d55 0%, transparent 55%), #1d2766; }
.login { animation: pop .45s var(--ease); } .login-logo { width: 190px; max-width: 70%; display: block; margin: 0 auto 4px; }
.btn { transition: background-color .15s, border-color .15s, box-shadow .15s, transform .08s; box-shadow: var(--shadow-sm); } .btn:active { transform: translateY(1px) scale(.985); }
.btn.primary { background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-color: var(--brand); } .btn.primary:hover { box-shadow: 0 4px 14px rgba(43, 57, 144, .35); filter: none; }
:root[data-theme="dark"] .btn.primary { color: #0d1130; }
.card, .stat, .tablewrap, .docgroup { box-shadow: var(--shadow-sm); }
.stat { transition: transform .18s var(--ease), box-shadow .18s, border-color .18s; position: relative; overflow: hidden; } a.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); } .stats .stat:nth-child(3n+2)::before { background: var(--orange); } .stats .stat:nth-child(3n)::before { background: var(--accent); }
.docgroup > h3 { background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; } .docgroup > h3 small { color: #dfe4ff; }
.steps li.on { border-top-color: var(--accent); color: var(--brand); } .steps li.past { border-top-color: var(--brand); }
.tab { transition: color .15s, border-color .2s; } .tab[aria-selected="true"] { border-bottom-color: var(--accent); }
.data tr.clickable { transition: background-color .12s; } input, textarea, select { transition: border-color .15s, box-shadow .15s; } input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); outline: none; }
.fgroup { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 14px; margin: 0; min-width: 0; background: var(--surface); } .fgroup + .fgroup { margin-top: 12px; }
.fgroup legend { font-weight: 700; font-size: 13px; padding: 0 8px; color: var(--brand); } .fgroup-from { border-left: 4px solid var(--orange); } .fgroup-to { border-left: 4px solid var(--brand); }
.combo-wrap { display: block; }

/* motion */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slidein { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes load { 0% { transform: translateX(-100%); } 60% { transform: translateX(-12%); } 100% { transform: translateX(0); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(232, 38, 45, .45); } 50% { box-shadow: 0 0 0 7px rgba(232, 38, 45, 0); } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.content.enter > * > * { animation: rise .38s var(--ease) both; } .content.enter > * > *:nth-child(2) { animation-delay: .04s; } .content.enter > * > *:nth-child(3) { animation-delay: .08s; } .content.enter > * > *:nth-child(n+4) { animation-delay: .12s; }
.portal > * { animation: rise .4s var(--ease) both; } .portal > *:nth-child(2) { animation-delay: .05s; } .portal > *:nth-child(n+3) { animation-delay: .1s; }
.modal-back { animation: fade .16s ease-out; } .modal { animation: pop .24s var(--ease); } .pop { animation: pop .18s var(--ease); transform-origin: top right; }
.toast { animation: slidein .28s var(--ease); } .badge { transition: background-color .2s, color .2s; }
.bar-fill, .meter span { transform-origin: left; animation: grow .7s var(--ease) both; }
.svc-row, .item, .doc, .comment { transition: border-color .18s, background-color .18s, box-shadow .18s; } .svc-row.on { animation: pop .22s var(--ease); }
.btn.pulse { animation: pulse 1.6s infinite; }
body::before { content: ''; position: fixed; left: 0; top: 0; height: 3px; width: 100%; z-index: 300; background: linear-gradient(90deg, var(--accent), var(--orange), var(--brand)); transform: translateX(-100%); opacity: 0; pointer-events: none; }
body.loading::before { opacity: 1; animation: load 1.2s var(--ease) forwards; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ══════════ quotation editor — the sheet looks like the printed form ══════════ */
.q-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.q-side { display: grid; gap: 12px; position: sticky; top: 74px; } .q-side .card { padding: 14px; } .q-side .btn { width: 100%; }
.qsheet { --q-head: #1463c4; --q-head-text: #fff; --q-sub: #b9c5ea; --q-alt: #e4f0dc; --q-border: #000; --q-cond: #35b7c0;
  background: #fff; color: #000; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: 26px 28px 30px; font: 13px/1.35 'Times New Roman', 'SimSun', 'Noto Serif SC', 'Phetsarath OT', 'Lao UI', serif; min-width: 0; }
.qsheet.sans { font-family: Arial, 'Microsoft YaHei', 'Lao UI', 'Leelawadee UI', sans-serif; }
.qsheet input, .qsheet textarea, .qsheet select { font: inherit; color: #000; background: transparent; border: 1px dashed transparent; border-radius: 3px; min-height: 0; padding: 2px 4px; width: 100%; box-shadow: none; }
.qsheet input:hover, .qsheet textarea:hover, .qsheet select:hover { border-color: #9aa3c4; } .qsheet input:focus, .qsheet textarea:focus, .qsheet select:focus { border: 1px solid #2b3990; background: #f6f8ff; box-shadow: none; }
.qsheet input:disabled, .qsheet textarea:disabled, .qsheet select:disabled { opacity: 1; -webkit-text-fill-color: #000; }
.qsheet textarea { resize: none; overflow: hidden; display: block; }
.q-lh { display: flex; justify-content: center; align-items: center; gap: 10px; } .q-lh img { height: 58px; } .q-lh > div { border-bottom: 2px solid #e3262d; padding-bottom: 2px; color: #2b3a8f; font: 9.5px/1.3 'Lao UI', 'Leelawadee UI', Arial, sans-serif; } .q-lh > div div:nth-child(-n+2) { font-size: 12px; font-weight: 700; }
.q-title { text-align: center; font-size: 23px !important; font-weight: 700; margin: 14px 0 12px; }
.q-head { display: grid; grid-template-columns: 1.6fr 1fr 1.05fr; gap: 14px; align-items: end; }
.q-kv label { display: grid; grid-template-columns: auto 1fr; gap: 6px; align-items: center; } .q-kv label span { white-space: nowrap; min-width: 74px; }
.q-kv.boxed label span { text-align: right; } .q-kv.boxed input, .q-kv.boxed select, .q-kv.boxed .combo-wrap input { border: 1px solid var(--q-border); border-radius: 0; margin-top: -1px; }
.q-cap { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 2px; font-weight: 700; } .q-mini { width: auto !important; border: 1px solid #9aa3c4 !important; font-size: 12px !important; }
.q-scroll { overflow-x: auto; }
.q-table { width: 100%; border-collapse: collapse; } .q-table th, .q-table td { border: 1px solid var(--q-border); padding: 2px 3px; vertical-align: middle; }
.q-table th { background: var(--q-head); color: var(--q-head-text); font-weight: 700; text-align: center; } .q-table .no { width: 30px; text-align: center; } .q-table .unit { width: 108px; text-align: center; } .q-table .unit input, .q-table .unit select { text-align: center; }
.q-table .val { width: 104px; } .q-table .val input.num { text-align: right; font-variant-numeric: tabular-nums; }
.q-table .ctl { width: 34px; border: 0 !important; background: transparent !important; padding: 0 0 0 4px; } .q-table tr.sub td { background: var(--q-sub); text-align: center; } .q-table tr.sub td.ctl { background: transparent; }
.q-table tr.alt td, .q-table tr.x td { background: var(--q-alt); } .q-table tr.alt td.ctl, .q-table tr.x td.ctl { background: transparent; }
.q-th { color: var(--q-head-text) !important; text-align: center; font-weight: 700 !important; } .q-col { text-align: center; font-size: 12px !important; } .q-colctl { justify-content: center; gap: 4px; flex-wrap: nowrap; }
.q-rowctl { display: grid; gap: 0; } .icon-btn.sm { width: 26px; height: 24px; font-size: 12px; border-radius: 6px; color: #4a5278; } .icon-btn.sm:hover { background: #eceefa; color: #e8262d; }
.q-add { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 0 34px; font-family: var(--font); } .q-accept input { color: #1a1aa8 !important; font-weight: 700; margin: 8px 0 0 30px; width: calc(100% - 30px); }
.q-cond-title { background: #d6dcf0; font-weight: 700; text-decoration: underline; text-align: center; width: 270px; margin: 26px 0 0 30px; font-size: 15px; } .q-table.cond td { border-color: var(--q-cond); }
.q-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin: 24px 30px 0; } .q-sign .q-kv label { border-bottom: 1px solid var(--q-cond); }
.q-colours { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .q-colour { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; } .q-colour input { width: 30px; height: 26px; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px; background: none; }
.share-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.share-btn { display: grid; justify-items: center; gap: 6px; padding: 14px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; transition: transform .16s var(--ease), box-shadow .16s, border-color .16s; }
.share-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand); }
.share-ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); color: var(--brand); font-size: 18px; font-weight: 700; } .share-ico.wa { background: #25d366; color: #fff; } .share-ico.ln { background: #06c755; color: #fff; } .share-ico.tg { background: #2aabee; color: #fff; } .share-ico.wc { background: #07c160; color: #fff; }
@media (max-width: 1100px) { .q-layout { grid-template-columns: 1fr; } .q-side { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }
@media (max-width: 700px) { .qsheet { padding: 14px 12px 18px; } .q-head { grid-template-columns: 1fr; gap: 6px; } .q-sign { grid-template-columns: 1fr; margin: 18px 0 0; gap: 14px; } .q-add { margin-left: 0; } .q-cond-title { margin-left: 0; width: 100%; } .q-table.charges { min-width: 620px; } .q-lh img { height: 44px; } }
.q-unit { text-align: center; } .q-pick { width: 100% !important; font-size: 10.5px !important; padding: 0 2px !important; border-color: transparent !important; color: #5f6787 !important; font-family: var(--font) !important; } .q-pick:hover { border-color: #9aa3c4 !important; }

.card.selected { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent); } code { background: var(--tint); padding: 2px 6px; border-radius: 5px; font-size: 12.5px; user-select: all; overflow-wrap: anywhere; }

/* ══════════ quotation editor: formatting bar, switches, page setup ══════════ */
.q-main { min-width: 0; display: grid; gap: 10px; justify-items: center; } .q-main .qsheet { width: 100%; transition: max-width .3s var(--ease), padding .3s var(--ease); }
.fmtbar { position: sticky; top: 64px; z-index: 12; width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-sm); }
.fmtbar .fsel { width: 170px; min-height: 34px; padding: 4px 8px; } .fmtbar .fsize { width: 68px; min-height: 34px; padding: 4px 8px; }
.fgrp { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.fbtn { min-width: 34px; height: 34px; border: 0; background: var(--surface); color: var(--ink); font: 700 14px/1 Georgia, 'Times New Roman', serif; cursor: pointer; transition: background-color .15s, color .15s; } .fgrp .fbtn + .fbtn { border-left: 1px solid var(--line-strong); }
.fbtn[data-k="i"] { font-style: italic; } .fbtn[data-k="u"] { text-decoration: underline; } .fbtn:hover { background: var(--tint); } .fbtn[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.fbtn.wide { border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 10px; font: 600 12.5px var(--font); }
.fcolwrap { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 8px; font-weight: 700; cursor: pointer; } .fcolwrap.hl { color: #d9a800; }
.fcol { width: 22px; height: 22px; padding: 0; border: 0; background: none; min-height: 0; cursor: pointer; } .fhint { margin-left: auto; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; } .switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--line-strong); position: relative; transition: background-color .2s; }
.switch .track::after { content: ''; position: absolute; left: 2px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s var(--ease); }
.switch input:checked + .track { background: var(--brand); } .switch input:checked + .track::after { transform: translateX(16px); } .switch input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; } .switch input:disabled + .track { opacity: .5; }
.q-side .seg { display: flex; width: 100%; } .q-side .seg button { flex: 1; padding: 8px 6px; }
.q-margins { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-top: 6px; } .q-margin { display: grid; grid-template-columns: 1fr 64px; align-items: center; gap: 6px; font-size: 13px; } .q-margin input { min-height: 32px; padding: 3px 6px; }
.q-lh > div { font-family: var(--q-lh-font, 'Noto Sans Lao', 'Lao UI', sans-serif) !important; }
.q-kv label { align-items: start; } .q-kv textarea { min-height: 0; line-height: 1.35; } .q-kv.boxed label { align-items: center; }
.q-accept textarea { color: #1a1aa8; font-weight: 700; margin: 8px 0 0 30px; width: calc(100% - 30px); }
.q-table .val textarea.num { text-align: right; font-variant-numeric: tabular-nums; } .q-table .val textarea { min-height: 0; }
.q-colctl { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px; font-family: var(--font); } .q-width { width: 62px !important; text-align: center; } textarea.q-th, textarea.q-col { text-align: center; }
@media (max-width: 700px) { .fmtbar { top: 56px; } .fhint { display: none; } .q-accept textarea { margin-left: 0; width: 100%; } }
