/* ระบบจัดทำ มคอ.3 มหาวิทยาลัยสยาม — สไตล์หลัก
 *
 * สเกลตัวอักษรตั้งไว้สำหรับภาษาไทยโดยเฉพาะ
 * ฐาน 18px และระยะบรรทัด 1.85 เพราะสระบนล่างของไทยซ้อนกันสองชั้น
 * ถ้าใช้ค่าปกติของภาษาอังกฤษ (15-16px / 1.5) บรรทัดจะเกยกันเวลาอ่านเร็ว
 */

/* คลาสที่ตั้ง display เอง (เช่น .pick-row, .card) จะทับ [hidden] ของเบราว์เซอร์
   ต้องบังคับไว้ตรงนี้ ไม่งั้นการซ่อนแถวด้วย element.hidden จะไม่มีผล */
[hidden] { display: none !important; }

:root {
  /* ── สี: AI SIAM — เหลืองแบรนด์ #DFCC63 กับดำ (ตามโลโก้ศูนย์ฯ) ชุดเดียวกับ public/assets/css/shell.css ──
     --yellow       เหลืองแบรนด์ ใช้เป็น "พื้น" (แถบบน หน้าเข้าสู่ระบบ ป้ายเน้น) ห้ามใช้เป็นตัวหนังสือบนพื้นขาว
     --brand        พื้นของปุ่มหลัก — โหมดสว่างเป็นดำ โหมดมืดเป็นเหลือง ตัวหนังสือบนพื้นนี้ใช้ --on-brand เสมอ
     --brand-ink    ตัวหนังสือ/ลิงก์สีแบรนด์บนพื้นการ์ด (โหมดสว่างเป็นทองเข้ม เพราะเหลืองบนขาวอ่านไม่ออก)
     --brand-light  พื้นอ่อนของสีแบรนด์ (เมนูที่เลือก) ตัวหนังสือบนพื้นนี้ใช้ --brand-dark
     --bar-*        แถบบน: โหมดสว่างพื้นเหลืองตัวดำ โหมดมืดพื้นดำโลโก้เหลือง
     โหมดมืด: html[data-theme="dark"] ข้างล่าง (ปุ่มสลับที่แถบบน เก็บใน localStorage 'siam-theme') */
  --yellow: #dfcc63;
  --yellow-deep: #cdb44f;
  --yellow-soft: #f0d36b;
  --black: #141414;
  --brand: #161616;
  --brand-hover: #3b3a36;
  --brand-dark: #3d3205;
  --brand-light: #f7efc8;
  --brand-ink: #6f5b0b;
  --on-brand: #fff;
  --gold: #dfcc63;
  --gold-bg: #f7efc8;
  --gold-ink: #5c4a06;
  --accent: #dfcc63;
  --bar-bg: var(--yellow);
  --bar-ink: #141414;
  --bar-logo: #141414;
  --bar-soft: rgba(20, 20, 20, .07);
  --bar-soft-2: rgba(20, 20, 20, .13);
  --bar-line: rgba(20, 20, 20, .22);
  --bar-chip: #141414;
  --bar-chip-ink: var(--yellow);
  --bar-edge: rgba(20, 20, 20, .12);
  --ok: #1a7f47;
  --ok-bg: #e6f4ec;
  --ok-ink: #145c34;
  --ok-line: #b9dfc8;
  --warn: #b45309;
  --warn-bg: #fef4e6;
  --warn-ink: #8f4207;
  --warn-line: #f3d3a8;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --danger-ink: #8d1d17;
  --danger-line: #f3c6c2;
  --info: #0b6b9c;
  --info-bg: #e6f3fa;
  --info-ink: #08557c;
  --info-line: #bfe0f0;
  --ink: #1c1b17;
  --ink-2: #3a3832;
  --muted: #5d5a50;
  --line: #e5e2d6;
  --line-strong: #ccc8b8;
  --bg: #f6f5ef;
  --card: #fff;
  --surface-2: #fbfaf5;
  --surface-3: #efede4;
  --focus: rgba(140, 115, 15, .55);
  --focus-soft: rgba(223, 204, 99, .4);
  color-scheme: light;

  /* ── สเกลตัวอักษร (ฐาน 18px) ── */
  --fs-xs: 14px;    /* ป้ายกำกับเล็ก */
  --fs-sm: 16px;    /* คำอธิบาย ข้อความรอง */
  --fs-base: 18px;  /* เนื้อหาหลัก */
  --fs-md: 17px;    /* ตาราง */
  --fs-lg: 21px;    /* หัวข้อรอง */
  --fs-xl: 26px;    /* หัวข้อหน้า */
  --lh: 1.85;

  --radius: 10px;
  --shadow: 0 1px 3px rgba(23, 22, 22, .08), 0 4px 14px rgba(23, 22, 22, .05);
}

/* ── โหมดมืด — กลับด้านโลโก้: พื้นดำ เหลืองเป็นปุ่ม/ตัวเน้น (ตัวหนังสือบนปุ่มเหลืองเป็นดำ) ── */
html[data-theme="dark"] {
  --brand: #dfcc63;
  --brand-hover: #ead97c;
  --brand-dark: #f0e3a6;
  --brand-light: rgba(223, 204, 99, .14);
  --brand-ink: #e5d27a;
  --on-brand: #141414;
  --gold-bg: rgba(223, 204, 99, .16);
  --gold-ink: #ecd97f;
  --bar-bg: #121210;
  --bar-ink: #eeece3;
  --bar-logo: var(--yellow);
  --bar-soft: rgba(255, 255, 255, .07);
  --bar-soft-2: rgba(255, 255, 255, .13);
  --bar-line: rgba(255, 255, 255, .2);
  --bar-chip: var(--yellow);
  --bar-chip-ink: #141414;
  --bar-edge: rgba(223, 204, 99, .45);
  --ok-bg: rgba(22, 163, 74, .16);
  --ok-ink: #8fd9ad;
  --ok-line: rgba(63, 174, 108, .45);
  --warn-bg: rgba(217, 119, 6, .16);
  --warn-ink: #f5c27a;
  --warn-line: rgba(224, 138, 46, .45);
  --danger-bg: rgba(220, 38, 38, .16);
  --danger-ink: #f4a6a0;
  --danger-line: rgba(229, 83, 75, .45);
  --info-bg: rgba(37, 99, 235, .16);
  --info-ink: #9fd0ef;
  --info-line: rgba(74, 163, 216, .45);
  --ink: #eeece3;
  --ink-2: #d5d2c6;
  --muted: #a8a496;
  --line: #33322c;
  --line-strong: #4a4840;
  --bg: #0e0e0c;
  --card: #191916;
  --surface-2: #1f1f1b;
  --surface-3: #292824;
  --focus: rgba(223, 204, 99, .6);
  --focus-soft: rgba(223, 204, 99, .2);
  --shadow: 0 1px 3px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* ── สีประจำโมดูล ──
   ทุกระบบใช้ชุดสี AI SIAM เดียวกัน (เปลี่ยนจากแดงเลือดหมูเมื่อ 1 พ.ย. 2569) สีของแต่ละโมดูลใน modules.php
   ใช้เฉพาะขอบการ์ดบนหน้ากลาง — อย่า override --brand ตาม body[data-module] อีก */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "IBM Plex Sans Thai", "IBM Plex Sans", "Sarabun", "Noto Sans Thai", "Sukhumvit Set", "Leelawadee UI", "Tahoma", -apple-system, sans-serif;
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------------------------------------------------------- แถบบน */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  height: 66px; padding: 0 20px;
  background: var(--bar-bg); color: var(--bar-ink);
  border-bottom: 1px solid var(--bar-edge);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.topbar :focus-visible { outline-color: var(--bar-ink); }
/* แบรนด์: ΛI (partials/brand_logo) | ชื่อศูนย์ + มหาวิทยาลัย สองบรรทัด */
.brand { display: flex; align-items: center; gap: 12px; color: var(--bar-ink); }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; height: 26px; width: auto; color: var(--bar-logo); flex: 0 0 auto; }
.brand-words { display: flex; flex-direction: column; line-height: 1.2; padding-left: 12px; border-left: 1.5px solid var(--bar-line); }
.brand-mark { font-weight: 700; font-size: 16.5px; letter-spacing: .2px; }
.brand-text { font-size: 13px; opacity: .78; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.who { text-align: right; line-height: 1.35; }
.who strong { display: block; font-size: 15.5px; font-weight: 600; }
.who small { font-size: 13.5px; opacity: .78; }
.bell { position: relative; color: var(--bar-ink); font-size: 21px; }
.badge-dot {
  position: absolute; top: -5px; right: -10px;
  background: var(--bar-chip); color: var(--bar-chip-ink);
  font-size: 12px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
}
.menu-toggle {
  display: none; background: none; border: 0; color: var(--bar-ink);
  font-size: 24px; cursor: pointer; padding: 4px 8px;
}

/* ---------------------------------------------------------- ตัวสลับระบบงาน
   ซ่อนอัตโนมัติถ้าผู้ใช้มีสิทธิ์เข้าระบบเดียว (ดู main.php) — โผล่เมื่อมีระบบงาน 2+ */
.module-switcher { position: relative; }
.module-switcher-btn {
  background: var(--bar-soft); border: 1px solid var(--bar-line);
  color: var(--bar-ink); font-family: inherit; font-size: 15px; font-weight: 600;
  padding: 7px 14px; border-radius: 20px; cursor: pointer;
}
.module-switcher-btn:hover { background: var(--bar-soft-2); }
.module-switcher-panel {
  display: none; position: absolute; top: calc(100% + 8px); left: 0;
  min-width: 260px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px; z-index: 60;
}
body.switcher-open .module-switcher-panel { display: block; }
.module-switcher-item {
  display: block; padding: 10px 12px; border-radius: 8px; color: var(--ink); font-size: 16px;
}
.module-switcher-item:hover { background: var(--bg); text-decoration: none; }
.module-switcher-item.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }
.module-crumb {
  background: var(--bar-soft); border-radius: 20px;
  padding: 7px 16px; font-size: 15px; font-weight: 600;
}

/* ---------------------------------------------------------- โครง */
.shell { display: flex; align-items: flex-start; }
.sidebar {
  position: sticky; top: 66px;
  width: 292px; flex: 0 0 292px;
  height: calc(100vh - 66px); overflow-y: auto;
  background: var(--card); border-right: 1px solid var(--line);
  padding: 14px 0 48px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px; color: var(--ink); font-size: 16.5px;
  border-left: 4px solid transparent; line-height: 1.5;
}
.nav-item:hover { background: var(--brand-light); text-decoration: none; }
.nav-item.active {
  background: var(--brand-light); color: var(--brand-dark);
  font-weight: 600; border-left-color: var(--brand);
}
html[data-theme="dark"] .nav-item.active { border-left-color: var(--yellow); }
.nav-icon { width: 24px; text-align: center; flex: 0 0 24px; font-size: 18px; }
/* หมวดของเมนู — มีได้ถึง 8 หมวดสำหรับสำนักวิชาการ จึงบีบระยะให้แน่นกว่าเดิม */
.nav-sep {
  margin: 14px 20px 6px; padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px; font-weight: 700; letter-spacing: .5px;
  color: var(--muted); text-transform: uppercase;
}
.content { flex: 1; min-width: 0; padding: 26px 30px 70px; }
.content-plain { max-width: 520px; margin: 6vh auto; padding: 0 20px; }

/* ---------------------------------------------------------- หัวข้อ */
.page-head {
  display: flex; align-items: flex-start; gap: 16px;
  flex-wrap: wrap; margin-bottom: 22px;
}
.page-head h1 { margin: 0; font-size: var(--fs-xl); font-weight: 700; line-height: 1.3; }
.page-head .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; }
.page-head .spacer { margin-left: auto; }
h2 { font-size: var(--fs-lg); margin: 30px 0 12px; line-height: 1.35; }

/* หัวข้อหมวดในหน้าหลัก — คั่นการ์ดตามลำดับขั้นของกระบวนการ */
.sec-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 34px 0 14px; padding-top: 14px;
  border-top: 2px solid var(--line); font-weight: 700;
}
.sec-head:first-of-type { margin-top: 6px; padding-top: 0; border-top: 0; }
.sec-step {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  background: var(--brand-light); color: var(--brand-dark);
  font-size: 14px; font-weight: 700; white-space: nowrap;
}
h3 { font-size: 18px; margin: 20px 0 10px; line-height: 1.4; }

/* ---------------------------------------------------------- การ์ด */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 20px;
}
.card-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: -22px -22px 18px; padding: 15px 22px;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 600; font-size: 18px;
}
.card-head .spacer { margin-left: auto; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); }

/* ---------------------------------------------------------- สถิติ */
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 17px 19px; box-shadow: var(--shadow);
}
.stat .n { font-size: 33px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 15px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.stat.ok .n { color: var(--ok); }
.stat.warn .n { color: var(--warn); }
.stat.danger .n { color: var(--danger); }
.stat.brand .n { color: var(--brand-ink); }

/* ---------------------------------------------------------- ตาราง */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.7; }
th { background: var(--surface-3); font-weight: 600; font-size: 15.5px; color: var(--ink-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }
.table-compact th, .table-compact td { padding: 11px 13px; font-size: 16px; }
/* แถวของข้อมูลที่ปิดใช้งานแล้ว — ยังต้องอ่านได้ แต่ไม่ควรเด่นเท่าของที่ใช้อยู่ */
tr.row-muted td { background: var(--surface-2); color: var(--muted); }
/* แถวคั่นหมวดในตาราง เช่น หมวดหลักสูตรในกล่องรออนุมัติ */
tr.table-group th {
  background: var(--brand-light); color: var(--brand-dark);
  font-size: 15px; letter-spacing: .02em; padding: 9px 16px;
}
tr.table-group:hover { background: none; }

/* ---------------------------------------------------------- ปุ่ม */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 8px; border: 1px solid transparent;
  background: var(--brand); color: var(--on-brand); font-size: 17px; font-family: inherit;
  font-weight: 500; line-height: 1.4; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--brand-hover); text-decoration: none; color: var(--on-brand); }
.btn-sm { padding: 7px 14px; font-size: 15px; }
.btn-lg { padding: 14px 28px; font-size: 18.5px; font-weight: 600; }
.btn-outline { background: var(--card); color: var(--brand-ink); border-color: var(--line-strong); }
.btn-outline:hover { background: var(--brand-light); color: var(--brand-dark); }
/* ปุ่มโปร่ง — บนการ์ดเป็นปุ่มเส้นบาง ๆ บนแถบบนใช้สีของแถบ (.topbar .btn-ghost) */
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
.topbar .btn-ghost { background: var(--bar-soft); color: var(--bar-ink); border-color: var(--bar-line); }
.topbar .btn-ghost:hover { background: var(--bar-soft-2); color: var(--bar-ink); }
.btn-ok, .btn-ok:hover, .btn-danger, .btn-danger:hover, .btn-warn, .btn-warn:hover { color: #fff; }
.btn-ok { background: var(--ok); } .btn-ok:hover { background: #14663a; }
.btn-danger { background: var(--danger); } .btn-danger:hover { background: #8d1d17; }
.btn-warn { background: var(--warn); } .btn-warn:hover { background: #8f4207; }
/* ปุ่มเหลืองแบรนด์ — ตัวหนังสือดำเสมอ ทั้งสองโหมด */
.btn-yellow, .btn-yellow:hover { color: #141414; }
.btn-yellow { background: var(--yellow); }
.btn-yellow:hover { background: var(--yellow-soft); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------- ฟอร์ม */
.form-row { margin-bottom: 20px; }
label.form-label { display: block; font-weight: 600; font-size: 17px; margin-bottom: 7px; line-height: 1.5; }
.req { color: var(--danger); }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=search],
input[type=url], input[type=password], input[type=date], input[type=time], input[type=datetime-local], select, textarea {
  width: 100%; padding: 12px 15px; font-family: inherit; font-size: 17px;
  line-height: 1.75; border: 1.5px solid var(--line-strong); border-radius: 8px;
  background: var(--card); color: var(--ink);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus-soft);
}
input[readonly], input:disabled, textarea[readonly], select:disabled {
  background: var(--surface-3); color: var(--muted);
}
/* ช่องกรอกที่อยู่ในตาราง — ลดช่องไฟลงเพื่อไม่ให้แถวสูงเกินไป
   แต่คงขนาดตัวอักษรไว้เท่าเดิม ความอ่านง่ายจึงไม่ลดลง */
td input, td select, td textarea { padding: 8px 11px; }
td textarea { line-height: 1.6; }

.hint { font-size: 15px; color: var(--muted); margin-top: 6px; line-height: 1.65; }

/* หัวข้อย่อยในฟอร์ม CRUD — แบ่งฟอร์มยาว ๆ เป็นกลุ่มที่อ่านออกว่าแต่ละส่วนทำอะไร
   (ตั้งค่าด้วยคีย์ section / section_hint ของฟิลด์ใน resources.php) */
.form-section { margin: 26px 0 16px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form-section h3 { font-size: 18px; font-weight: 700; margin: 0; }
.form-section p { font-size: 15px; color: var(--muted); margin: 7px 0 0; line-height: 1.7; }
.check { display: flex; align-items: center; gap: 11px; }
.check input { width: 21px; height: 21px; flex: 0 0 21px; }
.form-actions {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line);
}
.checklist {
  max-height: 300px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 13px; background: var(--surface-2);
}
.checklist label {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 7px 0; font-size: 16.5px; line-height: 1.65;
}
.checklist input[type=checkbox] { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 3px; }
.inline { display: inline; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filters .form-row { margin: 0; min-width: 200px; }

/* กลุ่มเรียน — วัน เวลาเริ่ม เวลาสิ้นสุด ห้องเรียน แยกช่องกัน */
.section-row {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 15px 0; margin-bottom: 12px; background: var(--surface-2);
}
.section-head { font-weight: 600; font-size: 16px; margin-bottom: 11px; color: var(--brand-dark); }
.sched-grid {
  display: grid; gap: 14px;
  grid-template-columns: minmax(150px, 1fr) 140px 140px minmax(220px, 1.5fr);
}
@media (max-width: 860px) { .sched-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .sched-grid { grid-template-columns: 1fr; } }

/* ช่องค้นหาที่มีรายการแนะนำขึ้นให้เลือกทันทีที่พิมพ์ */
.ac { position: relative; }
.ac-menu {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 290px; overflow-y: auto; background: var(--card);
  border: 1.5px solid var(--line-strong); border-radius: 8px; box-shadow: 0 10px 26px rgba(23,22,22,.16);
}
.ac-item {
  display: flex; flex-wrap: wrap; gap: 4px 11px; align-items: baseline;
  padding: 10px 14px; cursor: pointer; font-size: 16.5px; line-height: 1.5;
  border-bottom: 1px solid var(--line);
}
.ac-item:last-child { border-bottom: 0; }
.ac-item .muted { font-size: 14.5px; }
.ac-item:hover, .ac-item.active { background: var(--brand-light); }
.ac-item[aria-disabled=true] { opacity: .55; cursor: default; }
.ac-note { padding: 12px 14px; color: var(--muted); font-size: 15.5px; line-height: 1.6; }
.ac-manual { margin-top: 6px; }
.ac-manual summary { cursor: pointer; font-size: 16px; color: var(--brand-ink); font-weight: 600; }

/* รายชื่อผู้สอนที่เลือกไว้ — ลำดับที่ 1 คือผู้รับผิดชอบรายวิชา */
.chip-list { display: grid; gap: 9px; margin-bottom: 14px; }
.chip-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface-2);
}
.chip-row.is-fixed { background: var(--brand-light); border-color: var(--line-strong); }
.chip-no {
  flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--on-brand);
  font-weight: 700; font-size: 14.5px; display: flex; align-items: center; justify-content: center;
}
.chip-main { flex: 1; min-width: 0; line-height: 1.5; }
.chip-main strong, .chip-main span { display: block; }
.chip-act { display: flex; gap: 6px; flex: 0 0 auto; }
.chip-btn {
  border: 1px solid var(--line-strong); background: var(--card); color: var(--brand-ink);
  border-radius: 6px; padding: 6px 11px; font: inherit; font-size: 14.5px; cursor: pointer;
}
.chip-btn:hover { background: var(--brand-light); }
.chip-btn:disabled { opacity: .35; cursor: not-allowed; }
.chip-btn.danger { color: var(--danger); border-color: var(--danger-line); }
.chip-btn.danger:hover { background: var(--danger-bg); }

/* ---------------------------------------------------------- ป้าย */
.badge {
  display: inline-block; padding: 4px 12px; border-radius: 20px;
  font-size: 14.5px; font-weight: 600; white-space: nowrap; line-height: 1.5;
}
.badge-secondary { background: var(--surface-3); color: var(--muted); }
.badge-brand { background: var(--brand-light); color: var(--brand-dark); }
.badge-success { background: var(--ok-bg); color: var(--ok); }
.badge-warning { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }

/* ---------------------------------------------------------- แจ้งเตือน */
.alert {
  padding: 15px 19px; border-radius: 9px; margin-bottom: 18px;
  border: 1px solid transparent; font-size: 17px; line-height: 1.75;
}
.alert-success { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.alert-danger  { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-ink); }
.alert-warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.alert-info    { background: var(--info-bg); border-color: var(--info-line); color: var(--info-ink); }
.alert ul { margin: 8px 0 0 20px; padding: 0; }
.alert li { margin-bottom: 5px; }

.ai-warning {
  background: var(--warn-bg); border: 1px solid var(--warn-line); border-left: 5px solid var(--warn);
  padding: 14px 18px; border-radius: 8px; font-size: 17px; line-height: 1.75; margin-bottom: 16px;
}

/* ---------------------------------------------------------- เดินทีละขั้น */
.stepbar {
  display: flex; gap: 0; overflow-x: auto; margin-bottom: 22px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.step {
  flex: 1 1 0; min-width: 150px;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; font-size: 15.5px; color: var(--muted);
  border-bottom: 4px solid transparent; line-height: 1.4;
}
.step:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.step .n {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-3); color: var(--muted);
  display: grid; place-items: center;
  font-size: 14.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.step.done { color: var(--ink); }
.step.done .n { background: var(--ok-bg); color: var(--ok); }
.step.now {
  color: var(--brand-dark); font-weight: 700;
  border-bottom-color: var(--brand); background: var(--brand-light);
}
.step.now .n { background: var(--brand); color: var(--on-brand); }

.stage-head { margin-bottom: 6px; }
.stage-head .counter {
  font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.stage-head h2 { margin: 2px 0 0; font-size: 24px; }

.why {
  background: var(--brand-light); border-radius: 9px;
  padding: 15px 18px; font-size: 17px; line-height: 1.75;
  margin: 16px 0 22px; color: var(--ink);
}
.why b { display: block; margin-bottom: 3px; }

.step-nav {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-top: 26px; padding-top: 20px; border-top: 2px solid var(--line);
}
.step-nav .spacer { margin-left: auto; font-size: 15px; color: var(--muted); }

/* ---------------------------------------------------------- เส้นทางงานตามบทบาท
 * ไทม์ไลน์แนวนอน: จุดกลมเรียงบนเส้นเดียวกัน การ์ดรายละเอียดอยู่ใต้จุด
 * 9 ขั้นยาวเกินจอ จึงให้เลื่อนแนวนอนได้ และมีสคริปต์เลื่อนไปหยุดที่ขั้นที่ค้างอยู่
 */
/* สรุปบนสุด — อ่านแถวเดียวรู้ว่าต้องทำอะไรและรออะไร ไม่ต้องไล่อ่านทั้ง 9 ขั้น */
.flow-sum { display: grid; gap: 8px; margin: 2px 0 4px; }
.flow-sum-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.flow-sum-label {
  font-size: 14.5px; font-weight: 700; flex: 0 0 auto;
  min-width: 62px; letter-spacing: .2px;
}
.flow-sum-label.tone-todo { color: var(--warn); }
.flow-sum-label.tone-wait { color: var(--muted); }

.sum-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px 5px 6px; border-radius: 999px;
  font-size: 15px; line-height: 1.5; border: 1px solid transparent;
}
.sum-chip i {
  font-style: normal; font-weight: 700; font-size: 13px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: color-mix(in srgb, var(--card) 75%, transparent);
}
.sum-chip b { font-variant-numeric: tabular-nums; }
.sum-chip.tone-todo {
  background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink);
}
a.sum-chip.tone-todo:hover { background: var(--warn-bg); text-decoration: none; }
.sum-chip.tone-wait { background: var(--surface-3); color: var(--muted); }
a.sum-chip.tone-wait:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.sum-chip.tone-clear { background: var(--ok-bg); color: var(--ok); }
a.sum-chip.tone-clear:hover { background: var(--ok-bg); text-decoration: none; }
.fstep-card .btn-row .btn { margin-top: 0; }

/* ไทม์ไลน์แนวตั้ง — 9 ขั้นวางแนวนอนแล้วล้นจอ จึงเรียงลงมาแทน
 * ขั้นที่ไม่มีงานค้าง (is-slim) ย่อเหลือบรรทัดเดียว ไม่ให้บังขั้นที่ต้องลงมือจริง */
.flow { list-style: none; margin: 10px 0 0; padding: 0; }
.fstep {
  position: relative; display: flex; align-items: flex-start; gap: 14px;
  padding-bottom: 10px;
}
/* เส้นแนวตั้งเชื่อมจุด — ขั้นสุดท้ายไม่ต้องมีหาง */
.fstep::before {
  content: ''; position: absolute; left: 18px; top: 36px; bottom: -4px;
  width: 3px; background: var(--line);
}
.fstep:last-child::before { display: none; }

.fstep-dot {
  position: relative; z-index: 1; flex: 0 0 39px;
  width: 39px; height: 39px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 16.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--card); color: var(--muted); border: 3px solid var(--line);
}

.fstep-card {
  flex: 1; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); padding: 11px 16px 13px;
}
.fstep-head { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.fstep-no {
  font-size: 13.5px; color: var(--muted); letter-spacing: .3px;
  flex: 0 0 auto; font-variant-numeric: tabular-nums;
}
.fstep-title { font-size: 17.5px; font-weight: 700; line-height: 1.5; }
.fstep-desc { font-size: 15.5px; color: var(--muted); line-height: 1.7; margin-top: 4px; }
.fstep-who { font-size: 14.5px; color: var(--muted); line-height: 1.6; margin-top: 2px; }
.fstep-card .btn { margin-top: 10px; }

.fstep-chip {
  display: inline-block; padding: 4px 11px; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; line-height: 1.6;
}
.fstep-chip.tone-todo  { background: var(--warn-bg); color: var(--warn-ink); }
.fstep-chip.tone-wait  { background: var(--surface-3); color: var(--muted); }
.fstep-chip.tone-clear { background: var(--ok-bg); color: var(--ok); }

.fstep-alert {
  font-size: 14.5px; line-height: 1.6; border-radius: 7px;
  padding: 8px 12px; border-left: 4px solid; margin-top: 8px;
}
.fstep-alert.tone-warning { background: var(--warn-bg); border-color: var(--warn); color: var(--warn-ink); }
.fstep-alert.tone-danger  { background: var(--danger-bg); border-color: var(--danger); color: var(--danger-ink); }

.fstep-mine {
  font-size: 13px; font-weight: 600; color: var(--brand-dark);
  background: var(--brand-light); border-radius: 999px; padding: 2px 9px;
}

/* สถานะของแต่ละขั้น — ขั้นที่เป็นงานค้างของผู้ใช้ต้องสะดุดตาที่สุด */
.fstep-clear .fstep-dot { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok); }
.fstep-wait .fstep-dot { border-color: var(--line-strong); color: var(--brand-ink); }
.fstep-todo .fstep-dot {
  border-color: var(--warn); background: var(--warn); color: #fff;
  box-shadow: 0 0 0 5px rgba(180, 83, 9, .13);
}
.fstep-todo .fstep-card {
  border-color: var(--warn); border-left: 5px solid var(--warn);
  background: var(--surface-2); box-shadow: var(--shadow);
}

/* ขั้นที่ไม่มีงานค้าง — บรรทัดเดียว จางลง */
.fstep.is-slim { padding-bottom: 8px; }
.fstep.is-slim .fstep-card {
  background: var(--surface-2); padding: 8px 16px; border-style: dashed;
}
.fstep.is-slim .fstep-title { font-size: 16px; font-weight: 600; color: var(--muted); }

/* ---------------------------------------------------------- หน้าที่ตามบทบาท */
.duty-grid { margin-top: 6px; }
.duty {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 15px 16px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface-2); height: 100%;
}
.duty-urgent { border-color: var(--danger-line); background: var(--surface-2); }
.duty-icon { font-size: 26px; line-height: 1.2; flex: 0 0 auto; }
.duty-body { min-width: 0; }
.duty-title {
  font-size: 17.5px; font-weight: 600; line-height: 1.5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.duty-desc { font-size: 15.5px; color: var(--muted); line-height: 1.7; margin: 3px 0 6px; }

/* ---------------------------------------------------------- อื่น ๆ */
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.mono { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 16px; }
.empty { text-align: center; padding: 54px 24px; color: var(--muted); font-size: 17px; }
.empty .big { font-size: 52px; margin-bottom: 10px; }

/* ---------------------------------------------------------- หน้ากลาง "งานของฉัน" (app/Views/home.php)
   [portal] ไอคอนทุกระบบอยู่ซ้าย แผงขวาเป็น "งานที่รอท่าน" หรือการ์ดใหญ่ของระบบที่แตะ
   initPortal() ใน app.js ตั้ง --portal-h ให้ทั้งชุดพอดีจอ แล้วไอคอนกับชื่อย่อตามขนาดช่องเอง (หน่วย cq*)
   ไม่มี JS: ช่องสูงอย่างน้อย 170px และหน้าเลื่อนได้ตามปกติ
   สีประจำระบบมาจาก style="--m-color/--m-dark" ของแต่ละช่อง — พื้นอ่อนผสมจาก --card จึงใช้ได้ทั้งโหมดสว่างและมืด */
.content:has(> .portal) { padding-bottom: 24px; }
.portal {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 31%, 400px);
  gap: 22px; height: var(--portal-h, auto);
}
.portal-apps { min-height: 0; container: apps / inline-size; }
.portal-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(170px, 1fr); gap: 16px; height: 100%;
}
.portal[data-fit] .portal-grid { grid-auto-rows: minmax(0, 1fr); }
@container apps (max-width: 620px) { .portal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.app-tile {
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 12px 12px 10px; text-align: center;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  container-type: size;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.app-tile:hover { text-decoration: none; color: var(--ink); border-color: var(--m-color); transform: translateY(-2px); }
.app-tile:focus-visible { outline-offset: 3px; }
.app-tile.is-selected {
  border-color: var(--m-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--m-color) 40%, transparent), var(--shadow);
}
.app-tile-icon {
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: clamp(44px, min(40cqw, 38cqh), 88px); aspect-ratio: 1; border-radius: 24%;
  margin-bottom: clamp(2px, 4cqh, 12px);
  background: color-mix(in srgb, var(--m-color) 14%, var(--card)); border: 2px solid var(--m-color);
  font-size: clamp(22px, min(20cqw, 19cqh), 46px); line-height: 1;
}
/* การ์ดแสดงชื่อสั้นทุกขนาดจอ — ชื่อทางการเต็ม (docs/SYSTEM_NAMES.md) ยาวเกินการ์ด อ่านได้ด้วยโปรแกรมอ่านหน้าจอและในแผงรายละเอียด */
.app-tile-name {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.app-tile-short {
  max-width: 100%; font-size: clamp(14px, 8cqw, 17px); font-weight: 700; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.app-tile-sub {
  max-width: 100%; font-size: 13.5px; line-height: 1.4; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-tile-sub.is-warn { color: var(--warn-ink); font-weight: 600; }
.app-tile-sub.is-danger { color: var(--danger-ink); font-weight: 600; }
/* ตัวเลขงานค้างมุมขวาบน — ระบบที่ยังเข้าไม่ได้ใช้ช่องเดียวกันแสดง 🔒 🛠️ ⏳ */
.app-tile-count {
  position: absolute; top: 10px; right: 10px;
  min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--warn); color: #fff; font-size: 14px; font-weight: 700; line-height: 1;
}
.app-tile-count.is-glyph { background: none; padding: 0; font-size: 16px; }
.app-tile.is-off { background: var(--surface-2); box-shadow: none; }
.app-tile.is-off .app-tile-icon { filter: grayscale(1); opacity: .6; }
.app-tile.is-off .app-tile-name { color: var(--muted); }

.portal-side { min-height: 0; display: flex; flex-direction: column; }
.portal-panel {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  padding: 20px 22px;
}
.portal-panel[hidden] { display: none; }
.portal-panel-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 19px; font-weight: 700; }
.portal-sub {
  margin: 22px 0 10px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 15px; font-weight: 700; color: var(--muted);
}
.portal-note { margin: 12px 0 0; font-size: 14.5px; line-height: 1.6; color: var(--muted); }
.portal-clear { margin: 12px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--ok-bg); color: var(--ok-ink); font-size: 15.5px; }

.todo-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.todo-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
}
.todo-item:hover { text-decoration: none; color: var(--ink); border-color: var(--m-color); }
.todo-icon {
  flex: 0 0 40px; height: 40px; border-radius: 10px; font-size: 22px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--m-color) 14%, var(--card));
}
.todo-body { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.45; }
.todo-body strong { font-size: 15.5px; font-weight: 600; }
.todo-from { font-size: 14px; color: var(--muted); }
.todo-go { margin-top: 6px; font-size: 14.5px; font-weight: 600; color: var(--m-dark); }
/* โหมดมืด: สีเข้มประจำโมดูลอ่านไม่ออกบนพื้นดำ — ผสมสีโมดูลกับขาวแทน */
html[data-theme="dark"] .todo-go { color: color-mix(in srgb, var(--m-color) 62%, #fff); }

.state-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 15.5px; }
.state-list li { display: flex; align-items: center; gap: 10px; }
.state-list strong { margin-left: auto; }
.state-dot { flex: 0 0 10px; height: 10px; border-radius: 50%; }
.state-open { background: var(--ok); }
.state-locked { background: var(--line-strong); }
.state-maintenance { background: var(--warn); }
.state-coming { background: var(--info); }

/* การ์ดใหญ่ของระบบที่แตะ — จอใหญ่แทนที่แผงขวา จอโทรศัพท์เลื่อนขึ้นจากขอบล่าง (ดู @media ด้านล่าง) */
.app-detail {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  border-top: 6px solid var(--m-color); padding-top: 26px;
}
.app-detail-close {
  position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  font-family: inherit; font-size: 24px; line-height: 1; cursor: pointer;
}
.app-detail-close:hover { background: var(--surface-3); color: var(--ink); }
.app-detail-icon {
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: clamp(84px, 14vh, 124px); aspect-ratio: 1; border-radius: 26%;
  background: color-mix(in srgb, var(--m-color) 14%, var(--card)); border: 3px solid var(--m-color);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--m-color) 25%, transparent);
  font-size: clamp(44px, 7.5vh, 66px); line-height: 1;
}
.app-detail.is-off .app-detail-icon { filter: grayscale(1); opacity: .7; }
.app-detail-title { margin: 16px 0 0; font-size: 22px; font-weight: 700; line-height: 1.35; }
.app-detail-owner { margin-top: 2px; font-size: 15px; color: var(--muted); }
.app-detail-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.app-detail-summary { align-self: stretch; margin: 14px 0 0; font-size: 16px; line-height: 1.65; color: var(--ink-2); text-align: left; }
.app-detail-facts {
  align-self: stretch; margin: 14px 0 0; padding: 12px 14px; border-radius: 10px;
  background: var(--surface-2); font-size: 15px; text-align: left;
}
.app-detail-facts dt { font-size: 14px; font-weight: 600; color: var(--muted); }
.app-detail-facts dd { margin: 2px 0 0; }
.app-detail-foot { align-self: stretch; margin-top: auto; padding-top: 18px; }
.app-detail-go { display: block; text-align: center; background: var(--m-dark); color: #fff; }
.app-detail-go:hover { background: var(--m-dark); color: #fff; filter: brightness(1.18); }
.app-detail-why { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-3); color: var(--muted); font-size: 15px; }
.portal-scrim { display: none; }

/* โลโก้แอปแบบไอคอนไอโฟน (.has-logo, public/assets/img/apps/<key>.svg) — รูปเป็นทรง squircle เต็มกรอบอยู่แล้ว
   จึงตัดพื้นและขอบของช่องออก เหลือมุมโค้ง 23% ไว้ให้เงาและวงแหวนตอนเลือก (box-shadow) โค้งตามรูป */
.app-tile-icon.has-logo, .app-detail-icon.has-logo, .todo-icon.has-logo { background: none; border: 0; border-radius: 23%; }
.has-logo img { display: block; width: 100%; height: 100%; }
.app-tile-icon.has-logo { width: clamp(52px, min(50cqw, 48cqh), 108px); box-shadow: 0 6px 14px rgba(0, 0, 0, .14); }
.app-detail-icon.has-logo { width: clamp(96px, 16vh, 136px); box-shadow: 0 10px 26px rgba(0, 0, 0, .18); }
.todo-icon.has-logo { flex-basis: 44px; height: 44px; }

/* จอโทรศัพท์: ไอคอนแบบหน้าจอมือถือ 4 คอลัมน์ ชื่อสั้นใต้ไอคอน แผง "งานที่รอท่าน" ต่อข้างล่างเสมอ */
@media (max-width: 760px) {
  .content:has(> .portal) { padding-bottom: 40px; }
  .portal { display: block; height: auto; }
  .portal-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: auto; gap: 18px 6px; height: auto; }
  .app-tile, .app-tile.is-off {
    container-type: normal; overflow: visible; justify-content: flex-start; gap: 6px; padding: 2px 0;
    background: none; border: 0; box-shadow: none;
  }
  .app-tile:hover { transform: none; }
  .app-tile.is-selected { box-shadow: none; }
  .app-tile.is-selected .app-tile-icon { box-shadow: 0 0 0 3px color-mix(in srgb, var(--m-color) 40%, transparent); }
  .app-tile-icon { width: 60px; margin: 0; border-radius: 18px; font-size: 30px; }
  .app-tile-icon.has-logo { width: 62px; border-radius: 23%; }
  /* ชื่อเต็มกับสถานะยังอ่านได้ด้วยโปรแกรมอ่านหน้าจอ แต่บนจอแสดงชื่อสั้นแทน */
  .app-tile-name, .app-tile-sub {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .app-tile-short {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    max-width: 100%; font-size: 13.5px; font-weight: 600; line-height: 1.3;
  }
  .app-tile-count { top: -6px; right: calc(50% - 40px); }
  .portal-side { margin-top: 22px; }
  .portal-overview[hidden] { display: block; }
  .portal-status { display: none; }
  .portal-panel { overflow: visible; }
  .app-detail {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    max-height: 88dvh; overflow-y: auto; border-radius: 22px 22px 0 0;
    padding: 30px 20px calc(20px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 40px rgba(0, 0, 0, .25);
    animation: portal-sheet .22s ease-out;
  }
  .app-detail-icon { width: 96px; font-size: 52px; }
  .portal[data-view="detail"] .portal-scrim {
    display: block; position: fixed; inset: 0; z-index: 85; background: rgba(0, 0, 0, .45);
  }
}
@media (max-width: 359px) { .portal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@keyframes portal-sheet { from { transform: translateY(48px); opacity: .5; } to { transform: none; opacity: 1; } }
html.portal-sheet-open { overflow: hidden; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.pager a, .pager span {
  padding: 8px 15px; border: 1px solid var(--line);
  border-radius: 7px; background: var(--card); font-size: 16px;
}
.pager .cur { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.pager a:hover { background: var(--brand); color: var(--on-brand); border-color: var(--brand); text-decoration: none; }
.pager .off { color: var(--muted); background: var(--surface-3); cursor: default; }
.pager .gap { border: 0; background: none; padding: 8px 2px; color: var(--muted); }
/* สรุปช่วงข้อมูลไม่ใช่ปุ่ม จึงไม่ต้องมีกรอบ */
.pager .pager-info { border: 0; background: none; padding: 8px 4px; margin-left: auto; }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tab {
  padding: 11px 20px; border: 0; background: none; cursor: pointer;
  font-family: inherit; font-size: 17px; color: var(--muted);
  border-bottom: 4px solid transparent; margin-bottom: -2px; white-space: nowrap;
}
.tab:hover { color: var(--brand); text-decoration: none; }
.tab.active { color: var(--brand-dark); font-weight: 600; border-bottom-color: var(--brand); }

.timeline { border-left: 3px solid var(--line); padding-left: 20px; margin-left: 8px; }
.timeline-item { position: relative; padding-bottom: 18px; font-size: 16.5px; line-height: 1.75; }
.timeline-item::before {
  content: ''; position: absolute; left: -27px; top: 8px;
  width: 13px; height: 13px; border-radius: 50%; background: var(--line);
  border: 2px solid var(--card);
}
.timeline-item.done::before { background: var(--ok); }
.timeline-item.auto::before { background: var(--warn); }
.timeline-item.reject::before { background: var(--danger); }

.progress { height: 10px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); }

.diff-new { background: var(--ok-bg); }
.diff-same { background: var(--card); }
.diff-changed { background: var(--warn-bg); }
.row-error { background: var(--danger-bg); }

/* ---------------------------------------------------------- ตารางสอน (แกนตั้ง = วัน, แกนนอน = เวลา) */
.tt-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.tt {
  --hour-w: 86px;
  --day-h: 76px;
  --tt-hours: 13;              /* 08:00-21:00 ตรงกับ ScheduleService::DAY_START/DAY_END */
  display: grid;
  grid-template-columns: 92px 1fr;
  min-width: calc(92px + var(--tt-hours) * var(--hour-w));
}
.tt-corner { border-bottom: 1px solid var(--line); background: var(--brand-light); }
.tt-head {
  display: flex; align-items: center; justify-content: center;
  padding: 8px 6px; font-weight: 600; font-size: 15.5px;
  color: var(--brand-dark); background: var(--brand-light);
  border-top: 1px solid var(--line); border-right: 1px solid var(--line);
}
.tt-head.is-weekend { background: var(--surface-3); color: var(--muted); }

.tt-times {
  position: relative; height: 34px;
  background: var(--brand-light); border-bottom: 1px solid var(--line);
}
.tt-time {
  position: absolute; bottom: 8px; transform: translateX(-50%);
  font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.tt-time.is-first { transform: none; }
.tt-time.is-last { transform: translateX(-100%); }

.tt-row {
  position: relative; height: var(--day-h);
  border-top: 1px solid var(--line);
  background-image: linear-gradient(to right, var(--line) 0, var(--line) 1px, transparent 1px);
  background-size: calc(100% / var(--tt-hours)) 100%;
  background-repeat: repeat-x;
}
.tt-row.is-weekend { background-color: var(--surface-2); }

.tt-block {
  position: absolute; overflow: hidden;
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px;
  align-content: center;
  padding: 4px 8px; box-sizing: border-box;
  border-radius: 7px; border-left: 4px solid var(--tt-color, var(--brand));
  background: var(--tt-bg, var(--brand-light)); color: var(--ink);
  font-size: 13.5px; line-height: 1.35;
  box-shadow: 0 1px 2px rgba(23,22,22,.12);
}
a.tt-block:hover { text-decoration: none; filter: brightness(.97); }
.tt-block b { font-size: 14px; font-weight: 700; color: var(--tt-color, var(--brand-dark)); }
.tt-block span { color: var(--muted); }
.tt-block .tt-time-label { font-variant-numeric: tabular-nums; }
.tt-block.is-clash { outline: 2px solid var(--danger); outline-offset: -2px; }

.tt-free {
  position: absolute; top: 0; bottom: 0;
  background: var(--ok-bg); border-left: 1px dashed var(--ok-line); border-right: 1px dashed var(--ok-line);
}
.tt-free span {
  position: absolute; left: 6px; top: 4px;
  font-size: 12.5px; color: var(--ok); font-variant-numeric: tabular-nums;
}

.tt-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 14px 0 4px; }
.tt-legend-item { display: flex; align-items: center; gap: 7px; font-size: 15px; }
.tt-legend-swatch { width: 15px; height: 15px; border-radius: 4px; flex: 0 0 15px; }

.free-day { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.free-day h3 { margin: 0 0 8px; font-size: 16.5px; color: var(--brand-dark); }
.free-chip {
  display: inline-block; margin: 0 6px 6px 0; padding: 5px 11px;
  background: var(--ok-bg); color: var(--ok); border-radius: 999px;
  font-size: 15px; font-variant-numeric: tabular-nums;
}
.free-day.is-none .free-chip { background: var(--surface-3); color: var(--muted); }

.pick-list { display: grid; gap: 8px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.pick-row {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; background: var(--card);
}
.pick-row.is-on { border-color: var(--brand); background: var(--brand-light); }
.pick-label { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; cursor: pointer; }
.pick-label input[type=checkbox] { width: 20px; height: 20px; flex: 0 0 20px; }
.pick-main { flex: 1; min-width: 0; line-height: 1.5; }
.pick-main strong { display: block; }
.pick-bar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 12px 0 2px; margin-top: 14px;
}

/* คาบเรียนหลายคาบต่อกลุ่มในหน้ากรอกรายวิชา */
.slot-row + .slot-row { border-top: 1px dashed var(--line); padding-top: 12px; }
.slot-del-cell { display: flex; align-items: flex-end; }

/* ---------------------------------------------------------- จอเล็ก */
@media (max-width: 980px) {
  .menu-toggle { display: block; }
  .sidebar {
    position: fixed; left: 0; top: 66px; z-index: 40;
    transform: translateX(-100%); transition: transform .2s;
    box-shadow: 4px 0 18px rgba(0,0,0,.14);
  }
  body.nav-open .sidebar { transform: none; }
  .content { padding: 18px 16px 60px; }
  .who { display: none; }
  .step { min-width: 130px; font-size: 14.5px; }
  .fstep { gap: 10px; }
  .fstep-card { padding: 10px 13px 12px; }
  .flow-sum-label { min-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------------------------------------------------------- พิมพ์ */
@media print {
  .topbar, .sidebar, .btn, .form-actions, .tabs, .stepbar, .step-nav { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #999; break-inside: avoid; }
  body { background: #fff; font-size: 15px; line-height: 1.6; }
}

/* ---------------------------------------------------------- ปุ่มสลับภาษา TH | EN  [i18n — ดู docs/I18N.md]
   วาดจาก app/Views/partials/lang_toggle.php ทั้งที่แถบบน และหน้าที่ยังไม่ล็อกอิน (.lang-float)
   แถบบนของโมดูลเดิม (legacy mount) ใช้ partial เดียวกันแต่สไตล์ .aic-shell-lang อยู่ใน shell.css */
.lang-toggle {
  display: inline-flex; gap: 2px; padding: 2px;
  background: var(--bar-soft); border: 1px solid var(--bar-line); border-radius: 16px;
}
.lang-toggle-item {
  display: inline-block; min-width: 34px; padding: 2px 9px; border-radius: 13px;
  font-size: 13.5px; font-weight: 600; letter-spacing: .4px; line-height: 1.6; text-align: center;
  color: var(--bar-ink); opacity: .85;
}
a.lang-toggle-item:hover { background: var(--bar-soft-2); opacity: 1; text-decoration: none; }
.lang-toggle-item.is-active { background: var(--bar-chip); color: var(--bar-chip-ink); opacity: 1; }

/* ยังไม่ล็อกอิน: ไม่มีแถบบน — ลอยมุมขวาบนบนพื้นสว่าง */
.lang-float { position: absolute; top: 14px; right: 16px; z-index: 5; }
.lang-float .lang-toggle,
.login-tools .lang-toggle { background: var(--card); border-color: var(--line); box-shadow: var(--shadow); }
.lang-float .lang-toggle-item,
.login-tools .lang-toggle-item { color: var(--ink); }
.lang-float a.lang-toggle-item:hover,
.login-tools a.lang-toggle-item:hover { background: var(--bg); }
.lang-float .lang-toggle-item.is-active,
.login-tools .lang-toggle-item.is-active { background: var(--brand); color: var(--on-brand); }
@media print { .lang-toggle, .lang-float { display: none !important; } }

/* จอโทรศัพท์: แถบบนแคบ (เดิมก็ล้นอยู่แล้วก่อนมีปุ่มภาษา) — ซ่อนชื่อระบบเหลือไอคอน, บีบช่องว่าง,
   และปุ่มภาษาแสดงเฉพาะ "ภาษาที่จะสลับไป" ปุ่มเดียว (ภาษาที่ใช้อยู่ดูได้จากหน้าเว็บเอง) */
@media (max-width: 600px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .topbar-right { gap: 8px; }
  .topbar .brand-words { display: none; }
  .topbar .brand-logo { height: 22px; }
  .topbar .menu-toggle { padding: 4px; }
  .topbar .module-switcher-btn {
    max-width: 120px; padding: 6px 10px; font-size: 14px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .topbar .lang-toggle-item { min-width: 0; padding: 2px 7px; font-size: 12.5px; }
  .topbar .lang-toggle-item.is-active { display: none; }
  .topbar .btn-sm { padding-left: 10px; padding-right: 10px; font-size: 13.5px; white-space: nowrap; }
}
/* โทรศัพท์จอแคบ (≤420px) ยังล้นอยู่ — ตัวสลับระบบงานเหลือแค่ ⠿ ▾ (ปุ่มมี aria-label อยู่แล้ว) */
@media (max-width: 420px) {
  .topbar { gap: 6px; }
  .topbar-right { gap: 6px; }
  .topbar .module-switcher-label { display: none; }
}


/* [theme] ปุ่มสลับโหมดสว่าง/มืดบนแถบบน — สคริปต์ใน layouts/main.php และ partials/theme_head.php */
.theme-toggle {
  background: var(--bar-soft); border: 1px solid var(--bar-line); color: var(--bar-ink);
  border-radius: 20px; width: 38px; height: 34px; font-size: 17px; line-height: 1; cursor: pointer;
}
.theme-toggle:hover { background: var(--bar-soft-2); }
.login-tools .theme-toggle { background: var(--card); border-color: var(--line); box-shadow: var(--shadow); }
.login-tools .theme-toggle:hover { background: var(--bg); }
.theme-toggle .when-dark { display: none; }
html[data-theme="dark"] .theme-toggle .when-dark { display: inline; }
html[data-theme="dark"] .theme-toggle .when-light { display: none; }
/* รูปและตารางเวลาในโหมดมืด — ลดความจ้าของพื้นขาวในเนื้อหาที่ฝังสีไว้เอง */
html[data-theme="dark"] img { opacity: .92; }

/* ---------------------------------------------------------- หน้าเข้าสู่ระบบ  [theme — app/Views/auth/login.php]
   layout 'bare' (ไม่มีแถบบน) · ซ้าย = แผงเหลืองแบรนด์ AI SIAM ไล่สีแบบภาพแบนเนอร์ของศูนย์ฯ · ขวา = การ์ด
   โหมดมืดกลับด้านโลโก้: แผงพื้นดำ โลโก้และคำเน้นสีเหลือง */
.content-bare { display: block; }
.login {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(440px, .88fr);
  min-height: 100vh; min-height: 100dvh;
}
.login-brand {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between; gap: 48px;
  padding: clamp(32px, 4.6vw, 64px);
  background: linear-gradient(172deg, var(--yellow-deep) 0%, var(--yellow) 46%, var(--yellow-soft) 100%);
  color: #141414;
}
.login-logo { display: block; width: clamp(104px, 8.4vw, 132px); height: auto; color: #141414; }
/* ΛI ขนาดใหญ่จาง ๆ ล้นขอบขวา — ตกแต่งอย่างเดียว */
.login-watermark {
  position: absolute; z-index: -1; right: -16%; top: 9%;
  width: 82%; height: auto; color: rgba(20, 20, 20, .055); pointer-events: none;
}
.login-slogan { max-width: 640px; animation: login-rise .6s ease-out both; }
.login-slogan-en {
  margin: 0; font-family: "Outfit", "IBM Plex Sans", sans-serif; font-weight: 300;
  font-size: clamp(30px, 3.3vw, 50px); line-height: 1.14; letter-spacing: -.01em;
}
.login-slogan-en span, .login-slogan-en strong { display: block; }
.login-slogan-en strong { font-weight: 800; font-size: 1.36em; letter-spacing: -.025em; line-height: 1.04; margin: .05em 0 .06em; }
.login-slogan-th { margin: 18px 0 0; max-width: 32em; font-size: 17px; line-height: 1.7; opacity: .78; }
.login-systems { margin-top: 38px; padding-top: 20px; border-top: 1.5px solid rgba(20, 20, 20, .16); }
.login-systems-label { font-size: 13.5px; font-weight: 700; letter-spacing: .06em; margin-bottom: 12px; opacity: .72; }
.login-systems ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.login-systems li {
  padding: 4px 13px; border-radius: 999px; font-size: 14.5px; font-weight: 500; line-height: 1.6;
  background: rgba(255, 255, 255, .34); border: 1px solid rgba(20, 20, 20, .12);
}

.login-tools { position: absolute; top: 18px; right: 20px; z-index: 5; display: flex; align-items: center; gap: 10px; }
.login-panel {
  display: flex; flex-direction: column; align-items: center;
  padding: 92px clamp(20px, 4vw, 56px) 26px; background: var(--bg);
}
.login-card { width: 100%; max-width: 420px; margin: auto 0; animation: login-rise .6s .08s ease-out both; }
.login-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 600; letter-spacing: .02em; color: var(--muted);
}
.login-eyebrow::before { content: ""; width: 26px; height: 5px; border-radius: 3px; background: var(--yellow); }
.login-card h1 { margin: 8px 0 4px; font-size: 36px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
.login-sub { margin: 0 0 30px; color: var(--muted); font-size: 16.5px; line-height: 1.65; }

/* ปุ่ม Google แบบเข้ม (#131314 ตามแนวทางแบรนด์ของ Google) — เข้ากับดำ/เหลืองของ AI SIAM
   โหมดมืดใช้แบบสว่างแทน ให้เด่นบนพื้นดำ */
.btn-google {
  width: 100%; justify-content: center; gap: 12px; padding: 14px 20px; border-radius: 12px;
  background: #131314; color: #fff; border: 1px solid #131314; font-weight: 600;
  box-shadow: 0 6px 18px -8px rgba(20, 20, 20, .55);
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.btn-google:hover { background: #2a2a28; color: #fff; transform: translateY(-1px); box-shadow: 0 10px 22px -10px rgba(20, 20, 20, .6); }
.btn-google-g { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #fff; flex: 0 0 28px; }
html[data-theme="dark"] .btn-google { background: #fff; color: #1f1f1f; border-color: #fff; box-shadow: none; }
html[data-theme="dark"] .btn-google:hover { background: #ecebe6; color: #1f1f1f; }

.login-notes { list-style: none; margin: 24px 0 0; padding: 20px 0 0; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.login-notes li { display: flex; gap: 12px; font-size: 15px; line-height: 1.65; color: var(--muted); }
.login-notes li::before {
  content: ""; flex: 0 0 7px; height: 7px; margin-top: .66em;
  border-radius: 1.5px; background: var(--yellow-deep); transform: rotate(45deg);
}
.dev-login {
  margin-top: 24px; padding: 14px; border: 1.5px dashed var(--line-strong);
  border-radius: 12px; background: var(--surface-2);
}
.dev-login-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.dev-login-row input { flex: 1; min-width: 0; padding: 8px 12px; font-size: 16px; }
.login-foot { margin: 28px 0 0; text-align: center; font-size: 14.5px; line-height: 1.7; color: var(--muted); }
.login-foot a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

html[data-theme="dark"] .login-brand {
  background: radial-gradient(120% 80% at 0% 100%, rgba(223, 204, 99, .14), rgba(223, 204, 99, 0) 62%), #121210;
  color: #eeece3; border-right: 1px solid var(--line);
}
html[data-theme="dark"] .login-logo,
html[data-theme="dark"] .login-slogan-en strong { color: var(--yellow); }
html[data-theme="dark"] .login-watermark { color: rgba(223, 204, 99, .06); }
html[data-theme="dark"] .login-systems { border-top-color: rgba(255, 255, 255, .14); }
html[data-theme="dark"] .login-systems li { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .12); }

@keyframes login-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* จอแคบ: แผงแบรนด์ขึ้นบน (เตี้ยลง) การ์ดตามมาข้างล่าง · โทรศัพท์ซ่อนรายชื่อระบบให้ปุ่มเข้าสู่ระบบอยู่ใกล้ */
@media (max-width: 960px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { gap: 30px; padding: 22px 20px 32px; }
  .login-logo { width: 84px; }
  .login-watermark { width: 74%; right: -18%; top: auto; bottom: -14%; }
  .login-slogan-en { font-size: clamp(27px, 6.4vw, 40px); }
  .login-slogan-th { font-size: 16px; margin-top: 12px; }
  .login-systems { margin-top: 24px; }
  .login-tools { top: 16px; right: 16px; }
  .login-panel { padding: 34px 16px 24px; }
  .login-card h1 { font-size: 30px; }
  html[data-theme="dark"] .login-brand { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .login-systems { display: none; }
}

/* ── [prog] ระบบ Pitching กลาง — ส่วนหัวหน้างานโทนมืดแบบโลโก้กลับด้าน (เหลือง AI SIAM บนพื้นดำ)
   ใช้เหลืองเป็น "เส้น/ป้าย/ตัวเน้น" ตัวหนังสือหลักเป็นสีสว่าง (อ่านง่ายทั้งโหมดสว่างและมืด) ── */
.prog-hero {
  background: #121210; color: #f0efe8; border-radius: var(--radius); padding: 30px 28px 26px;
  border-top: 5px solid var(--yellow); position: relative; overflow: hidden; margin-bottom: 20px;
}
.prog-hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(223, 204, 99, .35), rgba(223, 204, 99, 0) 70%);
}
.prog-hero h1 { color: #fff; margin: 6px 0 4px; font-size: 30px; line-height: 1.3; position: relative; z-index: 1; }
.prog-hero .prog-tagline { color: var(--yellow); font-size: 18px; position: relative; z-index: 1; }
.prog-hero .prog-meta { color: #c8c5ba; font-size: 15.5px; margin-top: 10px; position: relative; z-index: 1; }
.prog-hero .prog-kind {
  display: inline-block; font-size: 13px; letter-spacing: .04em; padding: 2px 10px; border-radius: 12px;
  background: var(--yellow); color: #141414; font-weight: 600; position: relative; z-index: 1;
}
.prog-hero .btn { position: relative; z-index: 1; }
.prog-hero .btn-gold, .btn-gold { background: var(--yellow); color: #141414; }
.prog-hero .btn-gold:hover, .btn-gold:hover { background: var(--yellow-soft); color: #141414; }
.prog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.prog-card {
  display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--line);
  border-top: 4px solid var(--brand); border-radius: var(--radius); padding: 18px 18px 14px; color: var(--ink);
}
a.prog-card:hover { text-decoration: none; border-color: var(--brand); }
.prog-card .t { font-weight: 600; font-size: 18px; }
.prog-card .m { color: var(--muted); font-size: 15px; }
.prog-timeline { list-style: none; margin: 0; padding: 0; }
.prog-timeline li { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.prog-timeline li:last-child { border-bottom: 0; }
.prog-timeline .n {
  flex: 0 0 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: var(--brand); color: var(--on-brand);
}
.prog-code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 24px; letter-spacing: .18em; font-weight: 700;
  padding: 6px 14px; border-radius: 8px; background: var(--gold-bg); color: var(--gold-ink); display: inline-block;
}
.prog-score { width: 110px; }
.prog-rank-1 td:first-child { color: var(--gold-ink); font-weight: 700; }

/* ---------------------------------------------------------- แถบ "วันนี้ที่ศูนย์ AI" (partials/today_strip.php) + หน้า /today
   แถวเดียวใต้คำทักทายของหน้าแรก เลื่อนซ้าย-ขวาได้ — initPortal() วัดความสูงที่เหลือหลังแถบนี้เอง หน้าจึงยังพอดีจอเดียว
   สีขอบซ้ายของแต่ละชิ้นมาจาก --m-color ของระบบที่เกี่ยวข้อง · แจ้งเตือนสำคัญใช้สีแดง */
.today-strip {
  display: flex; align-items: center; gap: 14px; margin: -8px 0 18px;
  padding: 8px 10px 8px 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow);
}
.today-strip-title { flex: 0 0 auto; margin: 0; font-size: 16px; font-weight: 700; white-space: nowrap; }
.today-strip-list {
  flex: 1 1 auto; min-width: 0; display: flex; gap: 10px; margin: 0; padding: 2px; list-style: none;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin;
}
.today-strip-list > li { flex: 0 0 auto; scroll-snap-align: start; }
.today-chip {
  display: flex; align-items: center; gap: 10px; width: 290px; height: 100%; padding: 7px 12px 7px 9px;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  border-left: 4px solid var(--m-color, var(--yellow-deep)); border-radius: 10px;
}
.today-chip:hover { text-decoration: none; color: var(--ink); border-color: var(--m-color, var(--yellow-deep)); }
.today-chip.kind-alert { --m-color: var(--danger); background: var(--danger-bg); }
.today-chip-icon {
  flex: 0 0 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; font-size: 20px; line-height: 1;
  background: color-mix(in srgb, var(--m-color, var(--yellow)) 16%, var(--card));
}
.today-chip-icon.has-logo { background: none; }
.today-chip-icon img { width: 100%; height: 100%; border-radius: 10px; }
.today-chip-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.today-chip-kind { font-size: 13px; color: var(--muted); }
.today-chip.kind-alert .today-chip-kind { color: var(--danger); font-weight: 600; }
.today-chip-title { font-size: 15.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-strip-all { flex: 0 0 auto; font-size: 15px; font-weight: 600; white-space: nowrap; padding: 0 6px; }
@media (max-width: 760px) {
  .today-strip { flex-wrap: wrap; gap: 8px 12px; margin-top: -10px; padding: 10px 12px; }
  .today-strip-title { flex: 1 1 auto; }
  .today-strip-all { order: 2; }
  .today-strip-list { order: 3; flex-basis: 100%; }
  .today-chip { width: 250px; }
}

.today-section { margin-bottom: 30px; }
.today-section h2 { font-size: 19px; font-weight: 700; margin: 0 0 12px; }
.today-card {
  display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; padding: 16px 18px;
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--m-color, var(--yellow-deep));
  border-radius: var(--radius); box-shadow: var(--shadow); scroll-margin-top: 90px;
}
.today-card:target { box-shadow: 0 0 0 3px var(--focus-soft), var(--shadow); }
.today-card.kind-alert { --m-color: var(--danger); }
.today-card-icon {
  flex: 0 0 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; font-size: 24px;
  background: color-mix(in srgb, var(--m-color, var(--yellow)) 16%, var(--card));
}
.today-card-body { min-width: 0; flex: 1; }
.today-card-meta { font-size: 14px; color: var(--muted); }
.today-card.kind-alert .today-kind { color: var(--danger); font-weight: 600; }
.today-card h3 { margin: 2px 0 6px; font-size: 18px; font-weight: 700; line-height: 1.45; }
.today-card p { margin: 0 0 10px; color: var(--ink-2); line-height: 1.7; }

/* ---------------------------------------------------------- [prog] Pitch & Hack — ส่วนเพิ่มให้เท่าระบบ Hackathon เดิม (037_prog_parity)
   หน้าปก นับถอยหลัง consent QR หลังสมัคร ตัวเลือก SDG สถิติภาพรวม ตารางคะแนนรายกรรมการ แท็บ SDG ── */
.prog-cover { display: block; width: 100%; max-height: 340px; object-fit: cover; border-radius: var(--radius); margin-bottom: 14px; background: var(--surface-3); }
.prog-countdown { position: relative; z-index: 1; margin-top: 16px; }
.prog-cd-label { color: #c8c5ba; font-size: 15px; margin-bottom: 8px; }
.prog-cd-boxes { display: flex; gap: 10px; flex-wrap: wrap; }
.prog-cd-boxes > div {
  min-width: 74px; padding: 8px 10px; text-align: center; border-radius: 10px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(223, 204, 99, .45);
}
.prog-cd-boxes b { display: block; font-size: 28px; line-height: 1.1; color: var(--yellow); font-variant-numeric: tabular-nums; }
.prog-cd-boxes span { font-size: 13px; color: #c8c5ba; }
.prog-consent { margin: 4px 0 12px; padding: 10px 12px; border-radius: 8px; background: var(--surface-3); border: 1px solid var(--line); }
.prog-next > summary { cursor: pointer; list-style: none; }
.prog-next > summary::-webkit-details-marker { display: none; }
.prog-next-body { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.prog-qr { width: 200px; max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); background: #fff; padding: 6px; }
.prog-thumb { display: block; max-width: 220px; max-height: 140px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); margin: 6px 0; background: var(--surface-3); }
.prog-date-n { font-size: 14px; }
.prog-edit { margin-top: 6px; }
.prog-edit > summary { cursor: pointer; color: var(--brand); }
.prog-edit form { margin-top: 8px; padding: 10px; border: 1px dashed var(--line); border-radius: 8px; }
.prog-session { padding: 10px 0; border-bottom: 1px solid var(--line); }
.prog-session:last-child { border-bottom: 0; }
.prog-sdg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.prog-sdg-item { align-items: flex-start; font-size: 15px; }
.prog-sdg-chip {
  display: inline-block; margin: 2px 6px 2px 0; padding: 2px 10px; border-radius: 99px; font-size: 14px;
  background: var(--gold-bg); color: var(--gold-ink); border: 1px solid var(--line);
}
.prog-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.prog-stat { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: var(--radius); padding: 14px 16px; }
.prog-stat b { display: block; font-size: 28px; line-height: 1.2; }
.prog-stat span { color: var(--muted); font-size: 14.5px; }
.prog-stat small { display: block; color: var(--muted); font-size: 13px; }
.prog-stat.warn { border-top-color: var(--warn); background: var(--warn-bg); }
.prog-matrix td, .prog-matrix th { vertical-align: top; }
.prog-matrix tr.prog-matrix-team td { border-top: 2px solid var(--line); }
.prog-sdg-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.prog-sdg-list { max-height: 75vh; overflow-y: auto; }
.prog-sdg-team { display: block; padding: 8px 10px; border-radius: 8px; border: 1px solid transparent; color: var(--ink); }
.prog-sdg-team:hover { text-decoration: none; background: var(--surface-3); }
.prog-sdg-team.active { border-color: var(--brand); background: var(--gold-bg); }
.prog-sdg-team .small { display: block; }
@media (max-width: 760px) {
  .prog-sdg-layout { grid-template-columns: 1fr; }
  .prog-sdg-list { max-height: none; }
  .prog-cd-boxes > div { min-width: 64px; }
}
