/* ตารางติดตามงาน พมจ.กำแพงเพชร
   โลกของสี: ตาราง Excel เดิมของสำนักงาน — แถบกรมท่า หัวตารางชมพู แถวฟ้าอ่อน */

:root {
  --navy: oklch(0.3 0.08 268);
  --navy-2: oklch(0.37 0.085 268);
  --navy-ink-2: oklch(0.86 0.03 268);
  --pink: oklch(0.53 0.19 357);
  --pink-hover: oklch(0.47 0.18 357);
  --pink-soft: oklch(0.955 0.025 357);
  --pink-ink: oklch(0.46 0.17 357);

  --ground: oklch(0.968 0.01 250);
  --surface: oklch(0.996 0.002 250);
  --surface-2: oklch(0.948 0.022 243);   /* แถวฟ้าอ่อนของตาราง */
  --ink: oklch(0.25 0.035 266);
  --ink-2: oklch(0.43 0.03 266);
  --ink-3: oklch(0.56 0.025 266);
  --line: oklch(0.9 0.014 255);
  --line-2: oklch(0.82 0.02 255);

  --over: oklch(0.55 0.2 27);
  --over-soft: oklch(0.96 0.025 27);
  --over-ink: oklch(0.46 0.17 27);
  --warn: oklch(0.76 0.15 72);
  --warn-soft: oklch(0.97 0.045 88);
  --warn-ink: oklch(0.47 0.11 62);
  --prog: oklch(0.56 0.13 255);
  --prog-soft: oklch(0.955 0.025 255);
  --prog-ink: oklch(0.43 0.13 258);
  --done: oklch(0.6 0.12 155);
  --done-soft: oklch(0.96 0.035 155);
  --done-ink: oklch(0.42 0.1 155);
  --idle: oklch(0.64 0.025 266);
  --idle-soft: oklch(0.95 0.008 266);
  --idle-ink: oklch(0.42 0.03 266);

  --r: 12px;
  --r-sm: 8px;
  --shadow: 0 1px 2px oklch(0.3 0.05 266 / 0.06), 0 6px 16px -6px oklch(0.3 0.05 266 / 0.1);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --tabbar-h: 64px;

  color-scheme: light;
  accent-color: var(--pink);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 1rem/1.6 "Sarabun", "Leelawadee UI", "Thonburi", system-ui, sans-serif;
  caret-color: var(--pink);
  scrollbar-color: var(--line-2) transparent;
}
::selection { background: oklch(0.88 0.07 357); color: var(--ink); }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; border-radius: 4px; }
a { color: var(--navy-2); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--pink-ink); }
h1, h2, h3 { margin: 0; line-height: 1.3; color: var(--ink); text-wrap: balance; }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.125rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
small { font-size: 0.8125rem; }
.ico { width: 1.25em; height: 1.25em; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 50; background: var(--pink); color: #fff; padding: 8px 14px; border-radius: var(--r-sm); }
.skip:focus { top: 12px; }
.muted { color: var(--ink-2); }
.pad { padding: 16px 18px; }
.stack { display: grid; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.hint { font-size: 0.875rem; color: var(--ink-2); }
.num, .key-n, .remain, time, .tab-n { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.shell { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 30; }
.shell-in { max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; flex: none; }
.brand img { border-radius: 8px; }
.brand span { display: grid; line-height: 1.2; }
.brand b { font-weight: 700; font-size: 1.0625rem; }
.brand small { color: var(--navy-ink-2); font-size: 0.8125rem; }
.brand:hover { color: #fff; }
.topnav { display: flex; align-self: stretch; gap: 4px; }
.topnav a {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--navy-ink-2);
  text-decoration: none; font-weight: 500; white-space: nowrap; border-bottom: 3px solid transparent; border-top: 3px solid transparent;
  transition: color .15s, border-color .15s;
}
.topnav a:hover { color: #fff; }
.topnav a[aria-current] { color: #fff; border-bottom-color: var(--pink); }
.shell-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.bell, .who {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px; border-radius: var(--r-sm);
  color: var(--navy-ink-2); text-decoration: none; position: relative; transition: background .15s, color .15s;
}
.bell:hover, .who:hover, .bell[aria-current], .who[aria-current] { background: var(--navy-2); color: #fff; }
.bell .dot {
  position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--pink); color: #fff; font-size: 0.6875rem; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--navy);
}
.who span { max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-new { margin-left: 8px; }

.page { max-width: 1280px; margin: 0 auto; padding: 28px 24px 56px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.sub { color: var(--ink-2); margin-top: 4px; }
.crumb { display: flex; align-items: center; gap: 4px; font-size: 0.875rem; margin-bottom: 4px; }
.crumb .ico { width: 14px; height: 14px; color: var(--ink-3); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: var(--r-sm); border: 1px solid transparent; font: 600 0.9375rem/1 inherit; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--pink); color: #fff; }
.btn-primary:hover { background: var(--pink-hover); color: #fff; }
.btn-quiet { background: var(--surface-2); color: var(--navy); border-color: var(--line-2); }
.btn-quiet:hover { background: oklch(0.92 0.03 243); color: var(--navy); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-done { background: var(--done-ink); color: #fff; }
.btn-done:hover { background: oklch(0.36 0.09 155); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--over-ink); border-color: oklch(0.86 0.06 27); }
.btn-danger-ghost:hover { background: var(--over-soft); color: var(--over-ink); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 0.875rem; gap: 6px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 1rem; }
.btn-icon { width: 38px; padding: 0; background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.btn-icon:hover { color: var(--over-ink); border-color: var(--over); }
.btn .ico { width: 18px; height: 18px; }
form.inline { display: inline; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.panel + .panel, .cols + .panel, .panel + .logout { margin-top: 20px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head-sub { border-top: 1px solid var(--line); background: var(--ground); }
.panel-head-sub h3 { color: var(--ink-2); font-size: 0.9375rem; }
.count { color: var(--ink-2); font-size: 0.875rem; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.cols-wide { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.cols > .panel + .panel { margin-top: 0; }

.flash {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 18px; border-radius: var(--r-sm);
  background: var(--done-soft); color: var(--done-ink); border: 1px solid oklch(0.86 0.06 155); font-weight: 500;
}
.flash-error { background: var(--over-soft); color: var(--over-ink); border-color: oklch(0.86 0.06 27); }

.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 40px 24px; color: var(--ink-2); }
.empty .ico { width: 36px; height: 36px; color: var(--ink-3); }
.empty b { color: var(--ink); font-size: 1.0625rem; }
.empty p { max-width: 46ch; }

/* ---------- status strip (แถบสถานะ: ทั้งตัวเลขและตัวกรอง) ---------- */
.status { margin-bottom: 24px; }
.status-bar { display: flex; gap: 3px; height: 14px; border-radius: 7px; overflow: hidden; background: var(--line); }
.seg { min-width: 10px; transform-origin: left; }
.seg-overdue { background: var(--over); }
.seg-in_progress { background: var(--prog); }
.seg-not_started { background: var(--idle); }
.seg-done { background: var(--done); }
.seg-empty { flex: 1; background: var(--line); }
.status-keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.key {
  display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--ink);
  transition: border-color .15s, background .15s;
}
.key::before { content: ""; grid-row: span 2; width: 12px; height: 12px; border-radius: 3px; background: var(--c); }
.key:hover { border-color: var(--c); color: var(--ink); }
.key-n { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.key-l { font-size: 0.875rem; color: var(--ink-2); font-weight: 500; }
.key-overdue { --c: var(--over); }
.key-overdue .key-n { color: var(--over-ink); }
.key-in_progress { --c: var(--prog); }
.key-not_started { --c: var(--idle); }
.key-done { --c: var(--done); }
.status-total { margin-top: 10px; font-size: 0.875rem; color: var(--ink-2); }

@media (prefers-reduced-motion: no-preference) {
  .seg { animation: grow .7s var(--ease) both; }
  @keyframes grow { from { transform: scaleX(0.001); } }
}

/* ---------- dashboard ---------- */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.side { display: grid; gap: 20px; }
.side .panel + .panel { margin-top: 0; }

.due-list { list-style: none; margin: 0; padding: 0; }
.due {
  display: grid; grid-template-columns: 196px minmax(0, 1fr) auto; gap: 6px 20px; align-items: start;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.due:last-child { border-bottom: 0; }
.due-overdue { background: var(--over-soft); }
.due-time { padding-top: 2px; }
.due-step { font-weight: 600; }
.due-step .seq { color: var(--ink-3); }
.state-tag { font-size: 0.75rem; font-weight: 600; color: var(--ink-2); background: var(--idle-soft); border-radius: 4px; padding: 1px 6px; margin-left: 4px; vertical-align: 2px; white-space: nowrap; }
.due-case { margin-top: 2px; }
.due-case a { color: var(--ink); text-decoration: none; }
.due-case a:hover { color: var(--pink-ink); text-decoration: underline; }
.due-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 0.875rem; color: var(--ink-2); }
.due-meta span { display: inline-flex; align-items: center; gap: 4px; }
.due-meta .ico { width: 15px; height: 15px; }
.due .track { margin-top: 12px; max-width: 520px; }
.due-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.due-list-quiet .due { padding-block: 12px; }
.due-list-quiet .remain { font-size: 0.9375rem; }

.remain { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 1.0625rem; line-height: 1.3; }
.remain .ico { width: 18px; height: 18px; }
.remain-overdue { color: var(--over-ink); }
.remain-warn { color: var(--warn-ink); }
.remain-ok { color: var(--prog-ink); }
.remain-none { color: var(--ink-3); font-weight: 500; font-size: 0.875rem; }
.remain-done { color: var(--done-ink); font-weight: 500; font-size: 0.875rem; }
.remain-done em { font-style: normal; font-weight: 700; color: var(--warn-ink); }

/* แถบเส้นเวลา: เริ่มนับ → ครบกำหนด */
.track { --tone: var(--prog); }
.track-warn { --tone: var(--warn); }
.track-done { --tone: var(--done); }
.track-overdue { --tone: var(--over); }
.track-bar { display: block; position: relative; height: 6px; border-radius: 3px; background: var(--line); }
.track-bar i { position: absolute; inset: 0 auto 0 0; width: var(--fill); border-radius: inherit; background: var(--tone); transition: width .4s var(--ease); }
.track-overdue .track-bar i {
  background: linear-gradient(90deg, var(--idle) 0 var(--plan),
    var(--over) var(--plan) 100%);
}
.track-overdue .track-bar::after {
  content: ""; position: absolute; left: var(--plan); top: -4px; bottom: -4px; width: 2px; margin-left: -1px;
  background: var(--ink); border-radius: 1px;
}
.track-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 0.8125rem; color: var(--ink-2); }
.track-overdue .track-meta span:last-child { color: var(--over-ink); font-weight: 600; }

.mini { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.mini th, .mini td { padding: 10px 18px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.mini thead th { background: var(--surface-2); color: var(--ink-2); font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }
.mini tbody tr:last-child > * { border-bottom: 0; }
.mini tbody th { font-weight: 500; }
.mini tbody th small { display: block; color: var(--ink-2); font-weight: 400; }
.mini .num { text-align: right; }
.mini a { color: var(--ink); text-decoration: none; }
.mini a:hover { color: var(--pink-ink); text-decoration: underline; }
.is-over { color: var(--over-ink); font-weight: 700; }
.mini td.is-over { font-size: 1rem; }
.push-card .pad + .pad { padding-top: 0; }

/* ---------- badges, chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 0.8125rem; font-weight: 600; white-space: nowrap;
}
.badge .ico { width: 15px; height: 15px; }
.badge-overdue { background: var(--over-soft); color: var(--over-ink); box-shadow: inset 0 0 0 1px oklch(0.86 0.06 27); }
.badge-in_progress { background: var(--prog-soft); color: var(--prog-ink); }
.badge-not_started { background: var(--idle-soft); color: var(--idle-ink); }
.badge-done { background: var(--done-soft); color: var(--done-ink); }
.chip { display: inline-block; padding: 1px 8px; border: 1px solid var(--line-2); border-radius: 6px; font-size: 0.8125rem; color: var(--ink-2); background: var(--surface); }

/* ---------- case list (แบบตาราง) ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: thin; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; white-space: nowrap;
  color: var(--ink-2); text-decoration: none; font-weight: 500; border: 1px solid transparent; transition: background .15s, color .15s;
}
.tab:hover { background: var(--surface); border-color: var(--line); color: var(--ink); }
.tab[aria-current] { background: var(--navy); color: #fff; }
.tab-n { font-size: 0.8125rem; font-weight: 600; padding: 0 7px; border-radius: 999px; background: oklch(0.3 0.08 268 / 0.08); }
.tab[aria-current] .tab-n { background: oklch(1 0 0 / 0.18); }
.tab-overdue:not([aria-current]) .tab-n { background: var(--over-soft); color: var(--over-ink); }

.filters {
  display: grid; grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(140px, 1fr)) auto; gap: 12px; align-items: end;
  margin-bottom: 20px;
}
.filters-go { display: flex; gap: 8px; }
.filters .field > span:not(.sr) { font-size: 0.8125rem; }

.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: clip; }
.sheet-head, .case { display: grid; grid-template-columns: 104px minmax(220px, 0.9fr) minmax(0, 2fr); }
.sheet-head { background: var(--pink); color: #fff; font-weight: 600; font-size: 0.875rem; }
.sheet-head > span { padding: 10px 16px; }
.case { border-top: 1px solid var(--line); }
.case:nth-of-type(even) { background: oklch(0.975 0.012 243); }
.case-info { padding: 16px; display: grid; gap: 6px; align-content: start; border-right: 1px solid var(--line); }
.case-date { font-weight: 600; white-space: nowrap; }
.case-main { padding: 16px; display: grid; gap: 8px; align-content: start; justify-items: start; border-right: 1px solid var(--line); }
.case-title { font-size: 1rem; font-weight: 600; line-height: 1.5; }
.case-title a { color: var(--ink); text-decoration: none; }
.case-title a:hover { color: var(--pink-ink); text-decoration: underline; }
.case-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 0.875rem; color: var(--ink-2); }
.case-meta span { display: inline-flex; align-items: center; gap: 4px; }
.case-meta .ico { width: 15px; height: 15px; }

.steps { list-style: none; margin: 0; padding: 4px 0; }
.step {
  display: grid; grid-template-columns: minmax(0, 1fr) 200px 104px 164px; gap: 4px 14px; align-items: center;
  padding: 10px 16px;
}
.step + .step { border-top: 1px dashed var(--line); }
.step-name .seq { color: var(--ink-3); }
.step-done .step-name { color: var(--ink-2); }
.step-time { display: grid; }
.step-time .remain { font-size: 0.9375rem; }
.step-time small { color: var(--ink-3); }
.step-state { font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); }
.step-overdue .step-state { color: var(--over-ink); }
.step-done .step-state { color: var(--done-ink); }
.step-in_progress .step-state { color: var(--prog-ink); }
.step-act { display: flex; gap: 6px; justify-content: flex-end; }
.step .track { grid-column: 1 / -1; }
.step .track-bar { height: 4px; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; align-content: start; min-width: 0; position: relative; }
.field > span:not(.sr) { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--ink-3); }
input, select, textarea { font: inherit; color: var(--ink); }
.field input:not([type=checkbox]), .field select, .field textarea, .sla-input input, .sla-input select, .table-edit input:not([type=checkbox]) {
  width: 100%; min-height: 44px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); transition: border-color .15s, box-shadow .15s;
}
.field textarea { padding: 10px 12px; line-height: 1.6; resize: vertical; }
select {
  appearance: none; padding-right: 36px !important; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23596079' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 10px center / 18px;
}
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pink) !important; box-shadow: 0 0 0 3px oklch(0.53 0.19 357 / 0.15); }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input[readonly] { background: transparent; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--over); }
.field-error { color: var(--over-ink); font-weight: 600; }
.field-search .ico { position: absolute; left: 12px; bottom: 12px; width: 20px; height: 20px; color: var(--ink-3); pointer-events: none; }
.field-search input { padding-left: 40px !important; }
.check input { width: 20px; height: 20px; }

.case-form { display: grid; gap: 20px; }
.case-form .panel + .panel { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; padding: 18px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.steps-edit { list-style: none; margin: 0; padding: 16px 18px 0; display: grid; gap: 12px; counter-reset: step; }
.step-edit { counter-increment: step; border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--surface); }
.step-edit.is-fixed { background: var(--surface-2); border-color: oklch(0.88 0.025 243); }
.step-edit.tone-overdue { border-color: oklch(0.82 0.08 27); background: var(--over-soft); }
.se-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.se-num::before {
  content: counter(step); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy); color: #fff; font-weight: 700; font-size: 0.9375rem;
}
.se-name { flex: 1; }
.is-fixed .se-name input { border-color: transparent; background: transparent; font-weight: 600; padding-left: 0; min-height: 36px; }
.is-fixed .se-name input:focus { box-shadow: none; }
.tag-fixed { font-size: 0.75rem; font-weight: 600; color: var(--pink-ink); background: var(--pink-soft); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.se-grid { display: grid; grid-template-columns: 1.2fr 1.1fr 1fr 1.4fr; gap: 12px; }
.sla-input { display: grid; grid-template-columns: minmax(64px, 0.8fr) minmax(0, 1.2fr); gap: 6px; }
.se-status { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-2); display: grid; gap: 8px; }
.danger-zone { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }

.table-edit td { padding: 8px 12px; }
.table-edit .w-num { width: 72px; text-align: right; }
.table-edit .sla-input { min-width: 220px; }
.row-new td { background: var(--ground); }
.row-new .ico { color: var(--ink-3); width: 18px; height: 18px; }

/* ---------- notifications, account ---------- */
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.notif:last-child { border-bottom: 0; }
.notif > .ico { margin-top: 2px; color: var(--ink-3); }
.notif-overdue > .ico { color: var(--over-ink); }
.notif-warn > .ico { color: var(--warn-ink); }
.notif a { display: grid; color: var(--ink); text-decoration: none; }
.notif a span { color: var(--ink-2); font-size: 0.9375rem; }
.notif a:hover b { color: var(--pink-ink); }
.notif time { color: var(--ink-3); font-size: 0.8125rem; white-space: nowrap; }
.notif.is-new { background: var(--pink-soft); }

.link-list { display: grid; margin-top: 20px; }
.link-list a { display: flex; align-items: center; gap: 14px; padding: 14px 18px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.link-list a:last-child { border-bottom: 0; }
.link-list a span { flex: 1; display: grid; font-weight: 600; }
.link-list small { font-weight: 400; color: var(--ink-2); }
.link-list a:hover { background: var(--ground); color: var(--ink); }
.logout { margin-top: 20px; }

.pop { position: relative; }
.pop summary { list-style: none; }
.pop summary::-webkit-details-marker { display: none; }
.pop-body {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 260px; display: grid; gap: 10px;
  padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 12px 32px -8px oklch(0.3 0.05 266 / 0.25);
}
.row-actions { text-align: right; }
.is-off th, .is-off td { color: var(--ink-3); }

.login { min-height: calc(100dvh - 200px); display: grid; place-items: center; }
.login-card { width: min(100%, 420px); padding: 28px; display: grid; gap: 18px; }

/* ---------- mobile tab bar ---------- */
.tabbar { display: none; }

@media (max-width: 1180px) {
  .who span { display: none; }
  .topnav a .ico { display: none; }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .field-search { grid-column: 1 / -1; }
  .dash { grid-template-columns: minmax(0, 1fr); }
  .side { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .se-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1020px) {
  .topnav, .who span, .btn-new { display: none; }
  .who { padding: 0 8px; }
  .shell-in { padding: 0 16px; height: 56px; }
  .page { padding: 20px 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.5rem; }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 30;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px -8px oklch(0.3 0.05 266 / 0.15);
  }
  .tabbar a { display: grid; place-items: center; align-content: center; gap: 2px; color: var(--ink-2); text-decoration: none; font-size: 0.75rem; font-weight: 500; }
  .tabbar a .ico { width: 24px; height: 24px; }
  .tabbar a[aria-current] { color: var(--navy); font-weight: 700; }
  .tabbar a[aria-current] .ico { color: var(--pink); }
  .tabbar .tab-new { align-self: center; justify-self: center; width: 52px; height: 52px; border-radius: 50%; background: var(--pink); color: #fff; box-shadow: 0 6px 16px -6px oklch(0.53 0.19 357 / 0.6); }
  .tabbar .tab-new .ico { width: 26px; height: 26px; }

  .status-keys { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .key { padding: 10px 14px; }
  .key-n { font-size: 1.625rem; }
  .side { grid-template-columns: minmax(0, 1fr); }
  .cols, .cols-wide { grid-template-columns: minmax(0, 1fr); }

  .due { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 14px 16px; }
  .due .track { max-width: none; margin-top: 10px; }
  .due-actions { justify-content: stretch; margin-top: 10px; }
  .due-actions form { flex: 1; }
  .due-actions .btn { width: 100%; height: 44px; }

  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters-go { grid-column: 1 / -1; }
  .filters-go .btn { flex: 1; }

  .sheet-head { display: none; }
  .case { grid-template-columns: minmax(0, 1fr); }
  .case-info { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; border-right: 0; }
  .case-main { padding: 6px 16px 10px; border-right: 0; }
  .steps { border-top: 1px solid var(--line); margin: 0 16px; padding: 2px 0 8px; }
  .step { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 0; }
  .step-time { grid-column: 1; }
  .step-state { grid-column: 2; grid-row: 1; text-align: right; }
  .step-act { grid-column: 1 / -1; justify-content: flex-start; }
  .step-act .btn { height: 40px; }

  .form-grid { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .se-grid { grid-template-columns: minmax(0, 1fr); }
  .steps-edit { padding: 14px 14px 0; }
  .form-actions {
    position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 5;
    margin: 0 -16px; padding: 12px 16px; background: oklch(0.968 0.01 250 / 0.94); backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
  }
  .form-actions .btn { flex: 1; }
  .notif { grid-template-columns: auto minmax(0, 1fr); }
  .notif time { grid-column: 2; }
  .table-users thead th:nth-child(2), .table-users td:nth-child(2) { display: none; }
  .table-edit { display: block; overflow-x: auto; }
}

@media (max-width: 380px) {
  .brand small { display: none; }
  .status-keys { gap: 8px; }
  .key { column-gap: 8px; padding: 10px; }
}

/* date/datetime inputs มีความกว้างขั้นต่ำในตัว ทำให้ล้นคอลัมน์บนมือถือ */
.field input { min-width: 0; max-width: 100%; }
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }

/* ---------- ส่วนตั้งค่าระบบ ---------- */
.admin-tabs { margin-top: -8px; margin-bottom: 20px; }
.nowrap { white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.mini tr.is-warn > * { background: var(--warn-soft); }
.mini td small { display: block; color: var(--ink-3); font-size: 0.75rem; }
.rules { margin: 0; padding: 14px 18px 16px 36px; display: grid; gap: 8px; color: var(--ink-2); }
.rules b { color: var(--ink); }
.copy { display: flex; gap: 8px; align-items: stretch; }
.copy code {
  flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--navy); color: var(--navy-ink-2); font: 0.8125rem/1.6 ui-monospace, Consolas, monospace;
}
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; border-top: 1px solid var(--line); }
.filters-log { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; margin: 0; border-bottom: 1px solid var(--line); }
.pop-body { width: 300px; max-height: min(70vh, 560px); overflow-y: auto; }
.pop-body form + form, .pop-body form + .row { padding-top: 10px; border-top: 1px solid var(--line); }

.history { margin-top: 20px; }
.timeline { list-style: none; margin: 0; padding: 6px 18px 12px; }
.timeline li { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 4px 16px; padding: 10px 0; border-bottom: 1px dashed var(--line); align-items: baseline; }
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--ink-2); font-size: 0.875rem; }
.timeline p span { color: var(--ink-2); }
.timeline small { color: var(--ink-3); white-space: nowrap; }

@media (max-width: 1020px) {
  .filters-log { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline li { grid-template-columns: minmax(0, 1fr); }
  .table-users thead th:nth-child(4), .table-users td:nth-child(4) { display: none; }
  .pop-body { position: fixed; inset: auto 12px calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)) 12px; width: auto; top: auto; }
}
.stack > * { min-width: 0; }

/* ---------- ติ๊กเลือก (ประเภทงาน, คำนำหน้า) ---------- */
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
fieldset.checks legend, .prefix-label { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); padding: 0; margin-bottom: 8px; }
fieldset.checks legend small, .prefix-label small { font-weight: 400; color: var(--ink-3); }
.check-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { position: relative; cursor: pointer; }
.pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pill span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px 0 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 500;
  transition: background .15s, border-color .15s, color .15s;
}
.pill .ico { width: 16px; height: 16px; color: var(--ink-3); opacity: .35; transition: opacity .15s, color .15s; }
.pill:hover span { border-color: var(--ink-3); }
.pill input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.pill input:checked + span .ico { color: #fff; opacity: 1; }
.pill input:focus-visible + span { outline: 2px solid var(--pink); outline-offset: 2px; }

.other-resp { display: grid; gap: 14px; padding: 16px; border: 1px solid oklch(0.88 0.025 243); border-radius: 10px; background: var(--surface-2); }
.other-resp[hidden] { display: none; }
.other-resp legend { float: left; width: 100%; font-weight: 600; color: var(--navy); padding: 0; }
.other-resp.has-error input[name="resp_other"] { border-color: var(--over); }
.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-2); justify-self: start; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 7px 18px; border-radius: 7px; font-weight: 600; color: var(--ink-2); transition: background .15s, color .15s; }
.seg input:checked + span { background: var(--navy); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--pink); outline-offset: 2px; }
.prefix-row[hidden] { display: none; }
.prefix-label { display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- LINE ---------- */
.line-cols { gap: 0; border-bottom: 1px solid var(--line); }
.line-cols > * + * { border-left: 1px solid var(--line); }
.check-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin-top: 3px; flex: none; }
.check-row span { display: grid; font-weight: 500; }
.check-row small { color: var(--ink-2); font-weight: 400; }
.quota p b { font-size: 1.375rem; }
.quota .track-bar { margin: 6px 0; }
.quota .track-bar i { background: var(--prog); }
.howto summary { cursor: pointer; font-weight: 600; color: var(--navy-2); }
.howto ol, .line-steps { margin: 8px 0 0; padding-left: 22px; display: grid; gap: 8px; color: var(--ink-2); }
.line-steps li { padding-left: 4px; }
.line-steps .btn { margin-left: 8px; vertical-align: middle; }
.btn-line { background: oklch(0.71 0.19 150); color: #fff; }
.btn-line:hover { background: oklch(0.64 0.18 150); color: #fff; }
.link-code { display: grid; justify-items: start; gap: 4px; padding: 14px 18px; border-radius: var(--r); background: var(--navy); color: var(--navy-ink-2); }
.link-code-n { font-size: 2.25rem; font-weight: 700; letter-spacing: 0.08em; color: #fff; font-variant-numeric: tabular-nums; line-height: 1.2; }
@media (max-width: 1020px) {
  .line-cols > * + * { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- ผู้จัดทำ ---------- */
.credit { margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--line); text-align: center; font-size: 0.8125rem; line-height: 1.7; color: var(--ink-2); }
.credit b { font-weight: 600; color: var(--ink); }
.credit p { text-wrap: balance; }
.login + .credit { margin-top: 24px; }

/* ---------- หน้าตั้งค่าแบบแถว (การแจ้งเตือน) ---------- */
.settings { overflow: clip; }
.settings-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.settings-head h2 { font-size: 1.125rem; }
.settings-head p { margin-top: 2px; color: var(--ink-2); font-size: 0.875rem; }
.save-state { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; font-size: 0.8125rem; font-weight: 600; color: var(--ink-3); white-space: nowrap; transition: opacity .3s; }
.save-state .ico { width: 16px; height: 16px; }
.save-state.is-ok { color: var(--done-ink); }
.save-state.is-error { color: var(--over-ink); white-space: normal; }

.setting-list { list-style: none; margin: 0; padding: 0; }
.setting-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; column-gap: 16px;
  padding: 16px 20px; border-top: 1px solid var(--line); transition: background .15s;
}
.setting-list .setting-row:first-child { border-top: 0; }
.setting-row:hover { background: oklch(0.985 0.006 250); }
.setting-row-head { border-top: 0; border-bottom: 1px solid var(--line); }
.setting-row-head:hover { background: transparent; }
.setting-row-head h2 { font-size: 1.125rem; }

.sr-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--c-soft); color: var(--c); transition: filter .2s, opacity .2s; }
.sr-icon .ico { width: 20px; height: 20px; }
.sr-warn { --c: var(--warn-ink); --c-soft: var(--warn-soft); }
.sr-overdue { --c: var(--over-ink); --c-soft: var(--over-soft); }
.sr-digest { --c: var(--navy-2); --c-soft: var(--surface-2); }
.sr-assign { --c: var(--done-ink); --c-soft: var(--done-soft); }
.sr-line { --c: oklch(0.55 0.16 150); --c-soft: oklch(0.95 0.04 150); }

.sr-text { min-width: 0; }
.sr-text h3 { font-size: 0.9375rem; font-weight: 600; }
.sr-text p { font-size: 0.875rem; color: var(--ink-2); margin-top: 1px; }
.sr-hint { display: block; margin-top: 4px; font-size: 0.8125rem; color: var(--ink-3); }
.sr-control { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; transition: opacity .2s, filter .2s; }
.link-btn { padding: 0; border: 0; background: none; font: inherit; color: var(--navy-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--pink-ink); }

/* ช่องกรอกตัวเลขในประโยค: "เมื่อเหลือ [25] %" */
.inline-field {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 4px 0 12px; border: 1px solid var(--line-2);
  border-radius: var(--r-sm); background: var(--surface); font-size: 0.875rem; color: var(--ink-2); white-space: nowrap;
}
.inline-field:focus-within { border-color: var(--pink); box-shadow: 0 0 0 3px oklch(0.53 0.19 357 / 0.15); }
.inline-field input {
  width: 3.4em; height: 30px; padding: 0 4px; border: 0; border-radius: 6px; background: var(--ground);
  font: 600 0.9375rem/1 inherit; color: var(--ink); text-align: center; font-variant-numeric: tabular-nums;
}
.inline-field input:focus { outline: none; box-shadow: none; }
.inline-field:last-child { padding-right: 12px; }

/* เวลาส่งสรุปเป็นชิป */
.time-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.time-chip {
  display: inline-flex; align-items: center; height: 34px; padding: 0 2px 0 10px; border: 1px solid var(--line-2);
  border-radius: 999px; background: var(--surface); transition: border-color .15s;
}
.time-chip:focus-within { border-color: var(--pink); }
.time-chip input { border: 0; background: transparent; font: 600 0.875rem/1 inherit; color: var(--ink); font-variant-numeric: tabular-nums; padding: 0; width: 6.4em; }
.time-chip input:focus { outline: none; box-shadow: none; }
.time-chip button { display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-3); cursor: pointer; }
.time-chip button:hover { background: var(--over-soft); color: var(--over-ink); }
.time-chip button .ico { width: 14px; height: 14px; }
.chip-add {
  display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 12px; border: 1px dashed var(--line-2);
  border-radius: 999px; background: transparent; color: var(--ink-2); font: 500 0.8125rem/1 inherit; cursor: pointer;
}
.chip-add:hover { border-color: var(--navy-2); color: var(--navy-2); }
.chip-add .ico { width: 14px; height: 14px; }

/* ---------- สวิตช์เปิด/ปิด ---------- */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; flex: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-track { position: relative; width: 44px; height: 24px; border-radius: 12px; background: var(--line-2); transition: background .2s; }
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px oklch(0.3 0.05 266 / 0.3); transition: transform .2s var(--ease);
}
.switch input:checked + .switch-track { background: var(--done-ink); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--pink); outline-offset: 2px; }
.switch-state { width: 2em; font-size: 0.8125rem; font-weight: 600; color: var(--done-ink); }
.switch input:not(:checked) ~ .switch-state { color: var(--ink-3); }

/* ปิดอยู่ = เทา แก้ไม่ได้ */
.setting-row.is-off .sr-icon, .is-off > .setting-row-head .sr-icon { filter: grayscale(1); opacity: .5; }
.setting-row.is-off .sr-text h3, .is-off > .setting-row-head h2 { color: var(--ink-3); }
.setting-row.is-off .sr-text p, .setting-row.is-off .sr-hint { color: var(--ink-3); }
.setting-row.is-off .sr-control, .is-off > [data-toggle-body] { opacity: 0.4; filter: grayscale(1); user-select: none; }
.is-off > .setting-row-head .badge { filter: grayscale(1); opacity: .6; }
[data-toggle-body] { transition: opacity .2s, filter .2s; }

@media (max-width: 720px) {
  .setting-row { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "icon text switch" ". control control"; row-gap: 12px; padding: 14px 16px; }
  .sr-icon { grid-area: icon; align-self: start; }
  .sr-text { grid-area: text; }
  .setting-row > .switch { grid-area: switch; align-self: start; }
  .sr-control { grid-area: control; justify-content: flex-start; }
  .sr-control:empty { display: none; }
  .time-chips { justify-content: flex-start; }
  .switch-state { display: none; }
  .settings-head { flex-direction: column; padding: 16px; }
}

#alerts-form { display: block; margin: 20px 0; }

/* ---------- คู่มือตั้งค่า LINE OA ---------- */
.guide { border-top: 1px solid var(--line); background: var(--ground); }
.guide > summary {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; cursor: pointer; list-style: none;
}
.guide > summary::-webkit-details-marker { display: none; }
.guide > summary:hover .guide-title { color: var(--pink-ink); }
.guide-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--navy); }
.guide-title .ico { width: 18px; height: 18px; transition: transform .2s var(--ease); }
.guide[open] .guide-title .ico { transform: rotate(0); }
.guide-meta { font-size: 0.8125rem; color: var(--ink-2); }
.guide-title::after { content: "แสดง"; margin-left: 6px; font-size: 0.75rem; font-weight: 600; color: var(--ink-3); }
.guide[open] .guide-title::after { content: "ซ่อน"; }

.phases { list-style: none; margin: 0; padding: 4px 20px 8px; counter-reset: phase; display: grid; gap: 12px; }
.phase {
  counter-increment: phase; position: relative; padding: 16px 18px 16px 60px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--surface);
}
.phase::before {
  content: counter(phase); position: absolute; left: 18px; top: 15px; display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700; font-size: 0.9375rem;
}
.phase-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.phase-head h4 { margin: 0; font-size: 1rem; line-height: 1.4; }
.ext {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px 2px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--navy-2); font-size: 0.8125rem; font-weight: 600; text-decoration: none;
}
.ext:hover { background: var(--navy); color: #fff; }
.ext .ico { width: 14px; height: 14px; }
.g-done { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8125rem; font-weight: 600; color: var(--done-ink); }
.g-done .ico { width: 15px; height: 15px; }

.g-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--ink); font-size: 0.9375rem; }
.g-steps li { padding-left: 4px; line-height: 1.65; }
.g-steps li::marker { color: var(--ink-3); font-weight: 600; }
.g-steps b { font-weight: 600; color: var(--navy); }
.g-steps a { font-weight: 600; }
.g-note { display: block; margin-top: 2px; font-size: 0.8125rem; color: var(--ink-2); }
.g-warn { display: inline-block; margin-left: 4px; padding: 0 8px; border-radius: 6px; background: var(--warn-soft); color: var(--warn-ink); font-size: 0.8125rem; font-weight: 600; }
.g-copy { margin-top: 6px; max-width: 560px; }
.g-callout { display: flex; gap: 8px; margin: 0 0 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn-ink); font-size: 0.875rem; }
.g-callout .ico { flex: none; margin-top: 2px; }
.g-callout a { color: inherit; font-weight: 600; }

.path { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; vertical-align: baseline; }
.path b {
  display: inline-block; padding: 0 8px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface); font-size: 0.8125rem; font-weight: 600; color: var(--ink); line-height: 1.7;
}
.path-sep { color: var(--ink-3); font-size: 0.875rem; }
.guide-foot { margin: 0; padding: 4px 20px 16px; font-size: 0.8125rem; color: var(--ink-3); }

/* กระพริบสวิตช์เมื่อต้องเปิดก่อนกรอก */
.switch.nudge .switch-track { animation: nudge .9s var(--ease) 2; }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 oklch(0.53 0.19 357 / 0); } 50% { box-shadow: 0 0 0 6px oklch(0.53 0.19 357 / 0.35); } }

@media (max-width: 720px) {
  .phases { padding: 4px 12px 8px; }
  .phase { padding: 14px 14px 14px 50px; }
  .phase::before { left: 12px; top: 13px; }
  .guide > summary { padding: 14px 16px; }
}
.g-callout-inline { margin: 6px 0 0; }
.adv summary { cursor: pointer; font-size: 0.875rem; font-weight: 600; color: var(--navy-2); }
.adv[open] summary { margin-bottom: 10px; }
.adv .check-row { margin-top: 8px; font-size: 0.875rem; }
.guide-foot p + p { margin-top: 6px; }
.guide-foot b { color: var(--ink-2); }

/* ---------- ลบเรื่อง / ถังขยะ ---------- */
.btn-danger { background: var(--over-ink); color: #fff; }
.btn-danger:hover { background: oklch(0.4 0.16 27); color: #fff; }
.bulk { overflow: clip; }
.bulk-bar {
  position: sticky; top: 64px; z-index: 4; display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap;
  padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.bulk-all { align-items: center; }
.bulk-count { color: var(--ink-2); font-size: 0.875rem; }
.bulk-count b { color: var(--ink); font-variant-numeric: tabular-nums; }
.bulk-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.purge-ok { align-items: center; font-size: 0.8125rem; color: var(--over-ink); font-weight: 600; }
.purge-ok input { width: 18px; height: 18px; margin-top: 0; }
.bulk-hint { border-bottom: 1px solid var(--line); background: var(--warn-soft); color: var(--warn-ink); }
.bulk-hint a { color: inherit; font-weight: 600; }
.bulk-table td.cb, .bulk-table th.cb { width: 44px; padding-right: 0; }
.bulk-table td.cb input { width: 18px; height: 18px; }
.bulk-table tbody tr[data-row] { cursor: pointer; }
.bulk-table tbody tr.is-selected > * { background: var(--pink-soft); }
.bulk-title { min-width: 260px; }
.bulk-title a { font-weight: 500; }
.bulk-table td small { display: block; color: var(--ink-3); font-size: 0.75rem; margin-top: 2px; }
.bulk-table .badge { font-size: 0.75rem; }
@media (max-width: 1020px) { .bulk-bar { top: 56px; } .bulk-actions { margin-left: 0; width: 100%; } }
@media (max-width: 720px) { .bulk-table th:nth-child(4), .bulk-table td:nth-child(4) { display: none; } .bulk-title { min-width: 200px; } }

/* คอลัมน์ขั้นตอนกว้างเท่ากันทุกแถว (เดิมคอลัมน์ปุ่มเป็น auto ทำให้แต่ละแถวเยื้องกัน) */
.step-time .remain { white-space: nowrap; }
.step-time .remain-done { font-size: 0.8125rem; }
.step-act .btn-sm { padding: 0 10px; }
@media (max-width: 1020px) {
  .step { grid-template-columns: minmax(0, 1fr) auto; }
  .step-time .remain { white-space: normal; }
}
.step-state { white-space: nowrap; }
@media (max-width: 1020px) { .step-state { white-space: normal; } }
