/* Twinvoice look ("Mango"): shared by the Twinvoice home, the invoice/quote/receipt tools and the guides.
 * Mobile first. Colours are tokens with dark-mode values. The tool pages also load invoice.css, which uses the
 * older variable names (--card, --teal, --navy...); those are mapped to the Mango tokens below.
 * The on-screen invoice sheet (.sheet) is paper: it keeps its own colours in both modes. */

@font-face { font-family: 'Anuphan'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/anuphan-thai-400.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Anuphan'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/anuphan-thai-700.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Anuphan'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/anuphan-latin-400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Anuphan'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/anuphan-latin-700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #fff8ec; --surface: #ffffff; --ink: #1f2a1c; --muted: #535c4c; --line: #eadcc4;
  --brand: #1f6b3a; --brand-ink: #ffffff; --accent: #f59e0b; --accent-ink: #1f2a1c; --accent-edge: #c97f06;
  --chip1: #fde7c2; --chip2: #dcefe1; --chip3: #ffe0d6;
  --field: #ffffff; --field-line: #c9b99c; --focus: #1f6b3a;
  --fault: #b42318; --fault-bg: #fef3f2; --warn: #9a4a06; --warn-bg: #fffaeb; --ok: #067647; --ok-bg: #ecfdf3;
  --font: 'Anuphan', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Thai', sans-serif;
  /* names used by invoice.css */
  --card: var(--surface); --teal: var(--brand); --teal-dark: var(--brand); --navy: var(--ink); --navy-2: var(--ink);
  --radius: 18px; --shadow: none;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141a12; --surface: #1d251a; --ink: #f4efe4; --muted: #b9c0ae; --line: #34402e;
    --brand: #5ccb84; --brand-ink: #0e1a10; --accent: #fbbf24; --accent-ink: #1f2a1c; --accent-edge: #b98408;
    --chip1: #3b2f17; --chip2: #1e3a27; --chip3: #3d241d;
    --field: #10150e; --field-line: #4a5841; --focus: #fbbf24;
    --fault: #ff8a80; --fault-bg: #3a1714; --warn: #fbbf24; --warn-bg: #33270d; --ok: #6ee7a0; --ok-bg: #12301f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141a12; --surface: #1d251a; --ink: #f4efe4; --muted: #b9c0ae; --line: #34402e;
  --brand: #5ccb84; --brand-ink: #0e1a10; --accent: #fbbf24; --accent-ink: #1f2a1c; --accent-edge: #b98408;
  --chip1: #3b2f17; --chip2: #1e3a27; --chip3: #3d241d;
  --field: #10150e; --field-line: #4a5841; --focus: #fbbf24;
  --fault: #ff8a80; --fault-bg: #3a1714; --warn: #fbbf24; --warn-bg: #33270d; --ok: #6ee7a0; --ok-bg: #12301f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.6;
       -webkit-font-smoothing: antialiased; }
html[data-lang="en"] [lang-th] { display: none !important; }
html[data-lang="th"] [lang-en] { display: none !important; }
[hidden] { display: none !important; }
a { color: var(--brand); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: 720px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.wrap.wide { max-width: 1280px; }
.note { color: var(--muted); font-size: 14.5px; margin: 8px 0; }
.lead { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Preview aid: add ?drafts=1 to outline Thai wording that Paul has not approved yet. */
html[data-show-drafts] [data-th-draft] { outline: 2px dashed #e11d48; outline-offset: 2px; }

/* Header: brand + language on one row, the four tools as a row of pills under it */
.tv-head { background: var(--bg); border-bottom: 1.5px solid var(--line); }
.tv-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
          padding-top: 12px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-height: 44px; }
.brand svg { width: 34px; height: 34px; flex: none; }
.word { font-weight: 700; font-size: 24px; letter-spacing: -.02em; color: var(--brand); line-height: 1; }
.word span { color: var(--accent-edge); }
.lang { display: flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.lang button { font: inherit; font-size: 15px; border: 0; background: none; color: var(--ink); padding: 6px 14px; min-height: 40px; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 700; }
.tv-nav { order: 3; width: 100%; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.tv-nav::-webkit-scrollbar { display: none; }
.tv-nav a { flex: none; text-decoration: none; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line);
            border-radius: 999px; padding: 6px 14px; font-size: 15px; min-height: 40px; display: inline-flex; align-items: center; }
.tv-nav a[aria-current] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 700; }
@media (min-width: 760px) {
  .tv-nav { order: 0; width: auto; margin-left: auto; overflow: visible; }
}

/* Buttons */
.cta, .btn-main { display: inline-flex; justify-content: center; align-items: center; min-height: 52px; padding: 0 28px;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; box-shadow: 0 4px 0 var(--accent-edge);
  font: inherit; font-weight: 700; font-size: 18px; text-decoration: none; cursor: pointer; }
.cta:hover, .btn-main:hover { filter: brightness(1.05); background: var(--accent); }
.cta:active, .btn-main:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--accent-edge); }
.btn-main:disabled { background: var(--line); color: var(--muted); box-shadow: none; cursor: not-allowed; filter: none; }
.btn-sec { font: inherit; font-weight: 600; background: var(--surface); color: var(--ink); border: 1.5px solid var(--field-line);
  border-radius: 999px; padding: 10px 18px; min-height: 44px; cursor: pointer; }
.btn-sec:hover { background: var(--chip2); }
.btn-green { background: var(--brand); color: var(--brand-ink); box-shadow: none; }
.btn-green:hover { background: var(--brand); }

/* Footer */
.tv-foot { margin-top: 48px; border-top: 1.5px solid var(--line); padding: 24px 0 40px; font-size: 14px; color: var(--muted); }
.tv-foot .fbrand { color: var(--ink); font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.tv-foot div + div { margin-top: 6px; }

/* ---------- Home ---------- */
.hero { padding-top: 20px; }
.hero h1 { font-size: clamp(32px, 8.6vw, 46px); line-height: 1.22; margin: 8px 0 12px; letter-spacing: -.01em; }
.hero h1 em { font-style: normal; display: block; color: var(--brand); }
.hero .sub { margin: 0 0 20px; color: var(--muted); font-size: 18px; }
.hero .cta { width: 100%; }
.demo { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; margin: 24px 0 4px; }
.demo > div { background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px; padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.demo .out { border-color: var(--brand); }
.demo small { font-size: 12.5px; color: var(--muted); }
.demo b { font-size: 16px; line-height: 1.3; }
.demo .qty { font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.demo svg { width: 26px; height: 26px; color: var(--accent-edge); }
.demo-note { font-size: 13.5px; color: var(--muted); margin: 6px 0 0; }
.tools { display: grid; gap: 12px; margin-top: 28px; }
.tool-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 76px; text-decoration: none; color: var(--ink);
             background: var(--surface); border: 1.5px solid var(--line); border-radius: 20px; }
.tool-card:hover { border-color: var(--brand); }
.tool-card svg { width: 44px; height: 44px; flex: none; }
.tool-card .t { flex: 1; display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.tool-card b { font-size: 19px; }
.tool-card small { color: var(--muted); font-size: 14.5px; }
.tool-card .go { font-size: 28px; color: var(--muted); }
.trust { list-style: none; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.trust li { background: var(--chip2); border-radius: 16px; padding: 12px 10px; font-size: 14.5px; line-height: 1.35; display: flex; flex-direction: column; }
.trust small { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.home h2 { font-size: 22px; line-height: 1.35; margin: 36px 0 10px; }
.glist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.glist a { display: flex; align-items: center; min-height: 52px; padding: 10px 16px; background: var(--surface); border: 1.5px solid var(--line);
           border-radius: 14px; text-decoration: none; color: var(--ink); }
.glist a:hover { border-color: var(--brand); }
.wait { margin-top: 36px; background: var(--chip1); border-radius: 24px; padding: 20px 16px; }
.wait h2 { margin: 6px 0 8px; }
.wait p { margin: 0 0 12px; color: var(--ink); }
.tag { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 12px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.waitform { display: grid; gap: 12px; margin-top: 14px; }
.waitform label { display: grid; gap: 4px; font-size: 15px; font-weight: 600; }
.waitform label small { font-weight: 400; color: var(--muted); }
.waitform input, .waitform select { font: inherit; font-size: 16px; padding: 10px 12px; min-height: 48px; border: 1.5px solid var(--field-line);
  border-radius: 14px; background: var(--field); color: var(--ink); width: 100%; }
.waitform .btn-main { width: 100%; }
.waitform .hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.wait-status { font-weight: 600; margin: 4px 0 0; min-height: 1.6em; }
.wait-status.ok { color: var(--ok); }
.wait-status.err { color: var(--fault); }
.wait .ask { margin: 14px 0 0; font-weight: 600; }
.wait .ask a { display: inline-block; margin-left: 4px; }
.wait .privacy { font-size: 13.5px; color: var(--muted); margin: 12px 0 0; }
@media (min-width: 760px) {
  .hero { padding-top: 40px; }
  .hero .cta { width: auto; }
  .tools { grid-template-columns: repeat(3, 1fr); }
  .tool-card { flex-direction: column; align-items: flex-start; }
  .tool-card .go { display: none; }
  .wait { padding: 28px; }
  .waitform .btn-main { width: auto; justify-self: start; }
}

/* ---------- Tool pages (invoice/quote/receipt): restyle invoice.css's page chrome, never the .sheet ---------- */
.tool-intro { padding-top: 22px; }
.tool-intro h1 { font-size: clamp(28px, 6vw, 40px); line-height: 1.25; }
.en-note { color: var(--warn); }
.inv-form fieldset { border: 1.5px solid var(--line); border-radius: 20px; }
.f input[type="text"], .f input[type="date"], .f textarea, .f select, .row input, .row select {
  background: var(--field); color: var(--ink); border-color: var(--field-line); border-radius: 12px; min-height: 44px; }
.f select:focus, .f input:focus, .f textarea:focus, .row input:focus, .row select:focus { border-color: var(--brand); outline: 3px solid color-mix(in srgb, var(--brand) 30%, transparent); }
.choices.tpl label { background: var(--field); border-color: var(--field-line); border-radius: 999px; min-height: 40px; }
.choices.tpl label:has(input:checked) { border-color: var(--brand); background: var(--chip2); }
.f.accent input[type="color"] { background: var(--field); border-color: var(--field-line); }
.row button.x { background: var(--field); border-color: var(--field-line); min-height: 44px; }
button.link { color: var(--brand); }
.inv-form .btn-sec { margin: 4px 0 14px; }
.inv-check { border: 1.5px solid var(--line); }
.inv-actions .btn-main, .inv-actions .btn-sec { font-size: 16px; }
.preview-wrap { background: var(--line); border-radius: 12px; }
.inapp-warn { border-radius: 16px; }
.inapp-warn a.btn-main { display: inline-flex; }

/* ---------- Guides ---------- */
.guide { padding-top: 22px; }
.guide h1 { font-size: clamp(28px, 7vw, 38px); line-height: 1.25; margin: 6px 0 10px; }
.guide .lead { font-size: 18px; margin: 0 0 6px; }
.guide .updated { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.guide .crumb { margin: 0; font-size: 15px; }
.guide .crumb a { text-decoration: none; }
.guide article h2 { font-size: 22px; margin: 32px 0 8px; line-height: 1.35; }
.guide article ul, .guide article ol { padding-left: 1.3em; margin: 8px 0 12px; }
.guide article li { margin: 6px 0; }
html[data-lang="th"] .guide { line-height: 1.8; }
.gnote { background: var(--chip1); border-radius: 14px; padding: 12px 16px; font-size: 15.5px; }
.gcta { margin: 16px 0 6px; }
.gcta a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 20px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); text-decoration: none; font-weight: 700; }
.gsrc { font-size: 15px; overflow-wrap: anywhere; }
.gcards { display: grid; gap: 12px; margin-top: 18px; }
.gcard { display: block; background: var(--surface); border: 1.5px solid var(--line); border-radius: 20px; padding: 16px 18px; text-decoration: none; color: var(--ink); }
.gcard:hover { border-color: var(--brand); }
.gcard strong { display: block; font-size: 19px; margin-bottom: 4px; }
.gcard span { color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .cta:active, .btn-main:active { transform: none; } }
