/* BizThai - calm stationery look: warm paper, dark ink, one deep-teal seal colour. */
@font-face { font-family: "Sarabun"; src: url("/fonts/Sarabun-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Sarabun"; src: url("/fonts/Sarabun-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Sarabun"; src: url("/fonts/Sarabun-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
:root {
  --paper: #fbf7ee; --sheet: #fffdf8; --ink: #1d1b17; --muted: #6c6556; --line: #dcd3c0;
  --seal: #0f5c63; --seal-deep: #0a4046; --seal-soft: #e7f0f0; --warn: #8a5a00; --warn-bg: #fbf3df; --bad: #a3321f;
  --radius: 10px; --max: 1080px;
  --sans: "Sarabun", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Sarabun", Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.6;
  background-image: radial-gradient(circle at 1px 1px, rgba(29,27,23,.05) 1px, transparent 0); background-size: 22px 22px; }
a { color: var(--seal); text-underline-offset: 2px; }
a:hover { color: var(--seal-deep); }
.wrap { width: min(var(--max), 100% - 32px); margin: 0 auto; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(26px, 5vw, 38px); letter-spacing: -.01em; }
h2 { font-size: 22px; } h3 { font-size: 18px; }
p { margin: 0 0 1em; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 9; }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: rgba(251,247,238,.92); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px); }
.site-header .wrap { display: flex; align-items: center; gap: 12px; padding: 10px 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--seal); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.brand b { font-size: 19px; letter-spacing: .01em; } .brand small { display: block; font-size: 12px; color: var(--muted); line-height: 1.1; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--sheet); }
.lang button { border: 0; background: transparent; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; color: var(--muted); min-height: 36px; }
.lang button[aria-pressed="true"] { background: var(--seal); color: #fff; }
.pro-link { text-decoration: none; border: 1px solid var(--seal); color: var(--seal); border-radius: 999px; padding: 5px 14px; font-size: 14px; font-weight: 500; }
.pro-link:hover { background: var(--seal-soft); }
.nav-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 22px; padding: 0; list-style: none; }
.nav-pills a { display: block; text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: var(--sheet); padding: 6px 14px; border-radius: 999px; font-size: 15px; }
.nav-pills a:hover { border-color: var(--seal); }
.nav-pills a[aria-current="page"] { background: var(--seal); border-color: var(--seal); color: #fff; }

/* layout bits */
main { padding-bottom: 30px; }
.lede { font-size: 19px; color: var(--muted); max-width: 46em; }
.hero { padding: 26px 0 8px; }
.eyebrow { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--seal); font-weight: 700; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin: 18px 0; }
.card { display: block; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: inherit; box-shadow: 0 1px 0 rgba(29,27,23,.04); transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--seal); transform: translateY(-2px); color: inherit; }
.card h2, .card h3 { margin: 0 0 4px; color: var(--seal-deep); } .card p { margin: 0; color: var(--muted); font-size: 15px; }
.card .ico { font-size: 26px; display: block; margin-bottom: 6px; }
.panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.work { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 960px) { .work.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .work.invoice { grid-template-columns: 440px minmax(0, 1fr); } }
.note { background: var(--warn-bg); border: 1px solid #e0cf9e; color: #5e4510; border-radius: var(--radius); padding: 12px 14px; font-size: 15px; margin: 0 0 16px; }
.note.info { background: var(--seal-soft); border-color: #b9d3d5; color: var(--seal-deep); }
.sources { font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; margin-top: 26px; }
.sources ul { margin: 6px 0 0; padding-left: 20px; } .sources li { margin: 3px 0; word-break: break-word; }
.asof { display: inline-block; font-size: 13px; background: var(--seal-soft); color: var(--seal-deep); padding: 2px 10px; border-radius: 999px; }

/* forms */
label { display: block; font-size: 14px; color: var(--muted); font-weight: 500; margin: 0 0 4px; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 1px solid #c9bfa9; border-radius: 8px; padding: 9px 11px; min-height: 44px; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(15,92,99,.35); outline-offset: 1px; border-color: var(--seal); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--seal); }
.chk { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 16px; margin: 6px 0; cursor: pointer; }
.chk input { flex: none; }
.row { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 12px; }
@media (min-width: 560px) { .row.c2 { grid-template-columns: 1fr 1fr; } .row.c3 { grid-template-columns: 1fr 1fr 1fr; } }
.field { margin-bottom: 12px; } .hint { font-size: 13px; color: var(--muted); margin-top: 3px; }
.err { color: var(--bad); font-size: 14px; margin-top: 4px; } .warn { color: var(--warn); font-size: 14px; margin-top: 4px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 14px; padding: 12px 14px 4px; }
legend { font-weight: 700; color: var(--seal-deep); padding: 0 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px; border-radius: 8px; border: 1px solid var(--seal); background: var(--seal); color: #fff; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--seal-deep); color: #fff; }
.btn.ghost { background: transparent; color: var(--seal); } .btn.ghost:hover { background: var(--seal-soft); color: var(--seal-deep); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { flex: 1 1 auto; min-height: 44px; border: 1px solid var(--line); background: var(--sheet); border-radius: 8px; font: inherit; cursor: pointer; padding: 6px 12px; }
.tabs button[aria-pressed="true"] { background: var(--seal); color: #fff; border-color: var(--seal); }

/* items table (invoice form) */
.items { display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 1fr 70px 100px 40px; gap: 6px; align-items: start; }
.item .del { min-height: 44px; border: 1px solid var(--line); background: var(--sheet); border-radius: 8px; cursor: pointer; font-size: 18px; }
@media (max-width: 520px) { .item { grid-template-columns: 1fr 1fr 40px; } .item .d { grid-column: 1 / -1; } }

/* results */
.result { display: grid; gap: 0; }
.result .r { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.result .r:last-child { border-bottom: 0; } .result .r.big { font-size: 20px; font-weight: 700; color: var(--seal-deep); }
.result .r span:last-child { font-variant-numeric: tabular-nums; text-align: right; }
table.t { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
table.t th, table.t td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; } table.t th:first-child, table.t td:first-child { text-align: left; }
table.t th { color: var(--muted); font-weight: 500; font-size: 13px; }
.words { background: var(--seal-soft); border-radius: 8px; padding: 10px 12px; font-weight: 500; color: var(--seal-deep); margin-top: 10px; }
.qr-box { display: grid; place-items: center; gap: 10px; }
.qr-box svg, .qr-box canvas { width: min(360px, 100%); height: auto; border: 1px solid var(--line); background: #fff; border-radius: 8px; }
.payload { font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }

/* ad + pro */
.ad-slot { border: 1px dashed #bfb59d; border-radius: var(--radius); padding: 14px 16px; margin: 18px 0; background: repeating-linear-gradient(-45deg, #fcf9f1, #fcf9f1 12px, #f6f0e2 12px, #f6f0e2 24px); }
.ad-slot .ad-kicker { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.ad-slot h3 { margin: 2px 0 2px; font-size: 18px; } .ad-slot p { margin: 0 0 8px; color: var(--muted); font-size: 15px; }
.pro-bar { display: flex; gap: 10px 16px; flex-wrap: wrap; align-items: center; background: var(--seal-deep); color: #eaf4f4; border-radius: var(--radius); padding: 12px 16px; margin: 0 0 18px; font-size: 15px; }
.pro-bar b { color: #fff; } .pro-bar a { color: #fff; font-weight: 500; margin-left: auto; }
.cross { border-left: 4px solid var(--seal); background: var(--sheet); padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0; margin: 18px 0; }

/* footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 30px; padding: 28px 0 44px; background: #f4eedf; }
.footer-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.site-footer h3 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.site-footer a { display: block; color: var(--ink); text-decoration: none; padding: 3px 0; } .site-footer a:hover { color: var(--seal); text-decoration: underline; }
.fine { font-size: 13px; color: var(--muted); margin-top: 20px; line-height: 1.55; }

/* A4 preview */
.preview-wrap { overflow-x: auto; padding-bottom: 6px; }
.sheet { background: #fff; width: 794px; min-height: 1123px; margin: 0 auto; padding: 48px 52px; box-shadow: 0 2px 14px rgba(29,27,23,.18); font-size: 13.5px; line-height: 1.5; color: #1d1b17; position: relative; transform-origin: top left; }
.sheet .hd { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--seal); padding-bottom: 12px; margin-bottom: 12px; }
.sheet .hd .l { display: flex; gap: 12px; } .sheet .hd img { max-width: 80px; max-height: 70px; object-fit: contain; }
.sheet .sname { font-size: 18px; font-weight: 700; } .sheet .mut { color: #6c6556; font-size: 12px; white-space: pre-line; }
.sheet .ttl { text-align: right; } .sheet .ttl h2 { font-size: 24px; color: var(--seal); margin: 0; } .sheet .ttl .en { color: #6c6556; }
.sheet .sec { color: var(--seal); font-weight: 700; font-size: 12px; margin-top: 4px; }
.sheet table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.sheet th { background: var(--seal-soft); text-align: right; padding: 6px 8px; font-size: 12.5px; } .sheet td { padding: 6px 8px; text-align: right; border-bottom: 1px solid #e6dfcf; vertical-align: top; font-variant-numeric: tabular-nums; }
.sheet th:nth-child(1), .sheet td:nth-child(1) { text-align: left; width: 28px; } .sheet th:nth-child(2), .sheet td:nth-child(2) { text-align: left; white-space: pre-wrap; }
.sheet .tot { margin: 12px 0 0 auto; width: 290px; } .sheet .tot div { display: flex; justify-content: space-between; padding: 3px 8px; } .sheet .tot .strong { background: var(--seal-soft); font-weight: 700; font-size: 15px; }
.sheet .wd { text-align: right; font-weight: 700; color: var(--seal); margin-top: 10px; }
.sheet .blk { margin-top: 12px; white-space: pre-wrap; } .sheet .blk b { display: block; color: var(--seal); font-size: 12px; }
.sheet .sign { display: flex; justify-content: space-around; margin-top: 60px; } .sheet .sign div { width: 210px; text-align: center; border-top: 1px solid #1d1b17; padding-top: 4px; }
.sheet .qrp { float: right; width: 110px; text-align: center; font-size: 11px; color: #6c6556; margin: 10px 0 0 12px; } .sheet .qrp svg { width: 110px; height: 110px; }
.sheet .foot { position: absolute; left: 52px; right: 52px; bottom: 22px; font-size: 10.5px; color: #8a8272; }
.sheet.doc p { margin: 0 0 6px; white-space: pre-wrap; } .sheet.doc h3 { margin: 12px 0 2px; font-size: 14px; } .sheet.doc .cl { padding-left: 14px; }
.sheet.doc .box { background: var(--warn-bg); border: 1px solid #e0cf9e; color: #5e4510; padding: 6px 10px; font-size: 11.5px; margin-bottom: 12px; }

@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; }
  .skip, .site-header, .site-footer, nav, .hero, .note, .pro-bar, .ad-slot, .cross, .sources, .no-print { display: none !important; }
  main, .wrap { width: auto; margin: 0; padding: 0; max-width: none; }
  .work { display: block; }
  .print-area { width: 210mm; }
  .preview-wrap { overflow: visible; padding: 0; }
  .sheet { box-shadow: none; margin: 0; width: 210mm; min-height: 297mm; padding: 14mm 14mm; zoom: 1 !important; box-sizing: border-box; }
  .sheet .foot { position: static; margin-top: 18px; }
}
