/* ============================================================
   spa.css — shared look for every Ikigai Spa page.
   Page-specific rules stay in the page's own <style> block.
   ============================================================ */
:root{
  color-scheme: light;
  /* Ikigai: beige, black, brown.
     The page is beige and cards stay white, so a card has an edge without needing
     a heavier border — the old all-white screen had nothing separating one row
     from the next. Every neutral is warm; a cool grey next to beige reads dirty. */
  --ink:#1c1917; --muted:#7a6e60; --soft:#a89a88;
  --line:#e2d7c6; --line2:#eee7dc; --bg:#faf6f0; --shade:#f2ebe0;
  --card:#fff;
  --dark:#1c1917; --accent:#8b5e34; --accent-soft:#f2e6d8;
  --bad:#a8322b; --ot:#9a5a12; --ok:#4f6b3a; --now:#a8322b;
  --r:10px;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{background:var(--bg);color:var(--ink);
  font-family:"Inter","Noto Sans Thai",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  font-size:13px;line-height:1.45;-webkit-font-smoothing:antialiased}
[x-cloak]{display:none!important}
.wrap{display:flex;flex-direction:column;height:100vh}
.spacer{flex:1}
.muted{color:var(--muted)}

/* ---------- header ---------- */
.apphead{display:flex;align-items:center;gap:16px;padding:0 18px;height:56px;flex:0 0 auto;
  background:var(--card);border-bottom:1px solid var(--line)}
.logomark{display:flex;align-items:center;gap:9px}
.logotxt{display:flex;flex-direction:column;justify-content:center;line-height:1}
/* the stone mark: small, quiet, and never stretched */
.logoimg{width:26px;height:26px;object-fit:contain;display:block;flex:0 0 26px}
@media (max-width:760px){ .logoimg{width:22px;height:22px;flex-basis:22px} }
/* The Ikigai wordmark, set rather than pictured: font outlines stay sharp at any
   size and cost nothing beyond the Google Fonts call every page already makes.
   Swap for the brand SVG the day Sunny sends the original file. */
.logo{display:flex;align-items:baseline;white-space:nowrap;color:var(--ink);
  font-family:'Cormorant Garamond',Georgia,serif;font-weight:400}
.logo b{font-weight:400;font-size:19px;letter-spacing:.20em}
.logo span{font-weight:400;font-size:9.5px;letter-spacing:.22em;margin-left:.30em}
@media (max-width:760px){
  .logo b{font-size:16px;letter-spacing:.16em}
  .logo span{font-size:8.5px}
}
/* which build is on screen — quiet enough to ignore, there when it matters */
.logomark .ver{font-size:9.5px;font-weight:600;color:var(--soft);letter-spacing:.4px;
  margin-top:2px;font-variant-numeric:tabular-nums}
.navlinks{display:flex;gap:2px;overflow-x:auto;flex:1;min-width:0}
.navlinks a{color:var(--muted);text-decoration:none;font-size:13px;font-weight:500;
  padding:7px 13px;border-radius:8px;white-space:nowrap}
.navlinks a:hover{background:var(--shade);color:var(--ink)}
.navlinks a.active{background:var(--ink);color:var(--shade);font-weight:600}
.navlinks a.soon{opacity:.42}
.navlinks a.soon::after{content:"soon";font-size:9px;margin-left:5px;background:var(--line);
  color:var(--muted);border-radius:4px;padding:1px 4px;vertical-align:1px}
/* Accounting's second row (11 Nov 2026): its five parts on the left, the month's progress on the right */
.subnav{display:flex;align-items:center;gap:4px 12px;flex-wrap:wrap;flex:0 0 auto;padding:6px 14px;
  background:var(--card);border-bottom:1px solid var(--line)}
.subnav[hidden]{display:none}
.subtabs{display:flex;gap:2px;min-width:0;overflow-x:auto;scrollbar-width:none}
.subtabs::-webkit-scrollbar{display:none}
.subtabs a{display:inline-flex;align-items:center;gap:7px;color:var(--muted);text-decoration:none;font-size:13px;
  font-weight:500;padding:6px 9px;border-radius:8px;white-space:nowrap;border:1px solid transparent}
.subtabs a:hover{background:var(--shade);color:var(--ink)}
.subtabs a.on{background:var(--accent-soft);color:var(--accent);font-weight:600;border-color:var(--accent)}
.subtabs a .n{font-size:11px;font-weight:700;background:var(--line);color:var(--ink);border-radius:9px;
  padding:1px 6px;font-variant-numeric:tabular-nums}
.subtabs a.on .n{background:var(--accent);color:#fff}
.mstrip{display:flex;align-items:center;gap:2px;margin-left:auto;min-width:0;overflow-x:auto;scrollbar-width:none;
  font-size:12px;white-space:nowrap}
.mstrip::-webkit-scrollbar{display:none}
.mstrip:empty{display:none}
.mstrip .mlab{font-weight:700;color:var(--ink);margin-right:4px;font-variant-numeric:tabular-nums}
.mchip{display:inline-flex;align-items:center;gap:4px;padding:3px 5px;border-radius:7px;
  color:var(--muted);text-decoration:none;font-variant-numeric:tabular-nums}
a.mchip:hover{background:var(--shade);color:var(--ink)}
.mchip i{width:7px;height:7px;border-radius:50%;background:var(--soft);flex:0 0 7px}
.mchip b{font-weight:700}
.mchip.g i{background:var(--ok)}
.mchip.a{color:var(--ink)} .mchip.a i{background:var(--bad)} .mchip.a b{color:var(--bad)}
@media print{ #spa-subnav{display:none!important} }
@media (max-width:760px){
  .subnav{padding:6px 10px;gap:6px}
  .subtabs,.mstrip{flex:1 1 100%;margin-left:0}
}
.crosslink{color:var(--muted);text-decoration:none;font-size:12px;white-space:nowrap;
  border:1px solid var(--line);border-radius:8px;padding:6px 11px}
.crosslink:hover{background:var(--shade);color:var(--ink)}
.user{font-size:12px;color:var(--muted);white-space:nowrap}
/* On a phone the signed-in address is the least useful 230px on screen, and it
   is nowrap, so it was helping push the header past the viewport. You know who
   you are; the wrench and Sign out stay. */
@media (max-width:760px){
  .user{display:none}
  /* 375px cannot hold the logo, the nav, a link to another app, the wrench and
     Sign out at a 16px rhythm: measured, those come to 437px, so the header grew
     wider than the screen and .navlinks — flex:1 — was squeezed to ZERO while the
     page kept the extra width. Closing the gaps and dropping the cross-app link
     brings it to exactly 375 with ~97px of nav that scrolls itself. */
  .apphead{gap:8px;padding:6px 10px;height:auto;flex-wrap:wrap;row-gap:2px}
  .crosslink{display:none}
  /* Even with the gaps closed the nav was left 58px — enough for "Dashbo" and
     no way to tell which page you are on. Wrapped onto its own row it gets 355,
     and the header costs 22px of height for it (56 -> 78). Measured, not guessed. */
  .navlinks{order:9;flex-basis:100%;flex-grow:1}
}

/* ---------- buttons ---------- */
.btn{border:1px solid var(--line);background:#fff;border-radius:9px;padding:8px 14px;cursor:pointer;
  font-size:13px;font-weight:500;color:var(--ink);font-family:inherit;text-decoration:none;
  display:inline-flex;align-items:center;gap:6px}
.btn:hover{background:var(--shade)}
.btn:disabled{opacity:.4;cursor:not-allowed}
.btn.dark{background:var(--dark);border-color:var(--dark);color:#fff;font-weight:600}
.btn.dark:hover:not(:disabled){filter:brightness(1.25)}
.btn.sm{padding:5px 10px;font-size:12px;border-radius:7px}
.btn.ico{padding:7px 11px;font-size:15px;line-height:1}
.btn.danger{color:var(--bad)}
.seg{display:flex;border:1px solid var(--line);border-radius:9px;overflow:hidden}
.seg button{border:0;background:#fff;padding:7px 13px;cursor:pointer;font-size:12.5px;
  font-weight:600;color:var(--muted);font-family:inherit}
.seg button.on{background:var(--accent);color:#fff}
/* an icon button in a segmented control keeps the same box as its text siblings */
.seg button svg{display:block}
.seg button:has(svg){padding:6px 11px}

/* ---------- form fields ---------- */
.field{display:flex;flex-direction:column;gap:5px;margin-bottom:12px}
.field label{font-size:11.5px;font-weight:600;color:var(--muted)}
.req{color:var(--bad);font-weight:700}
.field input,.field select,.field textarea{border:1px solid var(--line);border-radius:9px;
  padding:9px 11px;font-size:13px;font-family:inherit;color:var(--ink);background:#fff;
  width:100%;min-width:0;max-width:100%}
.field textarea{resize:vertical;min-height:56px}
.field input:focus,.field select:focus,.field textarea:focus{outline:none;border-color:var(--accent);
  box-shadow:0 0 0 3px var(--accent-soft)}
.field input:disabled,.field textarea:disabled{background:var(--shade);color:var(--muted)}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:11px}
.row3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:11px}
/* grid items are min-width:auto by default, so a number input with spinners
   will not shrink and spills past its container. */
.row2>*,.row3>*{min-width:0}
.field{min-width:0}

/* ---------- chips & notices ---------- */
.chip{display:inline-block;border-radius:5px;padding:2px 7px;font-size:10.5px;font-weight:700;
  background:var(--line2);color:var(--muted)}
.chip.b{background:#e8f0fe;color:#1a56b8}
.chip.g{background:#e7f6ee;color:var(--ok)}
.chip.r{background:#fde2e2;color:var(--bad)}
.chip.a{background:#fef3c7;color:var(--ot)}
.chip.rose{background:#fde8ef;color:#9d174d}
.note{background:#fff8ec;border:1px solid #ffe0b3;color:#7a5308;border-radius:10px;
  padding:11px 13px;font-size:12.5px;display:flex;align-items:flex-start;gap:9px}
.errbar{background:#fff2f2;border:1px solid #ffd0d0;color:#9c2020;border-radius:10px;
  padding:11px 14px;font-size:12.5px;margin-bottom:14px}
.alertbox{display:flex;gap:10px;background:#fff7f7;border:1px solid #ffd9d9;border-radius:10px;
  padding:11px 12px}
.alertbox .ttl{font-weight:700;font-size:12.5px;color:#a12020}
.alertbox .txt{font-size:12.5px;color:#7a2020;white-space:pre-wrap;margin-top:2px}
.warn{color:var(--bad);font-size:12.5px}

/* ---------- slide-over sheet ---------- */
.sheetbg{position:fixed;inset:0;background:rgba(17,24,39,.28);z-index:110;
  backdrop-filter:saturate(.9) blur(1px)}
.sheet{position:fixed;top:0;right:0;bottom:0;width:440px;max-width:96vw;background:#fff;z-index:120;
  box-shadow:-10px 0 34px rgba(16,24,40,.2);display:flex;flex-direction:column;overflow:hidden}
.sheet .sh{padding:14px 18px;border-bottom:1px solid var(--line);display:flex;gap:13px;
  align-items:center;background:var(--shade)}
.sheet .sb{flex:1;overflow:auto;padding:18px}
.sheet .sf{padding:12px 18px;border-top:1px solid var(--line);display:flex;gap:8px;background:var(--shade)}
.av2{width:56px;height:56px;border-radius:50%;background:#ede9fe;color:#5b21b6;display:flex;
  align-items:center;justify-content:center;font-size:22px;font-weight:700;flex:0 0 auto}
.cav{width:36px;height:36px;border-radius:50%;background:#ede9fe;color:#5b21b6;display:flex;
  align-items:center;justify-content:center;font-weight:700;font-size:14px;flex:0 0 auto}

/* ---------- centred panels ---------- */
.center{flex:1;display:flex;align-items:center;justify-content:center;padding:20px;background:var(--shade)}
.loginbox{background:#fff;border-radius:14px;box-shadow:0 10px 34px rgba(16,24,40,.12);padding:26px;
  width:100%;max-width:340px;display:flex;flex-direction:column;gap:11px}
.loginbox h2{margin:0;font-size:19px;font-weight:700;letter-spacing:-.3px}
.spin{width:24px;height:24px;border:3px solid var(--line);border-top-color:var(--accent);
  border-radius:50%;animation:spa-sp .8s linear infinite}
@keyframes spa-sp{to{transform:rotate(360deg)}}
.empty{padding:50px 20px;text-align:center;color:var(--muted)}

/* ---------- toast (mounted by spa-controls.js) ---------- */
.spa-toast{position:fixed;bottom:22px;left:50%;transform:translateX(-50%);background:var(--dark);
  color:#fff;padding:10px 17px;border-radius:10px;z-index:400;font-size:13px;max-width:80vw;
  text-align:center;box-shadow:0 10px 26px rgba(0,0,0,.3)}
.spa-toast.bad{background:#a4262c}
/* REQ26100074/75, Jea: a toast still on screen when a print starts was printed on the paper —
   it is position:fixed, so it landed on every sheet. A toast is never part of a printout. */
@media print{.spa-toast{display:none!important}}

/* what an OTA or a card will take off this payment */
.feenote{border:1px solid var(--line);background:var(--shade);border-radius:9px;
  padding:8px 11px;margin-top:9px;font-size:12px;line-height:1.55}
.feenote .fn2{color:var(--muted);font-size:11.5px;margin-top:2px}

/* ---------- the dev request desk ----------
   Shared chrome, so it lives here rather than in fourteen page style blocks.
   The wrench sits beside Sign out on every page; the sheet is built by
   spa-controls.js and appended to the body once, on first press. */
.wrench{position:relative;border:1px solid var(--line);background:#fff;border-radius:9px;
  padding:7px 11px;font-size:15px;line-height:1;cursor:pointer;flex:0 0 auto}
.wrench:hover{background:var(--shade)}
/* Brown, not red. Everyone sees this forty times a day and nothing in the queue
   is an emergency — a red dot on every page trains people to ignore red dots. */
.wrench .badge{position:absolute;top:-7px;right:-7px;min-width:19px;height:19px;padding:0 5px;
  border-radius:10px;background:var(--accent);color:#fff;font-size:10.5px;font-weight:700;
  display:flex;align-items:center;justify-content:center;font-variant-numeric:tabular-nums}
.wrench .badge[hidden]{display:none}

.devscrim{position:fixed;inset:0;background:rgba(28,25,23,.42);z-index:120;
  display:flex;align-items:flex-start;justify-content:center;padding:38px 18px;overflow:auto}
.devscrim[hidden]{display:none!important}
.devsheet{background:var(--card);border:1px solid var(--line);border-radius:13px;
  width:min(580px,100%);box-shadow:0 18px 48px rgba(28,25,23,.22)}
.devhead{display:flex;align-items:center;gap:10px;padding:14px 16px;border-bottom:1px solid var(--line2)}
.devhead h2{margin:0;font-size:15px;font-weight:700}
.devbody{padding:16px}
.devrow{display:grid;grid-template-columns:1fr 1fr 1fr;gap:11px}
@media (max-width:560px){.devrow{grid-template-columns:1fr}}
.devbody label{display:block;font-size:10.5px;font-weight:600;letter-spacing:.6px;
  text-transform:uppercase;color:var(--soft);margin-bottom:4px}
.devbody select,.devbody textarea{width:100%;padding:8px 10px;border:1px solid var(--line);
  border-radius:8px;font:inherit;background:#fff;color:var(--ink)}
.devbody textarea{min-height:64px;resize:vertical}
.devfield{margin-top:13px}
.devdrop{margin-top:5px;border:1.5px dashed var(--line);background:var(--shade);border-radius:9px;
  padding:15px;text-align:center;color:var(--muted);cursor:pointer;font-size:12px}
.devdrop.over{border-color:var(--accent);background:var(--accent-soft);color:var(--accent)}
.devdrop b{display:block;color:var(--ink);font-size:13px;margin-bottom:2px}
.devthumbs{display:flex;gap:7px;flex-wrap:wrap;margin-top:9px}
.devthumbs .t.file{display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:1px;padding:3px 5px;text-align:center;overflow:visible}
.devthumbs .t.file b{font-size:10px;letter-spacing:.4px;color:var(--accent)}
.devthumbs .t.file i{font-style:normal;font-size:9.5px;line-height:1.15;color:var(--muted);
  max-width:64px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.devthumbs .t{width:74px;height:52px;border:1px solid var(--line);border-radius:7px;
  background:var(--shade) center/cover;position:relative}
.devthumbs .t button{position:absolute;top:-6px;right:-6px;width:18px;height:18px;border-radius:9px;
  border:1px solid var(--line);background:#fff;color:var(--muted);font-size:11px;line-height:1;
  cursor:pointer;padding:0}
.devauto{margin-top:13px;padding-top:11px;border-top:1px solid var(--line2);
  font-size:11.5px;color:var(--muted)}
.devauto code{font-size:10.5px;color:var(--soft);font-family:ui-monospace,Menlo,monospace}
.devbody .errbar{margin-top:11px}
.devfoot{display:flex;gap:8px;align-items:center;padding:13px 16px;
  border-top:1px solid var(--line2);background:var(--shade);border-radius:0 0 12px 12px}

/* ---------- phones (≤760px) ----------
   Sunny, 17 Oct 2026: every page usable on a phone, by everyone. Measured at 390px:
   nine pages kept their 200–240px side menu as a column and squeezed the page into a
   ~180px strip, and the frame clips rather than scrolls, so the rest could not be
   reached at all. These rules are the shared half; a page with its own layout keeps
   its own @media block beside its own CSS. Page styles load after this file, so the
   selectors here are deliberately one step more specific than the page's.
   `screen and`: an A4 page prints ~720px wide, so a bare max-width:760px also matched
   the printout — Jea's FTI came out with the phone tabs across the top (21 Oct). */
@media screen and (max-width:760px){
  /* 1. A side menu becomes one row of chips under the header that scrolls sideways,
        and the page gets the full width. Opt-in with .mside on .body: Clients keeps its
        ☰ drawer, and a menu that is really a list (voucher templates) is not a menu.
        Only the links survive — headings, dividers and notes have no place in a row. */
  .body.mside{flex-direction:column}
  .body.mside > .side{width:auto;min-width:0;flex:0 0 auto;display:flex;gap:6px;
    overflow-x:auto;overflow-y:hidden;padding:8px 10px;border-right:0;
    border-bottom:1px solid var(--line);scrollbar-width:none}
  .body.mside > .side::-webkit-scrollbar{display:none}
  .body.mside > .side > :not(a){display:none}
  .body.mside > .side > a{flex:0 0 auto;display:inline-flex;align-items:center;gap:6px;
    white-space:nowrap;padding:7px 12px;border:1px solid var(--line);border-radius:999px;
    background:#fff;font-size:12.5px;margin:0!important}
  .body.mside > .side > a.on{border-color:var(--accent)}
  .body.mside > .main{padding:14px 12px 60px;min-height:0}
  /* 3. Figures two to a row: one tile per row turned five numbers into a whole screen */
  .main .tiles{grid-template-columns:repeat(2,minmax(0,1fr))}
  /* 2. A list wider than the screen scrolls in its own box. spa-controls.js finds the
        box and sets --hsw to its widest row; every row takes that width so the columns
        stay lined up under the header while the page itself never moves sideways. */
  .hsx{overflow-x:auto;-webkit-overflow-scrolling:touch}
  .hsx > *{min-width:var(--hsw)}
  /* 6. iOS zooms the page into any field under 16px the moment it is tapped, and does
        not zoom back out. The one place !important is the honest tool: it is the rule. */
  input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea{font-size:16px!important}
}

/* Text that is a way somewhere. Lived in spa-vouchers.html only, copied verbatim
   here when the calendar needed it too — a third copy is how the two that already
   exist came to disagree (spa-tax.html's .chain .lnk is a scoped mono variant and
   stays where it is; it does not collide with this). */
.lnk{color:var(--accent);text-decoration:none;border-bottom:1px solid transparent}
.lnk:hover{border-bottom-color:var(--accent)}
