/* Circular v2 admin console - design system (light + dark).
   2026-10-20 owner: macOS "System Settings" look everywhere + Google Sans (self-hosted, OFL; Thai glyphs included,
   Noto Sans Thai as the Thai fallback). The macOS layer is at the end of this file ("macOS System Settings theme"). */
@font-face { font-family: "Google Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../vendor/fonts/GoogleSans-thai.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Google Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../vendor/fonts/GoogleSans-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Google Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../vendor/fonts/GoogleSans-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: "Noto Sans Thai"; font-style: normal; font-weight: 400 700; font-display: swap; src: local("Noto Sans Thai"), url("../vendor/fonts/NotoSansThai-thai.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
:root {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f7f7fa;
  --surface-3: #efeff4;
  --border: #e3e3e8;
  --border-strong: #d1d1d6;
  --sep: rgba(60, 60, 67, .14);
  --fill: rgba(118, 118, 128, .12);
  --text: #1d1d1f;
  --text-2: #4a4a50;
  --text-3: #86868b;
  --primary: #007aff;
  --primary-hover: #0068d9;
  --primary-soft: #e6f1ff;
  --on-primary: #ffffff;
  --ok: #248a3d;
  --ok-soft: #e3f5e8;
  --bad: #d70015;
  --bad-soft: #ffe8e9;
  --warn: #a05a00;
  --warn-soft: #fff2dc;
  --info: #0066cc;
  --info-soft: #e6f1ff;
  --mute: #636366;
  --mute-soft: #ececf0;
  --focus: #007aff;
  --ring: 0 0 0 3.5px rgba(0, 122, 255, .32);
  --shadow: 0 0 0 .5px rgba(0, 0, 0, .05), 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-lg: 0 0 0 .5px rgba(0, 0, 0, .12), 0 10px 30px rgba(0, 0, 0, .16), 0 22px 70px rgba(0, 0, 0, .12);
  --side-bg: rgba(232, 232, 237, .78);
  --side-solid: #e8e8ed;
  --side-text: #1d1d1f;
  --side-muted: #86868b;
  --side-hover: rgba(0, 0, 0, .05);
  --side-active: #007aff;
  --radius: 10px;
  --radius-sm: 7px;
  --side-w: 256px;
  --top-h: 52px;
  --font: "Google Sans", "Noto Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", "Leelawadee UI", Tahoma, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --c1: #007aff;
  --c2: #ff3b30;
  --c3: #34c759;
  --c4: #ff9500;
  --c5: #af52de;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --surface: #2c2c2e;
    --surface-2: #323235;
    --surface-3: #3a3a3c;
    --border: #3d3d40;
    --border-strong: #545458;
    --sep: rgba(84, 84, 88, .6);
    --fill: rgba(118, 118, 128, .24);
    --text: #f5f5f7;
    --text-2: #c7c7cc;
    --text-3: #98989d;
    --primary: #0a84ff;
    --primary-hover: #409cff;
    --primary-soft: #0d2a4a;
    --on-primary: #ffffff;
    --ok: #30d158;
    --ok-soft: #12331c;
    --bad: #ff453a;
    --bad-soft: #3d1614;
    --warn: #ffb340;
    --warn-soft: #3a2a0c;
    --info: #64aaff;
    --info-soft: #0d2a4a;
    --mute: #a1a1a6;
    --mute-soft: #3a3a3c;
    --focus: #0a84ff;
    --ring: 0 0 0 3.5px rgba(10, 132, 255, .45);
    --shadow: 0 0 0 .5px rgba(255, 255, 255, .06), 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 0 0 .5px rgba(255, 255, 255, .1), 0 12px 40px rgba(0, 0, 0, .55);
    --side-bg: rgba(44, 44, 46, .78);
    --side-solid: #2a2a2c;
    --side-text: #f5f5f7;
    --side-muted: #98989d;
    --side-hover: rgba(255, 255, 255, .07);
    --side-active: #0a84ff;
    --c1: #0a84ff;
    --c2: #ff453a;
    --c3: #30d158;
    --c4: #ff9f0a;
    --c5: #bf5af2;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.sp { height: 12px; }

.boot { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; background: var(--bg); color: var(--text-2); z-index: 5; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } * { scroll-behavior: auto !important; } }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 5px 13px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; font-weight: 500; line-height: 1.2; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-o { color: var(--bad); border-color: var(--bad); }
.btn.danger-o:hover { background: var(--bad-soft); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { min-height: 28px; padding: 2px 9px; font-size: 13px; }
.btn.icon { width: 34px; padding: 0; }
.btn.icon.sm { width: 28px; }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; background: var(--mute-soft); color: var(--mute); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.info { background: var(--info-soft); color: var(--info); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.shell.collapsed { grid-template-columns: 64px 1fr; }
.side { background: var(--side-bg); color: var(--side-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; gap: 10px; align-items: center; height: var(--top-h); padding: 0 16px; color: #fff; font-weight: 700; font-size: 16px; flex: none; }
.brand img { width: 28px; height: 28px; border-radius: 6px; }
.nav { padding: 4px 8px 16px; }
.nav-group { margin-top: 10px; }
.nav-title { font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: #7f93ad; padding: 8px 10px 4px; white-space: nowrap; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-text); text-decoration: none; white-space: nowrap; }
.nav a:hover { background: rgba(255, 255, 255, .07); }
.nav a[aria-current="page"] { background: var(--side-active); color: #fff; font-weight: 600; }
.shell.collapsed .nav-title, .shell.collapsed .nav a span.lbl, .shell.collapsed .brand span { display: none; }
.shell.collapsed .nav a { justify-content: center; }
/* menu count badge (face-login review: unreviewed suspicious scans) */
.nav a .nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.shell.collapsed .nav a { position: relative; }
/* collapsible sidebar group (owner 2026-10-20: ศูนย์รายงาน -> one sub-item per report) */
.nav-parent { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--side-text); font: inherit; text-align: left; cursor: pointer; white-space: nowrap; }
.nav-parent:hover { background: rgba(255, 255, 255, .07); }
.nav-parent .chev { margin-left: auto; display: inline-flex; transition: transform .18s; opacity: .8; }
.nav-sub.open .nav-parent .chev { transform: rotate(180deg); }
.nav-sub:has(a[aria-current="page"]) > .nav-parent { color: #fff; font-weight: 600; }
/* closed group: total of its sub-items' badges, just before the chevron (2026-10-21, ความปลอดภัยและระบบ) */
.nav-parent .nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #ff3b30; color: #fff; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.nav-parent .nav-badge[hidden] { display: none; }
.nav-parent .nav-badge:not([hidden]) + .chev { margin-left: 6px; }
.shell.collapsed .nav-parent { position: relative; }
.shell.collapsed .nav-parent .nav-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
.nav-sub[data-base="/admin/system"] { --tile: #636366; }
.nav-children { display: none; padding: 2px 0 4px; }
.nav-sub.open .nav-children { display: block; }
.nav-children a.nav-child { padding: 6px 10px 6px 34px; font-size: 13.5px; white-space: normal; line-height: 1.3; }
.nav-children a.nav-child svg { width: 15px; height: 15px; opacity: .85; }
.nav-fly-title { display: none; }
.shell.collapsed .nav-parent { justify-content: center; }
.shell.collapsed .nav-parent .lbl, .shell.collapsed .nav-parent .chev { display: none; }
.shell.collapsed .nav-sub .nav-children { display: none; position: fixed; left: 64px; min-width: 250px; max-height: calc(100vh - 16px); overflow-y: auto; padding: 6px; border-radius: 10px; background: var(--side-bg); box-shadow: var(--shadow-lg); z-index: 60; }
.shell.collapsed .nav-sub:hover .nav-children, .shell.collapsed .nav-sub.fly .nav-children { display: block; }
.shell.collapsed .nav-children a.nav-child { justify-content: flex-start; padding: 7px 10px; }
.shell.collapsed .nav-children a.nav-child span.lbl { display: inline; }
.shell.collapsed .nav-fly-title { display: block; padding: 6px 10px 4px; font-size: 11.5px; color: #7f93ad; }
.shell.collapsed .nav a .nav-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
/* face-login review page */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 18px; }
/* owner rule: never a coloured edge stripe - rows that need attention get a soft tint (the status itself is a chip) */
.tbl tr.row-attn td { background: var(--warn-soft); }
.face-ev-photo { width: 220px; height: 220px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.top h1 { font-size: 17px; font-weight: 700; }
.content { padding: 18px 20px 40px; max-width: 1500px; width: 100%; margin: 0 auto; flex: 1; }
.scrim { display: none; }
.badge-dot { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.pop { position: absolute; right: 0; top: calc(100% + 6px); width: 360px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 60; overflow: hidden; }
.pop-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 700; }
.pop-list { max-height: 60vh; overflow: auto; }
.pop-item { display: block; width: 100%; text-align: left; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--border); background: transparent; cursor: pointer; }
.pop-item:hover { background: var(--surface-2); }
.pop-item.unread { background: var(--primary-soft); }
.pop-item b { display: block; }
.pop-item small { color: var(--text-3); }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 9px 14px; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }
.rel { position: relative; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }

@media (max-width: 960px) {
  .shell, .shell.collapsed { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .shell.open .side { transform: none; }
  .shell.open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 25; }
  .shell.collapsed .nav-title, .shell.collapsed .nav a span.lbl, .shell.collapsed .brand span { display: initial; }
  .shell.collapsed .nav a { justify-content: flex-start; }
  .shell.collapsed .nav-parent { justify-content: flex-start; }
  .shell.collapsed .nav-parent .lbl, .shell.collapsed .nav-parent .chev { display: inline-flex; }
  .shell.collapsed .nav-sub .nav-children { position: static; display: none; box-shadow: none; padding: 2px 0 4px; min-width: 0; }
  .shell.collapsed .nav-sub.open .nav-children { display: block; }
  .shell.collapsed .nav-sub:hover .nav-children { display: none; }
  .shell.collapsed .nav-sub.open:hover .nav-children { display: block; }
  .shell.collapsed .nav-fly-title { display: none; }
  .shell.collapsed .nav-children a.nav-child { padding: 6px 10px 6px 34px; }
  .content { padding: 12px 12px 40px; }
  .hide-sm { display: none !important; }
}

/* ---------- cards / layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 700; flex-wrap: wrap; }
.card-b { padding: 14px 16px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@media (max-width: 1100px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.page-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.page-h h2 { font-size: 20px; }
.kpi { padding: 14px 16px; }
.kpi .k { color: var(--text-3); font-size: 13px; }
.kpi .v { font-size: 28px; font-weight: 800; line-height: 1.2; }
.kpi .s { font-size: 12.5px; color: var(--text-3); }
.kpi.bad .v { color: var(--bad); }
.kpi.warn .v { color: var(--warn); }
.kpi.ok .v { color: var(--ok); }
.banner { padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }
.banner.err { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.banner.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.banner.info { background: var(--info-soft); border-color: var(--info); color: var(--info); }
.banner.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.empty { padding: 36px 16px; text-align: center; color: var(--text-3); }
.skel { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 6px; height: 14px; }
@keyframes sh { to { background-position: -200% 0; } }

/* ---------- tables ---------- */
/* owner 2026-10-21 "ไม่อยากให้ทำ scroll bar ซ้อน": tables use the page's own scroll (full height); only a table wider
   than the screen scrolls sideways */
.tbl-wrap { overflow: visible; max-height: none; border-radius: var(--radius); }
.tbl-wrap.free { max-height: none; }
/* owner 2026-10-21: the header row stays visible under the top bar while the page scrolls (ui/controls.js stickyHead);
   a table wider than the screen scrolls sideways instead ("scroll-x") and keeps its header at the top of the table */
.tbl-wrap.scroll-x { overflow-x: auto; overflow-y: hidden; }
table.tbl { width: 100%; border-collapse: collapse; background: var(--surface); }
.tbl th { position: sticky; top: 0; z-index: 2; background: var(--surface-3); text-align: left; font-weight: 700; font-size: 13px; padding: 9px 12px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; color: var(--text-2); }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--primary); }
.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:nth-child(even) { background: var(--surface-2); }
.tbl tbody tr:hover { background: var(--primary-soft); }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.inactive td { opacity: .6; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .acts { display: flex; gap: 4px; justify-content: flex-end; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 4px 0; flex-wrap: wrap; color: var(--text-2); }
.pager .pg { display: flex; gap: 4px; align-items: center; }
.card .pager { padding: 10px 14px 0; }
.card > .tbl-wrap, .card > div > .tbl-wrap { border-radius: 0; }
.card .empty { padding: 28px 16px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .field > .lbl { font-weight: 600; font-size: 13px; color: var(--text-2); }
.req::after { content: " *"; color: var(--bad); }
.in, select.in, textarea.in { width: 100%; min-height: 36px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
textarea.in { min-height: 72px; resize: vertical; }
.in:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.in.invalid { border-color: var(--bad); }
.field .err { color: var(--bad); font-size: 12.5px; }
.field .hint { color: var(--text-3); font-size: 12.5px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.filters .field { min-width: 140px; }
.filters .field.wide { min-width: 220px; flex: 1; }
.filter-toggle { display: none; align-self: flex-end; }
@media (max-width: 720px) {
  .filter-toggle { display: inline-flex; }
  .filters.closed .field:not(.wide) { display: none; }
  .filters .field { min-width: calc(50% - 6px); flex: 1 1 calc(50% - 6px); }
  .filters .field.wide { min-width: 100%; }
}
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; padding: 0 8px; }
.tab { border: 0; background: transparent; padding: 10px 14px; cursor: pointer; border-bottom: 3px solid transparent; color: var(--text-2); white-space: nowrap; font-weight: 600; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { border-color: var(--primary); color: var(--primary); }
.tab .cnt { margin-left: 6px; background: var(--mute-soft); border-radius: 999px; padding: 0 7px; font-size: 12px; color: var(--text-2); }
.tab[aria-selected="true"] .cnt { background: var(--primary-soft); color: var(--primary); }

/* searchable select */
.ss { position: relative; }
.ss-list { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 90; max-height: 240px; overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.ss-opt { padding: 7px 10px; cursor: pointer; }
.ss-opt[aria-selected="true"], .ss-opt:hover { background: var(--primary-soft); }
.ss-opt.add { color: var(--primary); font-weight: 600; border-top: 1px solid var(--border); }
.ss-empty { padding: 8px 10px; color: var(--text-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip-x { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 13px; }
.chip-x button { border: 0; background: transparent; cursor: pointer; color: inherit; border-radius: 50%; width: 20px; height: 20px; line-height: 1; }
.chip-x button:hover { background: rgba(0, 0, 0, .12); }

/* ---------- modal / drawer ---------- */
#layer { position: relative; z-index: 100; }
.overlay { position: fixed; inset: 0; background: rgba(8, 18, 32, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.overlay.drawer { align-items: stretch; justify-content: flex-end; padding: 0; }
.modal { background: var(--surface); color: var(--text); border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; border: 1px solid var(--border); }
.modal.lg { max-width: 860px; }
.modal.xl { max-width: 1100px; }
.modal.sm { max-width: 420px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-h h3 { font-size: 17px; }
.modal-b { padding: 16px 18px; overflow: auto; flex: 1; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.drawer .modal { max-width: min(980px, 100vw); height: 100vh; max-height: 100vh; border-radius: 0; width: 100%; }
@media (max-width: 640px) { .overlay { padding: 0; align-items: flex-end; } .modal { max-height: 94vh; border-radius: 14px 14px 0 0; } .drawer .modal { height: 100vh; max-height: 100vh; border-radius: 0; } }
body.lock { overflow: hidden; }
.toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 28px)); }
.toast { padding: 10px 14px; border-radius: 8px; background: #1d2b3d; color: #fff; box-shadow: var(--shadow-lg); border: 1.5px solid var(--ok); display: flex; gap: 10px; align-items: flex-start; }
.toast.err { border-color: var(--bad); background: #3a1717; }
.toast.warn { border-color: var(--warn); }
.toast button { border: 0; background: transparent; color: inherit; cursor: pointer; margin-left: auto; }
.decide-q { display: flex; flex-direction: column; gap: 10px; }
.opt-list { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; }
.opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.opt input { margin-top: 3px; accent-color: var(--primary); }
.sample { margin: 0; padding-left: 18px; color: var(--text-2); }
.steps { display: flex; gap: 4px; }
.steps i { height: 5px; flex: 1; border-radius: 3px; background: var(--border-strong); }
.steps i.on { background: var(--primary); }

/* ---------- lightbox ---------- */
.lb { position: fixed; inset: 0; background: rgba(0, 0, 0, .92); z-index: 150; display: flex; align-items: center; justify-content: center; }
.lb img { max-width: 94vw; max-height: 88vh; object-fit: contain; }
.lb .lb-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; color: #fff; }
.lb button { background: rgba(255, 255, 255, .15); border: 0; color: #fff; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 22px; }
.lb button:hover { background: rgba(255, 255, 255, .3); }
.lb .prev { position: absolute; left: 12px; top: 50%; }
.lb .next { position: absolute; right: 12px; top: 50%; }

/* ---------- submission detail ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 18px; }
.fact .k { font-size: 12.5px; color: var(--text-3); }
.fact .v { font-weight: 600; word-break: break-word; }
.sec-t { font-weight: 700; padding: 8px 12px; background: var(--surface-3); border-radius: 6px; margin: 14px 0 6px; }
.ans { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 9px 4px; border-bottom: 1px dashed var(--border); }
.ans.fail { background: var(--bad-soft); border-radius: 6px; padding: 9px 8px; }
.ans .lab { font-weight: 500; }
.ans .rm { grid-column: 1 / -1; color: var(--text-2); font-size: 13px; }
.thumbs { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.thumb { width: 104px; height: 104px; border-radius: 6px; object-fit: contain; border: 1px solid var(--border-strong); cursor: zoom-in; background: var(--surface-3); display: block; }
.thumb-btn { padding: 0; border: 0; background: none; }
.thumb.big { width: 120px; height: 120px; }
/* result photos fill the frame (util.js photoFrame): the frame follows the photo, only the sides are trimmed */
.thumb.photo { width: 66px; height: 117px; object-fit: cover; }
.thumb.photo.land { width: 128px; height: 96px; }
.sig-img { max-width: 220px; max-height: 90px; background: #fff; padding: 4px; display: block; margin: 0 auto; } /* no frame around signatures (owner 2026-10-25) */
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border-strong); }
.timeline li { position: relative; padding: 0 0 12px 14px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; background: var(--primary); border-radius: 50%; }
.bac { font-size: 22px; font-weight: 800; }
.share-box { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; }
@media (max-width: 640px) { .share-box { grid-template-columns: 1fr; } }
.copyline { display: flex; gap: 6px; }
.copyline input { flex: 1; font-family: var(--mono); }
.pin { font: 800 30px/1 var(--mono); letter-spacing: .25em; padding: 10px 14px; background: var(--surface-3); border-radius: 8px; display: inline-block; }
.qr-wrap { background: #fff; padding: 6px; border-radius: 8px; border: 1px solid var(--border-strong); display: inline-block; }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .grid-l { stroke: var(--border); stroke-width: 1; }
.chart .axis-l { stroke: var(--border-strong); }
.chart .s1 { stroke: var(--c1); fill: var(--c1); }
.chart .s2 { stroke: var(--c2); fill: var(--c2); }
.chart .s3 { stroke: var(--c3); fill: var(--c3); }
.chart .s4 { stroke: var(--c4); fill: var(--c4); }
.chart .s5 { stroke: var(--c5); fill: var(--c5); }
.chart path.line { fill: none; stroke-width: 2; }
.chart path.area { stroke: none; opacity: .14; }
.chart circle { stroke: var(--surface); stroke-width: 1.5; }
.chart rect.bar:hover { opacity: .8; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.hbar { display: grid; grid-template-columns: minmax(80px, 38%) 1fr auto; gap: 8px; align-items: center; padding: 4px 0; }
.hbar .bar { height: 14px; background: var(--surface-3); border-radius: 7px; overflow: hidden; display: flex; }
.hbar .bar i { display: block; height: 100%; background: var(--c1); }
.hbar .bar i.f { background: var(--c2); }
.hbar .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- builder ---------- */
.fb-sec { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; background: var(--surface); }
.fb-sec-h { display: flex; gap: 8px; align-items: center; padding: 8px 12px; background: var(--surface-3); border-radius: var(--radius) var(--radius) 0 0; font-weight: 700; }
.fb-field { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--border); }
.fb-field.dragover { outline: 2px dashed var(--primary); outline-offset: -2px; }
.fb-field.off .nm b { color: var(--text-3); text-decoration: line-through; } /* hidden item (is_active 0): kept, not shown to users */
.fb-field .handle { cursor: grab; color: var(--text-3); }
.fb-field .nm { flex: 1; min-width: 0; }
.fb-field .nm b { display: block; overflow: hidden; text-overflow: ellipsis; }
.fb-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.opts-edit .orow { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 6px; margin-bottom: 6px; align-items: center; }
/* no inner vertical scroll (2026-10-21); sideways only when wider than the screen (stickyHead -> scroll-x) */
.perm-grid th.rc { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; height: 130px; vertical-align: bottom; text-align: left; }
.perm-grid td.c { text-align: center; }
.perm-grid .gh td { background: var(--surface-3); font-weight: 700; }
.perm-grid input { width: 17px; height: 17px; accent-color: var(--primary); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(160deg, var(--primary-soft), var(--bg)); }
.login-card { width: 100%; max-width: 400px; padding: 26px 24px; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }

/* ---------- print view (screen preview) ---------- */
.paper { background: #fff; color: #111; max-width: 210mm; margin: 0 auto; padding: 14mm; box-shadow: var(--shadow); border-radius: 4px; font-size: 13px; line-height: 1.45; }
.paper h2 { font-size: 20px; margin: 0 0 2px; }
.paper table { width: 100%; border-collapse: collapse; margin: 3px 0 6px; }
.paper th, .paper td { border: 1px solid #b9c2cf; padding: 2px 6px; text-align: left; vertical-align: top; line-height: 1.35; }
.paper th { background: #eef2f7; }
.paper .fail { color: #b00020; font-weight: 700; }
.paper .ok { color: #17803d; }
.paper h3 { font-size: 14px; margin: 8px 0 3px; background: #e6eef8; color: #0b3f75; padding: 4px 8px; border-radius: 4px; }
.paper .ph { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.paper td .ph img { max-width: 30mm; max-height: 36mm; }
.paper .ph img { width: auto; height: auto; max-width: 70mm; max-height: 48mm; object-fit: contain; border: 1px solid #999; }
/* compact header (owner 2026-10-25 "ใช้พื้นที่ให้แน่น"): two "หัวข้อ: ค่า" pairs per line, long text across the line */
.paper .meta { display: grid; grid-template-columns: max-content 1fr max-content 1fr; gap: 1px 8px; line-height: 1.35; }
.paper .meta b { color: #555; font-weight: 600; white-space: nowrap; }
.paper .meta b.w { grid-column: 1; }
.paper .meta span.w { grid-column: 2 / -1; }
/* photos fill their frame (util.js photoFrame): portrait 9:16 / landscape 4:3 over two columns; cover trims the sides
   only, so the date/GPS stamp along the top and bottom edges stays complete */
.paper table.items { table-layout: fixed; }
.paper table.items col.rc { width: 19mm; }
.paper table.items td.res { font-weight: 600; }
.paper table.items td.empty { border-left-color: transparent; border-right-color: transparent; border-bottom-color: transparent; }
.paper table.items .note { font-size: 11px; color: #555; font-weight: 400; }
.paper .gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(19mm, 1fr)); gap: 4px 6px; margin: 4px 0 6px; align-items: start; }
.paper .gal figure { margin: 0; text-align: center; break-inside: avoid; min-width: 0; }
.paper .gal figure:has(img.land) { grid-column: span 2; }
.paper .gal img { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; object-fit: cover; border: 1px solid #999; }
.paper .gal img.land { aspect-ratio: 4 / 3; }
.paper .gal figcaption { font-size: 10.5px; line-height: 1.25; color: #333; margin-top: 2px; }
.paper .gal figure.fail img { border: 2px solid #b00020; }
.paper .gal figure.fail figcaption { color: #b00020; font-weight: 700; }
.paper .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 2px solid #0b63b8; padding-bottom: 6px; margin-bottom: 6px; }
.paper .foot { margin-top: 8px; color: #555; font-size: 11.5px; border-top: 1px solid #ccc; padding-top: 6px; }
.paper tr { break-inside: avoid; }
/* one-page fit (printview.js fitToPage): measured at the A4 print width; headings never end a page */
.paper.measure { max-width: none; padding: 0; box-shadow: none; }
.paper h3 { break-after: avoid; page-break-after: avoid; }
.paper .tail, .paper .sigs { break-inside: avoid; page-break-inside: avoid; }
.paper .sigs { display: flex; gap: 10mm; flex-wrap: wrap; }
.paper .sig { width: 62mm; text-align: center; }
.paper .sig-box { height: 20mm; display: flex; align-items: flex-end; justify-content: center; margin-bottom: -1mm; }
.paper .sig-box img { max-width: 58mm; max-height: 20mm; width: auto; height: auto; display: block; }
.paper .sig-line { border-top: 1.2px solid #000; margin: 0 2mm; padding-top: 1.5mm; }
/* official report documents (reportdocs.js): grey = not approved yet. "wide" = landscape, chosen per document by
   reportprint.js (needsLandscape) together with its own @page size */
.paper.wide { max-width: 297mm; }
.paper.doc { font-size: 12px; }
.paper .doc-lines { text-align: right; font-size: 12px; }
.paper .muted-doc { color: #666; font-size: 11.5px; }
.paper .doc-table th, .paper .doc-table td { padding: 3px 5px; }
.paper .doc-table td.c, .paper .doc-table th.c { text-align: center; }
.paper .doc-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.paper .doc-table tr.grey td { color: #8a8f98; background: #f4f5f7; }
.paper .doc-table td.sig { width: 36mm; height: 11mm; padding: 1px 4px; }
.paper .doc-table td.sig img { max-width: 34mm; max-height: 11mm; object-fit: contain; display: block; }
.doc-scroll { overflow-x: auto; }
@page { size: A4; margin: 10mm; }
@media print {
  body { background: #fff !important; color: #000; font-size: 12px; }
  .side, .top, .no-print, .toasts, .scrim { display: none !important; }
  .shell, .shell.collapsed { display: block; }
  .content { padding: 0; max-width: none; }
  .paper { box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
  .paper h3 { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .paper th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .paper .doc-table tr.grey td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-scroll { overflow: visible; }
}

/* multi-tenancy: organisation name (login card + side brand) and the organisation settings page */
.login-org { font-weight: 700; color: var(--primary); }
.brand-org { display: block; font-size: 11.5px; font-weight: 500; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }

/* ===== "สรุปการใช้งานรายเดือน" (old admin Home usage dashboard, views/usage.js) — no edge stripes ===== */
.ud-shell { --ud-blue: #0f6cbd; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: 0 6px 18px rgba(30, 64, 110, .06); color: var(--text); min-width: 0; }
.ud-shell.is-loading { opacity: .75; transition: opacity .15s; }
.ud-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.ud-head h2 { font-size: 25px; line-height: 1.25; margin: 0 0 5px; font-weight: 750; }
.ud-head p { margin: 0; color: var(--text-3); font-size: 13px; }
.ud-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ud-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 8px; padding: 8px 11px; font: inherit; font-size: 12.5px; cursor: pointer; transition: border-color .18s, color .18s, box-shadow .18s, transform .18s; }
.ud-btn:hover { border-color: var(--ud-blue); color: var(--ud-blue); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 108, 189, .12); }
.ud-btn svg, .ud-mic svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ud-btn svg { width: 16px; height: 16px; }
.ud-btn.spin svg { animation: udspin .65s linear infinite; }
@keyframes udspin { to { transform: rotate(360deg); } }
.ud-filters { display: grid; grid-template-columns: 150px 120px minmax(200px, 1fr) auto; gap: 10px; align-items: end; margin-bottom: 14px; }
.ud-filters label, .ud-groupwrap { display: grid; gap: 5px; min-width: 0; }
.ud-filters label > span, .ud-groupwrap > span { font-size: 11.5px; font-weight: 700; color: var(--text-2); }
.ud-filters select { width: 100%; height: 38px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); padding: 0 10px; font: inherit; font-size: 13px; }
.ud-filters select:focus { outline: none; border-color: var(--ud-blue); box-shadow: 0 0 0 3px rgba(15, 108, 189, .14); }
.ud-seg { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; height: 38px; }
.ud-seg button { border: 0; background: transparent; color: var(--text-2); border-radius: 999px; padding: 0 14px; font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap; transition: background .2s, color .2s; }
.ud-seg button.active { background: var(--ud-blue); color: #fff; box-shadow: 0 2px 6px rgba(15, 108, 189, .28); font-weight: 700; }
.ud-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 2px 8px rgba(28, 55, 90, .05); min-width: 0; }
.ud-chartcard { padding: 15px 16px 12px; }
.ud-ctitle, .ud-rtitle { font-size: 14.5px; font-weight: 750; margin-bottom: 10px; }
.ud-chart { display: grid; grid-template-columns: 34px minmax(0, 1fr); min-height: 270px; }
.ud-yaxis { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; padding: 7px 6px 43px 0; color: var(--text-3); font-size: 10px; }
.ud-plot { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; align-items: end; padding: 8px 12px 0; border-bottom: 1px solid var(--border-strong); background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(25% - 1px), var(--surface-3) 25%); min-width: 0; }
.ud-baritem { height: 250px; display: grid; grid-template-rows: 1fr 22px 17px; align-items: end; min-width: 0; text-align: center; }
.ud-track { height: 205px; display: flex; align-items: flex-end; justify-content: center; padding-top: 18px; }
.ud-bar { position: relative; width: min(64px, 72%); min-height: 6px; border-radius: 7px 7px 0 0; background: linear-gradient(180deg, #2b79ec, #0f60d8); box-shadow: 0 2px 6px rgba(15, 96, 216, .25); transform-origin: 50% 100%; animation: udgrow .7s cubic-bezier(.16, .84, .28, 1) both; }
.ud-val { position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%); font-size: 12.5px; font-weight: 800; color: #0f5fd3; white-space: nowrap; }
@keyframes udgrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.ud-blabel { font-size: 11.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ud-bsub { font-size: 9.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ud-empty { display: grid; place-items: center; min-height: 230px; color: var(--text-3); font-size: 13px; }
.ud-empty.small { min-height: 90px; }
.ud-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.ud-metric { display: flex; align-items: center; gap: 12px; padding: 14px; min-height: 90px; }
.ud-mic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.ud-mic svg { width: 24px; height: 24px; stroke-width: 1.9; }
.ud-mic.count { background: #e7f0ff; color: #1667dc; }
.ud-mic.most { background: #e6f7ed; color: #16965c; }
.ud-mic.least { background: #fff2df; color: #e47212; }
.ud-mic.total { background: #efeaff; color: #6c4de6; }
.ud-mtext { min-width: 0; }
.ud-mlabel { font-size: 11.5px; color: var(--text-3); }
.ud-mmain { font-size: 20px; font-weight: 800; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ud-msub { font-size: 10.5px; color: var(--text-3); margin-top: 2px; }
.ud-ranks { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.ud-rank { padding: 14px; }
.ud-rhead, .ud-rrow { display: grid; grid-template-columns: 62px minmax(0, 1fr) 76px; gap: 10px; align-items: center; }
.ud-rhead { font-size: 10.5px; color: var(--text-3); padding: 0 4px 7px; border-bottom: 1px solid var(--surface-3); }
.ud-rhead span:last-child, .ud-rtotal { text-align: right; }
.ud-rrow { min-height: 52px; border-bottom: 1px solid var(--surface-3); padding: 6px 4px; font-size: 12px; }
.ud-rrow:last-child { border-bottom: 0; }
.ud-rno { color: var(--text-2); display: inline-flex; gap: 5px; align-items: center; }
.ud-medal { font-size: 14px; line-height: 1; }
.ud-rname { display: grid; min-width: 0; }
.ud-rname .pchip { justify-self: start; padding-right: 10px; }
.ud-rname .pchip .pc-t small { font-size: 10.5px; }
.ud-baritem.has-av { grid-template-rows: 1fr 40px 22px 17px; height: 280px; }
.ud-bav { display: flex; justify-content: center; align-items: center; padding-top: 6px; }
.ud-rname b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.ud-rname small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-3); font-size: 10px; }
.ud-rname i { display: block; height: 5px; border-radius: 9px; background: #e9eff8; margin-top: 5px; overflow: hidden; }
.ud-rname i em { display: block; height: 100%; background: #2b73e5; border-radius: 9px; }
.ud-rtotal { font-weight: 800; }
.ud-foot { display: flex; justify-content: space-between; gap: 16px; color: var(--text-3); font-size: 10.5px; padding: 12px 2px 0; flex-wrap: wrap; }
.ud-loading, .ud-error { min-height: 160px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-3); flex-wrap: wrap; text-align: center; }
.ud-loading span { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--ud-blue); border-radius: 50%; animation: udspin .8s linear infinite; }
.ud-error { color: var(--bad); }
@media (max-width: 1050px) { .ud-filters { grid-template-columns: 1fr 1fr; } .ud-company, .ud-groupwrap { grid-column: 1 / -1; } .ud-metrics { grid-template-columns: 1fr 1fr; } .ud-ranks { grid-template-columns: minmax(0, 1fr); } .ud-plot { gap: 10px; } }
@media (max-width: 680px) {
  .ud-shell { padding: 12px; border-radius: 12px; }
  .ud-head { display: block; } .ud-head h2 { font-size: 21px; } .ud-actions { margin-top: 10px; }
  .ud-filters { grid-template-columns: 1fr 1fr; }
  .ud-seg button { flex: 1; padding: 0 6px; }
  .ud-chart { grid-template-columns: 26px minmax(0, 1fr); }
  .ud-plot { gap: 6px; padding: 8px 4px 0; }
  .ud-blabel { font-size: 10px; } .ud-bsub { font-size: 8.5px; } .ud-val { font-size: 11px; }
  .ud-metric { padding: 12px; gap: 10px; } .ud-mic { width: 40px; height: 40px; } .ud-mmain { font-size: 17px; }
  .ud-rhead, .ud-rrow { grid-template-columns: 50px minmax(0, 1fr) 58px; gap: 8px; }
  .ud-foot { display: block; } .ud-foot span { display: block; margin-top: 4px; }
}
@media (max-width: 340px) { .ud-metrics { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .ud-bar, .ud-btn.spin svg, .ud-loading span { animation: none; } }
@media print { .ud-shell { display: none; } }

/* item 9: sync state line on the dashboard */
.sync-line { font-size: 13px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.sync-line.bad { color: var(--bad); border-color: var(--bad); }


/* 019: display picture card (original vs AI) - cut-outs shown on a soft brand circle */
/* 021: person chips (avatar + name), the same everywhere; full ring + soft tint, never an edge stripe */
.pchip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 3px 12px 3px 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: inherit; text-decoration: none; vertical-align: middle; line-height: 1.2; }
a.pchip:hover { background: var(--primary-soft); border-color: var(--border-strong); }
.pchip .pc-t { display: flex; flex-direction: column; min-width: 0; }
.pchip .pc-t b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchip .pc-t small { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-av { position: relative; flex: none; display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; font-weight: 700; box-shadow: 0 0 0 2px var(--surface), 0 1px 3px rgba(16, 35, 61, .18); }
.pc-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; opacity: 0; transition: opacity .15s; }
.pc-av.has-img img { opacity: 1; }
.pc-av.has-img .pc-in { visibility: hidden; }
.pchip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.dp-row { display: flex; gap: 16px; flex-wrap: wrap; }
.flag-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.dp-reason { font-size: 13px; color: #8a4b00; background: #fff6e5; border: 1px solid #f1cf8f; border-radius: 8px; padding: 6px 10px; }
.dp-fig { margin: 0; text-align: center; font-size: 12px; color: var(--text-3); }
.dp-fig img, .dp-none { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; background: radial-gradient(circle at 50% 35%, #ffffff, #dbe9fb 70%); border: 1px solid var(--border); display: grid; place-items: center; }


/* =====================================================================================================================
   macOS System Settings theme (owner 2026-10-20) - overrides the base rules above; only the look changes.
   Sidebar = translucent vibrancy + coloured rounded-square icons + blue selection pill; content = inset rounded
   list boxes with hairline separators; macOS controls (push / pop-up buttons, search field, switches, segmented).
   Owner rules kept: no coloured edge stripes, person chips unchanged, bottom action bars on phones.
   Motion: transform / opacity only, 160-240 ms ease-out, all switched off by prefers-reduced-motion.
   ===================================================================================================================== */
body { font: 14px/1.5 var(--font); letter-spacing: 0; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
h1, h2, h3, h4 { letter-spacing: -.01em; }
::selection { background: color-mix(in srgb, var(--primary) 26%, transparent); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { box-shadow: none; outline: none; }

/* ---------- sidebar (vibrancy) ---------- */
.side { background: var(--side-solid); color: var(--side-text); border-right: 1px solid var(--sep); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .side { background: var(--side-bg); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px); }
}
.brand { color: var(--side-text); font-size: 15px; height: var(--top-h); padding: 0 18px; }
.brand img { width: 26px; height: 26px; border-radius: 7px; box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.nav { padding: 2px 10px 18px; }
.nav-group { margin-top: 12px; }
.nav-title { font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: none; color: var(--side-muted); padding: 6px 10px 3px; }
.nav a, .nav-parent { gap: 9px; min-height: 30px; padding: 4px 8px; border-radius: 7px; color: var(--side-text); font-size: 13.5px; transition: background-color .12s; }
.nav a:hover, .nav-parent:hover { background: var(--side-hover); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--side-active); color: #fff; font-weight: 500; }
.nav-sub:has(a[aria-current="page"]) > .nav-parent { color: var(--side-text); font-weight: 600; }
/* coloured rounded-square icon tiles (macOS Settings) - colour per menu item, grey by default */
.nav a:not(.nav-child) > .ico:first-child, .nav-parent > .ico:first-child { width: 22px; height: 22px; padding: 3.5px; border-radius: 6px; background: var(--tile, #8e8e93); stroke: #fff; stroke-width: 2.3; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .1), 0 .5px 1px rgba(0, 0, 0, .12); }
.nav a[aria-current="page"] > .ico:first-child { box-shadow: 0 0 0 1px rgba(255, 255, 255, .35); }
.nav-children a.nav-child { min-height: 28px; padding: 4px 8px 4px 39px; font-size: 13px; }
.nav-children a.nav-child svg { width: 15px; height: 15px; opacity: 1; color: var(--tile, var(--side-muted)); stroke: currentColor; }
.nav-children a.nav-child[aria-current="page"] svg { color: #fff; }
.nav-parent .chev { opacity: .55; transition: transform .22s var(--ease); }
.nav-parent .chev .ico { width: 14px; height: 14px; }
.nav a .nav-badge { background: #ff3b30; }
.nav a[aria-current="page"] .nav-badge { background: #fff; color: var(--side-active); }
/* smooth open / close of a sidebar group (reports) */
.nav-children { display: block; max-height: 0; overflow: hidden; opacity: 0; visibility: hidden; padding: 0; transition: max-height .26s var(--ease), opacity .18s ease-out, visibility 0s linear .26s; }
.nav-sub.open .nav-children { max-height: 640px; opacity: 1; visibility: visible; padding: 2px 0 4px; transition: max-height .3s var(--ease), opacity .22s ease-out, visibility 0s; }
.nav-sub.open .nav-children > a { animation: cvSlideIn .24s var(--ease) backwards; }
.nav-sub.open .nav-children > a:nth-child(2) { animation-delay: 15ms; } .nav-sub.open .nav-children > a:nth-child(3) { animation-delay: 30ms; }
.nav-sub.open .nav-children > a:nth-child(4) { animation-delay: 45ms; } .nav-sub.open .nav-children > a:nth-child(5) { animation-delay: 60ms; }
.nav-sub.open .nav-children > a:nth-child(6) { animation-delay: 75ms; } .nav-sub.open .nav-children > a:nth-child(n+7) { animation-delay: 90ms; }
.shell.collapsed .nav-sub .nav-children { max-height: calc(100vh - 16px); opacity: 1; visibility: visible; transition: none; background: var(--surface); color: var(--text); border-radius: 10px; }
.shell.collapsed .nav-sub .nav-children a { color: var(--text); }
.shell.collapsed .nav-sub .nav-children a[aria-current="page"] { color: #fff; }
.shell.collapsed .nav-fly-title { color: var(--text-3); }
.shell.collapsed .nav a, .shell.collapsed .nav-parent { padding: 4px; justify-content: center; }
@media (max-width: 960px) {
  /* phone / tablet drawer: solid (no blur over moving content on cheap phones) */
  .side { width: 280px; transition: transform .26s var(--ease); background: var(--side-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .side { box-shadow: none; }
  .shell.open .side { box-shadow: var(--shadow-lg); }
  .shell.collapsed .nav a, .shell.collapsed .nav-parent { padding: 4px 8px; justify-content: flex-start; }
  .shell.collapsed .nav-sub .nav-children { background: none; color: inherit; max-height: 0; opacity: 0; visibility: hidden; }
  .shell.collapsed .nav-sub.open .nav-children { max-height: 640px; opacity: 1; visibility: visible; }
  .shell.collapsed .nav-sub .nav-children a { color: var(--side-text); }
  .shell.collapsed .nav-children a.nav-child { padding: 4px 8px 4px 39px; }
  .shell.open .scrim { background: rgba(0, 0, 0, .28); animation: cvFade .2s ease-out; }
}

/* ---------- toolbar (top bar) ---------- */
.top { height: var(--top-h); background: color-mix(in srgb, var(--surface) 82%, transparent); border-bottom: 1px solid var(--sep); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .top { -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
}
.top h1 { font-size: 15px; font-weight: 700; }
.top .btn.ghost.icon { color: var(--text-2); }
.avatar { background: linear-gradient(180deg, #8e8e93, #6e6e73); color: #fff; font-size: 12.5px; width: 28px; height: 28px; }
.badge-dot { background: #ff3b30; }
.content { padding: 22px 28px 48px; max-width: 1480px; }
@media (max-width: 960px) { .content { padding: 14px 16px 40px; } }

/* ---------- popovers / menus ---------- */
.pop { border: 0; border-radius: 12px; box-shadow: var(--shadow-lg); transform-origin: top right; animation: cvPop .16s var(--ease); background: var(--surface); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .pop { background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px); }
}
.pop-head { border-bottom: 1px solid var(--sep); font-size: 13px; }
.pop-item { border-bottom: 1px solid var(--sep); }
.pop-item:hover { background: var(--fill); }
.menu { padding-bottom: 5px; }
.menu a, .menu button { margin: 0 5px; width: calc(100% - 10px); padding: 6px 10px; border-radius: 6px; font-size: 13.5px; }
.menu a:hover, .menu button:hover { background: var(--primary); color: #fff; }
.menu .pop-head { margin-bottom: 5px; }

/* ---------- buttons (macOS push buttons) ---------- */
.btn { min-height: 32px; padding: 5px 13px; border-radius: var(--radius-sm); border: 0; background: var(--surface); color: var(--text); font-weight: 500; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .14), 0 1px 1.5px rgba(0, 0, 0, .08); transition: transform .12s var(--ease), background-color .12s, box-shadow .12s, filter .12s; }
.btn:hover { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: scale(.97); filter: brightness(.96); }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 88%, #fff), var(--primary)); color: #fff; box-shadow: 0 0 0 .5px color-mix(in srgb, var(--primary) 70%, #000), 0 1px 2px rgba(0, 0, 0, .14); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: linear-gradient(180deg, color-mix(in srgb, var(--bad) 88%, #fff), var(--bad)); color: #fff; box-shadow: 0 0 0 .5px color-mix(in srgb, var(--bad) 70%, #000), 0 1px 2px rgba(0, 0, 0, .14); }
.btn.danger-o { color: var(--bad); box-shadow: 0 0 0 .5px color-mix(in srgb, var(--bad) 55%, transparent), 0 1px 1.5px rgba(0, 0, 0, .06); }
.btn.ok { background: linear-gradient(180deg, color-mix(in srgb, var(--ok) 88%, #fff), var(--ok)); color: #fff; box-shadow: 0 0 0 .5px color-mix(in srgb, var(--ok) 70%, #000), 0 1px 2px rgba(0, 0, 0, .14); }
.btn.ghost { box-shadow: none; background: transparent; }
.btn.ghost:hover { background: var(--fill); }
.btn.sm { min-height: 26px; padding: 2px 9px; font-size: 12.5px; border-radius: 6px; }
.btn.icon { width: 32px; }
.btn.icon.sm { width: 26px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; }
@media (prefers-color-scheme: dark) {
  .btn { background: #48484a; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .5), inset 0 .5px 0 rgba(255, 255, 255, .12); }
  .btn:hover { background: #545458; }
  .btn.ghost { background: transparent; box-shadow: none; }
  .btn.ghost:hover { background: var(--fill); }
  .btn.danger-o { background: transparent; }
}

/* ---------- chips ---------- */
.chip { padding: 1px 9px; font-size: 12px; font-weight: 600; }

/* ---------- list boxes (cards) ---------- */
.card { border: 0; border-radius: 12px; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .card { box-shadow: 0 0 0 1px var(--border); } }
.card-h { padding: 11px 16px; border-bottom: 1px solid var(--sep); font-size: 13.5px; font-weight: 700; }
.card-b { padding: 14px 16px; }
.page-h { margin-bottom: 16px; }
.page-h h2 { font-size: 22px; font-weight: 700; letter-spacing: -.015em; }
.kpi .k { font-size: 12.5px; color: var(--text-3); }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.banner { border-radius: 10px; border: 0; box-shadow: inset 0 0 0 1px var(--sep); }
.banner.err { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 40%, transparent); }
.banner.warn { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 40%, transparent); }
.banner.info { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--info) 35%, transparent); }
.banner.ok { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 40%, transparent); }
.sync-line { border: 0; border-radius: 10px; box-shadow: var(--shadow); }
.flag-row, .ud-shell, .ud-card, .fb-sec { border-color: var(--sep); }

/* ---------- tables = list rows with hairline separators ---------- */
.tbl-wrap { border-radius: 0; }
table.tbl { background: transparent; }
.tbl th { background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--text-3); font-size: 12px; font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--sep); }
@media (pointer: fine) { @supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { .tbl th { -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); } } }
@media (pointer: coarse) { .tbl th { background: var(--surface); } }
/* sticky header under the sticky top bar (page scroll); inside a sideways scroller or a dialog: top of the box */
.tbl th { top: var(--top-h); background: color-mix(in srgb, var(--surface) 96%, transparent); box-shadow: 0 1px 0 var(--sep); }
.tbl-wrap.scroll-x .tbl th, .modal .tbl th, .drawer .tbl th { top: 0; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--sep); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:nth-child(even) { background: transparent; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.tbl tr.clickable:active { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.tbl th:first-child, .tbl td:first-child { padding-left: 16px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 16px; }
.pager { padding: 10px 16px 0; font-size: 12.5px; color: var(--text-3); }
.card .pager { padding: 10px 16px 0; }

/* ---------- form controls ---------- */
.field > label, .field > .lbl { font-weight: 500; font-size: 12.5px; color: var(--text-2); }
.in, select.in, textarea.in { min-height: 32px; padding: 5px 10px; border: 0; border-radius: 7px; background: var(--surface); box-shadow: 0 0 0 .5px rgba(0, 0, 0, .2), inset 0 1px 1.5px rgba(0, 0, 0, .06); transition: box-shadow .15s; }
.in:focus { outline: none; box-shadow: 0 0 0 1px var(--primary), var(--ring); }
.in.invalid { box-shadow: 0 0 0 1px var(--bad), 0 0 0 3.5px color-mix(in srgb, var(--bad) 25%, transparent); }
@media (prefers-color-scheme: dark) { .in, select.in, textarea.in { background: #1f1f21; box-shadow: 0 0 0 .5px rgba(255, 255, 255, .16), inset 0 1px 1.5px rgba(0, 0, 0, .3); } }
/* pop-up button (select) */
select.in { -webkit-appearance: none; appearance: none; padding-right: 30px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' rx='4' fill='%23007aff'/%3E%3Cpath d='M5 6.4 8 3.8l3 2.6M5 9.6 8 12.2l3-2.6' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; background-size: 16px 16px; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .16), 0 1px 1.5px rgba(0, 0, 0, .1); }
select.in[multiple] { background-image: none; padding-right: 10px; }
/* search field */
input[type="search"].in { border-radius: 8px; padding-left: 30px; background: var(--fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.6' fill='none' stroke='%238e8e93' stroke-width='1.7'/%3E%3Cpath d='m10.4 10.4 3.2 3.2' stroke='%238e8e93' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 9px center / 15px 15px; box-shadow: none; }
input[type="search"].in:focus { background-color: var(--surface); box-shadow: 0 0 0 1px var(--primary), var(--ring); }
/* switches: on/off toggles (form booleans + "ใช้งาน" in tables); option lists keep real checkboxes */
.field > .check input[type="checkbox"], .tbl .check input[type="checkbox"] { -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 38px; height: 22px; margin: 0; border-radius: 11px; background: var(--fill); box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .1); cursor: pointer; transition: background-color .2s var(--ease); }
.field > .check input[type="checkbox"]::after, .tbl .check input[type="checkbox"]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25), 0 0 0 .5px rgba(0, 0, 0, .06); transition: transform .2s var(--ease); }
.field > .check input[type="checkbox"]:checked, .tbl .check input[type="checkbox"]:checked { background: #34c759; }
.field > .check input[type="checkbox"]:checked::after, .tbl .check input[type="checkbox"]:checked::after { transform: translateX(16px); }
.field > .check input[type="checkbox"]:disabled, .tbl .check input[type="checkbox"]:disabled { opacity: .45; cursor: not-allowed; }
.field > .check input[type="checkbox"]:focus-visible, .tbl .check input[type="checkbox"]:focus-visible { box-shadow: var(--ring); }
.check input[type="checkbox"], .check input[type="radio"], .opt input { accent-color: var(--primary); }
/* filter bar */
.filters { padding: 12px 16px; border-bottom: 1px solid var(--sep); gap: 10px 12px; }
/* segmented controls (status tabs, usage "จัดกลุ่มตาม") */
.tabs { display: flex; gap: 2px; width: max-content; max-width: calc(100% - 32px); margin: 12px 16px 0; padding: 2px; border: 0; border-radius: 9px; background: var(--fill); overflow-x: auto; scrollbar-width: none; }
.tab { padding: 4px 12px; border: 0; border-radius: 7px; color: var(--text); font-weight: 500; font-size: 13px; transition: background-color .15s, box-shadow .15s; }
.tab:hover { color: var(--text); background: color-mix(in srgb, var(--surface) 50%, transparent); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .06); }
@media (prefers-color-scheme: dark) { .tab[aria-selected="true"] { background: #636366; } }
.tab .cnt { background: var(--fill); color: var(--text-2); }
.tab[aria-selected="true"] .cnt { background: var(--primary); color: #fff; }
.ud-seg { background: var(--fill); border: 0; border-radius: 9px; padding: 2px; height: 32px; }
.ud-seg button { border-radius: 7px; color: var(--text); font-size: 12.5px; }
.ud-seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .06); font-weight: 600; }
@media (prefers-color-scheme: dark) { .ud-seg button.active { background: #636366; } }
.ud-shell { --ud-blue: var(--primary); background: transparent; border: 0; box-shadow: none; padding: 0; }
.ud-card { border: 0; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .ud-card { box-shadow: 0 0 0 1px var(--border); } }
.ud-btn { border: 0; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .14), 0 1px 1.5px rgba(0, 0, 0, .08); border-radius: 7px; padding: 6px 11px; }
.ud-btn:hover { transform: none; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .14), 0 1px 1.5px rgba(0, 0, 0, .08); color: var(--text); background: var(--surface-2); }
.ud-filters select { height: 32px; border: 0; border-radius: 7px; -webkit-appearance: none; appearance: none; padding-right: 30px; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .16), 0 1px 1.5px rgba(0, 0, 0, .1); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' rx='4' fill='%23007aff'/%3E%3Cpath d='M5 6.4 8 3.8l3 2.6M5 9.6 8 12.2l3-2.6' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 7px center / 16px 16px; }
.ud-bar { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 80%, #fff), var(--primary)); box-shadow: none; }
.ud-val { color: var(--primary); }
.ud-filters label > span, .ud-groupwrap > span { font-weight: 500; }
/* searchable select dropdown + option rows */
.ss-list { border: 0; border-radius: 10px; padding: 4px; box-shadow: var(--shadow-lg); animation: cvPop .14s var(--ease); transform-origin: top center; }
.ss-opt { border-radius: 6px; padding: 6px 9px; }
.ss-opt[aria-selected="true"], .ss-opt:hover { background: var(--primary); color: #fff; }
.ss-opt[aria-selected="true"] .muted, .ss-opt:hover .muted { color: rgba(255, 255, 255, .8); }
.opt { border: 0; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--sep); }
.opt:has(input:checked) { box-shadow: inset 0 0 0 1.5px var(--primary); }
.chip-x { background: var(--fill); color: var(--text); }
.sec-t { border-radius: 8px; background: var(--fill); font-size: 13px; }
.ans { border-bottom: 1px solid var(--sep); }

/* ---------- sheets / dialogs ---------- */
.overlay { background: rgba(0, 0, 0, .3); animation: cvFade .18s ease-out; }
.modal { border: 0; border-radius: 14px; box-shadow: var(--shadow-lg); animation: cvSheet .22s var(--ease); }
.modal-h { padding: 14px 18px 12px; border-bottom: 1px solid var(--sep); }
.modal-h h3 { font-size: 15px; font-weight: 700; }
.modal-f { border-top: 1px solid var(--sep); padding: 12px 18px; }
.drawer .modal { animation: cvDrawer .26s var(--ease); border-radius: 14px 0 0 14px; }
@media (max-width: 640px) { .modal { border-radius: 14px 14px 0 0; animation: cvSheetUp .26s var(--ease); } .drawer .modal { border-radius: 0; animation: cvDrawer .26s var(--ease); } }
.toast { border: 0; border-radius: 12px; background: rgba(40, 40, 42, .94); box-shadow: var(--shadow-lg); animation: cvToast .24s var(--ease); }
.toast::after { content: none; }
.toast.err { background: rgba(120, 20, 18, .95); }
.lb { animation: cvFade .18s ease-out; }
.lb img { animation: cvZoom .22s var(--ease); }

/* ---------- skeleton shimmer (transform only) ---------- */
.skel { position: relative; overflow: hidden; background: var(--fill); animation: none; }
.skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); transform: translateX(-100%); animation: cvShimmer 1.25s ease-in-out infinite; }
@media (prefers-color-scheme: dark) { .skel::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent); } }

/* ---------- page / list motion ---------- */
.content > * { animation: cvView .24s var(--ease) backwards; }
.content > *:nth-child(2) { animation-delay: 30ms; } .content > *:nth-child(3) { animation-delay: 55ms; } .content > *:nth-child(n+4) { animation-delay: 75ms; }
.tbl tbody tr { animation: cvRow .22s var(--ease) backwards; }
.tbl tbody tr:nth-child(2) { animation-delay: 14ms; } .tbl tbody tr:nth-child(3) { animation-delay: 28ms; } .tbl tbody tr:nth-child(4) { animation-delay: 42ms; }
.tbl tbody tr:nth-child(5) { animation-delay: 56ms; } .tbl tbody tr:nth-child(6) { animation-delay: 70ms; } .tbl tbody tr:nth-child(7) { animation-delay: 84ms; }
.tbl tbody tr:nth-child(8) { animation-delay: 98ms; } .tbl tbody tr:nth-child(9) { animation-delay: 112ms; } .tbl tbody tr:nth-child(n+10) { animation-delay: 126ms; }
.grid > *, .ud-metrics > *, .pchip-list > * { animation: cvRow .24s var(--ease) backwards; }
.grid > *:nth-child(2), .ud-metrics > *:nth-child(2) { animation-delay: 30ms; } .grid > *:nth-child(3), .ud-metrics > *:nth-child(3) { animation-delay: 60ms; } .grid > *:nth-child(n+4), .ud-metrics > *:nth-child(n+4) { animation-delay: 90ms; }

@keyframes cvView { from { opacity: 0; transform: translateY(6px) scale(.995); } to { opacity: 1; transform: none; } }
@keyframes cvRow { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes cvSlideIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@keyframes cvFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cvPop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes cvSheet { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes cvSheetUp { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes cvDrawer { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes cvToast { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes cvZoom { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes cvShimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
  *:not(.spinner), *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .skel::after { display: none; }
}

/* ---------- print: never the theme ---------- */
@media print {
  .content > *, .tbl tbody tr, .grid > * { animation: none !important; }
  body { font-family: var(--font); }
}
/* icon tile colour per menu item (macOS Settings palette); unknown items stay grey */
.nav a[data-path="/admin"] { --tile: #007aff; }
.nav a[data-path="/admin/submissions"] { --tile: #34c759; }
.nav-sub[data-base="/admin/reports"] { --tile: #ff9500; }
.nav a[data-path="/admin/organizations"] { --tile: #a2845e; }
.nav a[data-path="/admin/drivers"] { --tile: #30b0c7; }
.nav a[data-path="/admin/supervisors"] { --tile: #af52de; }
.nav a[data-path="/admin/vehicles"] { --tile: #007aff; }
.nav a[data-path="/admin/vehicle-types"] { --tile: #ff2d55; }
.nav a[data-path="/admin/provinces"] { --tile: #ff3b30; }
.nav a[data-path="/admin/fleets"] { --tile: #5856d6; }
.nav a[data-path="/admin/forms"] { --tile: #ff9f0a; }
.nav a[data-path="/admin/org-settings"] { --tile: #8e8e93; }
.nav a[data-path="/admin/staff"] { --tile: #007aff; }
.nav a[data-path="/admin/roles"] { --tile: #636366; }
.nav a[data-path="/admin/identity"] { --tile: #30b0c7; }
.nav a[data-path="/admin/face-review"] { --tile: #ff3b30; }
.nav a[data-path="/admin/id-cards"] { --tile: #34c759; }
.nav a[data-path="/admin/public-links"] { --tile: #5ac8fa; }
.nav a[data-path="/admin/audit"] { --tile: #8e8e93; }
.nav a[data-path="/admin/deletions"] { --tile: #ff3b30; }
.nav a[data-path="/admin/rules"] { --tile: #ff9500; }
.nav a[data-path="/admin/health"] { --tile: #ff2d55; }
.nav a[data-path="/admin/imports"] { --tile: #34c759; }
.nav a[data-path="/admin/sessions"] { --tile: #ffcc00; }

/* ไทม์ไลน์การใช้งานแอป (views/activity.js, 028) - no nested scroll areas, no edge stripes */
.nav a[data-path="/admin/activity"] { --tile: #5856d6; }
.tl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.tl-bar .input { width: auto; min-width: 150px; }
.tl-layout { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
@media (min-width: 900px) { .tl-layout { grid-template-columns: 290px minmax(0, 1fr); } }
.tl-people { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tl-h { font-size: 12.5px; font-weight: 700; color: var(--text-3); margin: 6px 4px 2px; }
.tl-person { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; background: var(--surface); box-shadow: 0 0 0 1px var(--border); color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.tl-person:hover { background: var(--surface-2); }
.tl-person.on { background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary); }
.tl-person .pchip { min-width: 0; }
.tl-devic { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--fill); color: var(--text-2); flex: none; }
.tl-devic .ico { width: 16px; height: 16px; }
.tl-main { min-width: 0; }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.tl-sum { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 260px; }
.tl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tl-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.tl-list { list-style: none; margin: 0; padding: 0; }
.tl-row { display: grid; grid-template-columns: 66px 30px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 7px 0; border-bottom: 1px solid var(--sep); }
.tl-row:last-child { border-bottom: 0; }
.tl-t { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-2); padding-top: 4px; }
.tl-dot { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--fill); color: var(--text-2); }
.tl-dot .ico { width: 15px; height: 15px; }
.tl-dot.ok { background: var(--ok-soft); color: var(--ok); }
.tl-dot.bad { background: var(--bad-soft); color: var(--bad); }
.tl-dot.warn { background: var(--warn-soft); color: var(--warn); }
.tl-dot.info { background: var(--info-soft); color: var(--info); }
.tl-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding-top: 3px; }
.tl-title { font-size: 14px; overflow-wrap: anywhere; }
.tl-body small { overflow-wrap: anywhere; }
.tl-src { padding-top: 3px; }
.tl-gap { text-align: center; font-size: 12px; color: var(--text-3); padding: 8px 0; border-bottom: 1px dashed var(--sep); }
@media (max-width: 600px) {
  .tl-row { grid-template-columns: 58px 28px minmax(0, 1fr); }
  .tl-src { display: none; }
}

/* 030: แพ็กเกจและการชำระเงิน (views/billing.js) + trial strip of the shell. No edge stripes: full ring / tint only. */
.bl-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.bl-plan { box-shadow: 0 0 0 1px var(--sep), var(--shadow); }
.bl-plan.rec { box-shadow: 0 0 0 2px var(--primary), var(--shadow); }
.bl-plan.cur { background: var(--primary-soft); }
.bl-price b { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.bl-price span { color: var(--text-3); }
.bl-current { text-align: center; font-weight: 700; color: var(--primary); padding: 6px 0; }
.bl-note { font-size: 12.5px; color: var(--warn); }
.bl-plan .btn { width: 100%; }
.bl-meter { height: 8px; border-radius: 99px; background: var(--fill, var(--surface-3)); overflow: hidden; margin-top: 6px; }
.bl-meter span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.bl-meter span.hot { background: var(--warn); }
.seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.trial-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; padding: 8px 14px; border-radius: 10px; background: var(--info-soft); color: var(--info); font-size: 13.5px; }
.trial-strip.warn { background: var(--warn-soft); color: var(--warn); }
.trial-strip a { color: inherit; font-weight: 700; }
.welcome-steps { margin: 6px 0 0; padding-left: 20px; }
.welcome-steps li { margin: 6px 0; }

/* 032: first-use guide (onboarding.js) - checklist card + spotlight. No edge stripes: rings and tints only. */
.onb { position: fixed; right: 16px; bottom: 16px; z-index: 900; width: 340px; max-height: calc(100vh - 100px); display: flex; flex-direction: column; background: var(--surface); border-radius: 14px; box-shadow: 0 0 0 1px var(--sep, var(--border)), 0 12px 32px rgba(0, 0, 0, .18); overflow: hidden; }
.onb.min { width: auto; background: transparent; box-shadow: none; overflow: visible; }
.onb-pill { display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; padding: 10px 16px; border-radius: 999px; background: var(--primary); color: #fff; font: inherit; font-weight: 700; box-shadow: 0 8px 22px rgba(0, 0, 0, .22); }
.onb-pill .ico { width: 18px; height: 18px; }
.onb-h { display: flex; align-items: center; gap: 4px; padding: 12px 10px 8px 16px; }
.onb-h b { display: block; font-size: 15px; }
.onb-h small { display: block; color: var(--text-3); font-size: 12.5px; }
.onb-bar { height: 6px; margin: 0 16px 6px; border-radius: 99px; background: var(--surface-3, #eef1f5); overflow: hidden; }
.onb-bar span { display: block; height: 100%; background: var(--ok); border-radius: inherit; transition: width .3s; }
.onb-steps { list-style: none; margin: 0; padding: 4px 8px 4px; overflow-y: auto; }
.onb-steps li { display: flex; gap: 10px; padding: 8px; border-radius: 10px; align-items: flex-start; }
.onb-steps li.tap { cursor: pointer; }
.onb-steps li.tap:hover { background: var(--surface-3, #f2f4f7); }
.onb-steps li.cur { background: var(--primary-soft); }
.onb-steps li.done b { color: var(--text-3); text-decoration: line-through; font-weight: 500; }
.onb-steps p { margin: 4px 0 0; font-size: 13px; color: var(--text-2, var(--text)); line-height: 1.5; }
.onb-n { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; background: var(--surface-3, #eef1f5); color: var(--text-2, var(--text)); }
.onb-steps li.cur .onb-n { background: var(--primary); color: #fff; }
.onb-steps li.done .onb-n { background: var(--ok); color: #fff; }
.onb-b { min-width: 0; flex: 1; font-size: 14px; }
.onb-f { padding: 8px 16px 12px; border-top: 1px solid var(--sep, var(--border)); font-size: 13px; color: var(--text-3); }
.onb-f p { margin: 0 0 6px; }
.onb-f .link, .onb .link { border: 0; background: none; padding: 0; color: var(--primary); cursor: pointer; font: inherit; text-decoration: underline; }
.onb .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.onb-ring { position: fixed; z-index: 950; border-radius: 12px; pointer-events: none; box-shadow: 0 0 0 3px var(--primary), 0 0 0 7px rgba(255, 255, 255, .55); }
.onb-dim { position: fixed; z-index: 940; background: rgba(10, 20, 35, .45); pointer-events: none; }
.onb-tip { position: fixed; z-index: 960; background: var(--surface); color: var(--text); border-radius: 12px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .28); }
.onb-tip b { display: block; font-size: 14.5px; }
.onb-tip p { margin: 4px 0 10px; font-size: 13.5px; line-height: 1.55; }
@media (max-width: 760px) {
  .onb { left: 12px; right: 12px; width: auto; bottom: 12px; max-height: 70vh; }
  .onb.min { left: auto; }
}
@media print { .onb, .onb-ring, .onb-tip { display: none !important; } }
