/* Bigbox Security Workflow — ออกแบบใหม่ (สีประจำหน่วยงานชุดเดียวกันทุกหน้า) */

/* ฟอนต์: Leelawadee UI (มีในทุกเครื่อง Windows) ไม่ต้องโหลดไฟล์ฟอนต์จากภายนอก */
:root {
  --font: "Leelawadee UI", "Segoe UI", Tahoma, system-ui, sans-serif;
  --bg: #F4F6FA; --card: #FFFFFF; --text: #16213A; --muted: #4B5563; --label: #374151;
  --line: #E3E8F0; --line-2: #EDF0F5; --input: #C9D2E0; --hover: #F7F9FC;
  --brand: #006028; --brand-text: #E3F1E8; --gold: #D09808; --gold-ink: #07311A;
  --primary: #1F5FBF; --primary-d: #174A94; --focus: #BBD3F7;
  --danger: #A22D19; --danger-line: #E8B4AA; --danger-bg: #FFF1EE; --req: #B91C1C;
  --ok: #14825A; --mine-bg: #FFF8E8; --mine-chip: #FFE9B8; --mine-ink: #6B4A00; --mine-line: #F59E0B;
  --radius: 12px; --radius-lg: 16px;
  /* สีประจำหน่วยงาน: ทึบ / พื้นอ่อน / ตัวอักษรบนพื้นอ่อน / เส้นอ่อน */
  --cs: #6D3FD1;    --cs-bg: #F1EAFE;    --cs-ink: #4B2A99;    --cs-soft: #D6C5F7;
  --dev: #1F5FBF;   --dev-bg: #E6F0FF;   --dev-ink: #174A94;   --dev-soft: #BFD3F2;
  --infra: #0B7A7A; --infra-bg: #DDF5F3; --infra-ink: #0B6464; --infra-soft: #C5E3E3;
  --qa: #B84E08;    --qa-bg: #FFEBD6;    --qa-ink: #8A3F08;    --qa-soft: #F3D3B5;
  --ops: #C2255C;   --ops-bg: #FFE4EE;   --ops-ink: #9B1C4A;   --ops-soft: #F3C4D6;
  --comp: #475569;  --comp-bg: #E8EDF3;  --comp-ink: #334155;  --comp-soft: #CBD5E1;
  --closed: #14825A; --closed-bg: #E2F6EC; --closed-ink: #0D6445; --closed-soft: #BFE3D2;
}
/* ตัวแปรของหน่วยงาน — ใช้ร่วมกับ .d-XX ในทุก component */
.d-CS { --d: var(--cs); --d-bg: var(--cs-bg); --d-ink: var(--cs-ink); --d-soft: var(--cs-soft); }
.d-DEV { --d: var(--dev); --d-bg: var(--dev-bg); --d-ink: var(--dev-ink); --d-soft: var(--dev-soft); }
.d-INFRA { --d: var(--infra); --d-bg: var(--infra-bg); --d-ink: var(--infra-ink); --d-soft: var(--infra-soft); }
.d-QA { --d: var(--qa); --d-bg: var(--qa-bg); --d-ink: var(--qa-ink); --d-soft: var(--qa-soft); }
.d-OPS { --d: var(--ops); --d-bg: var(--ops-bg); --d-ink: var(--ops-ink); --d-soft: var(--ops-soft); }
.d-COMP { --d: var(--comp); --d-bg: var(--comp-bg); --d-ink: var(--comp-ink); --d-soft: var(--comp-soft); }
.d-CLOSED { --d: var(--closed); --d-bg: var(--closed-bg); --d-ink: var(--closed-ink); --d-soft: var(--closed-soft); }

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-d); text-decoration: underline; }
h1 { font-size: 28px; line-height: 1.35; font-weight: 700; margin: 0; }
h2 { font-size: 20px; line-height: 1.4; font-weight: 700; margin: 0 0 16px; display: flex; gap: 8px 14px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
main { max-width: 1400px; margin: 0 auto; padding: 28px 32px 56px; }
.page-title { margin-bottom: 24px; }

/* ---------- แถบหัว ---------- */
.topbar { background: var(--brand); padding: 12px 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.topbar-line { height: 4px; background: var(--gold); }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; font-size: 19px; font-weight: 700; }
.brand:hover { color: #fff; text-decoration: none; }
.logo { width: 40px; height: 40px; border-radius: 10px; background: var(--gold); color: var(--gold-ink); font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center; flex: none; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.nav { color: var(--brand-text); font-size: 15px; padding: 8px 12px; border-radius: 8px; }
.nav:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.me { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; color: #fff; }
.me .nav { padding: 6px 8px; }
.me-chip { padding: 4px 12px; border-radius: 999px; background: var(--d-bg); color: var(--d-ink); font-size: 13px; font-weight: 700; }
button.link, .me button.nav { background: none; border: 0; cursor: pointer; font: inherit; }
form.inline { display: inline; }

/* ---------- ฟอร์ม ---------- */
label { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 600; color: var(--label); }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; color: var(--text); font-size: 15px; cursor: pointer; }
label.check input { width: 20px; height: 20px; accent-color: var(--primary); }
label.full, .full { grid-column: 1 / -1; }
input, select, textarea { font: inherit; font-size: 15px; height: 48px; padding: 0 14px; border: 1.5px solid var(--input); border-radius: 10px;
  color: var(--text); background: #fff; min-width: 0; width: 100%; }
textarea { height: auto; padding: 10px 14px; }
input[type=checkbox], input[type=radio] { width: auto; height: auto; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--focus); border-color: var(--primary); }
.req { color: var(--req); }
.ro { color: var(--text); min-height: 20px; display: block; padding: 2px 0; white-space: pre-wrap; font-weight: 400; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.5; font-weight: 400; margin: 0; }

/* ---------- ปุ่ม ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 46px; padding: 0 18px; border-radius: var(--radius);
  border: 1.5px solid var(--input); background: #fff; color: var(--text); cursor: pointer; font: inherit; font-size: 15px; font-weight: 600; white-space: nowrap; }
.btn:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-d); border-color: var(--primary-d); }
.btn.danger { color: var(--danger); border-color: var(--danger-line); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { height: 38px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn.big { height: 52px; font-size: 17px; }
.btn.block { width: 100%; }
.btn.dept { background: var(--d); border-color: var(--d); color: #fff; }
.btn.dept:hover { filter: brightness(.92); }

/* ---------- การ์ด / ข้อความแจ้ง ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px; margin-bottom: 24px; }
.card.tight { padding: 0; overflow: hidden; }
.card-head { padding: 20px 24px 12px; display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; }
.card-head h2 { margin: 0 8px 0 0; }
.card.narrow { max-width: 480px; margin: 48px auto; }
.card.narrow form { display: grid; gap: 20px; }
.flash { padding: 14px 20px; border-radius: 14px; margin-bottom: 20px; border: 1px solid; font-size: 15px; line-height: 1.7; }
.flash.ok { background: var(--closed-bg); border-color: var(--closed-soft); color: var(--closed-ink); }
.flash.error { background: #FDECEA; border-color: #F2B8B0; color: #8A2318; }
.flash.warn { background: #FFF6E0; border-color: #F1D28C; color: #7A5310; }
.flash.info { background: var(--dev-bg); border-color: var(--dev-soft); color: #183F7A; }
.flash.muted-box { background: #F1F2F5; border-color: var(--line); color: var(--muted); }
.flash.dept { background: var(--d-bg); border-color: var(--d-soft); color: var(--d-ink); }
.flash p { margin: 0; }
.issues { margin-top: 6px; } .issues ul { margin: 6px 0 0 18px; padding: 0; }

.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px 24px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form input[name=note] { flex: 1; min-width: 200px; }
.grow { flex: 1; }

/* ---------- ป้าย / ชิป ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  line-height: 1.4; white-space: nowrap; background: var(--d-bg, #EEF0F4); color: var(--d-ink, var(--muted)); }
.chip.solid { background: var(--d); color: #fff; }
.chip.sm { font-size: 12px; padding: 2px 10px; }
.chip.mine { background: var(--mine-chip); color: var(--mine-ink); font-weight: 700; }
.chip.admin { background: var(--text); color: #fff; }
.chip.warn { background: #FFF4DB; color: var(--mine-ink); }
.chip.bad { background: #FDECEA; color: #8A2318; }
.chip.ok { background: var(--closed-bg); color: var(--closed-ink); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid #D5DCE8; border-radius: 999px;
  font-size: 13px; background: #fff; color: var(--text); white-space: nowrap; }
.status i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #9AA3B2; }
.status.phase-1 i { background: var(--primary); } .status.phase-2 i { background: #D98A00; } .status.phase-3 i { background: var(--ok); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--d, #9AA3B2); }
.num { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none;
  font-size: 12px; font-weight: 700; background: var(--d-bg); color: var(--d-ink); }
.num.solid { background: var(--d); color: #fff; }
.num.lg { width: 36px; height: 36px; font-size: 16px; }

/* ของเดิมที่ยังใช้อยู่ */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #EEF0F4; color: var(--muted); }
.badge.bad { background: #FDECEA; color: #8A2318; }
.badge.st-CS { background: var(--cs-bg); color: var(--cs-ink); } .badge.st-DEV { background: var(--dev-bg); color: var(--dev-ink); }
.badge.st-INFRA { background: var(--infra-bg); color: var(--infra-ink); } .badge.st-QA { background: var(--qa-bg); color: var(--qa-ink); }
.badge.st-OPS { background: var(--ops-bg); color: var(--ops-ink); } .badge.st-CLOSED { background: var(--closed-bg); color: var(--closed-ink); }
.badge.phase-1 { background: var(--dev-bg); color: var(--dev-ink); } .badge.phase-2 { background: #FFF4DB; color: var(--mine-ink); }
.badge.phase-3 { background: var(--closed-bg); color: var(--closed-ink); }
.dept-chip, .owner { display: inline-block; padding: 4px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #fff; }
.dept-CS { background: var(--cs); } .dept-DEV { background: var(--dev); } .dept-INFRA { background: var(--infra); }
.dept-QA { background: var(--qa); } .dept-OPS { background: var(--ops); } .dept-COMP { background: var(--comp); }
.timeline .dept-chip { padding: 2px 10px; font-size: 12px; }

/* ---------- ตาราง ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
table.list th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { font-size: 14px; line-height: 1.5; padding: 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.list tbody tr:hover td { background: var(--hover); }
table.list tr.mine td { background: var(--mine-bg); }
table.list tr.mine:hover td { background: #FFF1D2; }
table.list .sub { margin-top: 6px; }
tr.off { opacity: .6; }
.empty { text-align: center; color: var(--muted); padding: 30px !important; }

/* ---------- หน้าเข้าสู่ระบบ ---------- */
.login-wrap { min-height: calc(100vh - 76px); max-width: 1200px; margin: 0 auto; padding: 48px 32px; display: flex; flex-wrap: wrap;
  gap: 56px; align-items: center; justify-content: center; }
.login-info { flex: 1 1 460px; min-width: 0; max-width: 560px; display: flex; flex-direction: column; gap: 20px; }
.login-info h2 { font-size: 30px; margin: 0; }
.login-info p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--muted); }
.dept-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.dept-list li { display: flex; align-items: center; gap: 16px; padding: 12px 18px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.dept-list .circle { width: 40px; height: 40px; border-radius: 50%; background: var(--d); color: #fff; font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center; flex: none; }
.dept-list b { flex: 1; min-width: 0; font-size: 17px; font-weight: 600; }
.login-card { flex: 1 1 400px; min-width: 0; max-width: 480px; background: #fff; border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; box-shadow: 0 8px 30px rgba(18,32,58,.08); }
.rainbow { display: flex; height: 8px; } .rainbow span { flex: 1; background: var(--d); }
.login-body { padding: 36px; display: flex; flex-direction: column; gap: 24px; }
.login-body form { display: flex; flex-direction: column; gap: 20px; }
.login-body label { font-size: 15px; color: var(--text); }
.login-body input { height: 52px; font-size: 16px; border-radius: 12px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 76px; }
.pw-toggle { position: absolute; right: 8px; top: 6px; height: 40px; min-width: 60px; padding: 0 12px; border: 0; border-radius: 8px;
  background: #EEF2F8; color: var(--primary-d); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.login-body .btn { height: 54px; font-size: 17px; }

/* ---------- หน้ารายการงาน ---------- */
.pipeline { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; margin-bottom: 24px; }
.pipe-steps { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 5 1 760px; }
.pill { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 14px; flex: 1 1 130px; min-width: 120px;
  background: var(--d-bg); color: var(--d-ink); border: 2px solid transparent; }
.pill:hover { text-decoration: none; color: var(--d-ink); filter: brightness(.97); }
.pill.active { border-color: var(--d); }
.pill .step-lbl { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.pill .count { font-size: 34px; font-weight: 700; line-height: 1.1; }
.pill .name { font-size: 14px; font-weight: 600; }
.pill.mine { flex: 1 1 190px; background: #FFF4DB; border-color: var(--mine-line); color: var(--text); }
.pill.mine .count { font-size: 40px; }
.pill.mine .name { font-size: 15px; }
.pill.mine .sub { font-size: 13px; color: var(--mine-ink); }
.pill.mine.active { box-shadow: 0 0 0 3px #FCD58A; }
.chev { flex: none; color: #8A94A6; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 24px; }
.search { display: flex; gap: 10px; flex: 1 1 420px; max-width: 640px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box svg { position: absolute; left: 14px; top: 16px; color: #6B7280; }
.search-box input { height: 50px; padding-left: 42px; border-radius: 12px; }
.search .btn { height: 50px; }
.toolbar .btn.primary { height: 50px; padding: 0 24px; margin-left: auto; }

/* ---------- หน้ารายละเอียดงาน ---------- */
.back { font-size: 15px; font-weight: 500; display: inline-block; margin-bottom: 14px; }
.proj-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.proj-head .title { flex: 1 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.proj-head .title-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.proj-head .doc { font-size: 15px; font-weight: 600; color: var(--muted); }
.proj-head .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 15px; color: var(--muted); }
.proj-head .actions { justify-content: flex-start; }
.steps { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; margin: 0 0 24px; padding: 0; list-style: none; }
.steps li { flex: 1 1 150px; min-width: 140px; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; border-radius: 12px;
  border: 2px solid transparent; }
.steps .bar { height: 6px; border-radius: 3px; background: var(--d-soft); }
.steps li.done .bar { background: var(--d); }
.steps .head { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.steps .task { font-size: 13px; line-height: 1.5; color: var(--muted); }
.steps li.current { background: #fff; border-color: var(--d); }
.steps li.current .bar { background: var(--d); }
.steps li.current .head { font-weight: 700; color: var(--d-ink); }
.steps li.done .num { background: var(--d); color: #fff; }

/* แท็บ */
.tabs { display: flex; flex-wrap: wrap; border-bottom: 2px solid #DDE3EE; margin: 0; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 14px 20px; font: inherit; font-size: 16px; font-weight: 600; color: var(--muted);
  background: transparent; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; border-radius: 10px 10px 0 0; }
.tab:hover { color: var(--text); background: #EEF2F8; }
.tab:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.tab[aria-selected="true"] { color: var(--text); background: #fff; border-bottom-color: var(--d, var(--text)); }
.tab .tdot { width: 12px; height: 12px; border-radius: 50%; background: var(--d); display: none; }
.tab[aria-selected="true"] .tdot { display: inline-block; }
.tab[aria-selected="true"] .num { display: none; }
.tab .num.done { background: var(--d); color: #fff; }
.tab-mine { padding: 2px 10px; border-radius: 999px; background: var(--mine-chip); color: var(--mine-ink); font-size: 12px; font-weight: 700; }
.tab-count { padding: 2px 10px; border-radius: 999px; background: var(--comp-bg); color: var(--comp-ink); font-size: 12px; font-weight: 700; }
.tab-panel { margin-top: 16px; }
.tab-panel[hidden] { display: none; }
.sign-line { margin-top: 14px; font-size: 14px; }

/* PCF */
.pcf-part { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 16px; }
.pcf-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 18px 22px; background: #FAFAFD; border-bottom: 1px solid var(--line); }
.pcf-head > div { flex: 1 1 360px; min-width: 0; }
.pcf-head .t { font-size: 17px; font-weight: 700; line-height: 1.5; }
.pcf-head .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.pcf-body { padding: 24px 22px; }
.pcf-body .actions { margin-top: 22px; }
.pcf-body input.grow { flex: 1; min-width: 220px; }
.pcf-no { width: 36px; height: 36px; border-radius: 50%; background: var(--cs); color: #fff; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 16px; flex: none; }
details.pcf-part.next { border: 1px dashed #BFA8F2; background: #FBF8FF; }
details.pcf-part.next > summary { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 18px 22px; cursor: pointer; }
details.pcf-part.next > summary::-webkit-details-marker { display: none; }
details.pcf-part.next > summary > div { flex: 1 1 320px; min-width: 0; }
details.pcf-part.next .pcf-no, .pcf-part.locked .pcf-no { background: var(--cs-bg); color: var(--cs-ink); }
details.pcf-part.next[open] { border-style: solid; border-color: var(--cs-soft); background: #fff; }
details.pcf-part.next[open] > summary { background: #FBF8FF; border-bottom: 1px solid var(--line); }
details.pcf-part.next[open] .open-btn { display: none; }
.open-btn { height: 48px; padding: 0 24px; border-radius: 12px; background: var(--cs); color: #fff; font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; }
.pcf-part.locked { border: 1px dashed var(--line); background: #FAFAFD; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 18px 22px; color: var(--muted); }
.pcf-part.locked > div { flex: 1; }
.pcf-note { background: #FFFBD1; padding: 10px 14px; border-radius: 10px; font-style: italic; font-size: 13px; margin: 4px 0 0; }

/* ตารางแบบฟอร์ม */
table.form-table { font-size: 13px; min-width: 1300px; }
table.form-table th { background: #F1F4F9; padding: 8px; border: 1px solid var(--line); font-weight: 600; text-align: left; color: var(--label); }
table.form-table td { padding: 6px; border: 1px solid var(--line); vertical-align: middle; }
table.form-table th.qa, table.form-table td.qa { background: #FFFAF2; }
table.form-table input, table.form-table select { width: 100%; height: 36px; padding: 0 8px; font-size: 13px; border-radius: 8px; }
table.form-table input[type=checkbox] { width: 18px; height: 18px; }
table.form-table input.wide { min-width: 240px; }
table.form-table select { min-width: 130px; }
table.form-table input[type=date] { min-width: 140px; }
table.form-table td.c { text-align: center; }
tr.cat td { background: #EEF2F8; }
tr.cat.on td { background: #E6F0FF; }
tr.item.on td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.fill-helper { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; color: var(--muted); }
.fill-helper input { width: auto; height: 40px; }

.signoff { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 20px; }
.signoff div { display: flex; flex-direction: column; gap: 2px; border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; }
.action-bar { position: sticky; bottom: 0; box-shadow: 0 -4px 14px rgba(20,33,61,.08); display: grid; gap: 14px; padding: 20px 28px; }
.return-group { display: inline-flex; gap: 8px; margin-right: auto; flex-wrap: wrap; }
.return-group select, .return-group input { width: auto; min-width: 200px; }

.timeline { list-style: none; padding: 0; margin: 16px 0 0; }
.timeline li { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.timeline .ts { color: var(--muted); font-size: 13px; margin-right: 6px; }
.timeline .note { margin: 6px 0 0; padding: 8px 12px; background: #F6F7FA; border-radius: 8px; white-space: pre-wrap; }

/* แบบฟอร์ม IT Dev / IT Infra */
.add-system { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.add-system select { width: auto; min-width: 320px; }
.sys-block { border: 1px solid var(--line); border-left: 4px solid var(--d, var(--dev)); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.sys-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.sys-head .btn { margin-left: auto; }
.sys-head .pcf-no { width: 30px; height: 30px; font-size: 14px; background: var(--d, var(--dev)); }
.sys-name { width: auto; min-width: 320px; font-weight: 700; height: 40px; }
table.form-table th.gk { background: #EEF1F6; }
table.form-table td.gk .ro:empty::before { content: "—"; color: #C3C8D2; }
.push-right { margin-left: auto; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px 24px; }
.info-grid > div { display: flex; flex-direction: column; gap: 2px; }
.info-grid .muted { font-size: 13px; }

/* หน้าผู้ใช้ */
.fchip { display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 600;
  background: var(--d-bg, #EEF0F4); color: var(--d-ink, var(--text)); border: 1.5px solid transparent; cursor: pointer; }
.fchip[aria-pressed="true"] { border-color: var(--d, var(--text)); }
.fchip.all[aria-pressed="true"] { background: var(--text); color: #fff; }
.user-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.user-actions details > summary { list-style: none; }
.user-actions details > summary::-webkit-details-marker { display: none; }
.user-actions details[open] > summary { background: var(--bg); }
.user-edit { margin-top: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #FAFBFD; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; align-items: end; min-width: 520px; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.state i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.state.off i { background: #9AA3B2; }

/* หน้าตั้งค่า */
.dept-checks { display: flex; flex-wrap: wrap; gap: 12px; }
.gchk { display: inline-flex; flex-direction: row; align-items: center; gap: 10px; height: 48px; padding: 0 18px; border-radius: 12px; font-size: 15px;
  font-weight: 600; cursor: pointer; border: 2px solid var(--input); background: #fff; color: var(--label); }
.gchk input { width: 20px; height: 20px; accent-color: var(--d); }
.gchk:has(input:checked) { background: var(--d-bg); border-color: var(--d); color: var(--d-ink); }
.save-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 20px 28px; }
.save-bar input { width: 320px; max-width: 100%; }
.save-bar .btn.primary { height: 50px; padding: 0 30px; font-size: 16px; margin-left: auto; }

@media (max-width: 900px) {
  main { padding: 20px 16px 40px; }
  .topbar { padding: 12px 16px; }
  .card { padding: 20px; }
  .login-wrap { padding: 32px 16px; gap: 32px; }
  .login-body { padding: 24px; }
  .user-edit { min-width: 0; }
}
@media (max-width: 640px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tab { white-space: nowrap; padding: 12px 14px; }
  .chev { display: none; }
  h1 { font-size: 24px; }
}

/* ตัวช่วยจัดวาง (แทน inline style — CSP ไม่อนุญาต style แบบ inline) */
.stack-6 { display: flex; flex-direction: column; gap: 6px; }
.stack-8 { display: flex; flex-direction: column; gap: 8px; }
.stack-6 p, .stack-8 p { margin: 0; }
.flash.flush { margin: 0; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: 15px; color: var(--text); }
.login-help { margin: 0; font-size: 14px; text-align: center; }
table.list.jobs { min-width: 1180px; }
.job-link { font-weight: 500; }
.pcf-title { margin: 0 0 18px; font-size: 14px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 18px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--muted); }
.stack-form { display: flex; flex-direction: column; gap: 20px; }
.check-cell { display: flex; align-items: flex-end; padding-bottom: 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.spaced { margin-top: 20px; }
.proj-head .title .back { margin-bottom: 4px; }

/* ---------- ปรับหลังตรวจหน้าจอ ---------- */
label:not(.check):not(.gchk) { display: block; }
label:not(.check):not(.gchk) > input, label:not(.check):not(.gchk) > select, label:not(.check):not(.gchk) > textarea,
label:not(.check):not(.gchk) > .ro, label:not(.check):not(.gchk) > .hint { display: block; margin-top: 8px; }
input, select, textarea { font-weight: 400; }
.grid3, .info-grid { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.user-edit { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.pipe-steps { align-items: stretch; }
.pipe-steps .chev { align-self: center; }
.steps .chip { align-self: flex-start; }
.section-head.stack-6, .section-head.stack-8 { align-items: flex-start; }
.topbar nav { flex: 1 1 auto; }
.nav { font-size: 14px; padding: 8px 10px; }
.me { font-size: 14px; }
.proj-head .title, .pcf-head > div, details.pcf-part.next > summary > div { flex-basis: min(560px, 100%); }
.pcf-head > div, details.pcf-part.next > summary > div { flex-basis: min(320px, 100%); }
@media (max-width: 640px) {
  .brand span:last-child { font-size: 16px; }
  .topbar nav, .me { width: 100%; }
  .steps li { flex-basis: calc(50% - 4px); min-width: 0; }
  .pipe-steps .pill { flex-basis: calc(50% - 4px); }
  .pill.mine { flex-basis: 100%; }
  .card { padding: 16px; }
  .pcf-body, .pcf-head, details.pcf-part.next > summary { padding: 16px; }
  .add-system select, .sys-name { min-width: 0; width: 100%; }
  .return-group select, .return-group input { min-width: 0; width: 100%; }
  .proj-head .actions .btn { white-space: normal; height: auto; min-height: 46px; text-align: center; }
}
.logo-img { width: 40px; height: 40px; flex: none; display: block; }

/* แถบขั้นตอนงาน (หน้ารายละเอียดงาน) — การ์ดเดียว แถบสีต่อกันตามลำดับ */
.flow { display: flex; flex-wrap: wrap; align-items: stretch; margin: 0 0 24px; padding: 22px 24px; list-style: none;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); row-gap: 20px; }
.flow li { flex: 1 1 150px; min-width: 140px; display: flex; flex-direction: column; gap: 12px; }
.flow .head { display: flex; align-items: center; gap: 10px; padding-right: 10px; font-size: 15px; font-weight: 600; }
.flow .num { width: 30px; height: 30px; font-size: 14px; }
.flow .bar { height: 8px; background: var(--d-soft); }
.flow li:first-child .bar { border-radius: 4px 0 0 4px; }
.flow li:last-child .bar { border-radius: 0 4px 4px 0; }
.flow .foot { display: flex; flex-direction: column; gap: 8px; padding-right: 10px; }
.flow .task { font-size: 13px; line-height: 1.5; color: var(--muted); }
.flow .chip, .flow-state { align-self: flex-start; }
.flow-state { font-size: 12px; font-weight: 600; color: #6B7280; }
.flow-state.done { color: var(--closed-ink); }
.flow li.current .num, .flow li.done .num { background: var(--d); color: #fff; }
.flow li.current .bar, .flow li.done .bar { background: var(--d); }
.flow li.current .head { font-weight: 700; color: var(--d-ink); }
.flow .chip { padding: 3px 12px; font-weight: 700; }
@media (max-width: 640px) {
  .flow { padding: 16px; }
  .flow li { flex-basis: calc(50% - 1px); min-width: 0; }
  .flow .bar { border-radius: 4px !important; }
}

/* ปุ่มกลับหน้ารายการงาน (หน้ารายละเอียดงาน) */
.back-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 18px 0 12px; margin-bottom: 14px;
  border-radius: 10px; background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 2px 6px rgba(0,96,40,.25); }
.back-btn:hover { background: var(--gold-ink); color: #fff; text-decoration: none; }
.back-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* หน้าเข้าสู่ระบบ (ปรับตาม Design ล่าสุด) */
.login-info-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.login-info-head h2, .login-info-head p { margin: 0; }
.topbar-login { min-height: 72px; gap: 14px; }
.topbar-login .logo-img { width: 44px; height: 44px; }
.topbar-login .brand { gap: 14px; font-size: 20px; }

/* แบบฟอร์ม IT Dev/Infra: ช่องผู้ดำเนินการ/หมายเหตุ (G, K) กว้างพอให้อ่านชื่อได้ */
table.form-table td.gk input[type=text] { min-width: 140px; }

/* ---------- ทำงานพร้อมกัน (IT Dev / IT Infra / Operation) ---------- */
.chips-wrap { display: flex; flex-wrap: wrap; gap: 4px; }
.flow { margin-bottom: 8px; }
.flow li.par .bar { opacity: .85; }
.flow li.par .head .num { box-shadow: 0 0 0 3px var(--d-bg); }
.flow-note { margin: 0 0 20px; font-size: 13px; color: var(--muted); }
.sec-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.card h2 .chip.sm { font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
