﻿/* Hallmark · v2.0.0 · shape: app screen · scope: app · theme: locked docs/Design.md (repo rule, dark theme 2026-10-29) · genre: modern-minimal · screen: หน้าสรุปงาน — รายการงานค้างพร้อมสายหลักฐาน, สรุปทีม, สถานะระบบ, ลิงก์ระบบอื่น · states: loading, empty, error, full · signature: รายการงานที่ทุกแถวพกหลักฐานต้นทาง (กางดูข้อความ LINE จริงได้ในแถว) และแยกแหล่งข้อมูล 3 ชั้นทุกแถว · pre-emit critique: P4 H4 E4 S4 R4 V4 · weakest: R — หน้าเดียวแบกสี่ภูมิภาคข้อมูล; แก้ด้วยอัตราส่วนตัวอักษรคงที่ สูตร container เดียว และใช้ตาราง (ไม่ใช่การ์ด) กับรายการงาน · surface: absolute */
/* critique: จุดอ่อนที่สุดคือ R (regions) — หน้าเดียวมีสี่ภูมิภาคข้อมูล จึงกดทุกส่วนรองลงเหลือตาราง/รายการและให้ hero ถือตัวเลขนำสายตาตัวเดียว · sweep 2026-11-02 (version 07fc9b06): sloplint --scope app --genre modern-minimal บน HTML ที่ render จริงจาก production 3 หน้า (dashboard, login, 404) + app.css → 0 FAIL 0 WARN · แก้อะไรไปบ้าง: 19 en-dash ในช่วงวันที่เปลี่ยนเป็น "ถึง", 3 แถบข้าง hero-strip--signal เปลี่ยนเป็น hairline รอบตัว, 67 ข้อความไทยที่มีอักษรละตินพิมพ์ใหญ่ล้วน (LINE/AI) หุ้ม AI ด้วย <abbr title="ปัญญาประดิษฐ์"> ซึ่งเป็น markup ที่ถูกต้องและช่วย screen reader พร้อมตัดคำซ้ำในป้าย log · Floor อื่นผ่านในไฟล์นี้: focus-visible 5 จุด, overflow-x: clip บน html+body, :active 9, :disabled 13, prefers-reduced-motion, ไม่มี transition: all, token ล้วนไม่มี colour literal นอก :root · re-sweep 2026-11-02 (render tier): sloplint --render บน HTML production ที่ inline CSS + ฝังฟอนต์เป็น data URI + strip preload (file:// โหลด webfont ไม่ได้) → 0 FAIL 0 WARN · gate 67 รอบใหม่: log detail ของ identity_autobound มี "LINE" ซ้ำสองครั้ง (humanizeLogDetail เติม "บัญชี LINE" ทับ detail ที่มี "LINE" อยู่แล้ว = ละตินพิมพ์ใหญ่ 8 ตัว) แก้ให้เติม "บัญชี LINE" เฉพาะเมื่อ detail ยังไม่มีคำว่า LINE · F17/F2 answered, 41 dismissed ×5 · finish-review 2026-11-02 (subagent fresh context): 3 findings, 3 resolved, gap none — (1) log detail ของ analysis_run ที่ปน machine token (window=/messages=) ถูก humanize เป็นภาษาไทย ("ข้ามรอบ: …" / "วิเคราะห์ N ข้อความ …") โดย raw ยังอยู่ใน title, (2) .hero-strip__right flex:1 + .metrics space-between + โน้ตจำกัด 55ch ให้ตัวเลขรองกางเต็มการ์ดไม่เหลือครึ่งขวาว่าง, (3) ตัดคำซ้ำ อัตโนมัติ/ชื่อโปรไฟล์ ในป้าย+detail ของ identity_autobound */
/* built: Hallmark (ต้นฉบับ app/site/assets/app.css 2026-11-01) · theme: locked docs/Design.md · redesign: extended for services/dashboard · ส่วนต่อเติมอยู่ที่ท้ายไฟล์ ใต้แถบ "หน้าสรุปงาน (services/dashboard)" */
/* Hallmark · answered F24 · the app cards commit to a defined edge; elevation is carried by surface level only */
/* Hallmark · dismissed 41 · checked every one of the six named selectors against the 77 classes render.ts actually emits and none of them is rendered by this dashboard, they belong to the Phase 2 office screens and arrive inside the shared locked stylesheet app/site/assets/app.css copied verbatim so both stay on one sheet, and every dark surface this page does render already sets its own text colour in the same rule */
/* Hallmark · answered F2 · the five three period sequences sit inside verbatim LINE chat messages displayed as source evidence, so normalising them to a true ellipsis would silently edit the evidence and break the repo rule that quoted chat text must match the original character for character; no text the system writes itself contains three periods */
/* Hallmark · answered F17 · the ledger date cell (เปิดเมื่อ) is not squeezed: .when and .when__rel are each white-space:nowrap and render the date on one line and the relative time on a second at the column's natural max-content width (~100px); F17 divided the tall row box (stretched by the eight-tag owners cell beside it) by line-height and reported ~7 lines, a measurement artifact confirmed against the 1440 full-page capture, with no overflow or clipped date at 360/390/1440 */

/* =====================================================================
   S.T. MASTERTECH — ระบบงานภายใน (Phase 2)
   Tokens ทั้งหมดจาก docs/Design.md (ล็อกไว้) — ไม่มี colour literal นอก token block
   ===================================================================== */

/* น้ำหนักฟอนต์ที่ selector ในไฟล์นี้ใช้จริง: Prompt 400/500/600 + Inter var (100-900 ครอบคลุม 500/600/700 ของตัวเลข)
   Prompt 700 ประกาศไว้เป็น fallback ของ <strong> แต่ไม่มีหน้าปัจจุบันใช้ — render.ts ยัง preload ขาด Prompt-Medium.woff2 (500) */
@font-face {
  font-family: "Prompt";
  src: url("fonts/Prompt-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: optional;
}
@font-face {
  font-family: "Prompt";
  src: url("fonts/Prompt-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: optional;
}
@font-face {
  font-family: "Prompt";
  src: url("fonts/Prompt-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: optional;
}
@font-face {
  font-family: "Prompt";
  src: url("fonts/Prompt-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: optional;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: optional;
}

:root {
  /* สี (จาก Design.md §2) */
  --st-navy-950: #071828;
  --st-navy-900: #0a2134;
  --st-navy-800: #0f2a41;
  --st-navy-700: #16364f;
  --st-red: #f52c4b;
  --st-red-deep: #eb2341;
  --st-red-action: #da2444;
  --st-red-bright: #ff5d75;
  --st-white: #f8fbff;
  --st-text: #d4e1e9;
  --st-text-soft: #a6c1d2;
  --st-line: rgba(166, 193, 210, 0.26);
  --st-line-dark: rgba(255, 255, 255, 0.07);
  --st-surface: #0a2134;
  --st-red-tint: rgba(245, 44, 75, 0.12);
  --st-red-ink: #ffb3bd;
  --st-wash-dark: rgba(255, 255, 255, 0.08);
  --st-outline-line: rgba(248, 251, 255, 0.45);
  --st-red-wash: rgba(245, 44, 75, 0.18);
  --st-shadow: 0 12px 32px rgba(2, 10, 18, 0.45);
  --st-scrim: rgba(3, 10, 18, 0.72);
  --st-shadow-header: 0 1px 0 var(--st-line-dark), 0 8px 24px rgba(2, 10, 18, 0.35);

  /* semantic (ต่อจาก Design.md §2 — UI variation) */
  --ink: var(--st-white);
  --muted: var(--st-text-soft);
  --line: var(--st-line);
  --danger-ink: var(--st-red-ink);
  --danger-tint: var(--st-red-tint);
  --focus-ring: var(--st-red-bright);

  /* ตัวอักษร */
  --font-th: "Prompt", "Noto Sans Thai", system-ui, sans-serif;
  --font-num: "Inter", "Prompt", system-ui, sans-serif;
  --text-11: 0.6875rem;
  --text-12: 0.75rem;
  --text-14: 0.875rem;
  --text-16: 1rem;
  --text-18: 1.125rem;
  --text-20: 1.25rem;
  --text-24: 1.5rem;
  --text-40: 2.5rem;
  --text-48: 3rem;
  --leading-body: 1.65;
  --leading-head: 1.25;

  /* ระยะ (spacing scale) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* โครงสร้าง */
  --container: 1100px;
  --gutter: clamp(20px, 4vw, 48px);
  --radius-s: 4px;
  --radius: 8px;
  --radius-l: 12px;
  --control-h: 40px;
  --hit-h: 44px;
  --topbar-h: 56px;
  --z-sticky-nav: 30;

  /* motion */
  --dur-micro: 120ms;
  --dur-short: 200ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

/* ---------- base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  overflow-x: clip;
}

body {
  overflow-x: clip;
  margin: 0;
  background: var(--st-navy-950);
  color: var(--st-text);
  font-family: var(--font-th);
  font-size: var(--text-16);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--st-red-bright);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1, h2, h3 {
  font-family: var(--font-th);
  font-weight: 600;
  color: var(--ink);
  line-height: var(--leading-head);
  margin: 0;
  text-wrap: balance;
  overflow-wrap: break-word;
  min-width: 0;
}

p {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

::selection {
  background: var(--st-red);
  color: var(--st-white);
}

html {
  caret-color: var(--st-red-bright);
  scrollbar-color: var(--st-navy-700) var(--st-navy-950);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- ปุ่ม ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--hit-h);
  padding: 0 var(--space-5);
  border-radius: var(--radius);
  font-family: var(--font-th);
  font-size: var(--text-16);
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-micro) var(--ease), border-color var(--dur-micro) var(--ease), color var(--dur-micro) var(--ease), opacity var(--dur-micro) var(--ease);
}
.btn:hover {
  text-decoration: none;
}
.btn:disabled {
  background: var(--st-navy-800);
  color: var(--muted);
  border-color: var(--st-line);
  cursor: not-allowed;
}
.btn--primary {
  background: var(--st-red-action);
  color: var(--st-white);
  border-color: var(--st-red-action);
}
.btn--primary:hover:not(:disabled) {
  background: var(--st-red-deep);
  border-color: var(--st-red-deep);
}
.btn--primary:active:not(:disabled) {
  background: var(--st-red);
  border-color: var(--st-red);
}
.btn--ghost {
  background: transparent;
  color: var(--st-text);
  border-color: var(--st-outline-line);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--st-wash-dark);
  border-color: var(--st-text-soft);
  color: var(--ink);
}
.btn--ghost:active:not(:disabled) {
  background: var(--st-navy-700);
  color: var(--ink);
}
.btn--block {
  width: 100%;
}

/* ---------- ฟอร์ม ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.field label {
  font-size: var(--text-14);
  font-weight: 500;
  color: var(--st-text);
}
.input {
  min-height: var(--hit-h);
  padding: 0 var(--space-4);
  background: var(--st-navy-800);
  border: 1px solid var(--st-line);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-th);
  font-size: var(--text-16);
  transition: border-color var(--dur-micro) var(--ease), background-color var(--dur-micro) var(--ease);
}
.input::placeholder {
  color: var(--muted);
}
.input:hover {
  border-color: var(--st-text-soft);
}
.input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -3px;
  border-color: var(--st-red-bright);
}
.input:disabled {
  background: var(--st-navy-900);
  color: var(--muted);
  border-color: var(--st-line-dark);
  cursor: not-allowed;
}
.input:active:not(:disabled) {
  background: var(--st-navy-700);
}

/* ---------- ข้อความสถานะ ---------- */
.alert {
  display: none;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-14);
  line-height: 1.5;
}
.alert--error {
  background: var(--danger-tint);
  color: var(--danger-ink);
}
.alert.is-visible {
  display: block;
}

/* ---------- top bar (app shell) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky-nav);
  min-height: var(--topbar-h);
  background: var(--st-navy-950);
  border-bottom: 1px solid var(--st-line-dark);
}
.topbar__inner {
  max-width: min(var(--container), 100%);
  margin: 0 auto;
  padding: 0 var(--gutter);
  min-height: var(--topbar-h);
  display: flex;
  /* จอแคบกว่าเนื้อหาให้ขึ้นบรรทัดใหม่ แทนการดันปุ่มออกนอกจอ (html overflow-x: clip ทำให้เลื่อนไปกดไม่ได้) */
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0;
  text-decoration: none;
  min-width: 0;
  white-space: nowrap;
}
.brand:hover {
  text-decoration: none;
}
.brand__mark {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-s);
  background: var(--st-navy-800);
  border: 1px solid var(--st-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-num);
  font-size: var(--text-14);
  font-weight: 700;
  color: var(--ink);
}
.brand__mark::before {
  content: "ST";
  color: var(--st-red-bright);
}
.brand__text {
  font-size: var(--text-14);
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__spacer {
  flex: 1;
}
.userchip {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  margin-left: auto; /* คงชิดขวาทั้งแถวเดียวและเมื่อแถบด้านบนขึ้นบรรทัดใหม่ */
  gap: var(--space-3);
  font-size: var(--text-14);
}
.userchip__name {
  color: var(--ink);
  font-weight: 500;
}
.badge {
  display: inline-block;
  min-width: 0;
  overflow-wrap: break-word; /* ป้ายใน header ต้องไม่ดันแถวให้กว้างกว่าจอ */
  padding: 2px var(--space-2);
  border-radius: 999px;
  border: 1px solid var(--st-line);
  background: var(--st-wash-dark);
  color: var(--muted);
  font-size: var(--text-14);
  line-height: 1.5;
}
.badge--admin {
  border-color: var(--st-red);
  color: var(--st-red-bright);
  background: var(--st-red-tint);
}

/* ---------- layout ---------- */
.page {
  flex: 1;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-8) var(--gutter) var(--space-16);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

/* ---------- login ---------- */
.login-body {
  display: flex;
  flex-direction: column;
}
.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--gutter);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--st-surface);
  color: var(--st-text);
  border: 1px solid var(--st-line-dark);
  border-radius: var(--radius-l);
  padding: var(--space-10) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.login-card__head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.login-card__head h1 {
  font-size: var(--text-24);
}
.login-card__head p {
  color: var(--muted);
  font-size: var(--text-14);
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.login-foot {
  font-size: var(--text-14);
  color: var(--muted);
  text-align: center;
}
.site-foot {
  border-top: 1px solid var(--st-line-dark);
  padding: var(--space-4) var(--gutter);
  text-align: center;
  font-size: var(--text-14);
  color: var(--muted);
}
.site-foot p {
  max-width: 70ch;
  margin: 0 auto;
}

/* ---------- dashboard ---------- */
.hero-strip {
  background: var(--st-navy-800);
  color: var(--st-text);
  border: 1px solid var(--st-line-dark);
  border-radius: var(--radius-l);
  padding: var(--space-8);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
}
.hero-strip__label {
  font-size: var(--text-14);
  color: var(--muted);
}
.hero-strip h2.hero-strip__label {
  font-weight: 500;
  font-size: var(--text-14);
  color: var(--muted);
  line-height: 1.5;
}
.hero-strip__figure {
  font-family: var(--font-num);
  font-weight: 600;
  font-size: var(--text-48);
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.hero-strip__unit {
  font-size: var(--text-18);
  font-weight: 500;
  color: var(--st-text);
  margin-left: var(--space-2);
}
.hero-strip__note {
  font-size: var(--text-14);
  color: var(--muted);
  margin-top: var(--space-2);
  /* จำกัดความกว้างโน้ตให้บล็อกซ้ายไม่ดันตัวเลขรอง (.metrics) ตกบรรทัดแล้วชิดซ้ายทิ้งครึ่งขวาของการ์ดว่าง (finish review 2026-11-02) */
  max-width: 55ch;
}
.hero-strip__right {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-start;
  /* เติมเต็มพื้นที่แถวที่เหลือ กันตัวเลขรองตกบรรทัดแล้วชิดซ้ายทิ้งครึ่งขวาของการ์ดว่าง (finish review 2026-11-02) */
  flex: 1;
  min-width: 0;
}

.panel {
  background: var(--st-surface);
  color: var(--st-text);
  border: 1px solid var(--st-line-dark);
  border-radius: var(--radius-l);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}
.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.panel__head h2 {
  font-size: var(--text-20);
}
.panel__count {
  font-family: var(--font-num);
  font-size: var(--text-14);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
  min-width: 0;
}
@media (max-width: 860px) {
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- ตาราง/รายการ ---------- */
.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: var(--text-14);
}
.table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: var(--text-14);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--st-line-dark);
  white-space: nowrap;
}
.table td:first-child,
.table th:first-child {
  min-width: 8rem;
}
.table td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--st-line-dark);
  vertical-align: top;
}
.table tr:last-child td {
  border-bottom: none;
}
.table .num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 500;
}
.table .sub {
  color: var(--muted);
  font-size: var(--text-14);
  margin-top: var(--space-1);
}
.table td {
  white-space: nowrap;
}
.table td:first-child {
  white-space: normal;
  overflow-wrap: break-word;
}
/* ข้อความยาวเป็นประโยคต้องหักบรรทัดในเซลล์ได้ (ค่าสั้น ๆ: ตัวเลข/tag/วันที่ ยัง nowrap ตาม td) — กันตารางดัน scrollWidth เกินจอ */
.table td .sub,
.table td p {
  white-space: normal;
  overflow-wrap: break-word;
}

.tag {
  display: inline-block;
  padding: 2px var(--space-2);
  border-radius: var(--radius-s);
  font-size: var(--text-14);
  border: 1px solid var(--st-line);
  color: var(--st-text-soft);
  background: var(--st-wash-dark);
}
.tag--pending {
  border-color: var(--st-red);
  color: var(--st-red-bright);
  background: var(--st-red-tint);
}
.tag--high {
  border-color: var(--st-red);
  color: var(--st-red-bright);
  background: var(--st-red-tint);
}

/* ---------- สถานะว่าง/โหลด ---------- */
.empty {
  padding: var(--space-8) var(--space-4);
  text-align: center;
  color: var(--muted);
  font-size: var(--text-14);
  display: none;
}
.empty.is-visible {
  display: block;
}

.skel {
  position: relative;
  overflow: hidden;
  background: var(--st-navy-800);
  border-radius: var(--radius-s);
  min-height: var(--space-4);
}
.skel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, var(--st-wash-dark) 50%, transparent 80%);
  animation: skel-sweep 1.4s linear infinite;
}
@keyframes skel-sweep {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}
.skel-row {
  display: none;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}
.js .skel-row {
  display: flex;
}

.errline {
  display: none;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--danger-tint);
  color: var(--danger-ink);
  font-size: var(--text-14);
}
.errline.is-visible {
  display: block;
}

/* ---------- responsive 360px ---------- */
@media (max-width: 560px) {
  .brand__text {
    display: none;
  }
  .brand {
    /* เหลือแต่ mark — ขยายเป้าสัมผัสให้ครบ 44x44 ตาม Design.md */
    min-width: var(--hit-h);
    min-height: var(--hit-h);
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .userchip__name {
    display: none;
  }
  .topbar__hide-sm {
    display: none;
  }
  /* ไม่พึ่ง id อย่างเดียว — ครอบคลุมปุ่มออกจากระบบใน userchip ทุกกรณี (ไม่ย่อเหลือ 12px: ต่ำกว่าเกณฑ์ Design.md) */
  #logout-btn,
  .userchip .btn--ghost {
    padding: 0 var(--space-3);
    font-size: var(--text-14);
    min-height: var(--hit-h);
  }
  .userchip {
    gap: var(--space-2);
  }
  /* ข้อยกเว้น Design.md: badge ใน header ที่ 390px ใช้ 14px แล้วแถวเกินจอ (คำนวณแล้ว 12px = ขนาดใหญ่ที่สุดที่พอดี) */
  .userchip .badge {
    font-size: var(--text-12);
  }
  .hero-strip__figure {
    font-size: var(--text-40);
  }
  .topbar__inner {
    padding: 0 var(--space-4);
    gap: var(--space-2);
  }
  .page {
    padding-top: var(--space-6);
    gap: var(--space-6);
  }
  .btn {
    padding: 0 var(--space-3);
  }
  .panel {
    padding: var(--space-4);
  }
  .hero-strip {
    padding: var(--space-5);
  }
  .table th,
  .table td {
    padding: var(--space-2) var(--space-2);
    white-space: normal;
  }
  .table td:first-child,
  .table th:first-child {
    min-width: 0;
  }
  .table th {
    white-space: normal;
  }
  .page {
    min-width: 0;
  }
}

/* =====================================================================
   กระดานติดตามงาน (P2-M4)
   ===================================================================== */

.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  gap: var(--space-1);
  margin-left: var(--space-6);
}
.nav__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--hit-h);
  padding: 0 var(--space-3);
  border-radius: var(--radius-s);
  color: var(--muted);
  font-size: var(--text-14);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur-micro) var(--ease), background-color var(--dur-micro) var(--ease);
}
.nav__link:hover {
  color: var(--ink);
  background: var(--st-wash-dark);
  text-decoration: none;
}
.nav__link[aria-current="page"] {
  color: var(--ink);
  background: var(--st-navy-800);
}
/* แถบ nav บนจอเล็ก — ต้องประกาศหลัง base .nav/.nav__link ไม่งั้นถูก cascade ทับ (กติกาเดิมที่อยู่ก่อน base จึงไม่เคยมีผลจริง)
   คงตัวอักษร 14px ตามเกณฑ์ Design.md แล้วชดเชยความกว้างด้วย padding/gap แทน */
@media (max-width: 560px) {
  .nav {
    margin-left: var(--space-2);
    gap: 0;
  }
  .nav__link {
    padding: 0 var(--space-2);
  }
}

.board-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
}
.board-head h1 {
  font-size: var(--text-24);
}
.board-head__sub {
  color: var(--muted);
  font-size: var(--text-14);
  margin-top: var(--space-1);
}
.board-tools {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--st-line);
  border-radius: var(--radius);
  background: var(--st-navy-900);
}
.segmented button {
  min-height: 40px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-th);
  font-size: var(--text-14);
  cursor: pointer;
  transition: background-color var(--dur-micro) var(--ease), color var(--dur-micro) var(--ease);
}
.segmented button:hover {
  color: var(--ink);
}
.segmented button[aria-pressed="true"] {
  background: var(--st-navy-700);
  color: var(--ink);
}
.segmented button:active {
  background: var(--st-navy-800);
}

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: start;
}
@media (max-width: 1100px) {
  .board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .board {
    grid-template-columns: minmax(0, 1fr);
  }
}

.col {
  background: var(--st-navy-900);
  color: var(--st-text);
  border: 1px solid var(--st-line-dark);
  border-radius: var(--radius-l);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  min-height: 120px;
}
.col.is-target {
  border-color: var(--st-red);
  background: var(--st-navy-800);
  color: var(--st-text);
}
.col__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
}
.col__title {
  font-size: var(--text-14);
  font-weight: 600;
  color: var(--text-line, var(--st-text));
}
.col__count {
  font-family: var(--font-num);
  font-size: var(--text-12);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.col__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 40px;
}
.col__empty {
  padding: var(--space-3) var(--space-2);
  font-size: var(--text-12);
  color: var(--muted);
  text-align: center;
}
.col__add {
  width: 100%;
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 1px dashed var(--st-line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-th);
  font-size: var(--text-14);
  text-align: left;
  cursor: pointer;
  transition: color var(--dur-micro) var(--ease), border-color var(--dur-micro) var(--ease);
}
.col__add:hover {
  color: var(--ink);
  border-color: var(--st-text-soft);
}
.col__add:active {
  background: var(--st-wash-dark);
}

.card {
  background: var(--st-navy-800);
  border: 1px solid var(--st-line-dark);
  border-radius: var(--radius);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  cursor: grab;
  text-align: left;
  width: 100%;
  font-family: var(--font-th);
  color: var(--st-text);
  transition: border-color var(--dur-micro) var(--ease), background-color var(--dur-micro) var(--ease);
}
.card:hover {
  border-color: var(--st-text-soft);
  background: var(--st-navy-700);
}
.card:active {
  cursor: grabbing;
}
.card.is-dragging {
  opacity: 0.55;
}
.card__title {
  font-size: var(--text-14);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.45;
  overflow-wrap: break-word;
}
.card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-12);
  color: var(--muted);
}
.card__due {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}
.card__due.is-late {
  color: var(--st-red-bright);
}
.card__people {
  display: inline-flex;
  gap: 2px;
}
.avatar {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--st-navy-700);
  border: 1px solid var(--st-line);
  color: var(--text-line, var(--st-text));
  font-family: var(--font-num);
  font-size: var(--text-12); /* ข้อยกเว้น: อักษรย่อ 1-2 ตัวในวงกลม 22px (องค์ประกอบกระดาน P2 ไม่ใช่ตาราง/ข้อความอธิบาย) */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: lowercase;
}

/* ---------- dialog: รายละเอียดงาน ---------- */
.dialog {
  border: 1px solid var(--st-line);
  border-radius: var(--radius-l);
  background: var(--st-navy-900);
  color: var(--st-text);
  padding: 0;
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 48px);
}
.dialog::backdrop {
  background: var(--st-scrim);
}
.dialog__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-6);
  overflow-y: auto;
  max-height: calc(100dvh - 48px);
}
.dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.dialog__head h2 {
  font-size: var(--text-18);
}
.dialog__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-3);
}
@media (max-width: 520px) {
  .dialog__row {
    grid-template-columns: minmax(0, 1fr);
  }
}
.select {
  min-height: var(--hit-h);
  padding: 0 var(--space-3);
  background: var(--st-navy-800);
  border: 1px solid var(--st-line);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-th);
  font-size: var(--text-16);
  cursor: pointer;
}
.select:active {
  background: var(--st-navy-700);
}
.textarea {
  min-height: 88px;
  padding: var(--space-3) var(--space-4);
  background: var(--st-navy-800);
  border: 1px solid var(--st-line);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-th);
  font-size: var(--text-16);
  line-height: 1.5;
  resize: vertical;
}
.textarea:active {
  background: var(--st-navy-700);
}
.assignees {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--st-line);
  border-radius: 999px;
  font-size: var(--text-14);
  color: var(--st-text);
  cursor: pointer;
  background: var(--st-navy-800);
  transition: border-color var(--dur-micro) var(--ease), background-color var(--dur-micro) var(--ease);
}
.check:hover {
  border-color: var(--st-text-soft);
}
.check input {
  accent-color: var(--st-red-action);
  width: 16px;
  height: 16px;
}
.check:has(input:checked) {
  border-color: var(--st-red);
  background: var(--st-red-tint);
  color: var(--ink);
}
.check input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.dialog__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.dialog__actions-right {
  display: flex;
  gap: var(--space-2);
  margin-left: auto;
}
.dialog__hint {
  font-size: var(--text-12);
  color: var(--muted);
}

/* =====================================================================
   ระบบลา การตั้งค่าบัญชี และประกาศความเป็นส่วนตัว (P2-M3/P2-M6)
   ===================================================================== */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.page-head h1 {
  font-size: var(--text-24);
}
.page-head p,
.panel__intro {
  margin-top: var(--space-1);
  color: var(--muted);
  font-size: var(--text-14);
}
.required {
  color: var(--st-red-bright);
  font-weight: 400;
}
.field__help {
  min-height: 1lh;
  color: var(--muted);
  font-size: var(--text-12);
}
.select:focus-visible,
.textarea:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -3px;
  border-color: var(--st-red-bright);
}
.select:hover,
.textarea:hover {
  border-color: var(--st-text-soft);
}
.select:disabled,
.textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn[aria-busy="true"] {
  cursor: progress;
}

.balance-cards {
  background: var(--st-navy-800);
  border: 1px solid var(--st-line-dark);
  border-radius: var(--radius-l);
  padding: var(--space-6);
}
.balance-cards__head {
  margin-bottom: var(--space-4);
}
.balance-cards__grid,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
}
.balance-card,
.summary-stat {
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid var(--st-line-dark);
  border-radius: var(--radius);
  background: var(--st-navy-900);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.balance-card span,
.summary-stat span,
.balance-card small,
.summary-stat small {
  color: var(--muted);
  font-size: var(--text-12);
}
.balance-card strong,
.summary-stat strong {
  color: var(--ink);
  font-family: var(--font-num);
  font-size: var(--text-24);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}
.request-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}
.request-card {
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid var(--st-line-dark);
  border-radius: var(--radius);
  background: var(--st-navy-800);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.request-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}
.request-card__head h3 {
  font-size: var(--text-16);
}
.request-card__facts {
  color: var(--st-text);
  font-size: var(--text-14);
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}
.request-card__note,
.review-summary {
  color: var(--muted);
  font-size: var(--text-14);
  overflow-wrap: break-word;
}
.request-card__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: var(--space-2);
}
.tag--approved {
  color: var(--st-white);
  border-color: var(--st-text-soft);
  background: var(--st-navy-700);
}
.tag--rejected {
  color: var(--danger-ink);
  border-color: var(--st-red);
  background: var(--danger-tint);
}
.decision-field {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.decision-field legend {
  width: 100%;
  margin-bottom: var(--space-2);
  color: var(--st-text);
  font-size: var(--text-14);
  font-weight: 500;
}

.setup-main {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
  padding: var(--space-8) var(--gutter);
}
.setup-card {
  width: 100%;
  max-width: 520px;
  padding: var(--space-8);
  background: var(--st-surface);
  border: 1px solid var(--st-line-dark);
  border-radius: var(--radius-l);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.setup-field {
  margin-top: var(--space-4);
}
.consent-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  color: var(--st-text);
  font-size: var(--text-14);
  cursor: pointer;
}
.consent-check input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex: 0 0 auto;
  accent-color: var(--st-red-action);
}
.policy-page {
  flex: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: var(--space-10) var(--gutter) var(--space-16);
}
.policy-card {
  padding: var(--space-8);
  border: 1px solid var(--st-line-dark);
  border-radius: var(--radius-l);
  background: var(--st-surface);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.policy-card h1 {
  font-size: var(--text-24);
}
.policy-card h2 {
  margin-bottom: var(--space-2);
  font-size: var(--text-18);
}
.policy-card p {
  color: var(--st-text);
  overflow-wrap: break-word;
}
.policy-meta,
.policy-note {
  margin-top: var(--space-2);
  color: var(--muted) !important;
  font-size: var(--text-14);
}

@media (max-width: 760px) {
  .balance-cards__grid,
  .summary-grid,
  .request-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  .balance-cards__grid,
  .summary-grid,
  .request-list {
    grid-template-columns: minmax(0, 1fr);
  }
  .balance-cards,
  .setup-card,
  .policy-card {
    padding: var(--space-4);
  }
  .page-head .btn {
    width: 100%;
  }
}

.sr-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}


/* =====================================================================
   หน้าสรุปงาน (services/dashboard) — ส่วนต่อเติม 2026-11-01
   ใช้ token เดิมของ docs/Design.md ทั้งหมด · เพิ่มเฉพาะ token สถานะสำเร็จ/เตือน
   (ค่าสีสองตัวนี้คัดจาก app/site/assets/preview.css ที่ Hallmark รับรองแล้วใน repo เดียวกัน)
   signature: "เส้นสัญญาณสีแดง" = เครื่องหมายว่าข้อมูลนี้ย้อนกลับไปถึงแชทจริงได้
   ===================================================================== */

:root {
  --ok: #80d6b2;
  --ok-tint: rgba(128, 214, 178, 0.12);
  --warn: #f0c878;
  --warn-tint: rgba(240, 200, 120, 0.12);
}

/* ---------- ป้ายสภาพแวดล้อม + ข้อความหลังทำรายการ ---------- */
.badge--env {
  border-color: var(--warn);
  color: var(--warn);
  background: var(--warn-tint);
}
.badge--live {
  border-color: var(--ok);
  color: var(--ok);
  background: var(--ok-tint);
}
.flash {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--st-line-dark);
  border-radius: var(--radius);
  background: var(--st-navy-800);
  color: var(--st-text);
  font-size: var(--text-14);
  line-height: 1.5;
}
.flash--ok {
  border-color: var(--ok);
  background: var(--ok-tint);
  color: var(--ok);
}
.flash--err {
  border-color: var(--st-red);
  background: var(--danger-tint);
  color: var(--danger-ink);
}

abbr[title] {
  text-decoration: none;
}

/* ---------- ตัวเลขนำสายตา (hero) + ตัวเลขรองที่ถูกกดระดับลง ---------- */
.hero-strip--signal {
  /* Hallmark gate 3: ไม่ใช้แถบข้าง ย้ำขอบ hairline เดิมด้วยสี accent รอบตัวแทน */
  border-color: var(--st-red);
}
.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  /* กางเต็มความกว้างของ .hero-strip__right เพื่อไม่ให้เหลือพื้นที่ว่างทางขวาเมื่อตัวเลขรองอยู่คนละบรรทัดกับตัวเลขหลัก */
  width: 100%;
  justify-content: space-between;
}
.metric {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.metric > span {
  color: var(--muted);
  font-size: var(--text-14);
}
.metric > strong {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-20);
  font-weight: 600;
  color: var(--st-text);
  overflow-wrap: break-word;
}

/* ---------- ตัวกรอง (สถานะอยู่ใน URL) ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.filters__label {
  color: var(--muted);
  font-size: var(--text-14);
  margin-right: var(--space-1);
}
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--st-line);
  border-radius: 999px;
  background: var(--st-navy-900);
  color: var(--muted);
  font-size: var(--text-14);
  text-decoration: none;
  transition: color var(--dur-micro) var(--ease), border-color var(--dur-micro) var(--ease),
    background-color var(--dur-micro) var(--ease);
}
.chip:hover {
  color: var(--ink);
  border-color: var(--st-text-soft);
  text-decoration: none;
}
.chip[aria-current="true"] {
  color: var(--ink);
  background: var(--st-navy-700);
  border-color: var(--st-text-soft);
}
.chip__n {
  margin-left: var(--space-2);
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  color: var(--st-red-bright);
}
/* chip ที่เลือกอยู่ พื้น --st-navy-700 (#16364f): --st-red-bright ได้เพียง 4.22:1 (ไม่ผ่าน AA)
   จึงใช้ --st-red-ink (#ffb3bd) = 7.43:1 · chip ที่ไม่เลือกคง --st-red-bright (5.53:1 บน --st-navy-900 ผ่าน AA) */
.chip[aria-current="true"] .chip__n {
  color: var(--st-red-ink);
}
@media (pointer: coarse) {
  .chip {
    min-height: 44px;
  }
}

/* ---------- บัญชีงาน (ledger) : ตาราง ไม่ใช่การ์ด ---------- */
.ledger td {
  white-space: normal;
}
.ledger__work {
  color: var(--ink);
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: break-word;
}
.ledger__id {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: var(--text-14);
}
.when {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  color: var(--st-text);
  font-size: var(--text-14);
  /* วันที่ต้องอยู่เป็นก้อนเดียว ห้ามหักกลางเลข — ใช้ได้ทั้ง "2026-10-30" และ "30 ต.ค. 2026" */
  white-space: nowrap;
}
.when__rel {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--font-th);
  font-size: var(--text-14);
  white-space: nowrap;
}
.owners {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}
.tag--done {
  border-color: var(--ok);
  color: var(--ok);
  background: var(--ok-tint);
}

/* ---------- ป้ายแยกแหล่งข้อมูล 3 ชั้น (กฎความปลอดภัยของ repo) ---------- */
.src {
  display: inline-block;
  padding: 1px var(--space-2);
  border: 1px solid var(--st-line);
  border-radius: var(--radius-s);
  background: var(--st-wash-dark);
  color: var(--muted);
  font-size: var(--text-14);
  line-height: 1.6;
}
.src--ai {
  color: var(--st-text-soft);
}
.src--human {
  border-color: var(--ok);
  background: var(--ok-tint);
  color: var(--ok);
}
.src--staff {
  border-color: var(--warn);
  background: var(--warn-tint);
  color: var(--warn);
}

/* ---------- สายหลักฐาน: กางดูข้อความแชทต้นทางได้ในแถว ---------- */
.ev {
  margin-top: var(--space-2);
}
.ev > summary {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--space-2);
  margin-left: calc(-1 * var(--space-2));
  border-radius: var(--radius-s);
  color: var(--st-red-bright);
  font-size: var(--text-14);
  cursor: pointer;
  list-style: none;
  transition: background-color var(--dur-micro) var(--ease), color var(--dur-micro) var(--ease);
}
.ev > summary::-webkit-details-marker {
  display: none;
}
.ev > summary:hover {
  background: var(--st-red-tint);
  color: var(--st-white);
}
.ev[open] > summary {
  background: var(--st-red-tint);
  color: var(--st-white);
}
.ev__none {
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: var(--text-14);
}
.chat {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin: var(--space-2) 0 0;
  padding: var(--space-4);
  border-left: 2px solid var(--st-red);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--st-navy-950);
}
.chat__row {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.chat__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  font-size: var(--text-14);
  color: var(--muted);
}
.chat__who {
  color: var(--st-text-soft);
  font-weight: 500;
}
.chat__when {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}
.chat__text {
  color: var(--st-text);
  font-size: var(--text-14);
  line-height: 1.6;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}
.chat__unsent {
  color: var(--danger-ink);
  font-size: var(--text-14);
}
@media (pointer: coarse) {
  .ev > summary {
    min-height: 44px;
  }
}

/* ---------- ปุ่มทำรายการในแถว (สไตล์รอง — ปุ่มหลักเติมสีมีเฉพาะหน้าล็อกอิน) ---------- */
.rowacts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.rowacts form {
  display: inline-flex;
  margin: 0;
}
.act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--st-line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--st-text);
  font-family: var(--font-th);
  font-size: var(--text-14);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-micro) var(--ease), border-color var(--dur-micro) var(--ease),
    color var(--dur-micro) var(--ease);
}
.act:hover:not(:disabled) {
  background: var(--st-wash-dark);
  border-color: var(--st-text-soft);
  color: var(--ink);
}
.act:active:not(:disabled) {
  background: var(--st-navy-700);
  color: var(--ink);
}
.act:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.act--danger {
  border-color: var(--st-red);
  color: var(--danger-ink);
}
.act--danger:hover:not(:disabled) {
  background: var(--danger-tint);
  border-color: var(--st-red);
  color: var(--st-white);
}
.act.is-busy {
  opacity: 0.55;
  pointer-events: none;
}
@media (pointer: coarse) {
  .act {
    min-height: 44px;
  }
}

/* ---------- สถานะระบบ / ลิงก์ระบบอื่น : ใช้ dl ตามธรรมเนียม ---------- */
.facts {
  display: grid;
  margin: 0;
}
.facts > div {
  display: grid;
  grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--st-line-dark);
  min-width: 0;
}
.facts > div:last-child {
  border-bottom: 0;
}
.facts dt {
  color: var(--muted);
  font-size: var(--text-14);
  font-weight: 500;
}
.facts dd {
  margin: 0;
  min-width: 0;
  color: var(--ink);
  font-size: var(--text-14);
  line-height: 1.6;
  overflow-wrap: break-word;
}
.facts dd .num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}
.links {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}
.links li {
  border-bottom: 1px solid var(--st-line-dark);
}
.links li:last-child {
  border-bottom: 0;
}
.links a {
  display: grid;
  gap: 2px;
  padding: var(--space-3) 0;
  color: var(--ink);
  text-decoration: none;
}
.links a:hover {
  text-decoration: none;
}
.links a:hover .links__t {
  color: var(--st-red-bright);
}
.links__t {
  font-size: var(--text-16);
  font-weight: 500;
  overflow-wrap: break-word;
  transition: color var(--dur-micro) var(--ease);
}
.links__d {
  color: var(--muted);
  font-size: var(--text-14);
  line-height: 1.5;
}
.links__s {
  margin-top: 2px;
}

/* ---------- log ล่าสุด ---------- */
.logs {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-14);
}
.logs li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--st-line-dark);
  min-width: 0;
}
.logs li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.logs__t {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}
.logs__b {
  min-width: 0;
  overflow-wrap: break-word;
}
.logs__ev {
  color: var(--st-text-soft);
  font-weight: 500;
}
.logs li.is-warn .logs__ev {
  color: var(--warn);
}
.logs li.is-error .logs__ev {
  color: var(--st-red-bright);
}
.logs__d {
  color: var(--muted);
}

/* ---------- restack ตารางบนจอเล็ก: คอลัมน์ที่บอกชื่อว่างานอะไรและคอลัมน์ที่กดได้ต้องอยู่ให้เห็น ----------
   ครอบคลุมทั้งบัญชีงาน (.ledger) และตารางสรุปทีม (.team) — ใช้ data-label เดียวกัน */
@media (max-width: 760px) {
  .ledger thead,
  .team thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .ledger tr,
  .team tr {
    display: block;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--st-line-dark);
  }
  .ledger tr:last-child,
  .team tr:last-child {
    border-bottom: 0;
  }
  .ledger td,
  .team td {
    display: block;
    padding: var(--space-1) 0;
    border: 0;
    white-space: normal;
  }
  .ledger td[data-label]::before,
  .team td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: var(--text-14);
  }
  .ledger td[data-label=""]::before,
  .team td[data-label=""]::before {
    content: none;
  }
  .facts > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .metrics {
    gap: var(--space-4);
  }
  .logs li {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}