:root {
  --bg: #f4f6fb; --panel: #ffffff; --ink: #0f172a; --muted: #64748b; --line: #e2e8f0; --soft: #f1f5f9;
  --primary: #1a5fd0; --primary-ink: #ffffff; --primary-soft: #ecf3ff; --navy: #0b2a66; --cyan: #17b3d6; --brand-green: #10a36b;
  --green: #059669; --green-soft: #e7f8f1; --amber: #b45309; --amber-soft: #fff6e5;
  --red: #dc2626; --red-soft: #fdecec; --violet: #7c3aed; --violet-soft: #f3edff; --slate-soft: #eef2f7;
  --side: #0a1f47; --side-ink: #c9d6ee; --side-active: #13306a;
  --radius: 10px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.05);
  font-family: 'IBM Plex Sans Thai', 'Sarabun', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; } .mono { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .row.end { justify-content: flex-end; } .grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid { display: grid; gap: 14px; }
.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)); } .g5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
@media (max-width: 1200px) { .g5 { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 900px) { .g2, .g3, .g4, .g5 { grid-template-columns: 1fr; } }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 16px; padding: 6px 10px 16px; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); display: grid; place-items: center; font-size: 13px; }
.brand .logo-img { width: 40px; height: 34px; object-fit: contain; background: #fff; border-radius: 9px; padding: 3px; }
.brand-sub { font-size: 10.5px; font-weight: 400; color: #8fb2e8; letter-spacing: .02em; }
.side { background: linear-gradient(180deg, #0a1f47 0%, #0b2a66 100%); }
.nav a.active { background: linear-gradient(90deg, #1a5fd0, #17a0d6); }
.nav-count { background: #f59e0b; color: #111; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 0 7px; display: none; }
.gsearch { width: min(320px, 45vw); } .gsearch input { background: var(--soft); border-color: transparent; }
.login .card { border-top: 4px solid var(--primary); }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-ink); }
.nav a:hover { background: var(--side-active); text-decoration: none; color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }
.nav a .ic { width: 18px; text-align: center; opacity: .9; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .menu-btn { display: none; }
.content { padding: 22px 24px 60px; max-width: 1400px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { flex: 1; min-width: 200px; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; left: -260px; width: 240px; transition: left .2s; }
  .side.open { left: 0; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
}

/* ---------- Components ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-b { padding: 16px; } .card-h { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card-h h2, .card-h h3 { flex: 1; }
.kpi { padding: 16px; } .kpi .label { color: var(--muted); font-size: 12.5px; } .kpi .value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 7px 13px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--soft); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); border-color: #f5c2c2; }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfd3fe; border-color: var(--primary); }
textarea { resize: vertical; min-height: 64px; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
label.f > span em { color: var(--red); font-style: normal; }
label.chk { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; } label.chk input { width: auto; }
.search { max-width: 280px; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); background: var(--soft); padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; } table.t tbody tr.click:hover td { background: #f8fafc; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tfoot td { font-weight: 600; background: var(--soft); }
.tbl-wrap { overflow-x: auto; }
.empty { padding: 36px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--slate-soft); color: #334155; white-space: nowrap; }
.badge.blue { background: var(--primary-soft); color: var(--primary); } .badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); } .badge.red { background: var(--red-soft); color: var(--red); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--primary); border-color: var(--primary); font-weight: 600; } .tabs a:hover { text-decoration: none; color: var(--ink); }

/* Document editor lines */
.lines td { padding: 6px; } .lines input, .lines select { padding: 5px 7px; }
.lines .w-qty { width: 80px; } .lines .w-price { width: 120px; } .lines .w-unit { width: 80px; }
.totals { margin-left: auto; width: min(380px, 100%); }
.totals .r { display: flex; justify-content: space-between; padding: 5px 0; gap: 12px; } .totals .r.big { font-size: 17px; font-weight: 700; border-top: 1px solid var(--line); padding-top: 9px; }
.ac { position: relative; } .ac-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); max-height: 260px; overflow-y: auto; min-width: 320px; }
.ac-list div { padding: 7px 10px; cursor: pointer; } .ac-list div:hover, .ac-list div.on { background: var(--primary-soft); }

/* Files */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 10px; }
.thumb { border: 1px solid var(--line); border-radius: 8px; padding: 5px; text-align: center; background: #fff; }
.thumb.primary { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.thumb img { width: 100%; height: 90px; object-fit: cover; border-radius: 6px; display: block; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.drop-zone.over { outline: 2px dashed var(--primary); background: var(--primary-soft); border-radius: 8px; }
.pimg { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); vertical-align: middle; background: #fff; }
.ac-list img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; vertical-align: middle; margin-right: 6px; }
.share-files { max-width: 210mm; margin: 0 auto 12px; background: #fff; border-radius: 10px; padding: 10px 14px; }
.share-files a { display: inline-flex; gap: 6px; align-items: center; margin: 4px 12px 4px 0; }
.paper .item-img { width: 46px; height: 46px; object-fit: contain; border-radius: 4px; border: 1px solid #e3e9f3; background: #fff; }

/* Profit (internal) */
.lines th.pf, .lines td.pf, table.t td.pf, table.t th.pf { background: #f3fbf7; }
.pfbox { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #f0faf5; border: 1px solid #c4ead8; }
.pfbox.low { background: var(--red-soft); border-color: #f5c2c2; }
.pfbox .r { display: flex; justify-content: space-between; padding: 3px 0; gap: 12px; } .pfbox .r.big { font-size: 16px; font-weight: 700; }

/* Credit */
.credit-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.credit-nums span { display: block; font-size: 11.5px; color: var(--muted); } .credit-nums b { font-size: 15px; }
.credit.compact .credit-nums b { font-size: 13.5px; }
.funnel { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.funnel .fs { width: var(--w); background: linear-gradient(90deg, var(--primary), var(--cyan)); color: #fff; border-radius: 8px; padding: 7px 12px; display: flex; justify-content: space-between; font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 7px 12px; cursor: pointer; font: inherit; } .seg button.on { background: var(--navy); color: #fff; }

/* Chain of documents */
.chain { display: flex; flex-direction: column; gap: 2px; }
.chain a { display: flex; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 6px; }
.chain a.cur { background: var(--primary-soft); font-weight: 600; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: var(--slate-soft); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.kcol h3 { font-size: 13px; display: flex; justify-content: space-between; margin-bottom: 8px; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.kcard:active { cursor: grabbing; } .kcol.drop { outline: 2px dashed var(--primary); }

/* Trip planner */
.planner { display: grid; grid-template-columns: 340px 1fr; gap: 14px; } @media (max-width: 1000px) { .planner { grid-template-columns: 1fr; } }
.stop { display: flex; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 8px; align-items: flex-start; }
.stop .seq { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }

/* Modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: min(640px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { width: min(980px, 100%); }
.modal-h { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; } .modal-h h2 { flex: 1; }
.modal-b { padding: 18px; } .modal-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 99; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; animation: tin .2s; }
.toast.err { background: var(--red); } .toast.ok { background: var(--green); }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 20% 20%, #dbe7ff, transparent 40%), radial-gradient(circle at 80% 80%, #e0f5ec, transparent 40%), var(--bg); padding: 16px; }
.login .card { width: min(400px, 100%); padding: 28px; }

/* Bars */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars .b i { display: block; width: 100%; max-width: 34px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .b span { font-size: 11px; color: var(--muted); }
.progress { height: 6px; background: var(--slate-soft); border-radius: 9px; overflow: hidden; } .progress i { display: block; height: 100%; background: var(--green); }

/* ---------- Print (A4) — หัวกระดาษ Wisepaq ---------- */
.print-root { background: #dfe5ee; min-height: 100vh; padding: 20px 0 40px; font-family: 'Sarabun', 'IBM Plex Sans Thai', sans-serif; }
.print-bar { max-width: 210mm; margin: 0 auto 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 0 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 7px 12px; cursor: pointer; font: inherit; } .seg button.on { background: var(--navy); color: #fff; }
.share-top { max-width: 210mm; margin: 0 auto 12px; display: flex; gap: 12px; align-items: center; background: #fff; padding: 10px 14px; border-radius: 10px; }
.share-top img { height: 44px; }
.paper { --navy: #0b2a66; --blue: #1a5fd0; --cyan: #17b3d6; --green: #10a36b; --ink: #1b2533; --line: #c9d3e3; --tint: #f2f6fc;
  width: 210mm; min-height: 297mm; margin: 0 auto 16px; background: #fff; padding: 10mm 12mm 8mm; box-shadow: 0 4px 18px rgba(10,31,71,.18);
  font-size: 12.6px; color: var(--ink); display: flex; flex-direction: column; position: relative; line-height: 1.45; }
.paper.half { min-height: auto; }
.paper .pre { white-space: pre-line; } .paper .small { font-size: 11.5px; } .paper .c { text-align: center; } .paper .r { text-align: right; white-space: nowrap; }
.lh { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.lh-left { display: flex; gap: 12px; align-items: center; min-width: 0; }
.lh-logo { height: 74px; width: auto; max-width: 110px; object-fit: contain; }
.lh-co { font-size: 11.6px; color: #3b4658; line-height: 1.45; }
.lh-name { font-size: 16.5px; font-weight: 700; color: var(--navy); line-height: 1.25; }
.lh-name2 { font-size: 12px; font-weight: 600; color: var(--blue); margin-bottom: 2px; }
.lh-right { text-align: right; flex: none; max-width: 76mm; }
.lh-title { display: inline-block; background: linear-gradient(90deg, var(--navy), var(--blue)); color: #fff; font-size: 17px; font-weight: 700; padding: 6px 14px; border-radius: 8px 0 8px 0; letter-spacing: .01em; }
.lh-sub { font-size: 11px; color: var(--blue); font-weight: 600; letter-spacing: .08em; margin-top: 3px; }
.lh-copy { display: inline-block; margin-top: 6px; border: 1.5px solid var(--navy); color: var(--navy); font-weight: 700; padding: 1px 12px; border-radius: 99px; font-size: 11.5px; }
.lh-copy.void { border-color: #c00; color: #c00; }
.lh-bar { height: 4px; margin: 8px 0 10px; border-radius: 4px; background: linear-gradient(90deg, var(--navy) 0%, var(--blue) 45%, var(--cyan) 75%, var(--green) 100%); }
.lh-bar.thin { height: 2px; margin: 0 0 5px; }
.paper .party { display: grid; grid-template-columns: 1fr 72mm; gap: 8px; }
.paper .box { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.paper .box-h { background: var(--tint); color: var(--navy); font-weight: 700; padding: 3px 10px; font-size: 11.5px; border-bottom: 1px solid var(--line); }
.paper .box-b { padding: 6px 10px; } .paper .pname { font-weight: 700; font-size: 13.5px; color: var(--navy); } .paper .mt { margin-top: 3px; }
.paper .meta .kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; } .paper .meta .kv span { color: #5b677a; } .paper .meta .kv b { text-align: right; }
.paper table.items { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 9px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.paper table.items thead th { background: var(--navy); color: #fff; padding: 6px 6px; font-weight: 600; font-size: 11.8px; text-align: left; }
.paper table.items th.r { text-align: right; } .paper table.items th.c { text-align: center; }
.paper table.items td { padding: 4px 6px; vertical-align: top; border-bottom: 1px solid #edf1f7; }
.paper table.items tbody tr:nth-child(even):not(.blank) td { background: #f7f9fd; }
.paper table.items tr.blank td { height: 21px; border-bottom-color: transparent; }
.paper table.items tr.txt td { background: var(--tint) !important; color: var(--navy); }
.paper table.items tr.total td { background: var(--tint); border-top: 1.5px solid var(--navy); }
.paper table.kvt th { background: var(--tint) !important; color: var(--navy) !important; text-align: left; border-bottom: 1px solid #e3e9f3; vertical-align: top; }
.paper .sum { display: grid; grid-template-columns: 1fr 76mm; gap: 8px; margin-top: 8px; }
.paper .sum-l { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.paper .words { background: var(--tint); color: var(--navy); font-weight: 700; text-align: center; padding: 5px 8px; border-radius: 6px; }
.paper .sum-r { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.paper .sum-r .r { display: flex; justify-content: space-between; padding: 3.5px 10px; border-bottom: 1px solid #edf1f7; }
.paper .sum-r .r.grand { background: linear-gradient(90deg, var(--navy), var(--blue)); color: #fff; font-weight: 700; font-size: 14px; padding: 6px 10px; border-bottom: 0; }
.paper .fn { font-size: 11.3px; margin-top: 6px; white-space: pre-line; color: #3b4658; }
.paper .signs { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 12px; margin-top: auto; padding-top: 22px; text-align: center; font-size: 11.6px; }
.paper .sign { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px 8px; }
.paper .sign-space { height: 46px; } .paper .sign .line { margin: 0 6px 2px; } .paper .sign-label { font-weight: 700; color: var(--navy); } .paper .sign-date { color: #5b677a; font-size: 11px; }
.paper .stamp { min-height: 40px; margin: 0 auto 4px; display: inline-block; border: 2px solid var(--green); color: var(--green); border-radius: 6px; padding: 1px 8px; font-size: 10px; line-height: 1.25; transform: rotate(-3deg); }
.paper .pf { margin-top: 10px; } .paper .pf-row { display: flex; justify-content: space-between; font-size: 10.5px; color: #6b7689; }
.paper .letter { flex: 1; margin-top: 10px; font-size: 14px; line-height: 1.8; outline: none; } .paper .letter p { margin: 0; }
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-bar, .share-top, .no-print, #toasts { display: none !important; }
  .print-root { padding: 0; background: #fff; }
  .paper { box-shadow: none; margin: 0; page-break-after: always; min-height: 296mm; }
  .paper.half { min-height: 296mm; }
}
@media (max-width: 600px) {
  .topbar { padding: 10px 12px; } .topbar .right, .topbar #pwBtn { display: none; } .gsearch { width: 40vw; }
  .page-head h1 { font-size: 19px; }
  .kanban { grid-template-columns: repeat(6, 240px); }
}

/* ===== หนังสือรับรองการหักภาษี ณ ที่จ่าย (50 ทวิ) ===== */
.paper.wht { font-size: 11.6px; line-height: 1.5; padding: 9mm 11mm; color: #000; }
.wht .wht-copy { text-align: right; font-size: 11px; }
.wht .wht-head { display: flex; justify-content: space-between; align-items: flex-end; margin: 1mm 0 2mm; }
.wht .wht-title { flex: 1; text-align: center; } .wht .wht-title b { font-size: 17px; } .wht .wht-no { text-align: right; line-height: 1.8; }
.wht .wbox { border: 1px solid #000; padding: 1.5mm 3mm; margin-bottom: -1px; }
.wht .wrow { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin: .5mm 0; } .wht .grow { flex: 1; }
.wht u { text-decoration: none; border-bottom: 1px dotted #000; padding: 0 4px; min-height: 1.3em; display: inline-block; }
.wht .hint { font-size: 9.6px; color: #333; margin: -0.6mm 0 0.6mm 10mm; }
.wht .tid { display: inline-flex; align-items: center; gap: 0; } .wht .tid i { font-style: normal; width: 4.6mm; height: 5.2mm; border: 1px solid #000; margin-left: -1px; display: inline-grid; place-items: center; font-weight: 600; }
.wht .tid em { font-style: normal; margin: 0 1.2mm; }
.wht .ck { display: inline-grid; place-items: center; width: 3.6mm; height: 3.6mm; border: 1px solid #000; font-size: 10px; font-weight: 700; line-height: 1; vertical-align: -1px; margin-left: 2mm; }
.wht .pnd { font-size: 11px; }
.wht table.wtbl { width: 100%; border-collapse: collapse; margin-top: 2mm; } .wht .wtbl th, .wht .wtbl td { border: 1px solid #000; padding: 1.2mm 2mm; vertical-align: top; }
.wht .wtbl th { font-weight: 600; text-align: center; background: #f3f3f3; } .wht .wtbl td.lbl { font-size: 11px; } .wht .wtbl .tot td { background: #f7f7f7; }
.wht .words-in { display: inline-block; margin-left: 4mm; padding: 0 3mm; background: #f3f3f3; }
.wht .wfoot { display: grid; grid-template-columns: 1fr 1.4fr 26mm; border: 1px solid #000; margin-top: 2mm; }
.wht .wfoot > div { padding: 2mm 3mm; } .wht .warn { border-right: 1px solid #000; font-size: 10.5px; } .wht .wsign { text-align: center; }
.wht .wseal { border: 1px dashed #555; border-radius: 50%; margin: 3mm; height: 22mm; display: grid; place-items: center; text-align: center; font-size: 10px; color: #555; padding: 0; }

/* ===== พิมพ์ลงฟอร์มเปล่า (Dot matrix) ===== */
.fwrap { display: grid; grid-template-columns: 330px 1fr; gap: 16px; padding: 16px; background: #dfe6f0; min-height: 100vh; align-items: start; }
.fpanel { position: sticky; top: 16px; background: #fff; border-radius: 10px; padding: 12px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 2px 10px rgba(10,31,71,.12); }
.fpages { overflow: auto; }
.fpage { position: relative; background: #fff; margin: 0 auto 16px; box-shadow: 0 4px 18px rgba(10,31,71,.18); overflow: hidden; color: #000; font-family: Tahoma, 'Sarabun', sans-serif; }
.fwrap.mono .fpage { font-family: 'Courier New', Tahoma, monospace; }
.fpage .ff { position: absolute; line-height: 1.2; }
.fpage .fbg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; opacity: .5; pointer-events: none; }
.fpage .fgrid { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(26,95,208,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(26,95,208,.12) 1px, transparent 1px); background-size: 10mm 10mm; }
.fpage.editing .ff { outline: 1px dashed rgba(26,95,208,.7); background: rgba(26,95,208,.06); cursor: move; user-select: none; }
.fpage.editing .ff.sel { outline: 2px solid #e03131; background: rgba(224,49,49,.08); z-index: 2; }
.fpage .ff .ph { color: #8a96a8; font-style: italic; }
.fpage .ff-col { position: absolute; border: 1px dashed rgba(16,163,107,.6); pointer-events: none; } .fpage .ff-col span { position: absolute; top: -4.5mm; left: 0; font-size: 8pt; color: #10a36b; white-space: nowrap; }
@media print { .fwrap { display: block; padding: 0; background: #fff; } .fpanel { display: none !important; } .fpages { overflow: visible; } }
/* ===== ภาพรวมการขายทีม ===== */
.team-bars { height: 170px; overflow-x: auto; }
.team-bars .b { min-width: 26px; }
.team-bars .pair { display: flex; align-items: flex-end; gap: 2px; width: 100%; justify-content: center; }
.team-bars .pair i { width: 45%; max-width: 18px; }
.team-bars .pair i.pf { background: var(--green); }
.lg-dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; vertical-align: 0; }
table.matrix td, table.matrix th { white-space: nowrap; }
table.matrix .stick { position: sticky; left: 0; background: #fff; z-index: 1; box-shadow: 1px 0 0 var(--line); }
table.matrix thead .stick, table.matrix tfoot .stick { background: var(--bg, #f5f7fb); }
table.matrix td.neg { color: var(--red); }

/* ===== กระดิ่งแจ้งเตือน ===== */
.bell { position: relative; }
.bell #bellBtn { font-size: 18px; position: relative; padding: 6px 10px; }
.bell-n { position: absolute; top: 0; right: 0; background: var(--primary); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 99px; padding: 1px 5px; min-width: 16px; text-align: center; line-height: 1.4; }
.bell-n.urgent { background: var(--red); animation: bellpulse 1.6s infinite; }
@keyframes bellpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(224,49,49,.5); } 50% { box-shadow: 0 0 0 5px rgba(224,49,49,0); } }
.bell-pop { position: absolute; right: 0; top: calc(100% + 6px); width: min(400px, 92vw); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(10,31,71,.18); z-index: 60; overflow: hidden; }
.bell-h { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.bell-list { max-height: 420px; overflow: auto; } .bell-list.page { max-height: none; }
.ntf { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.ntf:hover { background: var(--bg, #f5f7fb); } .ntf.unread { background: #f2f7ff; } .ntf.unread.urgent { background: #fff1f1; }
.ntf .ic { font-size: 18px; } .ntf b { font-weight: 600; } .ntf.unread b { font-weight: 700; }
.ellip2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.bell-f { display: block; text-align: center; padding: 9px; font-size: 13px; }
.hc { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.hc .lv { font-size: 18px; line-height: 1.2; }
