/* ============================================================
   Get-LED Business System — UI stylesheet
   Corporate Identity 2023:
     Caribbean Green #00CC99 · Granite Grey #666666 · White
   Premium business tool · light theme
   Fonts: OS-local only, no network fetch (office must run fully offline —
   gof 2026-08-01). 'Leelawadee UI' ships with Windows 10/11 and is the one
   Thai font with correct stacked-mark metrics (สระบน+วรรณยุกต์ e.g. "ชั้น"
   render fully); 'Thonburi' covers the future macOS/Mac Mini deploy target.
   Previously loaded 'Sarabun'/'Mitr' from Google Fonts — removed: when the
   office network can't reach it the request just hangs/fails per page load,
   and it was never required since Leelawadee UI already renders Thai fully.
   Note: #00CC99 fails AA as text/button color — use it for identity
   and decorative surfaces only; text-safe shade is --accent #00805f.
   ============================================================ */

:root {
  --font: 'Leelawadee UI', 'Thonburi', Tahoma, sans-serif;
  --font-display: 'Leelawadee UI', 'Thonburi', Tahoma, sans-serif;

  /* surfaces — layered for depth (page < rail < card < raised) */
  --bg: #eef2f1;
  --bg-2: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #f5f8f7;
  --surface-3: #eef3f1;          /* solid, opaque — used for sticky table heads */
  --border: #e6ecea;
  --border-2: #eef2f1;
  --border-strong: #cdd7d3;

  /* ink — primary dark + CI granite grey for secondary */
  --ink: #1c2723;
  --ink-2: #3e4a45;
  --grey: #667069;               /* CI Granite Grey family — secondary text */
  /* Design refresh 2026-08-01 (Karina spec §2.2): was #8b948f — 3.12:1 on white, fails WCAG AA (used on
     timestamps/sub-labels/.stat-sub/empty-state text on nearly every page). New value is 6.05:1 on
     white / 5.66 on --surface-2 / 5.36 on --bg — passes AA everywhere this token is actually used. */
  --muted: #5b665f;

  /* brand greens — CI Caribbean Green + derived UI shades (hue ~165) */
  --brand: #00cc99;              /* CI exact — identity / decorative only */
  --brand-deep: #00a87e;
  --accent: #00805f;             /* buttons, links — AA (4.9:1) with white */
  --accent-hover: #006b50;
  --accent-press: #005c45;
  --accent-ink: #00694f;         /* text on soft green tints */
  --accent-soft: #e4f7ef;
  --accent-soft-2: #c9f0e1;
  --ring: rgba(0, 204, 153, 0.32);

  /* semantic */
  --danger: #cc3b3b;
  --danger-soft: #fdecec;
  --danger-border: #f3cccc;
  --warn: #e08a1e;
  --warn-ink: #8a6108;
  --warn-soft: #fdf2d9;
  --warn-border: #f2e0b0;
  --info-ink: #2f5fa8;
  --info-soft: #e8f0fc;
  --info-border: #d2e0f5;

  --radius-lg: 14px;
  --radius: 11px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  /* premium layered shadows — soft, cool, multi-stop */
  --shadow-xs: 0 1px 2px rgba(20, 42, 34, 0.05);
  --shadow-sm: 0 1px 2px rgba(20, 42, 34, 0.04), 0 2px 6px -1px rgba(20, 42, 34, 0.06);
  --shadow-md: 0 2px 4px rgba(20, 42, 34, 0.04), 0 8px 20px -6px rgba(20, 42, 34, 0.12);
  --shadow-lg: 0 4px 10px rgba(20, 42, 34, 0.06), 0 20px 40px -12px rgba(20, 42, 34, 0.20);

  --sidebar-w: 240px;
  --topbar-h: 58px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft-2); color: var(--accent-press); }

/* ---------- App shell: sidebar + topbar + content ---------- */

body.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  min-height: 100vh;
}

nav#nav {
  grid-area: sidebar;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%);
  border-right: 1px solid var(--border);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

/* real logo mark (GET LOGO.png is 419x316 — keep its aspect, no crop) */
.brand-mark {
  width: 44px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--brand);
  box-shadow: 0 2px 8px -2px rgba(0, 168, 126, 0.55);
}

.brand-mark img { display: block; width: 100%; height: 100%; }

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16.5px;
  color: var(--grey);            /* CI wordmark is granite grey */
  letter-spacing: 0.2px;
}

.brand-text small {
  font-family: var(--font);
  font-weight: 500;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.side-menu { display: flex; flex-direction: column; gap: 2px; }

.side-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--grey);
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease;
}

.side-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.8; transition: opacity 0.16s ease; }

.side-link:hover { background: var(--surface-2); color: var(--ink); }
.side-link:hover svg { opacity: 1; }

.side-link.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

.side-link.active svg { opacity: 1; color: var(--accent); }

/* accent rail on active item */
.side-link.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}

.side-foot {
  margin-top: auto;
  padding: 14px 8px 4px;
  font-size: 11.5px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* topbar — sticky at the top under window scroll. Fully OPAQUE (solid
   --surface, no rgba/backdrop) so rows scrolling beneath it never show
   through above the table header. */
.topbar {
  grid-area: topbar;
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar .spacer { flex: 1; }

.topbar-title { font-family: var(--font-display); font-size: 15px; font-weight: 500; color: var(--ink-2); letter-spacing: 0.2px; }

.user-chip { display: flex; align-items: center; gap: 10px; }

.user-chip .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--brand), var(--brand-deep));
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px -1px rgba(0, 168, 126, 0.5);
}

.user-chip .user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-chip .user-meta b { font-size: 13px; font-weight: 600; color: var(--ink); }
.user-chip .user-meta small { font-size: 11.5px; color: var(--muted); }

.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--grey);
  font-size: 13px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.logout-btn svg { width: 15px; height: 15px; }
.logout-btn:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }

.icon-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;   /* design refresh 2026-08-01 (Karina §2.2): was 38px — below the 44px WCAG touch target */
  height: 44px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--grey);
  cursor: pointer;
}

.icon-btn svg { width: 19px; height: 19px; }

/* Notification Center (office feedback §A4, migration 045) — one bell button, shared by every page */
.notif-wrap { position: relative; }
.notif-bell {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; position: relative;  /* was 38x38 (design refresh 2026-08-01, §2.2) */
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--grey); cursor: pointer; font-size: 18px; line-height: 1;
}
.notif-bell:hover { background: var(--accent-soft); }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.notif-panel {
  display: none; position: absolute; top: calc(100% + 10px); right: 0;
  width: 340px; max-width: 90vw; max-height: 420px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 20px 50px -20px rgba(20, 42, 34, 0.35); z-index: 40;
}
.notif-panel.on { display: block; }
.notif-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface);
}
.notif-panel-head button {
  border: none; background: none; color: var(--brand-deep); font-size: 12.5px;
  font-weight: 600; cursor: pointer; padding: 4px 6px;
}
.notif-list { padding: 4px 0; }
.notif-item { padding: 10px 14px; border-bottom: 1px solid rgba(20, 42, 34, 0.06); cursor: pointer; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--accent-soft); }
.notif-item.unread { background: #f4fbf8; }
.notif-item.unread .notif-title { font-weight: 700; }
.notif-title { font-size: 13px; color: var(--ink); }
.notif-body { font-size: 12px; color: var(--grey); margin-top: 2px; }
.notif-when { font-size: 11px; color: var(--muted); margin-top: 4px; }
.notif-empty { padding: 24px 14px; text-align: center; color: var(--muted); font-size: 13px; }

/* Shared modal dialog (originally local to customer.html's on-site check-in — centralised here so §B1's
   accounting-contact pop-up + §B2's survey-request modals reuse it without a 3rd/4th copy-paste). */
.dlg-back { position: fixed; inset: 0; background: rgba(20, 42, 34, 0.42); display: none; align-items: flex-start; justify-content: center; z-index: 60; padding: 40px 16px; overflow-y: auto; }
.dlg-back.on { display: flex; }
.dlg { background: #fff; border-radius: 12px; width: 100%; max-width: 480px; box-shadow: 0 20px 60px -20px rgba(20, 42, 34, 0.5); }
.dlg-head { padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.dlg-head h2 { margin: 0; font-size: 17px; }
.dlg-head .x { margin-left: auto; cursor: pointer; border: none; background: none; font-size: 22px; color: var(--grey); line-height: 1; }
.dlg-body { padding: 16px 18px; }
.dlg-body label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px; }
.dlg-body input[type=text], .dlg-body input[type=date], .dlg-body textarea { width: 100%; box-sizing: border-box; }

.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(18, 34, 28, 0.44);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

body.nav-open .nav-overlay { opacity: 1; pointer-events: auto; }

/* content — wide work area so list tables show full rows on one line without truncation;
   still centred with side padding, and every list card keeps its own overflow-x fallback. */
main {
  grid-area: main;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 30px 40px 56px;
}

h1 {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: 0.1px;
  color: var(--ink);
}

h2 {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 500;
  margin: 0 0 14px;
  color: var(--ink);
  letter-spacing: 0.1px;
}

.page-head { margin-bottom: 22px; }
.page-sub { margin: 3px 0 0; font-size: 13.5px; color: var(--muted); }

main > h1 { margin-bottom: 18px; }

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.card.flush { padding: 0; overflow: hidden; }
.card.flush table { border-radius: var(--radius-lg); }

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  font-size: 14px;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-2);
  vertical-align: middle;
}

th {
  background: var(--surface-2);
  color: var(--grey);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* first / last cells get a touch more breathing room */
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.13s ease; }
tbody tr:hover td { background: #f0faf6; }

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { color: var(--ink); font-feature-settings: "tnum"; }

/* empty-state rows (JS renders a single full-width cell) */
tbody td[colspan] {
  text-align: center;
  color: var(--muted);
  padding: 36px 16px;
  font-size: 13.5px;
}
tbody tr:hover td[colspan] { background: transparent; }

/* Sticky table head — OPT-IN via .sticky-head on the wrapping card.
   Global sticky was removed: multi-table pages (products, users, reports)
   stacked several heads at the same top offset, and the head fill was
   near-transparent so scrolled rows bled through (the "double header"
   bug). Only single-table list cards opt in, and the head fill is fully
   OPAQUE (--surface-3, no alpha) so rows can never show through. */
@media (min-width: 921px) {
  .card.sticky-head thead th {
    position: sticky;
    top: var(--topbar-h);                /* pins flush beneath the sticky topbar */
    z-index: 6;
    background: var(--surface-3);        /* opaque, no alpha — rows can't bleed */
    box-shadow: inset 0 -1px 0 var(--border);
  }
}

/* ---------- Forms ---------- */

label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin: 13px 0 5px;
  color: var(--ink-2);
}

/* line-height is explicit (not just inherited from body) — Thai stacks up to 2 marks above a
   consonant (สระ+วรรณยุกต์ e.g. "ชั้น"/"ที่") and a too-tight line box clips the top mark inside
   the input's own clipped content box. 1.6 gives enough headroom; verified against ชั้น ที่ ป้าย
   หนึ่ง ตู้ จ้าง เมื่อ ไม้ (gof 2026-08-01 report + fix). */
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667069' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 34px;
}

textarea { resize: vertical; min-height: 62px; }

input::placeholder, textarea::placeholder { color: #a8b1ad; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--ring);
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-2);
  color: var(--grey);
  border-color: var(--border);
  cursor: not-allowed;
}

input:user-invalid { border-color: var(--danger); }

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  box-shadow: none;
}

input[type="number"] { font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  /* Design refresh 2026-08-01 (Karina spec §2.2): was #009671 -> var(--accent) — the top stop measured
     3.75:1 with white text, failing AA. Both stops of the new gradient (--accent/--accent-hover) are
     already-defined tokens, no new colour: 4.94:1 -> 6.52:1, passing at both ends. */
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

button:hover { filter: brightness(1.06); box-shadow: var(--shadow-sm); }
button:active { transform: translateY(1px); filter: brightness(0.97); }
button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
button:disabled { opacity: 0.5; cursor: not-allowed; filter: none; transform: none; }

button.ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--accent);
  box-shadow: var(--shadow-xs);
}
button.ghost:hover { background: var(--accent-soft); border-color: var(--accent-soft-2); filter: none; }

button.danger {
  background: var(--surface);
  border-color: var(--danger-border);
  color: var(--danger);
  box-shadow: var(--shadow-xs);
}
button.danger:hover { background: var(--danger-soft); border-color: var(--danger); filter: none; }

button.small { padding: 5px 12px; font-size: 12.5px; font-weight: 600; }

.btn-block { width: 100%; margin-top: 20px; padding: 11px 18px; font-size: 15px; }

/* ---------- Toggle-button / segmented-control safety net (กอฟ live bug report 2026-08-05) ----------
   Root cause: several pages define their OWN local "tab"/"segmented" button class that overrides the
   base button{} rule above for the IDLE state — but the base button{} rule sets `color: #fff` (white,
   correct ONLY for its own dark-gradient background), and every one of these local classes is a plain
   class selector (same specificity as the element-level `button{}` above, so it always wins on whatever
   property it DOES set) — a copy that overrides `background` to something light/white WITHOUT ALSO
   re-declaring `color` silently keeps inheriting that leftover white text: white background + white
   text, invisible. Confirmed live on 5 pages sharing one exact copy-pasted pattern (attendance-
   compliance.html .ac-tab, evaluations.html .ev-tab, leave.html .lv-tab, schedule-requests.html .sr-tab,
   warning-letters.html .wl-tab — each pairs `.xx-tab { background:#fff; ... }` idle with a CORRECT
   `.xx-tab.active { background:var(--brand); color:#fff }` selected state) and, in a milder form, on
   pages that reuse the `.seg-btn` segmented-control idiom (dashboard.css's OWN copy is correct) without
   ever loading dashboard.css at all (deals-kanban.html, project-kanban.html, projects.html,
   marketing-calendar.html, attendance.html, forecast.html) — those fall through to the raw gradient
   button{} for BOTH idle and "on" alike, so the selected state is never visually distinct.
   Fixed HERE (not per-page) so every CURRENT instance is covered in one place, and so a FUTURE page that
   reuses either established naming convention (a `.seg`/`.seg-btn` pair, or a per-page "xx-tab" class —
   both patterns already exist repeatedly across this codebase by convention, see e.g. report-ar.html's
   own comment "same .seg/.seg-btn convention as calendar.html/project-kanban.html") gets a safe, readable
   default even if its author forgets to set `color` — without needing to touch this file again.
   Specificity stays LOW on purpose (plain class / one class + one attribute selector) so:
     - a page's OWN more specific or later-declared local override (calendar.html/report-ar.html/
       report-pl.html/dashboard.css's `.seg-btn` — all already correct) keeps winning exactly as before;
     - every existing 2-class "selected" variant (`.xx-tab.active`, `.seg-btn.on`) still wins over this
       1-class default (0,2,0 beats 0,1,0 / 0,1,1) — the CI-green + white text "pressed" look is untouched. */
.seg-btn,
button[class$="-tab"] {
  color: var(--grey);
}
/* Full segmented-control treatment (mirrors dashboard.css's own already-correct .seg/.seg-btn byte for
   byte) — pages that never link dashboard.css (deals-kanban.html, project-kanban.html, projects.html,
   marketing-calendar.html, attendance.html, forecast.html) now get the SAME idle/hover/on look instead of
   silently falling through to the plain gradient button{}. On any page that DOES also link dashboard.css,
   that stylesheet loads AFTER this one with identical selectors/values, so it simply wins the cascade —
   zero visual change there. */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.seg-btn {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.seg-btn:hover { background: var(--surface); color: var(--ink); filter: none; box-shadow: none; }
.seg-btn:active { transform: none; }
.seg-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.seg-btn.on, .seg-btn.active {
  background: var(--surface);
  color: var(--accent-ink);
  box-shadow: var(--shadow-xs);
}
.seg-btn.on:hover, .seg-btn.active:hover { background: var(--surface); filter: none; }

/* Show/hide password toggle (app.js wirePasswordToggles) — wraps every password <input> automatically. */
.pw-field-wrap { position: relative; display: block; }
/* design refresh 2026-08-01 (§2.2): padding widened 42px->48px to match the larger toggle hit-area below */
.pw-field-wrap input[type="password"], .pw-field-wrap input[type="text"] { padding-right: 48px; }
.pw-toggle-btn {
  position: absolute; top: 50%; right: 2px; transform: translateY(-50%);   /* right was 4px */
  width: 40px; height: 40px; padding: 0; margin: 0;                        /* was 30x30, below 44px target */
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none; box-shadow: none; color: var(--grey); cursor: pointer;
}
.pw-toggle-btn:hover { color: var(--accent); filter: none; box-shadow: none; background: none; }
.pw-toggle-btn:active { transform: translateY(-50%); filter: none; }
.pw-toggle-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-radius: var(--radius-xs); }
.pw-toggle-btn svg { width: 18px; height: 18px; }

/* ---------- Links / toolbar / misc ---------- */

a.link { color: var(--accent); font-weight: 500; text-decoration: none; }
a.link:hover { text-decoration: underline; text-underline-offset: 2px; }

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.row-actions { display: flex; gap: 6px; white-space: nowrap; align-items: center; }

.warn { color: var(--warn-ink); font-size: 13px; }

/* messages (JS toggles .ok / .err) */
.msg { padding: 12px 16px; border-radius: var(--radius-sm); margin: 0 0 16px; display: none; font-size: 14px; font-weight: 500; }
.msg.ok { background: var(--accent-soft); color: #04563e; border: 1px solid var(--accent-soft-2); display: block; }
.msg.err { background: var(--danger-soft); color: #9c2f2f; border: 1px solid var(--danger-border); display: block; }

.callout {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid transparent;
}
.callout.warning { background: var(--warn-soft); border-color: var(--warn-border); color: #6d4d08; }

/* ---------- Status badges (Thai document workflow + CRM outcome) ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  background: #eef1f0;
  color: var(--grey);
  border: 1px solid rgba(20, 42, 34, 0.05);
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* document status */
.badge.draft            { background: #eef1f0; color: #5e6863; }
.badge.pending_approval { background: var(--warn-soft); color: var(--warn-ink); border-color: var(--warn-border); }
.badge.approved         { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-soft-2); }
.badge.sent             { background: var(--info-soft); color: var(--info-ink); border-color: var(--info-border); }
/* Design refresh 2026-08-01 (Karina spec §2.2): was brand->brand-deep — 2.08-3.04:1 with white text
   across the gradient, failing AA (the standout status in the whole quotations table!). New stops
   (--accent-hover/--accent-press, both already-defined tokens) measure 6.52-8.03:1. */
.badge.confirmed        { background: linear-gradient(180deg, var(--accent-hover), var(--accent-press)); color: #fff; border-color: transparent; box-shadow: 0 1px 3px -1px rgba(0, 92, 69, 0.6); }
.badge.confirmed::before { background: rgba(255, 255, 255, 0.9); }
.badge.cancelled        { background: var(--danger-soft); color: #ab3232; border-color: var(--danger-border); }
.badge.option_closed    { background: #f2eef7; color: #7c5bb0; border-color: #e4dbf1; }

/* §B6 expense claim status (draft/approved/cancelled reuse the rules above) */
.badge.submitted { background: var(--info-soft); color: var(--info-ink); border-color: var(--info-border); }
.badge.rejected  { background: var(--danger-soft); color: #ab3232; border-color: var(--danger-border); }
/* same contrast fix + reason as .badge.confirmed above (design refresh 2026-08-01) */
.badge.paid      { background: linear-gradient(180deg, var(--accent-hover), var(--accent-press)); color: #fff; border-color: transparent; box-shadow: 0 1px 3px -1px rgba(0, 92, 69, 0.6); }
.badge.paid::before { background: rgba(255, 255, 255, 0.9); }

/* CRM sales outcome */
.badge.open  { background: var(--info-soft); color: var(--info-ink); border-color: var(--info-border); }
.badge.won   { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-soft-2); }
.badge.lost  { background: #eef1f0; color: #6a736e; }

/* customer activity_segment (office feedback §A3) — always computed live, never a stored column */
.badge.seg-active     { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-soft-2); }
.badge.seg-new        { background: var(--info-soft); color: var(--info-ink); border-color: var(--info-border); }
.badge.seg-occasional { background: #eef1f0; color: #5e6863; }
.badge.seg-lapsed     { background: var(--warn-soft); color: var(--warn-ink); border-color: var(--warn-border); }
.badge.seg-lead       { background: var(--warn-soft); color: var(--warn-ink); border-color: var(--warn-border); }
.badge.seg-inactive   { background: #eef1f0; color: #6a736e; }
.badge.seg-none       { background: #eef1f0; color: #6a736e; }

/* rotting / follow-up flag */
.flag-rot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--warn-soft);
  color: #9a5b06;
  border: 1px solid var(--warn-border);
  white-space: nowrap;
}

tr.row-rot td { background: #fff9ee; }
tr.row-rot:hover td { background: #fdf3d9; }
tr.row-rot td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

/* ---------- Quotations list: per-status row wash + non-wrapping key columns ---------- */
/* Subtle full-row tint (alpha ~5-9%) so a row's document status reads at a glance. Harmonised with
   the badge palette but spread across hues (approved=blue, sent=indigo) because the badges reuse
   green for BOTH approved and confirmed — the wash keeps all six distinguishable. Scoped to
   #qt-table so no other table is touched. Precedence: rotting > superseded > status. */
#qt-table tbody tr.st-draft td            { background: rgba(94, 104, 99, 0.05); }
#qt-table tbody tr.st-pending_approval td { background: rgba(224, 138, 30, 0.09); }
#qt-table tbody tr.st-approved td         { background: rgba(47, 95, 168, 0.07); }
#qt-table tbody tr.st-sent td             { background: rgba(99, 102, 217, 0.08); }
/* wash tint updated to match the new .badge.confirmed hue (design refresh 2026-08-01, was rgba(0,168,126,*)) */
#qt-table tbody tr.st-confirmed td        { background: rgba(0, 92, 69, 0.09); }
#qt-table tbody tr.st-cancelled td        { background: rgba(204, 59, 59, 0.055); color: var(--muted); }
#qt-table tbody tr.st-draft:hover td            { background: rgba(94, 104, 99, 0.09); }
#qt-table tbody tr.st-pending_approval:hover td { background: rgba(224, 138, 30, 0.15); }
#qt-table tbody tr.st-approved:hover td         { background: rgba(47, 95, 168, 0.12); }
#qt-table tbody tr.st-sent:hover td             { background: rgba(99, 102, 217, 0.14); }
#qt-table tbody tr.st-confirmed:hover td        { background: rgba(0, 92, 69, 0.15); }
#qt-table tbody tr.st-cancelled:hover td        { background: rgba(204, 59, 59, 0.1); }
/* superseded revision = extra faint + muted; wins over the per-status tint above */
#qt-table tbody tr.st-superseded td       { background: rgba(94, 104, 99, 0.04); color: var(--muted); }
#qt-table tbody tr.st-superseded:hover td { background: rgba(94, 104, 99, 0.08); }
/* rotting row keeps its amber attention wash + orange left border (placed LAST so it wins bg);
   the left border is a separate property so it always shows even when a tint wins the background */
#qt-table tbody tr.row-rot td             { background: #fff9ee; }
#qt-table tbody tr.row-rot:hover td       { background: #fdf3d9; }
#qt-table tbody tr.row-rot td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

/* key columns must never wrap to a 2nd line; customer/project get min-width and may wrap gracefully.
   The table holds a min-width so a narrow viewport scrolls the card sideways instead of squashing. */
#qt-table { min-width: 880px; }
#qt-table td.col-doc, #qt-table td.col-date, #qt-table td.col-status, #qt-table td.num { white-space: nowrap; }
#qt-table td.col-cust { min-width: 172px; }
#qt-table td.col-proj { min-width: 140px; }

/* ============================================================
   List tables — shared wide-table layout (all list pages)
   A wide list table lives in a card that scrolls sideways and the table
   carries a min-width, so a narrow viewport / many-column table SCROLLS
   the card instead of squashing columns — which was clipping the right
   edge (.row-actions) and wrapping long cells into tall, ragged rows.
   The .card.flush… selectors out-specify .card.flush's own overflow:hidden
   (0,2,0) so the horizontal scroll actually wins.
   Column roles (opt-in via <td> class — used by the busy #pj-table):
     · .col-nowrap / .col-date / .col-status / .num / .row-actions → never wrap
     · .col-text / -sm / -lg  (company / project / place / note)   → min-width + graceful wrap
   Per-table floor widths are grouped at the end, one line each by id.
   ============================================================ */
.card.flush.qt-list-card,
.card.flush.list-card,
.qt-list-card, .list-card { overflow-x: auto; }

.list-table td.col-nowrap,
.list-table td.col-date,
.list-table td.col-status,
.list-table td.num,
.list-table td.row-actions { white-space: nowrap; }

.list-table td.col-text    { min-width: 150px; overflow-wrap: anywhere; }
.list-table td.col-text-sm { min-width: 118px; overflow-wrap: anywhere; }
.list-table td.col-text-lg { min-width: 186px; overflow-wrap: anywhere; }

/* per-table floor widths — grouped for easy tuning */
#pj-table        { min-width: 1320px; }
#so-table        { min-width: 820px; }
#rq-table        { min-width: 940px; }
#po-table        { min-width: 1060px; }
#customers-table { min-width: 1040px; }
#sup-table       { min-width: 1000px; }
#mv-table        { min-width: 1040px; }
#products-table  { min-width: 840px; }
#stock-table     { min-width: 760px; }
#users-table     { min-width: 760px; }

/* ---------- Layout grids ---------- */

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ---------- Home: module tiles ---------- */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.module-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 19px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.module-card:hover {
  border-color: var(--accent-soft-2);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.module-card .mod-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.16s ease, color 0.16s ease;
}

.module-card:hover .mod-icon { background: linear-gradient(145deg, var(--brand), var(--brand-deep)); color: #fff; }
.module-card .mod-icon svg { width: 21px; height: 21px; }
.module-card b { display: block; font-size: 14.5px; font-weight: 600; margin-bottom: 3px; }
.module-card small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.narrow-card { max-width: 480px; }

/* ---------- Reports: KPI stat cards ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Design refresh 2026-08-01 (Karina spec §2.2): was #00b389->#008a67 — 2.69-4.35:1 with white text
   (label needs 4.5:1, value needs 3:1 — the top stop failed both). New stops (--accent-hover/
   --accent-press, already-defined tokens) measure 6.52-8.03:1 across the whole gradient. */
.stat-card.accent {
  background: linear-gradient(150deg, var(--accent-hover) 0%, var(--accent-press) 100%);
  border-color: transparent;
  box-shadow: 0 10px 24px -10px rgba(0, 92, 69, 0.7);
}

.stat-label { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-family: var(--font-display); font-size: 26px; font-weight: 600; color: var(--ink); line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

.stat-card.accent .stat-label { color: rgba(255, 255, 255, 0.85); }
.stat-card.accent .stat-value { color: #fff; }
.stat-card.accent .stat-sub { color: rgba(255, 255, 255, 0.8); }

/* ---------- Customer detail: info list ---------- */

.info-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2px 24px;
}

.info-list > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-2);
}

.info-list .k { font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: 0.2px; }
.info-list .v { font-size: 14px; color: var(--ink); }

/* ---------- Customer detail: quick-add activity form ---------- */

.quick-add {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px 14px;
  align-items: end;
}
.quick-add .qa-note { grid-column: 1 / -1; }
.quick-add label { margin-top: 0; }
.quick-add button { grid-column: 1 / -1; justify-self: start; }

/* ---------- Activity timeline (customer + quotation) ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-empty { color: var(--muted); font-size: 13.5px; padding: 8px 2px; }

.act-item {
  position: relative;
  display: flex;
  gap: 13px;
  padding: 0 0 16px 4px;
}
.act-item::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 16px;
  bottom: -2px;
  width: 2px;
  background: var(--border);
}
.act-item:last-child { padding-bottom: 2px; }
.act-item:last-child::before { display: none; }

.act-dot {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 3px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--brand);
}
.act-follow_up .act-dot, .act-site_visit .act-dot { border-color: var(--warn); }
.act-note .act-dot { border-color: var(--muted); }

.act-body { flex: 1; min-width: 0; }
.act-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.act-type { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.act-due {
  font-size: 11.5px;
  font-weight: 600;
  color: #9a5b06;
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  padding: 1px 8px;
  border-radius: 999px;
}
.act-note { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; }
.act-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* ---------- Quotation form ---------- */

.status-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--grey);
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  position: sticky;
  bottom: 14px;
  z-index: 20;
  margin-top: 18px;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
}

.actions:empty { display: none; }

.totals-preview { font-size: 14.5px; }

.totals-preview > div {
  padding: 8px 2px;
  border-bottom: 1px dashed var(--border);
  overflow: hidden;
  color: var(--grey);
}

.totals-preview > div > b { float: right; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }

.totals-preview .grand {
  margin-top: 12px;
  padding: 13px 15px;
  background: linear-gradient(150deg, var(--accent-soft) 0%, #d8f4ea 100%);
  border: 1px solid var(--accent-soft-2);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 16.5px;
  color: #04563e;
}

.totals-preview .grand span { float: right; font-variant-numeric: tabular-nums; }

/* row-type add buttons + section-row tags (header / note) in the items table */
.row-add-btns { display: flex; gap: 8px; flex-wrap: wrap; }
#items-table td.row-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--grey);
  white-space: nowrap;
}
#items-table tr[data-type="header"] .i-desc { font-weight: 700; color: var(--ink); }
#items-table tr[data-type="note"] .i-desc { color: var(--muted); font-style: italic; }
#items-table tr[data-type="header"] td.row-tag { color: var(--accent-ink); }
#items-table td.muted { color: var(--muted); }

/* ---------- Searchable combobox (customer + product pickers) ---------- */

.combo { position: relative; }
.combo-input { width: 100%; }
.combo-list {
  position: absolute;
  z-index: 45;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 244px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 4px;
}
.combo-opt {
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combo-opt.active, .combo-opt:hover { background: var(--accent-soft); color: var(--accent-ink); }
.combo-empty { padding: 9px 10px; font-size: 13px; color: var(--muted); }

/* ---------- Topbar back button (every page) ---------- */

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--grey);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}
.back-btn svg { width: 15px; height: 15px; }
.back-btn:hover { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-soft-2); filter: none; }

/* ---------- Sortable list headers ---------- */

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--accent-ink); }
th.sortable .sort-arrow { opacity: 0.4; font-size: 10px; margin-left: 3px; }
th.sortable.sort-active { color: var(--accent-ink); }
th.sortable.sort-active .sort-arrow { opacity: 1; }

/* ---------- Login ---------- */

body.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(1000px 460px at 84% -12%, rgba(0, 204, 153, 0.14), transparent 60%),
    radial-gradient(760px 400px at -12% 108%, rgba(0, 204, 153, 0.10), transparent 55%),
    var(--bg-2);
}

body.auth main { max-width: none; padding: 24px 16px; }

.login-card {
  width: 410px;
  max-width: 100%;
  margin: 0 auto;
  padding: 38px 34px 32px;
  text-align: center;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.login-card .brand-mark {
  width: 78px;
  height: 60px;
  border-radius: 13px;
  margin: 0 auto 18px;
  box-shadow: 0 6px 18px -6px rgba(0, 168, 126, 0.6);
}

.login-card h1 { font-size: 20px; margin-bottom: 3px; color: var(--ink); }
.login-sub { margin: 0 0 22px; font-size: 13px; color: var(--muted); }
.login-card form { text-align: left; }

.login-foot {
  text-align: center;
  margin: 20px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Responsive ---------- */

@media (max-width: 920px) {
  body.app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }

  nav#nav {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    width: min(80vw, 300px);
    z-index: 50;
    transform: translateX(-104%);
    transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
  }

  body.nav-open nav#nav { transform: translateX(0); }

  .icon-btn.nav-toggle { display: inline-flex; }
  .user-chip .user-meta small { display: none; }
  .logout-btn span { display: none; }

  main { padding: 20px 16px 44px; }

  /* wide tables scroll sideways inside their card */
  .card { overflow-x: auto; }

  .quick-add { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .topbar-title { display: none; }
  main { padding: 18px 14px 40px; }

  /* Touch-friendly target sizes (WCAG ≥44px) on mobile */
  button, input, select, textarea {
    min-height: 44px;
  }
}

/* ---------- Mobile polish 2026-08-04 (Liz review Info 7 + Karina) ----------
   Secondary/meta reading text under 13px is hard to read on a phone (timestamps, sub-labels,
   form field labels, notification/activity/profile text). Raised here, scoped to <=760px ONLY —
   base declarations earlier in this file (outside any media query) still govern desktop, untouched.
   Two tiers: 13px floor for general secondary text; 14px for text that gates doing a task correctly
   (form field labels, inline validation feedback).
   Deliberately NOT touched, with reasons:
     - .badge / .flag-rot / .act-due / #items-table td.row-tag — shared status-pill convention;
       padding + the ::before dot are tuned for the current size, needs a coordinated design pass
       across every variant (Karina), not a one-line font bump.
     - th (table column headers) — global/systemic, every table on every page; out of this
       ticket's blast radius.
     - button.small / .notif-panel-head button — interactive controls, not passive reading text.
     - .notif-badge / .side-soon / th.sortable .sort-arrow / .avatar-edit .avatar-overlay —
       decorative micro-badges/glyphs by convention, some in fixed-size circular containers.
     - .brand-text small / .side-foot — sidebar branding chrome, not operational content.
   Note: a handful of pages define their own MORE SPECIFIC local `label` overrides (e.g.
   .dlg-body label, .xxx-form-grid label in ~20 files) that this base `label` rule cannot reach
   due to CSS specificity — those already sit at >=12px and are a separate follow-up if wanted. */
@media (max-width: 760px) {
  label { font-size: 14px; }
  .field-hint, .field-error, .field-ok { font-size: 14px; }

  .user-chip .user-meta small { font-size: 13px; }
  .notif-body { font-size: 13px; }
  .notif-when { font-size: 13px; }
  .module-card small { font-size: 13px; }
  .stat-label { font-size: 13px; }
  .stat-sub { font-size: 13px; }
  .info-list .k { font-size: 13px; }
  .act-meta { font-size: 13px; }
  .login-foot { font-size: 13px; }
  .field-locked .lock-note { font-size: 13px; }
  .profile-hero .ph-meta { font-size: 13px; }
  .cropper-hint { font-size: 13px; }
  .empty-state .es-sub { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  nav#nav, .topbar, .nav-overlay, .actions { display: none !important; }
  body.app { display: block; }
  .card { box-shadow: none; border-color: #ddd; }
}

/* ---------- Sidebar: 2-level department accordion ---------- */
.side-dept { display: flex; flex-direction: column; }

.side-dept-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.side-dept-head svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.side-dept-head .side-dept-label { flex: 1; }
.side-dept-head:hover { background: var(--surface-2); color: var(--ink); }
.side-dept.open > .side-dept-head { color: var(--ink); }

.side-caret { display: inline-flex; opacity: 0.55; transition: transform 0.18s ease; }
.side-caret svg { width: 14px; height: 14px; }
.side-dept.open > .side-dept-head .side-caret { transform: rotate(90deg); }

.side-sub {
  display: none;
  flex-direction: column;
  gap: 1px;
  margin: 1px 0 5px 22px;
  padding-left: 11px;
  border-left: 1px solid var(--border);
}
.side-dept.open > .side-sub { display: flex; }

.side-sublink {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--grey);
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease;
}
.side-sublink > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-sublink:hover { background: var(--surface-2); color: var(--ink); }
.side-sublink.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.side-sublink.is-soon { color: var(--muted); }
.side-sublink.is-soon:hover { color: var(--ink-2); }

.side-soon {
  flex-shrink: 0;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--warn-ink);
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  padding: 1px 6px;
  border-radius: 999px;
  letter-spacing: 0.2px;
}

/* ---------- Coming-soon placeholder page ---------- */
.coming-soon {
  max-width: 520px;
  margin: 6vh auto 0;
  text-align: center;
  padding: 40px 34px 34px;
}
.coming-soon .cs-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 66px;
  height: 66px;
  margin-bottom: 18px;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
}
.coming-soon .cs-icon svg { width: 32px; height: 32px; }
.coming-soon .cs-badge { margin-bottom: 14px; background: var(--warn-soft); color: var(--warn-ink); border: 1px solid var(--warn-border); }
.coming-soon h1 { font-size: 22px; margin: 0 0 10px; }
.coming-soon .cs-sub { font-size: 14.5px; color: var(--grey); line-height: 1.6; margin: 0 auto; max-width: 420px; }
.coming-soon .cs-actions { margin-top: 26px; }
.coming-soon .cs-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  /* same contrast fix as the main button{} rule above (design refresh 2026-08-01) — kept identical so
     this page's CTA matches every other button in the system, not a separate one-off gradient. */
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: filter 0.15s ease;
}
.coming-soon .cs-back:hover { filter: brightness(1.06); }

/* ============================================================
   PROPOSED ADDITIONS — design refresh 2026-08-01 (Karina, spec.md §2.3)
   Nothing above this line changes any existing markup contract; everything below is new/additive,
   ported from vault/40-projects/ui-refresh-design/mockup-profile.html + mockup-quotations.html.
   ============================================================ */

/* user-chip becomes a real link (app.js renderNav — clicking your name/photo now opens your profile,
   spec §1.6). Base box is UNCHANGED; this only adds the link reset + hover wash + the photo path. */
a.user-chip { text-decoration: none; color: inherit; padding: 5px 8px 5px 5px; border-radius: var(--radius-sm); transition: background 0.15s ease; }
a.user-chip:hover { background: var(--surface-2); }
.user-chip .avatar { overflow: hidden; position: relative; }
.user-chip .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Inline field feedback (profile page's password-confirm check, future form validation elsewhere) */
.field-hint { margin-top: 5px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.field-error { margin-top: 5px; font-size: 12px; color: var(--danger); line-height: 1.5; display: flex; align-items: center; gap: 5px; }
.field-ok { margin-top: 5px; font-size: 12px; color: var(--accent-ink); line-height: 1.5; display: flex; align-items: center; gap: 5px; }
.field-hint svg, .field-error svg, .field-ok svg { width: 13px; height: 13px; flex-shrink: 0; }

/* Read-only field display (profile page's "ข้อมูลระบบ" card — username/role/permissions) */
.field-locked {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--ink-2);
}
.field-locked b { color: var(--ink); }
.field-locked .lock-note { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.field-locked .lock-note svg { width: 13px; height: 13px; flex-shrink: 0; }

/* Hero avatar (profile page) — larger variant of the existing .avatar + click/hover-to-edit overlay */
.avatar.lg { width: 96px; height: 96px; font-size: 34px; }
.avatar-edit { position: relative; display: inline-flex; border: none; padding: 0; background: none; cursor: pointer; border-radius: 50%; }
.avatar-edit .avatar-overlay {
  position: absolute; inset: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 3px; background: rgba(12, 26, 20, 0.55); color: #fff; opacity: 0;
  transition: opacity 0.16s ease; font-size: 10.5px; font-weight: 600; text-align: center;
}
.avatar-edit .avatar-overlay svg { width: 20px; height: 20px; }
.avatar-edit:hover .avatar-overlay, .avatar-edit:focus-visible .avatar-overlay { opacity: 1; }
.avatar-edit:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

.profile-hero { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.profile-hero .ph-id { display: flex; flex-direction: column; gap: 5px; }
.profile-hero .ph-name { font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--ink); }
.profile-hero .ph-role { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--grey); }
.profile-hero .ph-meta { font-size: 12px; color: var(--muted); }

/* Avatar cropper modal (client-side canvas crop/pan/zoom — profile page only, see settings.html) */
.cropper-back { position: fixed; inset: 0; background: rgba(20, 42, 34, 0.5); display: none; align-items: center; justify-content: center; z-index: 80; padding: 20px; }
.cropper-back.on { display: flex; }
.cropper-box { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 22px; width: 360px; max-width: 92vw; }
.cropper-box h2 { margin: 0 0 4px; }
.cropper-stage {
  position: relative; width: 300px; height: 300px; max-width: 100%; margin: 14px auto; border-radius: 50%;
  overflow: hidden; background: #17342c; cursor: grab; touch-action: none;
}
.cropper-stage:active { cursor: grabbing; }
.cropper-stage canvas { position: absolute; top: 0; left: 0; }
.cropper-hint { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: -6px; margin-bottom: 10px; }

/* Richer empty-state (opt-in — the plain tbody td[colspan] rule above still works unchanged everywhere
   that doesn't opt in). Not yet wired into any list page's JS this round; ships ready-to-use. */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 34px 20px; text-align: center; }
.empty-state .es-icon { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 2px; }
.empty-state .es-icon svg { width: 20px; height: 20px; }
.empty-state .es-title { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.empty-state .es-sub { font-size: 12.5px; color: var(--muted); max-width: 340px; }
.empty-state .es-action { margin-top: 8px; }
