/* =====================================================================
   SA GAMES — UI tokens
   K-minimal: พื้นเย็นสว่าง เส้นบาง ไม่ใช้เงา สีคณะสีเป็นจุดเด่นจุดเดียว (ลู่วิ่งหน้า Login)
   ===================================================================== */
:root {
  --ink: #1F2A44;
  --muted: #66708A;
  --paper: #F4F6FA;
  --surface: #FFFFFF;
  --line: #E2E7F0;
  --brand: #4353C9;
  --brand-ink: #2E3BA0;
  --brand-soft: #ECEEFF;
  --ok-bg: #E3F5EC;   --ok: #1E6B48;
  --off-bg: #EEF0F4;  --off: #5B6478;
  --warn-bg: #FFF0DD; --warn: #8A4B0E;
  --bad-bg: #FCE7EA;  --bad: #A3263A;
  --radius-lg: 16px;
  --radius: 10px;
  --font-head: "Kanit", "Sarabun", system-ui, sans-serif;
  --font-body: "Sarabun", system-ui, -apple-system, "Segoe UI", sans-serif;

  --bs-body-font-family: var(--font-body);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-border-color: var(--line);
  --bs-primary: var(--brand);
  --bs-primary-rgb: 67, 83, 201;
  --bs-link-color: var(--brand-ink);
  --bs-link-color-rgb: 46, 59, 160;
  --bs-link-hover-color: var(--brand);
  --bs-border-radius: var(--radius);
}

body { font-size: 1rem; line-height: 1.65; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .brand-name { font-family: var(--font-head); color: var(--ink); letter-spacing: 0; }
code { color: var(--brand-ink); font-size: .85em; }
.muted { color: var(--muted); }
.small, small { font-size: .875rem; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 2000; background: var(--surface); padding: .5rem 1rem; border-radius: var(--radius); }
.skip-link:focus { left: 8px; }

/* ---------- Buttons & forms ---------- */
.btn { border-radius: var(--radius); font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-ink); --bs-btn-hover-border-color: var(--brand-ink); --bs-btn-active-bg: var(--brand-ink); --bs-btn-disabled-bg: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand-ink); --bs-btn-border-color: #C9CEF3; --bs-btn-hover-bg: var(--brand-soft); --bs-btn-hover-color: var(--brand-ink); --bs-btn-hover-border-color: #C9CEF3; --bs-btn-active-bg: var(--brand-soft); --bs-btn-active-color: var(--brand-ink); }
.btn-outline-secondary { --bs-btn-color: var(--ink); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: var(--paper); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--line); }
.btn-icon { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: var(--radius); border: 1px solid transparent; background: transparent; color: var(--ink); }
.btn-icon:hover { background: var(--paper); }
.form-control, .form-select { border-radius: var(--radius); border-color: var(--line); padding: .55rem .8rem; }
.form-control:focus, .form-select:focus { border-color: #AEB6EE; box-shadow: 0 0 0 .2rem var(--brand-soft); }
.form-text { color: var(--muted); }
.field { margin-bottom: 1rem; }
.field > label { display: block; font-weight: 500; margin-bottom: .3rem; }
.fieldset { border-top: 1px solid var(--line); margin-top: 1.25rem; padding-top: 1rem; }
.fieldset legend { font-family: var(--font-head); font-size: 1rem; font-weight: 500; margin-bottom: .75rem; }
.form-actions { display: flex; gap: .5rem; align-items: center; margin-top: 1.5rem; }
.form-narrow { max-width: 640px; }

/* ---------- Notices & pills ---------- */
.notice { border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid transparent; }
.notice-error { background: var(--bad-bg); color: var(--bad); }
.notice-info { background: var(--brand-soft); color: var(--brand-ink); }
.notice-key { background: var(--ok-bg); color: var(--ok); display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.key-box { display: flex; gap: .5rem; align-items: center; }
.key-box code { font-size: 1.15rem; background: var(--surface); color: var(--ink); padding: .3rem .7rem; border-radius: 8px; letter-spacing: .04em; }
.pill { display: inline-block; font-size: .78rem; font-weight: 500; padding: .1rem .6rem; border-radius: 999px; line-height: 1.6; white-space: nowrap; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-off { background: var(--off-bg); color: var(--off); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-me { background: var(--brand-soft); color: var(--brand-ink); margin-left: .35rem; }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .45rem; vertical-align: baseline; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 252px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
@media (min-width: 992px) { .sidebar { position: sticky; top: 0; height: 100vh; } }
.sidebar-brand { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 1.25rem .75rem; }
.brand-name { font-size: 1.3rem; font-weight: 600; text-decoration: none; }
.brand-name span { font-weight: 400; color: var(--muted); }
.house-strip { display: flex; height: 4px; margin: 0 1.25rem 1rem; border-radius: 4px; overflow: hidden; }
.house-strip span { flex: 1; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0 .75rem; }
.nav-heading { font-size: .8rem; color: var(--muted); margin: 1.1rem .75rem .35rem; }
.sidebar .nav-link { display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: var(--radius); color: var(--ink); text-decoration: none; border: 0; background: none; font: inherit; }
.sidebar .nav-link i { font-size: 1.1rem; color: var(--muted); }
.sidebar .nav-link:hover { background: var(--paper); }
.sidebar .nav-link.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 500; }
.sidebar .nav-link.active i { color: var(--brand-ink); }
.sidebar-foot { padding: .75rem; border-top: 1px solid var(--line); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: .75rem clamp(1rem, 3vw, 2rem); border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: .6rem; background: none; border: 0; padding: .25rem .4rem; border-radius: var(--radius); color: var(--ink); }
.user-chip:hover { background: var(--paper); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-family: var(--font-head); font-weight: 500; }
.user-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.25; }
.user-name { font-weight: 500; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: .8rem; color: var(--muted); }
@media (max-width: 575px) { .user-meta { display: none; } }
.content { padding: clamp(1rem, 3vw, 2rem); max-width: 1240px; width: 100%; }

.page-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { font-size: clamp(1.4rem, 2.5vw, 1.75rem); font-weight: 600; margin: 0; }
.page-sub { color: var(--muted); margin: .25rem 0 0; max-width: 70ch; }
.page-actions { display: flex; gap: .5rem; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; }
.panel-title { font-size: 1.05rem; font-weight: 500; margin-bottom: .9rem; }
.grid-2 { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: start; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1.25rem; }
.stat { background: var(--surface); padding: 1rem 1.25rem; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
a.stat:hover { background: var(--paper); }
.stat strong { font-family: var(--font-head); font-size: 1.8rem; font-weight: 500; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .9rem; }
.stat-warn strong { color: var(--warn); }

.link-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.link-list li + li { border-top: 1px solid var(--line); }
.link-list a { display: flex; gap: .6rem; padding: .6rem 0; text-decoration: none; color: var(--ink); }
.link-list a:hover { color: var(--brand-ink); }
.link-list i { color: var(--muted); }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { display: grid; grid-template-columns: auto 1fr; column-gap: .6rem; padding: .55rem 0; border-top: 1px solid var(--line); font-size: .92rem; }
.activity li:first-child { border-top: 0; }
.activity-who { font-weight: 500; }
.activity time { grid-column: 2; color: var(--muted); font-size: .8rem; }
.house-list { list-style: none; padding: 0; margin: 0; }
.house-list li { padding: .35rem 0; }
.meta-list { margin: 0 0 1rem; }
.meta-list div { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.meta-list div:first-child { border-top: 0; }
.meta-list dt { font-weight: 400; color: var(--muted); }
.meta-list dd { margin: 0; text-align: right; }

/* ---------- Tables ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filter-bar .form-select { width: auto; min-width: 150px; }
.filter-search { position: relative; flex: 1 1 260px; }
.filter-search i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filter-search .form-control { padding-left: 2.3rem; }
.data-table { --bs-table-bg: transparent; }
.data-table th { font-weight: 500; color: var(--muted); font-size: .88rem; border-bottom-color: var(--line); padding: .8rem 1rem; white-space: nowrap; }
.data-table td { padding: .75rem 1rem; border-color: var(--line); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.sort-link { color: inherit; text-decoration: none; }
.sort-link:hover { color: var(--brand-ink); }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 1rem; border-top: 1px solid var(--line); }
.pagination { --bs-pagination-color: var(--ink); --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); --bs-pagination-border-color: var(--line); }
.empty { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.dropdown-menu { border-color: var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(31, 42, 68, .08); }
.dropdown-menu form { margin: 0; }

/* ---------- Permission matrix ---------- */
.perm-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.perm-filter { max-width: 260px; margin-left: auto; }
.perm-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); align-items: start; }
.perm-module { padding: 1rem 1.25rem; margin: 0; }
.perm-module-head { display: flex; justify-content: space-between; align-items: center; width: 100%; font-family: var(--font-head); font-size: 1rem; font-weight: 500; padding-bottom: .6rem; margin-bottom: .4rem; border-bottom: 1px solid var(--line); }
.perm-module-head .form-check-input { margin-right: .5rem; }
.perm-item { display: flex; gap: .65rem; padding: .4rem 0; cursor: pointer; align-items: flex-start; }
.perm-item .form-check-input { margin-top: .3rem; flex-shrink: 0; }
.perm-name { display: block; }
.perm-code { font-size: .78rem; }
.perm-item[hidden] { display: none; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--paper) 35%); padding: 1.5rem 0 1rem; }

/* ---------- Auth pages: ลู่วิ่งคณะสี ---------- */
body.auth { background: var(--paper); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); }
.auth-single { grid-template-columns: 1fr; place-items: center; }
.track { background: #E9EDF5; display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 6vw, 5rem) 0 clamp(2rem, 6vw, 5rem) clamp(2rem, 6vw, 5rem); gap: 2.5rem; overflow: hidden; }
.track-title h1 { font-size: clamp(2.4rem, 5.2vw, 4.2rem); font-weight: 600; line-height: 1.05; margin: 0 0 .75rem; }
.track-title p { margin: 0; font-size: 1.1rem; color: var(--muted); }
.track-title .track-date { color: var(--ink); font-weight: 500; }
.lanes { list-style: none; margin: 0; padding: 0; border-top: 2px dashed rgba(255, 255, 255, .9); }
.lane { display: flex; align-items: center; gap: 1.25rem; height: clamp(52px, 8vh, 72px); padding-left: 1.25rem;
        background: var(--lane); background: color-mix(in srgb, var(--lane) 26%, #FFFFFF);
        border-left: 8px solid var(--lane); border-bottom: 2px dashed rgba(255, 255, 255, .9);
        animation: lane-in .7s cubic-bezier(.2, .7, .2, 1) both; animation-delay: var(--lane-delay); }
.lane-no { font-family: var(--font-head); font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 600; color: #FFFFFF; -webkit-text-stroke: 1.5px var(--lane); width: 2ch; text-align: center; }
.lane-name { font-family: var(--font-head); font-weight: 500; color: var(--ink); }
@keyframes lane-in { from { transform: translateX(-40px); opacity: 0; } to { transform: none; opacity: 1; } }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; background: var(--surface); }
.auth-single .auth-panel { background: transparent; }
.auth-form { width: 100%; max-width: 380px; }
.auth-single .auth-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 2rem; }
.auth-form h2 { font-size: 1.6rem; font-weight: 600; margin-bottom: .25rem; }
.auth-help { color: var(--muted); margin-bottom: 1.5rem; }
.auth-form .btn-lg { margin-top: .5rem; font-size: 1.05rem; padding: .7rem 1rem; }
.auth-foot { color: var(--muted); font-size: .88rem; margin: 1.25rem 0 .25rem; }
.auth-public { font-size: .92rem; }
.error-box { text-align: center; }
.error-code { font-family: var(--font-head); font-size: 3.5rem; font-weight: 600; color: var(--brand); line-height: 1; margin-bottom: .5rem; }

@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .track { padding: 1.5rem 0 0 1.5rem; gap: 1rem; }
  .track-title h1 { font-size: 2rem; }
  .track-title p { font-size: .95rem; }
  .lane { height: 10px; padding: 0; border-left-width: 0; background: var(--lane); }
  .lane-no, .lane-name { display: none; }
  .auth-panel { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .lane { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* SweetAlert ให้ใช้ฟอนต์ไทยเดียวกัน */
.swal2-popup { font-family: var(--font-body) !important; border-radius: var(--radius-lg) !important; }
.swal2-title { font-family: var(--font-head) !important; font-weight: 500 !important; }
.sidebar { background: var(--surface) !important; }
.form-check-input:checked, .form-check-input:indeterminate { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem var(--brand-soft); border-color: #AEB6EE; }

/* ---------- Phase 03: คณะสี / นักเรียน / นำเข้า ---------- */
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.stat-bad strong { color: var(--bad); }
.house-badge { display: inline-block; background: var(--house); color: var(--house-ink); border-radius: 999px; padding: .05rem .7rem; font-size: .85rem; font-weight: 500; white-space: nowrap; }
.house-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.house-card { background: var(--surface); border: 1px solid var(--line); border-top: 6px solid var(--house); border-radius: var(--radius-lg); padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.house-card.is-off { opacity: .7; }
.house-card-head { display: flex; align-items: center; gap: .85rem; }
.house-card-head h2 { font-size: 1.15rem; font-weight: 500; margin: 0; }
.house-card-head p { margin: 0; font-size: .85rem; color: var(--muted); }
.house-logo { width: 56px; height: 56px; border-radius: 14px; object-fit: contain; background: var(--paper); flex-shrink: 0; }
.house-logo-empty { display: grid; place-items: center; background: var(--house); color: var(--house-ink); font-family: var(--font-head); font-size: .95rem; font-weight: 500; }
.house-stats { display: flex; gap: 1.5rem; margin: 0; }
.house-stats dt { font-weight: 400; color: var(--muted); font-size: .82rem; }
.house-stats dd { margin: 0; font-family: var(--font-head); font-size: 1.35rem; }
.house-teachers { margin: 0; font-size: .92rem; }
.house-card-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: auto; }
.house-card-actions form { margin: 0; }
.col-check { width: 2.5rem; }
.bulk-bar { position: sticky; top: .5rem; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; background: var(--brand-soft); color: var(--brand-ink); border-radius: var(--radius); padding: .5rem .75rem; margin-bottom: .75rem; }
.bulk-bar .form-select { width: auto; min-width: 180px; }
.bulk-bar[hidden] { display: none; }
.student-card { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-left: 8px solid var(--house); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.student-photo { width: 112px; height: 136px; border-radius: 14px; object-fit: cover; background: var(--paper); flex-shrink: 0; }
.student-photo-empty { display: grid; place-items: center; font-family: var(--font-head); font-size: 2.5rem; color: var(--muted); }
.student-photo-sm { width: 56px; height: 68px; border-radius: 10px; object-fit: cover; }
.student-card-body { flex: 1; min-width: 240px; }
.student-card-body h2 { font-size: 1.5rem; font-weight: 600; margin: 0; }
.student-facts { display: flex; flex-wrap: wrap; gap: .5rem 2rem; margin: 0; }
.student-facts dt { font-weight: 400; font-size: .82rem; color: var(--muted); }
.student-facts dd { margin: 0; font-weight: 500; }
.medal-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.25rem; }
.medal { display: flex; align-items: center; gap: .65rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .55rem .9rem; }
.medal-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--medal); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12); }
.medal strong { display: block; font-weight: 500; }
.medal span { font-size: .85rem; color: var(--muted); }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.plain-list li:first-child { border-top: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .75rem; }
.tab { padding: .4rem .85rem; border-radius: 999px; color: var(--ink); text-decoration: none; font-size: .92rem; }
.tab:hover { background: var(--surface); }
.tab.active { background: var(--ink); color: #FFFFFF; }
.tab-count { opacity: .7; margin-left: .2rem; }
.row-error td { background: #FFF7F8; }
.import-table td { vertical-align: top; }
.confirm-box { max-width: 720px; }

/* ---------- Phase 04: รายการแข่งขัน / กติกา / เกณฑ์คะแนน ---------- */
.label-text { display: block; font-weight: 500; margin-bottom: .3rem; }
legend.label-text { font-size: 1rem; float: none; }
.chip-checks { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip-check { position: relative; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; inset: 0; }
.chip-check span { display: inline-block; padding: .35rem .9rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.chip-check input:checked + span { background: var(--brand-soft); border-color: #AEB6EE; color: var(--brand-ink); font-weight: 500; }
.chip-check input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }
.chip-check input:disabled + span { opacity: .6; cursor: not-allowed; }
.event-status { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.event-status-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-left: auto; }
.event-status-actions form { margin: 0; }
.rule-list dd { max-width: 60%; }
.capacity-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.capacity { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .9rem; }
.capacity-head { font-weight: 500; margin-bottom: .4rem; }
.capacity-bar { height: 8px; border-radius: 999px; background: var(--paper); overflow: hidden; }
.capacity-bar span { display: block; height: 100%; background: var(--house); border-radius: 999px; }
.capacity-nums { display: flex; justify-content: space-between; gap: .5rem; margin-top: .4rem; font-size: .85rem; color: var(--muted); }
.capacity-nums strong { color: var(--ink); font-weight: 500; }
.qual-options { display: grid; gap: .5rem; }
.qual-option { display: flex; gap: .6rem; align-items: flex-start; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.qual-option:has(input:checked) { border-color: #AEB6EE; background: var(--brand-soft); }
.qual-option .form-check-input { margin-top: .3rem; flex-shrink: 0; }
[data-qual-field][hidden] { display: none !important; }
.score-table { max-width: 520px; }
.rank-cell { width: 4rem; font-weight: 500; }
.rules-form fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }

/* ---------- Phase 05: การสมัครแข่งขัน ---------- */
.reg-list { display: grid; gap: 1rem; }
.reg-card { display: flex; gap: 1.25rem; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--house); border-radius: var(--radius-lg); padding: 1.1rem 1.25rem; }
.reg-card.is-off { opacity: .72; border-left-color: var(--line); }
.reg-main { flex: 1; min-width: 0; }
.reg-main h2 { font-size: 1.15rem; font-weight: 500; margin: 0 0 .15rem; }
.reg-code { font-family: var(--font-head); font-weight: 500; letter-spacing: .03em; color: var(--brand-ink); margin: 0 0 .2rem; }
.reg-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .75rem; }
.reg-qr { width: 112px; height: 112px; flex-shrink: 0; }
.reg-qr svg { width: 100%; height: 100%; display: block; }
.withdraw-box { margin-top: .75rem; max-width: 460px; }
@media (max-width: 575px) { .reg-card { flex-direction: column; } .reg-qr { width: 96px; height: 96px; } }
.event-pick { display: grid; gap: .75rem; }
.pick-card { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1rem 1.25rem; }
.pick-card h2 { font-size: 1.1rem; font-weight: 500; margin: 0 0 .1rem; }
.pick-card.is-off { background: var(--paper); }
.reasons { margin: 0; padding-left: 1.1rem; color: var(--bad); font-size: .9rem; }
.verify-card { max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-top: 6px solid var(--house); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; }
.verify-flag { font-family: var(--font-head); font-size: 1.15rem; color: var(--ok); margin-bottom: .25rem; }
.verify-card.is-off .verify-flag { color: var(--bad); }

/* หลักฐานการสมัคร (พิมพ์ A4: 2 ใบต่อหน้า) */
body.print-page { background: #FFFFFF; padding: 1.5rem; }
.print-toolbar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.slip { max-width: 760px; border: 1.5px solid #1F2A44; border-radius: 12px; padding: 1.1rem 1.4rem; margin: 0 auto 1.25rem; page-break-inside: avoid; break-inside: avoid; }
.slip-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; border-bottom: 1px dashed #9AA3B8; padding-bottom: .6rem; margin-bottom: .8rem; }
.slip-title { font-family: var(--font-head); font-size: 1.3rem; font-weight: 600; margin: 0; }
.slip-sub { margin: 0; color: var(--muted); }
.slip-house { background: var(--house); color: var(--house-ink); border-radius: 999px; padding: .2rem .9rem; font-weight: 500; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.slip-body { display: flex; gap: 1.5rem; justify-content: space-between; }
.slip-facts { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; }
.slip-facts div { display: contents; }
.slip-facts dt { font-weight: 400; color: var(--muted); }
.slip-facts dd { margin: 0; font-weight: 500; }
.slip-code { font-family: var(--font-head); font-size: 1.2rem; letter-spacing: .04em; }
.slip-qr { text-align: center; font-size: .8rem; color: var(--muted); }
.slip-qr .reg-qr { width: 132px; height: 132px; }
.slip-qr p { margin: .2rem 0 0; }
.slip-foot { margin-top: .7rem; font-size: .8rem; color: var(--muted); }
@media print {
  .no-print { display: none !important; }
  body.print-page { padding: 0; }
  .slip { margin-bottom: 8mm; }
}

/* ---------- Phase 06: ตรวจสอบนักกีฬา ---------- */
.decisions { display: grid; gap: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.decision { margin: 0; }

/* ---------- Phase 07: โปรแกรม / สาย / ลู่ ---------- */
.notice-warn { background: var(--warn-bg); color: var(--warn); }
.schedule-links { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin: -.75rem 0 1rem; font-size: .92rem; }
.schedule-links a { text-decoration: none; display: inline-flex; gap: .35rem; align-items: center; }
.day-head { font-size: 1.05rem; font-weight: 500; margin: 0; padding: .9rem 1rem .4rem; }
.time-cell { font-family: var(--font-head); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.is-cancelled td { color: var(--muted); text-decoration: line-through; }
tr.is-cancelled td .pill { text-decoration: none; }
a.pill { text-decoration: none; }
.stat-row-sm .stat { padding: .6rem .9rem; }
.stat-row-sm .stat strong { font-size: 1.4rem; }
.conflict-list { list-style: none; padding: 0; margin: 0; }
.conflict-list > li { padding: .65rem 0; border-top: 1px solid var(--line); }
.conflict-list > li:first-child { border-top: 0; }
.conflict-athletes td { padding: .3rem .5rem; border-color: var(--line); }
.generate-box { border-style: dashed; }
.heat-list { display: grid; gap: 1rem; }
.heat { overflow: hidden; }
.heat-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: var(--paper); }
.heat-head h3 { font-size: 1.05rem; font-weight: 500; margin: 0 .75rem 0 0; display: inline; }
.heat-tools { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.heat-tools form { margin: 0; }
.heat-edit { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.heat-edit:not(.show) { display: none; }
.heat-edit .form-control { width: auto; max-width: 140px; }
.lane-table td, .lane-table th { padding: .5rem .85rem; }
.lane-no-col { width: 3.5rem; text-align: center; font-family: var(--font-head); font-weight: 600; font-size: 1.1rem; }
.lane-empty td { background: repeating-linear-gradient(-45deg, transparent 0 6px, var(--paper) 6px 12px); padding-top: .35rem; padding-bottom: .35rem; }
tr.has-clash td { background: #FFFAF2; }
.clash { color: var(--warn); font-size: .85rem; margin-top: .2rem; }
.lane-actions { display: flex; gap: .25rem; justify-content: flex-end; align-items: center; }
.lane-actions form { margin: 0; }
.move-form { display: flex; gap: .35rem; align-items: center; margin: 0; }
.move-form .form-select { width: auto; max-width: 260px; }
@media (max-width: 767px) { .lane-actions { flex-wrap: wrap; } .move-form .form-select { max-width: 180px; } }

/* เอกสารพิมพ์: ตาราง / รายชื่อสาย / ใบบันทึกลู่ (A4) */
.sheet { max-width: 900px; margin: 0 auto 1.5rem; }
.sheet-head { text-align: center; margin-bottom: 1rem; }
.sheet-title { font-family: var(--font-head); font-weight: 600; margin: 0; }
.sheet-sub { margin: 0; color: var(--muted); }
.sheet-h1 { font-size: 1.45rem; font-weight: 600; margin: .4rem 0 .1rem; text-align: center; }
.sheet-day { font-size: 1.1rem; font-weight: 500; margin: 1rem 0 .4rem; border-bottom: 2px solid var(--ink); padding-bottom: .2rem; }
.sheet-foot { font-size: .8rem; color: var(--muted); margin-top: 1rem; }
.print-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.print-table th, .print-table td { border: 1px solid #9AA3B8; padding: .3rem .5rem; vertical-align: middle; }
.print-table th { background: #EEF0F4; font-weight: 500; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-table caption { caption-side: top; color: var(--ink); font-family: var(--font-head); font-weight: 500; padding: .2rem 0; }
.print-table .house-badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; font-size: .8rem; }
.print-muted { color: var(--muted); font-size: .85em; }
.w-time { width: 7.5rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.w-num { width: 3.2rem; text-align: center; }
.w-result { width: 6.5rem; }
.w-attempt { width: 4.5rem; }
.start-list { margin-bottom: 1.25rem; break-inside: avoid-page; }
.start-title { font-size: 1.1rem; font-weight: 600; margin: 0; }
.heat-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); margin-top: .4rem; }
.heat-table { break-inside: avoid; }
.lane-sheet { page-break-after: always; break-after: page; }
.lane-sheet:last-of-type { page-break-after: auto; break-after: auto; }
.lane-sheet-head { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 2px solid var(--ink); padding-bottom: .5rem; margin-bottom: .75rem; }
.lane-sheet-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0 .75rem; margin: 0; font-size: .92rem; }
.lane-sheet-facts div { display: contents; }
.lane-sheet-facts dt { font-weight: 400; color: var(--muted); }
.lane-sheet-facts dd { margin: 0; font-weight: 500; }
.lane-sheet-facts .big { font-family: var(--font-head); font-size: 1.3rem; line-height: 1.2; }
.lane-sheet-table td { height: 2.6rem; }
.lane-big { font-family: var(--font-head); font-size: 1.25rem; font-weight: 600; }
.lane-sheet-table tr.is-empty td { color: var(--muted); }
.signatures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 2.5rem; text-align: center; font-size: .9rem; }
.signatures span { display: block; border-bottom: 1px dotted var(--ink); height: 2rem; margin-bottom: .3rem; }
@media print {
  @page { size: A4; margin: 12mm; }
  .sheet { max-width: none; margin: 0; }
}

/* ---------- Phase 08: รายงานตัวนักกีฬา ---------- */
.ci-search { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.ci-search-box { position: relative; flex: 1 1 320px; }
.ci-search-box i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.15rem; }
.ci-search-box .form-control { padding-left: 2.75rem; }
.ci-flash { display: grid; gap: .5rem; margin-bottom: 1rem; }
.ci-flash-msg { border-radius: var(--radius); padding: .85rem 1.1rem; font-family: var(--font-head); font-size: 1.15rem; font-weight: 500; }
.ci-flash-msg.is-success { background: var(--ok-bg); color: var(--ok); }
.ci-flash-msg.is-info { background: var(--brand-soft); color: var(--brand-ink); }
.ci-flash-msg.is-warning { background: var(--warn-bg); color: var(--warn); }
.ci-flash-msg.is-error { background: var(--bad-bg); color: var(--bad); }
.ci-toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.ci-toolbar .form-select { min-width: 200px; }
.ci-tiles { display: grid; gap: 1px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1.25rem; }
.ci-tile { background: var(--surface); padding: 1rem 1.25rem; display: flex; flex-direction: column; border-top: 4px solid var(--line); }
.ci-tile strong { font-family: var(--font-head); font-size: 2rem; font-weight: 500; line-height: 1.15; font-variant-numeric: tabular-nums; }
.ci-tile span { color: var(--muted); font-size: .92rem; }
.ci-tile small { color: var(--muted); font-size: .8rem; }
.ci-ok { border-top-color: #2F9E6B; } .ci-ok strong { color: var(--ok); }
.ci-warn { border-top-color: #E39B3B; } .ci-warn strong { color: var(--warn); }
.ci-bad { border-top-color: #D24B5E; } .ci-bad strong { color: var(--bad); }
.ci-off { border-top-color: #9AA3B8; }
.ci-progress-col { min-width: 160px; }
.ci-progress { height: 8px; border-radius: 999px; background: var(--paper); overflow: hidden; margin-bottom: .2rem; }
.ci-progress span { display: block; height: 100%; background: #2F9E6B; border-radius: 999px; }
.ci-results { display: grid; gap: 1rem; }
.ci-card { background: var(--surface); border: 1px solid var(--line); border-left: 8px solid var(--house); border-radius: var(--radius-lg); overflow: hidden; }
.ci-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; }
.ci-card-head h2 { font-size: 1.35rem; font-weight: 600; margin: 0 0 .25rem; }
.ci-note { margin: 0; padding: .6rem 1.25rem; background: var(--warn-bg); color: var(--warn); font-size: .92rem; }
.ci-entry { border-top: 1px solid var(--line); padding: .9rem 1.25rem 1rem; }
.ci-entry.is-focus { background: #F3FBF7; box-shadow: inset 4px 0 0 #2F9E6B; }
.ci-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem 1rem; margin: 0 0 .75rem; }
.ci-facts dt { font-weight: 400; color: var(--muted); font-size: .8rem; }
.ci-facts dd { margin: 0; }
.ci-facts div:first-child { grid-column: span 2; }
.ci-big { font-family: var(--font-head); font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.ci-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; justify-content: flex-end; }
.ci-entry .ci-actions { justify-content: flex-start; }
.ci-actions form { margin: 0; }
.ci-withdraw { display: flex; gap: .4rem; margin-top: .5rem; justify-content: flex-end; }
.ci-withdraw:not(.show) { display: none; }
.ci-withdraw .form-control { max-width: 260px; }
.ci-roster td { padding-top: .55rem; padding-bottom: .55rem; }
.scan-frame { position: relative; aspect-ratio: 4 / 3; background: #10162A; border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; }
.scan-frame video { width: 100%; height: 100%; object-fit: cover; }
.scan-overlay { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 18px; pointer-events: none; }
.scan-idle { position: absolute; color: #C9CFDF; text-align: center; margin: 0; }
.scan-idle i { font-size: 2.2rem; }
@media (max-width: 575px) { .ci-facts div:first-child { grid-column: 1 / -1; } .ci-search .btn { flex: 1; } }
.scan-idle { padding: 0 1rem; font-size: .9rem; }
@media (max-width: 575px) {
  .ci-roster thead { display: none; }
  .ci-roster, .ci-roster tbody { display: block; }
  .ci-roster tr { display: grid; grid-template-columns: 3rem 1fr auto; gap: .25rem .5rem; align-items: center; padding: .65rem .75rem; border-bottom: 1px solid var(--line); }
  .ci-roster tr[hidden] { display: none; }
  .ci-roster td { display: block; padding: 0 !important; border: 0; }
  .ci-roster td:nth-child(1) { grid-row: span 2; }
  .ci-roster td:nth-child(3) { grid-column: 3; grid-row: 1; }
  .ci-roster td:nth-child(4) { grid-column: 2 / 4; }
  .ci-roster td:nth-child(5) { grid-column: 1 / -1; text-align: left !important; }
  .ci-roster td:nth-child(5) .ci-actions { justify-content: flex-start; }
  .ci-roster .ci-withdraw { justify-content: flex-start; }
}
@media (max-width: 575px) { .ci-progress-col { min-width: 90px; } }

/* ---------- Phase 09: บันทึกผล ---------- */
.judge-list { display: grid; gap: .75rem; }
.judge-card { display: flex; gap: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1rem 1.25rem; }
.judge-card-time { display: flex; flex-direction: column; min-width: 4.5rem; }
.judge-card-time strong { font-family: var(--font-head); font-size: 1.35rem; font-weight: 500; line-height: 1.2; }
.judge-card-time span { color: var(--muted); font-size: .8rem; }
.judge-card-body { flex: 1; min-width: 0; }
.judge-card-body h2 { font-size: 1.1rem; font-weight: 500; margin: 0 0 .15rem; }
.heat-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.heat-chip { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .75rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); background: var(--paper); }
.heat-chip:hover { border-color: #AEB6EE; background: var(--brand-soft); }
.heat-chip .pill { margin: 0; }
.heat-nav { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; margin-bottom: 1rem; }
.result-table td { padding: .5rem .6rem; }
.result-table .result-input { max-width: 140px; font-family: var(--font-head); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.att-col { width: 5.5rem; }
.att-input { max-width: 5.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.result-table .form-select-sm { min-width: 140px; }
.best { font-family: var(--font-head); font-size: 1.15rem; }
.rank-cell { font-family: var(--font-head); font-size: 1.2rem; font-weight: 600; }
.result-actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; align-items: center; padding: .9rem 1rem; border-top: 1px solid var(--line); }
.wf-steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1rem; }
.wf-step { background: var(--surface); padding: .75rem 1rem; display: flex; flex-direction: column; }
.wf-step strong { font-family: var(--font-head); font-size: 1.5rem; font-weight: 500; color: var(--muted); }
.wf-step.is-on strong { color: var(--brand-ink); }
.wf-step span { font-size: .85rem; color: var(--muted); }
.wf-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.wf-form { display: flex; gap: .4rem; margin: 0; }
.wf-form .form-control { min-width: 240px; }
@media (max-width: 575px) { .wf-steps { grid-template-columns: repeat(3, 1fr); } .judge-card { flex-direction: column; gap: .25rem; } .wf-form { flex-wrap: wrap; } }
.att-input { min-width: 4.4rem; padding: .3rem .25rem; }
details[data-history] summary { cursor: pointer; }

/* ---------- Phase 10: คะแนนคณะสี ---------- */
.house-board { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); margin-bottom: 1.25rem; }
.house-rank { position: relative; background: var(--surface); border: 1px solid var(--line); border-top: 8px solid var(--house); border-radius: var(--radius-lg); padding: 1rem 1.25rem; display: grid; gap: .35rem; }
.house-rank.is-leader { box-shadow: inset 0 0 0 2px var(--house); }
.house-rank-no { position: absolute; top: .6rem; right: 1rem; font-family: var(--font-head); font-size: 2rem; font-weight: 600; color: var(--muted); line-height: 1; text-align: right; }
.house-rank-no small { display: block; font-size: .7rem; font-weight: 400; }
.house-rank.is-leader .house-rank-no { color: var(--ink); }
.house-rank-name { font-family: var(--font-head); font-size: 1.15rem; font-weight: 500; }
.house-rank-score strong { font-family: var(--font-head); font-size: 2.4rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.house-rank-score span { color: var(--muted); margin-left: .35rem; }
.house-rank-medals { display: flex; gap: .9rem; }
.medal-count { display: inline-flex; align-items: center; gap: .3rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.medal-dot { display: inline-block; width: .85rem; height: .85rem; border-radius: 50%; background: var(--medal); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15); margin-right: .3rem; vertical-align: -1px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.medalist-block + .medalist-block { border-top: 1px solid var(--line); margin-top: .6rem; padding-top: .6rem; }
.medalist-list { list-style: none; padding: 0; margin: .3rem 0 0; display: grid; gap: .25rem; }
.medalist-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
@media (max-width: 575px) { .house-board { grid-template-columns: 1fr 1fr; gap: .5rem; } .house-rank { padding: .75rem .85rem; } .house-rank-score strong { font-size: 1.9rem; } .house-rank-no { font-size: 1.5rem; right: .7rem; } .house-rank-medals { gap: .5rem; } }

/* ---------- Phase 12 เกียรติบัตร ---------- */
.stat.is-active { box-shadow: inset 0 -3px 0 var(--brand); }
.cert-revoke summary { list-style: none; display: inline-block; }
.cert-revoke summary::-webkit-details-marker { display: none; }
.cert-revoke[open] .cert-revoke-form { display: flex; }
.cert-revoke-form { display: none; gap: .35rem; align-items: center; margin-top: .35rem; min-width: 18rem; }
.cert-progress { height: 14px; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); overflow: hidden; }
.cert-progress > span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .3s ease; }
.cert-vars { display: flex; flex-wrap: wrap; gap: .3rem; }
.cert-vars button { font-family: ui-monospace, monospace; font-size: .78rem; }
.cert-el { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .75rem; margin-bottom: .5rem; background: var(--surface); }
.cert-el-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); gap: .4rem; margin-top: .4rem; }
.cert-el-grid label { font-size: .75rem; color: var(--muted); display: block; }
.cert-candidates { max-height: 26rem; overflow: auto; }
.cert-candidates tr.is-exists { color: var(--muted); }
.cert-card { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; align-items: center; padding: .9rem 1rem; border-top: 1px solid var(--line); }
.cert-card:first-child { border-top: 0; }
@media (prefers-reduced-motion: reduce) { .cert-progress > span { transition: none; } }

/* Phase 16: โลโก้โรงเรียนหน้าเข้าสู่ระบบ */
.track-logo { width: clamp(84px, 9vw, 128px); height: auto; aspect-ratio: 1; border-radius: 50%; background: #fff; padding: 6px; object-fit: contain;
  box-shadow: 0 6px 22px rgba(31, 42, 68, .18); margin-bottom: 1rem; }

/* Phase 18: ติดตามการแข่งขัน — สถานะของแต่ละจุด */
.notice-warn { background: var(--warn-bg); color: var(--warn); }
.flow-chip { display: inline-block; font-size: .82rem; padding: .15rem .6rem; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.flow-wait { background: var(--off-bg); color: var(--off); }
.flow-active { background: var(--warn-bg); color: var(--warn); border-color: #F1C68E; }
.flow-done { background: var(--ok-bg); color: var(--ok); }
.flow-alert { background: var(--bad-bg); color: var(--bad); border-color: #EFB3BD; }
.flow-table th[scope="row"] a { font-family: var(--font-head); font-weight: 500; text-decoration: none; }
.flow-steps { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; padding: 0; margin: 0 0 1rem; }
.flow-step { border-radius: var(--radius); padding: .6rem .8rem; display: flex; flex-direction: column; border: 1px solid transparent; min-width: 0; }
.flow-step-name { font-family: var(--font-head); font-weight: 500; }
.flow-step-text { font-size: .85rem; overflow-wrap: anywhere; }
.flow-stations { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.flow-station { margin: 0; }
.row-removed td { background: color-mix(in srgb, var(--bad-bg) 55%, transparent); }
@media (max-width: 767.98px) { .flow-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Phase 19: ลายเซ็นสด */
.sig-pad { border: 1px dashed #AEB6EE; border-radius: var(--radius); background: var(--surface); padding: .5rem; margin-bottom: .5rem; max-width: 560px; }
.sig-pad.is-invalid { border-color: var(--bad); }
.sig-pad.is-invalid .invalid-feedback { display: block; }
.sig-canvas { display: block; width: 100%; height: 160px; touch-action: none; cursor: crosshair; background: repeating-linear-gradient(transparent 0 129px, var(--line) 129px 130px); border-radius: calc(var(--radius) - 4px); }
.sig-pad-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .25rem; }
.flow-signed { display: flex; align-items: center; gap: .35rem; margin-top: .3rem; font-size: .78rem; }
.flow-signed img { height: 26px; max-width: 80px; object-fit: contain; background: #fff; border-radius: 4px; }
.flow-certs li { padding: .1rem 0; }
.sig-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .75rem; margin-top: 1.25rem; text-align: center; }
.sig-img { height: 56px; display: flex; align-items: flex-end; justify-content: center; }
.sig-img img { max-height: 56px; max-width: 100%; }
.sig-line { border-top: 1px dotted #9AA3B8; padding-top: .2rem; font-size: .85rem; }
@media (max-width: 767.98px) { .sig-grid { grid-template-columns: repeat(2, 1fr); } }
.wf-form.wf-sign { flex-direction: column; align-items: flex-start; flex-basis: 100%; }
.cert-el-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.entry-search { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; padding: .75rem 1rem; border-top: 1px solid var(--line); }
