/* DormDee admin app. Mint-green theme (light + dark): soft mint page, white cards, pastel tiles, round pill buttons. Fonts: Anuphan for headings and numbers, IBM Plex Sans Thai for text,
   falling back to the phone's or computer's own Thai font. */
/* Thai fonts kept in public/vendor/fonts (SIL Open Font License, see the OFL-*.txt files there); the browser only
   downloads the Thai or Latin file a page needs. */
@font-face { font-family: 'Anuphan'; font-style: normal; font-weight: 500 700; font-display: swap; src: url(/vendor/fonts/anuphan-thai.woff2) format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Anuphan'; font-style: normal; font-weight: 500 700; font-display: swap; src: url(/vendor/fonts/anuphan-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-style: normal; font-weight: 400; font-display: swap; src: url(/vendor/fonts/plex-thai-400-thai.woff2) format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-style: normal; font-weight: 400; font-display: swap; src: url(/vendor/fonts/plex-thai-400-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-style: normal; font-weight: 500; font-display: swap; src: url(/vendor/fonts/plex-thai-500-thai.woff2) format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-style: normal; font-weight: 500; font-display: swap; src: url(/vendor/fonts/plex-thai-500-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-style: normal; font-weight: 600; font-display: swap; src: url(/vendor/fonts/plex-thai-600-thai.woff2) format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-style: normal; font-weight: 600; font-display: swap; src: url(/vendor/fonts/plex-thai-600-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-style: normal; font-weight: 700; font-display: swap; src: url(/vendor/fonts/plex-thai-700-thai.woff2) format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-style: normal; font-weight: 700; font-display: swap; src: url(/vendor/fonts/plex-thai-700-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --bg: #ecf5ef; --bg-grad: radial-gradient(1100px 520px at 100% -8%, #d6ecdd 0, transparent 70%), radial-gradient(800px 500px at -10% 110%, #dfefe3 0, transparent 70%);
  --panel: #ffffff; --panel-2: #f1f7f3; --line: #e1ebe4; --line-2: #cbdad0; --text: #18241d; --muted: #5a6a61;
  --accent: #1f7a4c; --accent-hover: #186941; --accent-soft: #e0f1e5; --accent-ink: #165c39; --accent-text: #ffffff;
  --brand: #1d6b43; --leaf-1: #4f9e3f; --leaf-2: #74b84a; --leaf-3: #9bcf63; --logo-a: #f8fcf9; --logo-b: #d6ecdc;
  --danger: #c8372f; --danger-soft: #fde5e4; --warn: #b25d0b; --warn-soft: #fdeedb; --ok: #1d7f4a; --ok-soft: #dff2e4;
  --info: #2a63c6; --info-soft: #e3edfc; --violet: #6246c4; --violet-soft: #eeeafc; --hold: #535e68; --hold-soft: #eceff1;
  --yellow: #9a7100; --yellow-soft: #fcf3d2; --on-danger: #ffffff;
  --expiring-line: #e39a47; --seg-on: #ffffff; --chart-2: #b5dcc2; --age-2: #e89a3c; --age-3: #c2410c; --age-4: #7f1d1d;
  --shadow: 0 1px 2px rgba(22, 70, 42, .04), 0 10px 28px -16px rgba(22, 70, 42, .22);
  --radius: 20px; --radius-sm: 12px;
  --font: "IBM Plex Sans Thai", "Noto Sans Thai", Sarabun, Thonburi, Tahoma, system-ui, sans-serif;
  --display: "Anuphan", "IBM Plex Sans Thai", "Noto Sans Thai", Thonburi, Tahoma, system-ui, sans-serif;
  /* older names still used by a few inline styles */
  --vacant: var(--ok); --vacant-bg: var(--ok-soft); --booked: var(--violet); --booked-bg: var(--violet-soft);
  --occupied: var(--info); --occupied-bg: var(--info-soft); --expiring: var(--warn); --expiring-bg: var(--warn-soft); --hold-bg: var(--hold-soft);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1311; --bg-grad: radial-gradient(1100px 520px at 100% -8%, #12261b 0, transparent 70%), radial-gradient(800px 500px at -10% 110%, #10201a 0, transparent 70%);
    --panel: #141d18; --panel-2: #1a2620; --line: #24322b; --line-2: #34463c; --text: #e4ede7; --muted: #9daea4;
    --accent: #4cc283; --accent-hover: #66d197; --accent-soft: #163222; --accent-ink: #8fe0b2; --accent-text: #052215;
    --brand: #8fe0b2; --leaf-1: #5fb04c; --leaf-2: #82c659; --leaf-3: #a9da74; --logo-a: #1d3024; --logo-b: #14231a;
    --danger: #ff8f86; --danger-soft: #3a1716; --warn: #f2b268; --warn-soft: #33240f; --ok: #63d69a; --ok-soft: #133020;
    --info: #8fb6ff; --info-soft: #162540; --violet: #bba8ff; --violet-soft: #251d42; --hold: #aeb8c1; --hold-soft: #222a30;
    --yellow: #f0cd5c; --yellow-soft: #2e2910; --on-danger: #3a0d0b;
    --expiring-line: #9a6420; --seg-on: #2b3a34; --chart-2: #245a40; --age-2: #d18a33; --age-3: #e0663a; --age-4: #b23b3b;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 28px -16px rgba(0, 0, 0, .7); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1311; --bg-grad: radial-gradient(1100px 520px at 100% -8%, #12261b 0, transparent 70%), radial-gradient(800px 500px at -10% 110%, #10201a 0, transparent 70%);
  --panel: #141d18; --panel-2: #1a2620; --line: #24322b; --line-2: #34463c; --text: #e4ede7; --muted: #9daea4;
  --accent: #4cc283; --accent-hover: #66d197; --accent-soft: #163222; --accent-ink: #8fe0b2; --accent-text: #052215;
  --brand: #8fe0b2; --leaf-1: #5fb04c; --leaf-2: #82c659; --leaf-3: #a9da74; --logo-a: #1d3024; --logo-b: #14231a;
  --danger: #ff8f86; --danger-soft: #3a1716; --warn: #f2b268; --warn-soft: #33240f; --ok: #63d69a; --ok-soft: #133020;
  --info: #8fb6ff; --info-soft: #162540; --violet: #bba8ff; --violet-soft: #251d42; --hold: #aeb8c1; --hold-soft: #222a30;
  --yellow: #f0cd5c; --yellow-soft: #2e2910; --on-danger: #3a0d0b;
  --expiring-line: #9a6420; --seg-on: #2b3a34; --chart-2: #245a40; --age-2: #d18a33; --age-3: #e0663a; --age-4: #b23b3b;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 28px -16px rgba(0, 0, 0, .7); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
/* flow-root: a child's top margin (the login card) must not pull the body down and leave a bare strip above the gradient */
body { display: flow-root; background: var(--bg-grad), var(--bg); background-repeat: no-repeat; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--display); line-height: 1.35; }
h1 { font-size: 26px; font-weight: 700; margin: 0; } h2 { font-size: 17px; font-weight: 600; margin: 0 0 10px; } h3 { font-size: 15px; font-weight: 600; margin: 14px 0 6px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.danger { color: var(--danger); } .ok { color: var(--ok); } .warn { color: var(--warn); }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- app logo ---------- */
.logo { width: 42px; height: 42px; border-radius: 13px; background: linear-gradient(145deg, var(--logo-a), var(--logo-b)); color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; flex: none; }
.mark { width: 32px; height: 32px; display: block; }
.lg-s { stroke: var(--leaf-1); } .lg-1 { fill: var(--leaf-1); } .lg-2 { fill: var(--leaf-2); } .lg-3 { fill: var(--leaf-3); }
.logo.sm { width: 34px; height: 34px; border-radius: 11px; } .logo.sm .mark { width: 26px; height: 26px; }
/* login: the bare mark, large, like a splash screen */
.logo.lg { width: auto; height: auto; background: none; box-shadow: none; } .logo.lg .mark { width: 92px; height: 92px; }
/* leaf sprigs in the corners of the login page */
.deco { position: fixed; z-index: 0; pointer-events: none; width: 170px; height: 230px; opacity: .55; }
.deco.tr { top: -24px; right: -30px; transform: rotate(200deg); }
.deco.bl { bottom: -30px; left: -26px; transform: rotate(18deg); }

/* ---------- layout: side menu ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
/* the menu list scrolls on its own, so the account and theme switch stay in view at the bottom */
.nav { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px 14px; position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.side-head { display: flex; align-items: center; gap: 12px; padding: 2px 6px 8px; }
.side-names { flex: 1; min-width: 0; }
.side-head .dorm { font-family: var(--display); font-weight: 700; font-size: 17px; color: var(--brand); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-head .prod { font-size: 12px; color: var(--muted); line-height: 1.3; }
.nav-close { display: none; }
.bpick:empty { display: none; }
.bpick select { width: 100%; font-weight: 600; height: 40px; background: var(--panel-2); }
.menu { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px 8px; }
.grp { font-size: 12px; font-weight: 600; color: var(--muted); padding: 12px 10px 4px; }
.mgrid { display: flex; flex-direction: column; gap: 2px; }
.mgrid a { position: relative; color: var(--text); font-weight: 500; min-height: 40px; padding: 0 12px; border-radius: 12px; display: flex; gap: 10px; align-items: center; }
.mgrid a:hover { background: var(--panel-2); text-decoration: none; }
.mi { display: flex; color: var(--muted); }
.mgrid a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.mgrid a.on .mi { color: var(--accent-ink); }
.nbadge:not(:empty) { margin-left: auto; background: var(--danger); color: #fff; border-radius: 99px; font-size: 12px; font-weight: 700; min-width: 22px; padding: 0 7px; text-align: center; line-height: 22px; }
.nav .me { flex: none; display: flex; flex-direction: column; gap: 10px; padding: 12px 2px 0; border-top: 1px solid var(--line); }
.me-id { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; display: grid; place-items: center; flex: none; }
.me-t { flex: 1; min-width: 0; line-height: 1.35; }
.me-t b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-t span { font-size: 12px; color: var(--muted); }
/* theme switch: สว่าง / มืด / ตามเครื่อง */
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); }
.seg button { flex: 1 1 auto; min-width: 0; min-height: 34px; padding: 0 5px; border: 0; border-radius: 99px; background: transparent; color: var(--muted); font-size: 12.5px; justify-content: center; gap: 5px; }
.seg button:hover { background: transparent; color: var(--text); }
.seg button .ic { width: 15px; height: 15px; }
.seg button.on { background: var(--seg-on); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.me-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.me-acts button { justify-content: center; gap: 6px; padding: 0 6px; }
.me-acts .ic { width: 15px; height: 15px; }
.icon-btn { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 99px; background: transparent; color: var(--muted); justify-content: center; font-size: 17px; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
main { padding: 28px 32px 60px; min-width: 0; }
.topbar, .tabs { display: none; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); margin: 2px 0 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btag { display: inline-flex; align-items: center; height: 20px; font-size: 11.5px; font-weight: 600; padding: 0 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); border: 0; vertical-align: 1px; white-space: nowrap; }
h2.bhead { display: flex; align-items: baseline; gap: 10px; font-size: 19px; margin: 22px 0 12px; } h2.bhead:first-child { margin-top: 4px; }
h2.bhead .small { font-family: var(--font); font-weight: 400; }
tr.bhead-row td { background: var(--bg) !important; font-family: var(--display); font-weight: 600; }
.thumb { width: 160px; max-height: 240px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); cursor: zoom-in; }
.slip { display: grid; grid-template-columns: 170px 1fr; gap: 14px; }
@media (max-width: 600px) { .slip { grid-template-columns: 1fr; } .thumb { width: 100%; } }
.timeline { list-style: none; padding: 0 0 0 14px; margin: 0; border-left: 2px solid var(--line); }
.timeline li { margin-bottom: 10px; }

/* phones and small tablets: the menu is a sheet of icon tiles above the short-cut tabs at the bottom */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; top: 0; left: 0; right: 0; bottom: calc(66px + env(safe-area-inset-bottom)); width: auto; height: auto; z-index: 40;
    background: var(--bg); border: 0; padding: calc(10px + env(safe-area-inset-top)) 16px 22px; gap: 10px; overflow-y: auto; overscroll-behavior: contain;
    opacity: 0; visibility: hidden; transform: translateY(18px); transition: opacity .18s, transform .22s, visibility 0s .22s; }
  .nav.open { opacity: 1; visibility: visible; transform: none; transition: opacity .18s, transform .22s; }
  .side-head { padding: 4px 0 2px; }
  .nav-close { display: grid; width: 44px; height: 44px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 50%; }
  .nav-close .ic { width: 20px; height: 20px; }
  .bpick select { height: 44px; background: var(--panel); }
  /* one card of tiles for every page, so the whole menu and the account fit on one phone screen */
  .menu { flex: none; overflow: visible; margin: 4px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; padding: 8px;
    border-radius: 18px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
  .grp { display: none; }
  .mgrid { display: contents; }
  .mgrid a { flex-direction: column; justify-content: flex-start; gap: 6px; min-height: 88px; padding: 10px 2px 8px; border-radius: 14px; text-align: center; font-size: 12.5px; line-height: 1.3; font-weight: 500; }
  .mgrid a .ml { text-wrap: balance; }
  .mgrid a .mi { width: 46px; height: 46px; border-radius: 15px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; }
  .mgrid a .mi .ic { width: 23px; height: 23px; }
  .mgrid a.on { background: none; }
  .mgrid a.on .mi { background: var(--accent); color: var(--accent-text); }
  .mgrid a.on .ml { color: var(--accent-ink); font-weight: 700; }
  .mgrid .nbadge:not(:empty) { position: absolute; top: 4px; left: calc(50% + 12px); margin: 0; border: 2px solid var(--panel); line-height: 18px; }
  .nav .me { margin-top: 6px; padding: 14px; gap: 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
  .seg button { min-height: 40px; font-size: 13.5px; }
  .me-acts button { min-height: 42px; font-size: 14px; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; height: calc(60px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 10px 0;
    background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
  .topbar .icon-btn { width: 44px; height: 44px; color: var(--text); }
  .topbar .t { flex: 1; min-width: 0; font-family: var(--display); font-weight: 700; font-size: 19px; color: var(--brand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  main { padding: 10px 14px 110px; }
  h1 { font-size: 22px; }
  .scrim { display: none; }
  .menu-open { overflow: hidden; }
  .tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: var(--panel); border-radius: 22px 22px 0 0; box-shadow: 0 -1px 0 var(--line), 0 -10px 30px -18px rgba(22, 70, 42, .35); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
  .tabs a, .tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; padding: 0;
    border: 0; border-radius: 12px; background: none; font: inherit; font-size: 11.5px; font-weight: 500; color: var(--muted); }
  .tabs a:hover, .tabs button:hover { text-decoration: none; background: none; }
  .tabs .ic { width: 22px; height: 22px; }
  .tabs a.on, .menu-open .tabs .tab-menu { color: var(--accent-ink); font-weight: 700; }
  .menu-open .tabs a.on { color: var(--muted); font-weight: 500; }
  .tabs a.on .ic, .menu-open .tabs .tab-menu .ic { stroke-width: 2.2; }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 340px) { .menu { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; } }

/* ---------- components ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card.tight { padding: 12px 14px; }
.card > h2:first-child { margin-bottom: 12px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-h h2 { margin: 0; }
.card-h .more { font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 2px; }
.card-h .more .ic, .go .ic { width: 16px; height: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 0 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 0 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 14px; margin-bottom: 18px; }
.kpis.big { grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr)); gap: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.kpi .l { color: var(--muted); font-size: 13.5px; font-weight: 500; }
.kpi .v { font-family: var(--display); font-size: 26px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.kpi .v small { font-family: var(--font); font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.kpi-top { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.kpi-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.kpis.big .kpi { padding: 16px 18px; gap: 6px; }
.kpis.big .v { font-size: 30px; }
.chip-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-ink); }
.kpi-top .chip-ic { width: 32px; height: 32px; border-radius: 10px; } .kpi-top .chip-ic .ic { width: 17px; height: 17px; }
.chip-ic.info { background: var(--info-soft); color: var(--info); } .chip-ic.warn { background: var(--warn-soft); color: var(--warn); }
.chip-ic.violet { background: var(--violet-soft); color: var(--violet); } .chip-ic.danger { background: var(--danger-soft); color: var(--danger); }
/* pastel number tiles: green, blue, peach, pink, violet, yellow */
.kpi.t { background: var(--tile); border-color: transparent; box-shadow: none; }
.t-green { --tile: var(--ok-soft); --ink: var(--ok); } .t-blue { --tile: var(--info-soft); --ink: var(--info); } .t-peach { --tile: var(--warn-soft); --ink: var(--warn); }
.t-pink { --tile: var(--danger-soft); --ink: var(--danger); } .t-violet { --tile: var(--violet-soft); --ink: var(--violet); } .t-yellow { --tile: var(--yellow-soft); --ink: var(--yellow); }
.kpi.t .chip-ic { background: color-mix(in srgb, var(--panel) 78%, transparent); color: var(--ink); }
.kpi.t .kpi-top, .kpi.t .l { color: var(--text); }
.kpi.t .small.muted, .kpi.t .v small { color: color-mix(in srgb, var(--text) 68%, var(--tile)); }
.kpi.t .bar { background: color-mix(in srgb, var(--panel) 72%, transparent); }
.kpi.t .bar > span { background: var(--ink); }
/* phones: two small tiles per row, icon above the label */
@media (max-width: 600px) {
  .kpis, .kpis.big { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis.big .kpi, .kpi { padding: 13px 13px 12px; border-radius: 18px; }
  .kpis.big .kpi-top { flex-direction: column; align-items: flex-start; gap: 6px; font-size: 13.5px; line-height: 1.35; }
  .kpis.big .v { font-size: 25px; } .kpi .v { font-size: 22px; }
  .kpis.big .ring { width: 46px; height: 46px; } .kpis.big .ring::after { width: 32px; height: 32px; }
  .kpis.big .kpi-row { align-items: flex-end; gap: 6px; }
  .kpi .small { font-size: 12px; line-height: 1.4; }
  .kpi .bar { min-width: 0; }
}
.ring { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.ring::after { content: ""; width: 46px; height: 46px; border-radius: 50%; background: var(--tile, var(--panel)); }

button, .btn { font: inherit; font-weight: 500; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); border-radius: 99px; min-height: 40px; padding: 0 17px;
  cursor: pointer; display: inline-flex; gap: 7px; align-items: center; white-space: nowrap; }
button:hover, .btn:hover { background: var(--panel-2); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
button.primary:hover, .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger-btn { color: var(--danger); border-color: var(--danger); }
button.link { border: 0; background: none; color: var(--accent); padding: 2px 4px; min-height: 0; }
button.link:hover { background: none; text-decoration: underline; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.small, .btn.small { min-height: 32px; padding: 0 13px; font-size: 13px; border-radius: 99px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 8px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); outline-offset: 0; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
textarea { min-height: 70px; }
label.f { display: block; margin-bottom: 12px; } label.f > span { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.check { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.card .table-wrap { box-shadow: none; border-radius: 14px; }
table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { font-size: 13px; color: var(--muted); font-weight: 600; background: var(--panel-2); position: sticky; top: 0; white-space: nowrap; }
table.t tr:last-child td { border-bottom: 0; } table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--panel-2); }
table.t th.num, table.t td.num { text-align: right; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--panel-2); color: var(--muted); }
.pill.vacant, .pill.paid { background: var(--ok-soft); color: var(--ok); }
.pill.booked { background: var(--violet-soft); color: var(--violet); }
.pill.occupied, .pill.unpaid, .pill.draft { background: var(--info-soft); color: var(--info); }
.pill.expiring, .pill.partial, .pill.draft_issue { background: var(--warn-soft); color: var(--warn); }
.pill.hold, .pill.void { background: var(--hold-soft); color: var(--hold); }
.pill.overdue { background: var(--danger-soft); color: var(--danger); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
@media (max-width: 600px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px 14px; padding: 0 14px 2px; scrollbar-width: none; }
  .chips .chip { flex: none; }
}
.chip { border-radius: 99px; min-height: 36px; padding: 0 14px; font-size: 14px; font-weight: 400; gap: 8px; }
.chip em { font-style: normal; font-size: 12.5px; font-weight: 600; min-width: 24px; height: 24px; padding: 0 7px; margin-right: -8px; border-radius: 99px; background: var(--panel-2); color: var(--muted); display: grid; place-items: center; }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.chip.on:hover { background: var(--accent-hover); }
.chip.on em { background: rgba(255, 255, 255, .24); color: inherit; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.notice { background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); padding: 12px 16px; border-radius: 16px; margin-bottom: 16px; }
.notice.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; } .dl dt { color: var(--muted); } .dl dd { margin: 0; }
.bar, .progress { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; min-width: 120px; }
.bar > span, .progress > div { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.ok > span { background: var(--ok); }

/* dashboard: things to do */
.todo { padding: 8px; }
.todo .card-h { padding: 10px 12px 0; margin-bottom: 4px; }
.count { font-size: 13px; color: var(--muted); font-family: var(--font); font-weight: 400; }
.todo-row { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; color: var(--text); }
.todo-row:hover { background: var(--panel-2); text-decoration: none; }
.todo-row + .todo-row { border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; }
.todo-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.45; }
.todo-t b { font-weight: 600; }
.todo-t span { font-size: 13.5px; color: var(--muted); }
.go { display: inline-flex; align-items: center; gap: 2px; padding: 5px 8px 5px 14px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.todo-row:hover .go { background: var(--accent); color: var(--accent-text); }
/* phones: only the arrow */
@media (max-width: 600px) { .go, .todo-row:hover .go { font-size: 0; padding: 0; gap: 0; background: none; color: var(--muted); } .go .ic { width: 20px; height: 20px; } }
.hello h1 { font-size: 28px; } .hello .sub { margin-top: 4px; }
@media (max-width: 900px) { .hello h1 { font-size: 24px; } }

/* dashboard: money collected per month */
.chart { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 14px; align-items: end; height: 210px; padding-top: 6px; }
.col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.col-v { font-size: 12.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-b { width: 100%; max-width: 64px; border-radius: 10px 10px 4px 4px; background: var(--chart-2); }
.col.now .col-b { background: var(--accent); } .col.now .col-v { color: var(--text); }
.col-m { font-size: 13px; color: var(--muted); }
@media (max-width: 600px) { .chart { gap: 6px; } .col-v { font-size: 11px; } }

/* dashboard: branches */
.branch { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; padding: 14px 12px; border-radius: 12px; color: var(--text); cursor: pointer; }
.branch:hover { background: var(--panel-2); text-decoration: none; }
.branch + .branch { border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; }
.branch-n { font-family: var(--display); font-weight: 600; font-size: 16px; }
.branch-s { font-size: 13.5px; color: var(--muted); }
.branch-r { text-align: right; } .branch-r b { display: block; font-variant-numeric: tabular-nums; }
.branch .bar { grid-column: 1 / -1; }

/* dashboard: arrears by age */
.stack { display: flex; height: 12px; border-radius: 99px; overflow: hidden; gap: 3px; margin: 4px 0 14px; background: var(--panel-2); }
.stack span { display: block; height: 100%; }
.a1 { background: var(--chart-2); } .a2 { background: var(--age-2); } .a3 { background: var(--age-3); } .a4 { background: var(--age-4); }
.aging { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; margin: 0 0 10px; }
.aging i { width: 10px; height: 10px; border-radius: 3px; display: block; }
.aging dt { color: var(--muted); } .aging dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

/* dashboard: people lists */
.li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; color: var(--text); border-radius: 10px; cursor: pointer; }
.li:hover { background: var(--panel-2); text-decoration: none; }
.li + .li { border-top: 1px solid var(--line); }
.rno { min-width: 40px; height: 40px; padding: 0 6px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); border: 0; font-family: var(--display); font-weight: 700; font-size: 16px; display: grid; place-items: center; flex: none; }
.li-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.li-t b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-t span { font-size: 13px; color: var(--muted); }
.when { font-size: 13px; font-weight: 600; white-space: nowrap; padding: 3px 10px; border-radius: 99px; }
.when.warn { background: var(--warn-soft); color: var(--warn); } .when.violet { background: var(--violet-soft); color: var(--violet); }

/* room map: colour + status word + icon + border style, never colour alone */
.floor { margin-bottom: 14px; } .floor h3 { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 1px; min-height: 112px; padding: 12px 14px 12px; border-radius: 18px;
  border: 1.5px solid transparent; background: var(--panel); color: var(--text); box-shadow: var(--shadow); cursor: pointer; }
.tile:hover { text-decoration: none; border-color: var(--line-2); }
.tile .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.tile .n { font-family: var(--display); font-weight: 700; font-size: 23px; line-height: 1.15; }
.tile .st { font-size: 13px; font-weight: 600; color: var(--muted); }
.tile .who { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 34px; }
.tile .owe { font-size: 12.5px; font-weight: 600; color: var(--danger); font-variant-numeric: tabular-nums; padding-right: 34px; }
/* status icon in the bottom corner: door = vacant, person = tenant */
.tile .tic { position: absolute; right: 10px; bottom: 10px; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--panel) 70%, transparent); color: var(--muted); }
.tile .tic .ic { width: 20px; height: 20px; }
.tile .badges { display: flex; gap: 4px; align-items: center; }
.tile .badges .ic { width: 17px; height: 17px; color: var(--warn); }
.tile.occupied { background: var(--ok-soft); box-shadow: none; } .tile.occupied .st, .tile.occupied .tic { color: var(--ok); }
.tile.vacant { border-style: dashed; border-color: var(--line-2); background: var(--panel); box-shadow: none; } .tile.vacant .tic { background: var(--panel-2); }
.tile.booked { background: var(--violet-soft); box-shadow: none; } .tile.booked .st, .tile.booked .tic { color: var(--violet); }
.tile.expiring { border-color: var(--expiring-line); background: var(--warn-soft); box-shadow: none; } .tile.expiring .st, .tile.expiring .tic { color: var(--warn); }
.tile.hold { border-color: var(--line-2); box-shadow: none; background: repeating-linear-gradient(135deg, var(--hold-soft) 0 8px, var(--panel) 8px 16px); } .tile.hold .st { color: var(--hold); }
.tile.owing { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, transparent); } .tile.owing .st { color: var(--text); } .tile.owing .tic { color: var(--danger); }
/* overdue: a red ! in the corner */
.bang { width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: var(--on-danger); font: 800 14px/22px var(--display); text-align: center; display: inline-block; flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.legend .bang, .help-sec .bang { width: 16px; height: 16px; font-size: 11px; line-height: 16px; box-shadow: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); display: inline-block; box-shadow: 0 0 0 3px var(--danger-soft); }
.legend { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 14px; align-items: center; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend .ic { width: 16px; height: 16px; color: var(--warn); }
.sw { width: 14px; height: 14px; border-radius: 5px; border: 1.5px solid var(--line-2); background: var(--panel); display: inline-block; }
.sw.occupied { border-color: var(--ok); background: var(--ok-soft); }
.sw.vacant { border: 1.5px dashed var(--muted); background: var(--panel); } .sw.booked { border-color: var(--violet); background: var(--violet-soft); }
.sw.expiring { border-color: var(--expiring-line); background: var(--warn-soft); }
.sw.hold { background: repeating-linear-gradient(135deg, var(--hold-soft) 0 3px, var(--panel) 3px 6px); }

/* meters */
.meter-in { width: 110px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.meter-cell { display: flex; flex-direction: column; gap: 3px; }
.meter-cell .used { font-size: 12.5px; color: var(--muted); }
.meter-cell.warn input { border-color: var(--warn); } .meter-cell.err input { border-color: var(--danger); } .meter-cell.saved input { border-color: var(--ok); }
.meter-cell.saved .used { color: var(--ok); } .meter-cell.warn .used { color: var(--warn); } .meter-cell.err .used { color: var(--danger); }
.mlab { display: none; }
@media (max-width: 640px) {
  .meters { background: none; border: 0; box-shadow: none; overflow: visible; }
  .meters table, .meters tbody, .meters td { display: block; }
  .meters thead { display: none; }
  .meters tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
  .meters tr.bhead-row { display: block; background: none; border: 0; box-shadow: none; padding: 6px 2px 0; margin: 0; }
  .meters table.t tr.bhead-row td { background: none !important; font-size: 17px; padding: 0; }
  .meters table.t td { padding: 0; border: 0; }
  .meters td:first-child { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
  .meters td:first-child b { min-width: 40px; height: 40px; padding: 0 7px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-family: var(--display); font-size: 17px; display: grid; place-items: center; }
  .meters td:first-child button { margin-left: auto; }
  .meters .mlab { display: flex; align-items: center; gap: 5px; font-weight: 600; font-size: 13px; }
  .meters .mlab .ic { width: 15px; height: 15px; }
  .meters .meter-cell .small { min-height: 2.7em; line-height: 1.35; }
  .meters .meter-in { width: 100%; height: 52px; font-family: var(--display); font-size: 21px; text-align: center; border-radius: 14px; }
}
.mlab .w { color: #2f7bd6; } .mlab .e { color: #c98a00; }

/* modal & toast */
.modal-back { position: fixed; inset: 0; background: rgba(8, 14, 12, .5); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 12px; overflow-y: auto; }
.modal { background: var(--panel); border-radius: 24px; width: 100%; max-width: 520px; padding: 20px 22px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); border: 1px solid var(--line); }
.modal.wide { max-width: 760px; }
.modal h2 { font-size: 19px; margin-bottom: 14px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal .err { color: var(--danger); margin-top: 8px; white-space: pre-wrap; }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; }
.toast.error { background: var(--danger); color: #fff; }
.toast a, .toast button { color: inherit; border-color: currentColor; background: transparent; }

/* login */
.login { max-width: 410px; margin: 7vh auto; padding: 0 16px; position: relative; z-index: 1; }
.theme-corner { position: absolute; right: 16px; top: -44px; }
.login .card { padding: 28px 26px; border-radius: 26px; }
.login-head { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; margin-bottom: 18px; }
.login-head h1 { font-size: 30px; color: var(--brand); }
.login-head .prod { color: var(--muted); font-size: 14px; margin-top: -8px; }
.login .brand { text-align: center; margin-top: 14px; }
.login .center { text-align: center; margin: 14px 0 0; }
.check.remember { margin: 2px 0 10px; gap: 10px; cursor: pointer; line-height: 1.4; }
.check.remember input { width: 20px; height: 20px; flex: none; }

/* search box with an icon */
.field { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 99px; background: var(--panel); color: var(--muted); }
.field input { border: 0; padding: 0; height: 100%; background: transparent; min-width: 0; width: 180px; }
.field input:focus { outline: none; }
.field:focus-within { outline: 3px solid var(--accent-soft); border-color: var(--accent); }

/* "คู่มือ" button on every page */
.btn.help-link { min-height: 32px; padding: 0 10px; font-size: 13px; color: var(--muted); border-color: var(--line); gap: 5px; }
.btn.help-link .ic { width: 15px; height: 15px; }
.btn.help-link:hover { color: var(--accent-ink); }

/* user manual */
.help { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.help-toc { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 1px; max-height: calc(100vh - 32px); overflow-y: auto; }
.help-toc a { display: flex; gap: 9px; align-items: center; padding: 6px 10px; border-radius: 9px; color: var(--text); font-size: 14px; line-height: 1.35; }
.help-toc a .ic { width: 16px; height: 16px; color: var(--muted); }
.help-toc a:hover { background: var(--panel-2); text-decoration: none; }
.help-toc a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.help-toc a.on .ic { color: var(--accent-ink); }
.help-toc a[hidden] { display: none; }
.help-sec { scroll-margin-top: 16px; padding: 22px 24px; }
.help-sec[hidden] { display: none; }
.help-sec h2 { display: flex; gap: 10px; align-items: center; font-size: 20px; margin: 0 0 12px; }
.help-sec h2 .ic { width: 22px; height: 22px; color: var(--accent); }
.help-sec h3 { font-size: 16px; margin: 20px 0 6px; }
.help-sec p, .help-sec li, .help-sec dd { line-height: 1.75; }
.help-sec p { margin: 8px 0; }
.help-sec ol, .help-sec ul { padding-left: 22px; margin: 6px 0 10px; }
.help-sec li + li { margin-top: 5px; }
.help-sec .table-wrap { box-shadow: none; margin: 10px 0; }
.help-sec td .sw, .help-sec td .dot { vertical-align: -2px; margin-right: 4px; }
.ui { font-weight: 600; font-size: .93em; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; white-space: nowrap; }
.tip, .caution { padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); }
.caution { background: var(--warn-soft); }
.steps > li::marker { font-weight: 700; color: var(--accent); }
.faq { margin: 0; }
.faq dt { font-weight: 600; margin-top: 14px; }
.faq dt:first-child { margin-top: 0; }
.faq dd { margin: 2px 0 0; color: var(--muted); }
@media (max-width: 900px) {
  .help { grid-template-columns: 1fr; gap: 12px; }
  .help-toc { position: static; flex-direction: row; overflow-x: auto; max-height: none; margin: 0 -14px; padding: 0 14px 4px; gap: 6px; scrollbar-width: none; }
  .help-toc a { flex: none; border: 1px solid var(--line-2); border-radius: 99px; background: var(--panel); padding: 6px 12px; white-space: nowrap; }
  .help-sec { padding: 18px 16px; }
  .field input { width: 140px; }
}
/* printing the manual: plain black on white, no menus */
@media print {
  html:root, html:root[data-theme], html:root:not([data-theme="light"]) {
    color-scheme: light; --bg: #fff; --panel: #fff; --panel-2: #f2f2f2; --text: #111; --muted: #444; --line: #ccc; --line-2: #bbb;
    --accent: #1f7a4c; --accent-soft: #e6f3ea; --accent-ink: #165c39; --warn-soft: #fff3e0;
  }
  .help-toc, .help-link, .page-head .toolbar { display: none !important; }
  .help { display: block; }
  .help-sec { box-shadow: none; border: 0; border-top: 1px solid #ccc; border-radius: 0; padding: 14px 0 0; margin: 0 0 14px; }
  .help-sec h2 { break-after: avoid; }
  .tip, .caution, .ui { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media print { .nav, .topbar, .tabs, .toolbar, button, .deco { display: none !important; } .shell { display: block; } main { padding: 0; } body { background: #fff; } }

/* ======================= Liquid Glass =======================
   Frosted, see-through panels over a soft colourful background, light edges, floating tab bar.
   Screen only (printing keeps the plain look above). Falls back to the solid theme when the browser has no backdrop blur
   or the person asked for less transparency (iPhone: ลดความโปร่งใส / Reduce Transparency). */
:root {
  --glass: rgba(255, 255, 255, .56); --glass-strong: rgba(255, 255, 255, .74); --glass-line: rgba(255, 255, 255, .72);
  --glass-edge: rgba(22, 70, 42, .10); --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .9), inset 0 -1px 0 rgba(255, 255, 255, .28);
  --glass-shadow: 0 1px 1px rgba(22, 70, 42, .04), 0 12px 32px -14px rgba(22, 70, 42, .28); --blur: blur(22px) saturate(175%);
  --orbs: radial-gradient(620px 520px at 8% 0%, #bfe8cf 0, transparent 62%), radial-gradient(560px 460px at 100% 12%, #cde4ff 0, transparent 60%),
    radial-gradient(640px 560px at 86% 100%, #fde2c6 0, transparent 62%), radial-gradient(600px 520px at 0% 92%, #d8f0bd 0, transparent 60%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass: rgba(26, 38, 32, .5); --glass-strong: rgba(30, 44, 37, .72); --glass-line: rgba(255, 255, 255, .12);
    --glass-edge: rgba(0, 0, 0, .35); --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .13), inset 0 -1px 0 rgba(255, 255, 255, .03);
    --glass-shadow: 0 14px 36px -16px rgba(0, 0, 0, .8);
    --orbs: radial-gradient(620px 520px at 8% 0%, #12402a 0, transparent 62%), radial-gradient(560px 460px at 100% 12%, #142c4a 0, transparent 60%),
      radial-gradient(640px 560px at 86% 100%, #3a2a14 0, transparent 62%), radial-gradient(600px 520px at 0% 92%, #1d3a16 0, transparent 60%);
  }
}
:root[data-theme="dark"] {
  --glass: rgba(26, 38, 32, .5); --glass-strong: rgba(30, 44, 37, .72); --glass-line: rgba(255, 255, 255, .12);
  --glass-edge: rgba(0, 0, 0, .35); --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .13), inset 0 -1px 0 rgba(255, 255, 255, .03);
  --glass-shadow: 0 14px 36px -16px rgba(0, 0, 0, .8);
  --orbs: radial-gradient(620px 520px at 8% 0%, #12402a 0, transparent 62%), radial-gradient(560px 460px at 100% 12%, #142c4a 0, transparent 60%),
    radial-gradient(640px 560px at 86% 100%, #3a2a14 0, transparent 62%), radial-gradient(600px 520px at 0% 92%, #1d3a16 0, transparent 60%);
}
@media screen and (prefers-reduced-transparency: no-preference) {
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  /* the colourful light behind the glass stays put while the page scrolls (a fixed layer: iPhones ignore fixed backgrounds) */
  body { background: var(--bg); }
  body::before { content: ""; position: fixed; inset: -10vh -10vw; z-index: -1; pointer-events: none; background: var(--orbs), var(--bg); }

  .card, .kpi, .table-wrap, .modal, .nav .me, .login .card, .tile, .todo, .help-toc {
    background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--glass-hi), var(--glass-shadow);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  }
  .card .table-wrap, .help-sec .table-wrap { background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  table.t th { background: color-mix(in srgb, var(--glass-strong) 70%, transparent); }
  table.t th, table.t td { border-bottom-color: color-mix(in srgb, var(--line) 70%, transparent); }
  table.t tr.click:hover td, .li:hover, .todo-row:hover, .branch:hover { background: color-mix(in srgb, var(--glass-strong) 80%, transparent); }

  /* tinted glass for coloured number tiles and room tiles */
  .kpi.t { background: color-mix(in srgb, var(--tile) 66%, transparent); border-color: var(--glass-line); box-shadow: var(--glass-hi), var(--glass-shadow); }
  .kpi.t .chip-ic { background: var(--glass-strong); box-shadow: var(--glass-hi); }
  .tile.occupied { background: color-mix(in srgb, var(--ok-soft) 70%, transparent); }
  .tile.vacant { background: var(--glass); border: 1.5px dashed var(--line-2); }
  .tile.booked { background: color-mix(in srgb, var(--violet-soft) 72%, transparent); }
  .tile.expiring { background: color-mix(in srgb, var(--warn-soft) 72%, transparent); border-color: var(--expiring-line); }
  .tile.owing { background: color-mix(in srgb, var(--danger-soft) 74%, transparent); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
  .tile .tic { background: var(--glass-strong); box-shadow: var(--glass-hi); }

  /* controls: glass capsules; the main button is green glass with a light edge */
  button, .btn, .field, .seg { background: var(--glass-strong); border-color: var(--glass-line); box-shadow: var(--glass-hi);
    -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%); }
  button:hover, .btn:hover { background: color-mix(in srgb, var(--glass-strong) 60%, var(--panel)); }
  button.primary, .btn.primary, .chip.on {
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 78%, #fff) 0%, var(--accent) 55%, color-mix(in srgb, var(--accent) 88%, #000) 100%);
    border-color: color-mix(in srgb, var(--accent) 70%, #fff); color: var(--accent-text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 8px 20px -8px color-mix(in srgb, var(--accent) 75%, transparent);
  }
  button.link, .seg button, .tabs a, .tabs button, .icon-btn, .nav-close, .mgrid a, .theme-corner { -webkit-backdrop-filter: none; backdrop-filter: none; }
  button.link, .seg button:not(.on), .tabs a, .tabs button, .icon-btn, .mgrid a { background: transparent; border-color: transparent; box-shadow: none; }
  .seg button.on { background: var(--glass-strong); box-shadow: var(--glass-hi), 0 2px 8px -2px rgba(0, 0, 0, .18); }
  input, select, textarea { background: var(--glass-strong); border-color: var(--glass-line); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .06); }
  .field input { background: transparent; box-shadow: none; }
  .pill, .btag, .when, .chip em { box-shadow: var(--glass-hi); }

  /* side menu on a computer: a tall glass panel */
  .nav { background: var(--glass); border-right: 1px solid var(--glass-line); box-shadow: var(--glass-hi);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
  .mgrid a.on { background: color-mix(in srgb, var(--accent-soft) 78%, transparent); box-shadow: var(--glass-hi); }
  .logo { background: linear-gradient(145deg, color-mix(in srgb, var(--logo-a) 80%, transparent), color-mix(in srgb, var(--logo-b) 70%, transparent));
    box-shadow: var(--glass-hi), 0 0 0 1px var(--glass-line); }
  .logo.lg { background: none; box-shadow: none; }
  .modal-back { background: rgba(8, 20, 14, .28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  .toast { background: color-mix(in srgb, var(--text) 82%, transparent); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--glass-shadow); }

  @media (max-width: 900px) {
    /* phone: glass top bar, and the tab bar floats as a glass capsule above the bottom edge */
    .topbar { background: color-mix(in srgb, var(--glass) 70%, transparent); border-bottom: 1px solid var(--glass-line); }
    .tabs { left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 6px; border-radius: 30px;
      background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--glass-hi), 0 16px 36px -12px rgba(22, 70, 42, .38);
      -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
    .tabs a.on, .menu-open .tabs .tab-menu { background: color-mix(in srgb, var(--accent-soft) 82%, transparent); box-shadow: var(--glass-hi); border-radius: 24px; }
    .menu-open .tabs a.on { background: transparent; box-shadow: none; }
    main { padding-bottom: calc(118px + env(safe-area-inset-bottom)); }
    .nav { bottom: calc(88px + env(safe-area-inset-bottom)); border: 0; background: color-mix(in srgb, var(--bg) 55%, transparent); }
    .menu { background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--glass-hi), var(--glass-shadow);
      -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
    .mgrid a .mi { background: color-mix(in srgb, var(--accent-soft) 75%, transparent); box-shadow: var(--glass-hi); }
    .mgrid a.on .mi { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 78%, #fff), var(--accent)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45); }
    .nav-close { background: var(--glass-strong); border-color: var(--glass-line); box-shadow: var(--glass-hi); }
    .meters tr { background: var(--glass); border-color: var(--glass-line); box-shadow: var(--glass-hi), var(--glass-shadow);
      -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
    #toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
  }
}
}
