/* =========================================================
   ระบบ PA สำนักงานมหาวิทยาลัย — Design System
   CSS ล้วน ไม่มีไลบรารีภายนอกและไม่โหลดฟอนต์จากอินเทอร์เน็ต
   ใช้ฟอนต์ไทยที่ติดตั้งในเครื่องผู้ใช้ตามลำดับความสวยงาม
   ========================================================= */

:root {
  --primary: #6869AD;
  --primary-dark: #494A91;
  --primary-darker: #37386f;
  --primary-light: #e9e9f7;
  --primary-lighter: #f4f4fb;
  --accent: #A00020;
  --accent-dark: #7d0019;
  --accent-light: #fbe9ec;
  --ink: #1f2130;
  --ink-2: #4b4e63;
  --ink-3: #8a8da3;
  --bg: #f3f4f9;
  --card: #ffffff;
  --line: #e4e5f0;
  --green: #1a9e5c; --green-bg: #e3f6ec;
  --amber: #b97a08; --amber-bg: #fdf3dd;
  --blue: #2264c7;  --blue-bg: #e6effc;
  --red: #c22036;   --red-bg: #fbe9ec;
  --gray: #6b7280;  --gray-bg: #eef0f4;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(40,42,80,.07), 0 8px 24px rgba(40,42,80,.06);
  --shadow-lg: 0 4px 12px rgba(40,42,80,.12), 0 16px 48px rgba(40,42,80,.14);
  /* ฟอนต์หลักทั้งระบบ — Sarabun เก็บไฟล์ไว้ในโปรเจกต์ (ดู fonts.css) */
  --thai-font: 'Sarabun', 'Noto Sans Thai', 'Prompt', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* กันไอคอนหลุดขนาด: SVG ทุกตัวมีขนาดตั้งต้น 24px และไม่ถูกบีบ/ยืดโดย flexbox
   กราฟที่ต้องยืดเต็มความกว้างประกาศทับไว้เฉพาะที่ (.chart-box > svg) */
svg { width: 24px; height: 24px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
/* จองพื้นที่ scrollbar ไว้เสมอ — กันเนื้อหาขยับซ้าย-ขวาเวลาสลับหน้าที่ยาวไม่เท่ากัน */
html { font-size: 15px; scrollbar-gutter: stable; }
body {
  font-family: var(--thai-font);
  font-weight: 400;
  background: var(--bg); color: var(--ink);
  /* ตัวอักษรไทยมีสระบน-ล่าง ต้องเว้นบรรทัดให้โปร่ง ไม่ชิดกัน */
  line-height: 1.65;
  /* ขึ้นบรรทัดใหม่ตามพจนานุกรมคำไทยของเบราว์เซอร์ (อาศัย lang="th" ที่แท็ก html)
     ห้ามตัดกลางคำ และไม่ใส่ยัติภังค์ — ค่าเหล่านี้สืบทอดไปทุกองค์ประกอบในหน้า */
  word-break: normal;
  overflow-wrap: normal;
  line-break: normal;
  hyphens: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; }

/* ===== Layout: แถบเมนูแนวนอนด้านบน (top navigation) ===== */
.layout { display: flex; flex-direction: column; min-height: 100vh; }

.topnav {
  position: sticky; top: 0; z-index: 50; color: #fff;
  background: var(--primary-dark);
  box-shadow: 0 2px 10px rgba(40,42,80,.18);
}
.topnav-inner {
  display: flex; align-items: center; gap: 6px;
  max-width: 1360px; margin: 0 auto; padding: 0 22px; min-height: 60px;
}

/* แบรนด์ */
.tn-brand { display: flex; align-items: center; gap: 11px; color: #fff; padding: 8px 0; margin-right: 10px; flex-shrink: 0; }
.tn-brand:hover { text-decoration: none; }
.tn-brand img { width: 40px; height: auto; background: #fff; border-radius: 9px; padding: 3px; }
.tn-brand .t1 { font-weight: 700; font-size: .96rem; line-height: 1.25; }
.tn-brand .t2 { font-size: .7rem; opacity: .8; line-height: 1.3; }

/* เมนูหลัก */
.tn-menu { display: flex; align-items: center; gap: 2px; flex: 1; }
.tn-link {
  display: inline-flex; align-items: center; gap: 8px; color: rgba(255,255,255,.86);
  padding: 9px 13px; border-radius: 9px; font-size: .9rem; font-weight: 500; white-space: nowrap;
  border: 0; background: transparent; cursor: pointer; font-family: inherit; position: relative;
}
.tn-link svg { width: 18px; height: 18px; opacity: .9; }
.tn-link:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
/* เมนูที่เลือกอยู่ = ปุ่มขาวทึบชั้นเดียว ตัวอักษร/ไอคอนสีน้ำเงินแบรนด์ */
.tn-link.active, .tn-link.active:hover {
  background: #fff; color: var(--primary-dark); font-weight: 700; box-shadow: none;
}
.caret { display: inline-block; width: 6px; height: 6px; margin-left: 3px; margin-bottom: 2px;
  border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); opacity: .85; }

/* dropdown (เครื่องมือผู้ดูแล / โปรไฟล์) */
.tn-dd { position: relative; }
.tn-dd-panel {
  position: absolute; top: calc(100% + 9px); left: 0; min-width: 224px;
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 90;
}
.tn-dd.open .tn-dd-panel { display: block; }
.tn-dd-panel.tn-dd-right { left: auto; right: 0; }
.tn-dd-panel a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--ink-2); font-size: .88rem; font-weight: 500;
}
.tn-dd-panel a svg { width: 18px; height: 18px; opacity: .9; color: var(--primary-dark); }
.tn-dd-panel a:hover { background: var(--primary-lighter); color: var(--primary-darker); text-decoration: none; }
.tn-dd-panel a.active { background: var(--primary-light); color: var(--primary-darker); font-weight: 700; }
.tn-dd-sep { height: 1px; background: var(--line); margin: 5px 8px; }
.tn-prof-head { padding: 9px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.tn-prof-head .n { font-weight: 700; font-size: .88rem; color: var(--ink); }
.tn-prof-head .r { font-size: .74rem; color: var(--ink-3); }

/* ฝั่งขวา: กระดิ่ง + โปรไฟล์ */
.tn-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: 8px; }
.tn-icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 10px; border: 0;
  background: rgba(255,255,255,.12); color: #fff; display: inline-grid; place-items: center; cursor: pointer;
}
.tn-icon-btn:hover { background: rgba(255,255,255,.22); }
.tn-icon-btn svg { width: 20px; height: 20px; }
.tn-prof-btn {
  display: flex; align-items: center; gap: 8px; border: 0; cursor: pointer; font-family: inherit;
  background: rgba(255,255,255,.12); color: #fff; border-radius: 10px; padding: 4px 9px 4px 4px;
}
.tn-prof-btn:hover { background: rgba(255,255,255,.22); }
.tn-prof-btn .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--primary-dark);
  display: grid; place-items: center; font-weight: 700; font-size: .82rem; flex-shrink: 0;
}
.tn-prof-txt { display: flex; flex-direction: column; line-height: 1.22; text-align: left; max-width: 150px; }
/* จอแคบ — บีบชื่อ/ส่วนงานในปุ่มโปรไฟล์ให้ตัดด้วย … ไม่ดันแถบเมนูจนหน้าล้นแนวนอน */
@media (max-width: 1200px) { .tn-prof-txt { max-width: 88px; } }
.tn-prof-txt .uname { font-size: .8rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tn-prof-txt .urole { font-size: .66rem; opacity: .82; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ปุ่มแฮมเบอร์เกอร์ (แสดงเฉพาะจอแคบ) */
.tn-burger {
  display: none; width: 42px; height: 42px; border: 0; border-radius: 10px; flex-shrink: 0;
  background: rgba(255,255,255,.12); color: #fff; cursor: pointer; place-items: center;
}
.tn-burger:hover { background: rgba(255,255,255,.22); }
.tn-burger svg { width: 22px; height: 22px; }

/* เนื้อหา + ท้ายหน้า */
.main { flex: 1; min-width: 0; }
.content { padding: 22px; max-width: 1360px; width: 100%; margin: 0 auto; }
.site-foot {
  text-align: center; padding: 15px 18px; font-size: .72rem; color: var(--ink-3);
  border-top: 1px solid var(--line); background: #fff;
}
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title h1 { font-size: 1.35rem; font-weight: 800; color: var(--primary-darker); }
.page-title .sub { font-size: .84rem; color: var(--ink-3); margin-top: 2px; }

/* ===== Cards ===== */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.card-pad { padding: 20px; }
.card-head {
  padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.card-head h2 { font-size: 1rem; font-weight: 700; color: var(--primary-darker); }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line);
  padding: 13px 15px; display: flex; align-items: center; gap: 12px; position: relative; overflow: hidden;
}
.stat-card::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--primary); }
.stat-card.accent::after { background: var(--accent); }
.stat-card.green::after { background: var(--green); }
.stat-card.amber::after { background: var(--amber); }
.stat-card .ic {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--primary-light); color: var(--primary-dark);
}
.stat-card.accent .ic { background: var(--accent-light); color: var(--accent); }
.stat-card.green .ic { background: var(--green-bg); color: var(--green); }
.stat-card.amber .ic { background: var(--amber-bg); color: var(--amber); }
.stat-card .ic svg { width: 22px; height: 22px; }
.stat-card .st-txt { min-width: 0; }
.stat-card .num { font-size: 1.5rem; font-weight: 800; line-height: 1.15; color: var(--ink); }
.stat-card .lbl { font-size: .76rem; color: var(--ink-3); line-height: 1.35; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .stat-grid { grid-template-columns: minmax(0, 1fr); } }

/* แท็บมุมมองข้อมูล Dashboard (ทางการ / ตามที่กรอก) */
.dash-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; background: var(--primary-lighter);
  border: 1px solid var(--line); border-radius: 12px; padding: 5px; margin-bottom: 14px;
}
.dash-tabs a {
  display: inline-flex; align-items: center; gap: 9px; padding: 9px 18px; border-radius: 9px;
  font-size: .9rem; font-weight: 700; color: var(--ink-2);
}
.dash-tabs a svg { width: 18px; height: 18px; opacity: .9; }
.dash-tabs a:hover { background: #fff; text-decoration: none; }
.dash-tabs a.on { background: var(--primary-dark); color: #fff; box-shadow: 0 2px 8px rgba(73,74,145,.32); }
.dash-tabs a .sub { font-size: .72rem; font-weight: 500; opacity: .85; }

/* แถบเครื่องมือ: ตัวกรองซ้าย · ปุ่มขวา · ความสูง control เท่ากัน */
.dash-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.dash-toolbar .tb-left, .dash-toolbar .tb-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash-toolbar .tb-right { margin-left: auto; }
.dash-toolbar .inp { height: 38px; width: auto; }
.dash-toolbar select.unit-select { max-width: 320px; }
.dash-toolbar .kset-sw { height: 38px; padding: 4px; }
.dash-toolbar .btn { height: 38px; display: inline-flex; align-items: center; }

/* ===== หน้าแรกแบบตารางไอคอน ===== */
.menu-section { margin-bottom: 26px; }
.menu-section h2 {
  font-size: .95rem; font-weight: 700; color: var(--primary-darker); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.menu-section h2::before { content: ''; width: 4px; height: 18px; background: var(--accent); border-radius: 3px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 13px; }
.icon-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 11px; text-align: center;
  box-shadow: var(--shadow); transition: all .18s; color: var(--ink);
}
.icon-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); text-decoration: none; }
.icon-tile .ic {
  width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: #fff;
  box-shadow: 0 6px 14px rgba(104,105,173,.35);
}
.icon-tile.accent .ic { background: linear-gradient(135deg, #c02642 0%, var(--accent) 100%); box-shadow: 0 6px 14px rgba(160,0,32,.3); }
.icon-tile .ic svg { width: 27px; height: 27px; }
.icon-tile .t { font-weight: 600; font-size: .88rem; line-height: 1.45; }
.icon-tile .d { font-size: .72rem; color: var(--ink-3); line-height: 1.5; }

/* ===== ปุ่ม ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: none; cursor: pointer;
  font-size: .87rem; font-weight: 600; border-radius: 10px;
  padding: 8px 16px; transition: all .15s; text-decoration: none !important; line-height: 1.5;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 3px 10px rgba(160,0,32,.25); }
.btn-accent:hover { background: var(--accent-dark); }
.btn-outline { background: #fff; color: var(--primary-dark); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-lighter); }
.btn-ghost { background: var(--gray-bg); color: var(--ink-2); }
.btn-ghost:hover { background: var(--line); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { filter: brightness(.92); }
.btn-red { background: var(--red-bg); color: var(--red); }
.btn-red:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: .78rem; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ===== ป้ายสถานะ ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700;
  border-radius: 99px; padding: 3px 10px; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.gray { background: var(--gray-bg); color: var(--gray); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.purple { background: var(--primary-light); color: var(--primary-dark); }

/* ปุ่มช่วยเหลือประจำหน้า (มุมขวาล่าง) */
.help-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  width: 50px; height: 50px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff;
  box-shadow: 0 5px 18px rgba(73, 74, 145, .42);
  display: grid; place-items: center; transition: transform .18s, box-shadow .18s;
}
.help-fab svg { width: 23px; height: 23px; }
.help-fab:hover { transform: scale(1.09); box-shadow: 0 7px 22px rgba(73, 74, 145, .5); }
.help-fab.on { background: var(--accent); }
.help-pop {
  position: fixed; right: 24px; bottom: 86px; z-index: 60; width: 380px; max-width: calc(100vw - 40px);
  background: #fff; border: 1px solid var(--line); border-radius: 15px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18); padding: 16px 18px 14px;
  display: none; animation: helpIn .18s ease-out;
}
.help-pop.show { display: block; }
@keyframes helpIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
.help-hd { display: flex; align-items: center; gap: 9px; color: var(--primary-darker);
  font-size: .95rem; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.help-hd svg { width: 18px; height: 18px; flex-shrink: 0; }
.help-x { margin-left: auto; background: none; border: none; cursor: pointer; color: var(--ink-3); padding: 2px; }
.help-x svg { width: 16px; height: 16px; }
.help-pop ul { margin: 12px 0 0; padding-left: 20px; }
.help-pop ul li { margin-bottom: 8px; line-height: 1.68; font-size: .85rem; color: var(--ink-2); }
.help-pop ul li::marker { color: var(--primary); }
.help-more { display: inline-flex; align-items: center; gap: 7px; margin-top: 8px;
  font-size: .83rem; font-weight: 600; color: var(--primary-dark); text-decoration: none; }
.help-more:hover { text-decoration: underline; }
.help-more svg { width: 16px; height: 16px; }
@media (max-width: 640px) {
  .help-fab { right: 15px; bottom: 15px; width: 44px; height: 44px; }
  .help-pop { right: 15px; bottom: 68px; }
}
@media print { .help-fab, .help-pop { display: none !important; } }

/* สวิตช์เลือกชุดตัวชี้วัด (เฉพาะตัวชี้วัด PA / ทุกตัวชี้วัดตามแผน) */
.kset-sw { display: inline-flex; background: var(--primary-lighter); border: 1px solid var(--line);
  border-radius: 10px; padding: 3px; gap: 3px; }
.kset-sw a { padding: 6px 14px; border-radius: 8px; font-size: .8rem; font-weight: 600;
  color: var(--ink-2); text-decoration: none; white-space: nowrap; transition: background .15s, color .15s; }
.kset-sw a:hover { background: #fff; }
.kset-sw a.on { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(104, 105, 173, .35); }

/* ขั้นตอน workflow */
.stepper { display: flex; gap: 0; flex-wrap: wrap; margin: 10px 0 4px; }
.step { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--ink-3); }
.step .dot {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gray-bg); color: var(--ink-3); font-weight: 700; font-size: .75rem;
  border: 2px solid var(--line);
}
.step.done .dot { background: var(--green); border-color: var(--green); color: #fff; }
.step.now .dot { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--primary-light); }
.step.returned .dot { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-light); }
.step.done, .step.now { color: var(--ink); font-weight: 600; }
.step.returned { color: var(--accent); font-weight: 700; }
.step .bar { width: 34px; height: 2px; background: var(--line); margin: 0 8px; }
.step.done .bar { background: var(--green); }

/* สรุปว่ารออยู่ที่ใครและนานแค่ไหน (ใต้ stepper) */
.appr-note {
  display: flex; align-items: flex-start; gap: 9px; margin-top: 12px;
  background: var(--primary-lighter); border: 1px solid var(--line); border-left: 3px solid var(--primary);
  border-radius: 10px; padding: 10px 13px; font-size: .84rem; color: var(--ink-2); line-height: 1.6;
}
.appr-note svg { width: 17px; height: 17px; color: var(--primary-dark); flex-shrink: 0; margin-top: 2px; }
.appr-note b { color: var(--ink); }
.appr-note.returned { background: var(--accent-light); border-color: #f0cdd5; border-left-color: var(--accent); color: #7a2733; }
.appr-note.returned svg, .appr-note.returned b { color: var(--accent); }
.appr-note.done { background: var(--green-bg); border-color: #cfe9db; border-left-color: var(--green); color: #14724a; }
.appr-note.done svg, .appr-note.done b { color: var(--green); }

/* ---- stepper แบบย่อ (ในแถวตาราง) ---- */
.mini-steps { display: inline-flex; align-items: center; margin: 5px 0 3px; }
.mini-steps i {
  width: 11px; height: 11px; border-radius: 50%; background: var(--line);
  flex-shrink: 0; display: block; position: relative;
}
.mini-steps i.done { background: var(--green); }
.mini-steps i.current { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.mini-steps i.returned { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.mini-steps s { width: 16px; height: 2px; background: var(--line); display: block; flex-shrink: 0; }
.mini-steps s.done { background: var(--green); }
.mini-wait { font-size: .7rem; color: var(--ink-3); line-height: 1.45; display: block; margin-top: 2px; }
.mini-wait.returned { color: var(--accent); font-weight: 600; }

/* ===== ตาราง ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .85rem; background: #fff; }
.tbl thead th {
  background: var(--primary-dark); color: #fff; font-weight: 600; text-align: left;
  padding: 10px 12px; white-space: nowrap; position: sticky; top: 0; z-index: 5; font-size: .8rem;
}
.tbl thead th.num, .tbl td.num { text-align: right; }
.tbl thead th.ctr, .tbl td.ctr { text-align: center; }
.tbl tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:nth-child(even) { background: var(--primary-lighter); }
.tbl tbody tr:hover { background: var(--primary-light); }
.tbl .kpi-name { min-width: 260px; max-width: 420px; }
.tbl .month-col { min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.closed { background: var(--gray-bg); color: var(--ink-3); }

/* ===== ฟอร์ม ===== */
label.fl { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-2); margin: 0 0 5px; }
.inp, select.inp, textarea.inp {
  width: 100%; font-size: .88rem; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #fff;
  transition: border .15s, box-shadow .15s;
}
.inp:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.inp[disabled], .inp[readonly] { background: var(--gray-bg); color: var(--ink-3); }
.inp-sm { padding: 5px 8px; font-size: .82rem; border-radius: 8px; }
.frm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.fld { margin-bottom: 12px; }
.hint { font-size: .73rem; color: var(--ink-3); margin-top: 3px; }
/* หัวข้อย่อยภายในฟอร์ม — ใช้โทนน้ำเงินม่วงของระบบ (สีแดงสงวนไว้ให้ปุ่มหลักและข้อความแจ้งเตือน) */
.frm-sec {
  font-size: .9rem; font-weight: 700; color: var(--primary); margin: 18px 0 9px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.frm-sec:first-of-type { margin-top: 8px; }
.req { color: var(--accent); }

/* สวิตช์เปิด/ปิด */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl { position: absolute; inset: 0; background: #cdd0dd; border-radius: 99px; cursor: pointer; transition: .2s; }
.switch .sl::before {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  left: 3px; top: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .sl { background: var(--green); }
.switch input:checked + .sl::before { transform: translateX(20px); }

/* แถบตัวกรอง */
.filter-bar {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 18px; margin-bottom: 18px;
}
.filter-bar .fld { margin: 0; min-width: 170px; }

/* dropdown ค้นหาได้ */
.sdrop { position: relative; }
.sdrop .sdrop-list {
  position: absolute; z-index: 50; top: calc(100% + 4px); left: 0; right: 0; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg);
  max-height: 260px; overflow-y: auto; display: none;
}
.sdrop.open .sdrop-list { display: block; }
.sdrop-list .opt { padding: 8px 12px; cursor: pointer; font-size: .85rem; }
.sdrop-list .opt:hover { background: var(--primary-light); }

/* ===== Modal ===== */
.modal-bg {
  position: fixed; inset: 0; background: rgba(31,33,48,.55); z-index: 100;
  display: none; align-items: flex-start; justify-content: center; padding: 4vh 16px; overflow-y: auto;
}
.modal-bg.open { display: flex; }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 780px; animation: pop .18s ease-out; }
.modal.narrow { max-width: 480px; }
@keyframes pop { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; gap: 10px;
}
.modal-head h3 { font-size: 1.02rem; font-weight: 700; color: var(--primary-darker); }
.modal-head .x { border: none; background: var(--gray-bg); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 1rem; color: var(--ink-2); }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* กล่องกรอกเหตุผล — บอกว่ากำลังทำกับรายการใด และเตือนใต้ช่องเมื่อเว้นว่าง */
.rs-subject {
  background: var(--primary-lighter); border-radius: 10px; padding: 11px 14px;
  font-size: .86rem; line-height: 1.7; color: var(--ink-2); margin-bottom: 14px;
  white-space: pre-line;   /* ให้ขึ้นบรรทัดใหม่ตาม \n ที่ส่งมา */
}
.rs-err { min-height: 18px; font-size: .78rem; color: var(--accent); margin-top: 5px; }
.inp.has-err, textarea.inp.has-err { border-color: var(--accent); background: var(--accent-light); }

/* ===== ข้อความแจ้งผล ===== */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--ink); color: #fff; border-radius: 11px; padding: 11px 16px; font-size: .86rem;
  box-shadow: var(--shadow-lg); animation: pop .2s; max-width: 380px;
}
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }

/* ===== การแจ้งเตือน ===== */
.nbadge {
  display: none; background: var(--accent); color: #fff; border-radius: 99px;
  min-width: 18px; height: 18px; padding: 0 5px; font-size: .68rem; font-weight: 700;
  line-height: 18px; text-align: center; flex-shrink: 0;
}
.nbadge.show { display: inline-block; }
.nav a .nbadge { margin-left: auto; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.bellwrap { position: relative; }
.bellwrap .bell-badge { position: absolute; top: -5px; right: -5px; box-shadow: 0 0 0 2px #fff; }
.notif-dd {
  position: absolute; right: 0; top: calc(100% + 9px); width: 372px; max-width: 88vw;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  z-index: 80; display: none; overflow: hidden;
}
.notif-dd.open { display: block; }
.notif-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--primary-lighter);
  color: var(--primary-darker); font-size: .9rem;
}
#notifList { max-height: 350px; overflow-y: auto; }
.notif-item { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif-item:hover { background: var(--primary-lighter); }
.notif-item.read { opacity: .55; }
.notif-item .ni-title { font-size: .84rem; font-weight: 700; color: var(--ink); }
.notif-item .ni-body { font-size: .78rem; color: var(--ink-2); margin-top: 2px; }
.notif-item .ni-meta { font-size: .7rem; color: var(--ink-3); margin-top: 3px; }
.notif-ft {
  display: block; text-align: center; padding: 9px; font-size: .82rem; font-weight: 600;
  color: var(--primary-dark); border-top: 1px solid var(--line); background: #fff;
}
.notif-ft:hover { background: var(--primary-lighter); text-decoration: none; }

/* ===== สถานะ "ยังไม่มีข้อมูล" (ใช้ร่วมกันทุกหน้า) =====
   กล่องสูงคงที่ ไม่ยืดตามเนื้อหา · ไอคอนขนาดคงที่ 56px สีเทาอ่อน
   ห้ามพึ่ง viewBox อย่างเดียว จึงกำหนด width/height เป็น px และ flex-shrink: 0 */
.empty {
  min-height: 300px; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px 24px; color: var(--ink-3); gap: 0;
}
.empty > svg {
  width: 56px; height: 56px; min-width: 56px; min-height: 56px;
  flex-shrink: 0; flex-grow: 0;
  color: var(--ink-3); opacity: .42; stroke-width: 1.5; margin-bottom: 14px;
}
.empty .t { font-weight: 700; color: var(--ink-2); font-size: .95rem; line-height: 1.55; }
.empty .d { font-size: .82rem; margin-top: 5px; line-height: 1.65; max-width: 460px; }
.empty .a { margin-top: 16px; display: flex; gap: 9px; flex-wrap: wrap; justify-content: center; }
/* ในช่องตาราง (td) ให้เตี้ยลงเล็กน้อยแต่ยังคงสัดส่วนเดิม */
td > .empty, .empty.in-cell { min-height: 240px; }

/* ===== อื่น ๆ ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }
.mt { margin-top: 18px; } .mb { margin-bottom: 18px; }
.muted { color: var(--ink-3); font-size: .8rem; }
.tag { display: inline-block; background: var(--primary-light); color: var(--primary-dark); border-radius: 7px; padding: 2px 8px; font-size: .72rem; font-weight: 600; margin: 1px; }
.progressbar { height: 8px; background: var(--gray-bg); border-radius: 99px; overflow: hidden; min-width: 80px; }
.progressbar > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); }
.progressbar.good > div { background: linear-gradient(90deg, #29b46c, var(--green)); }
.progressbar.warn > div { background: linear-gradient(90deg, #eab308, var(--amber)); }
.progressbar.bad > div { background: linear-gradient(90deg, #e35d70, var(--red)); }

/* เส้นเวลา */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before {
  content: ''; position: absolute; left: -23px; top: 5px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary); border: 2.5px solid #fff; box-shadow: 0 0 0 2px var(--primary-light);
}
.tl-item.red::before { background: var(--red); }
.tl-item.green::before { background: var(--green); }
.tl-item .tl-t { font-size: .85rem; font-weight: 600; }
.tl-item .tl-d { font-size: .78rem; color: var(--ink-2); }
.tl-item .tl-m { font-size: .72rem; color: var(--ink-3); }

/* ไฟล์แนบ */
.att {
  display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 11px; font-size: .82rem; background: var(--primary-lighter); margin: 4px 0;
}
.att svg { width: 17px; height: 17px; color: var(--accent); flex-shrink: 0; }
.att .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.att .sz { color: var(--ink-3); font-size: .72rem; }

/* ===== หน้าเข้าสู่ระบบ ===== */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(135deg, var(--primary-darker) 0%, var(--primary) 55%, #8788c4 100%);
  position: relative; overflow: hidden;
}
.login-wrap::before, .login-wrap::after { content: ''; position: absolute; border-radius: 50%; opacity: .13; background: #fff; }
.login-wrap::before { width: 480px; height: 480px; top: -160px; right: -120px; }
.login-wrap::after { width: 360px; height: 360px; bottom: -140px; left: -100px; background: var(--accent); opacity: .2; }
.login-card {
  background: #fff; border-radius: 22px; box-shadow: 0 24px 70px rgba(20,20,60,.4);
  width: 100%; max-width: 430px; padding: 36px 34px; position: relative; z-index: 2;
}
.login-card img.lg { width: 120px; display: block; margin: 0 auto 10px; }
.login-card h1 { font-size: 1.15rem; text-align: center; color: var(--primary-darker); font-weight: 800; }
.login-card .sub { text-align: center; font-size: .8rem; color: var(--ink-3); margin: 4px 0 22px; }
.login-err { background: var(--red-bg); color: var(--red); font-size: .82rem; border-radius: 10px; padding: 9px 13px; margin-bottom: 14px; font-weight: 600; }
.demo-box { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 14px; font-size: .74rem; color: var(--ink-3); line-height: 1.9; }
.demo-box b { color: var(--ink-2); }
.demo-box code { background: var(--primary-lighter); border-radius: 5px; padding: 1px 6px; color: var(--primary-dark); font-weight: 700; }
.login-card h1 { line-height: 1.55; }

/* ปุ่มเข้าสู่ระบบด้วยบัญชี CMU (Microsoft Entra ID) — ปุ่มเดียวของหน้านี้ จึงทำให้เด่น */
.btn-cmu {
  display: flex; align-items: center; justify-content: center; gap: 11px;
  width: 100%; min-height: 52px; padding: 13px 18px; box-sizing: border-box;
  background: var(--primary); color: #fff; border-radius: 12px;
  font-family: var(--thai-font); font-size: .95rem; font-weight: 700;
  text-decoration: none; cursor: pointer;
  box-shadow: 0 6px 18px rgba(104,105,173,.35);
  transition: background .15s, transform .15s, box-shadow .15s;
}
.btn-cmu:hover { background: var(--primary-dark); box-shadow: 0 8px 22px rgba(73,74,145,.42); }
.btn-cmu:active { transform: translateY(1px); box-shadow: 0 3px 10px rgba(73,74,145,.35); }
.btn-cmu:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
/* พื้นขาวรองโลโก้ Microsoft เพื่อให้สี่สีอ่านออกบนพื้นปุ่มสีเข้ม */
.btn-cmu .ms { width: 20px; height: 20px; flex: none; background: #fff; border-radius: 3px; padding: 3px; }

.login-note {
  background: var(--amber-bg); color: #96650a; border-radius: 10px;
  padding: 11px 14px; font-size: .78rem; margin-top: 18px; line-height: 1.75;
}

/* บล็อกข้อมูลจากระบบต้นทาง — แสดงเป็นข้อความ ไม่ใช่ช่องกรอก จึงแก้ไม่ได้ */
.ro-box {
  background: var(--primary-lighter); border: 1px solid var(--line);
  border-radius: 11px; padding: 13px 15px; margin-bottom: 16px;
}
.ro-item + .ro-item { margin-top: 11px; }
.ro-lb { font-size: .74rem; color: var(--ink-3); }
.ro-vl { font-size: .89rem; font-weight: 700; color: var(--primary-darker); word-break: break-all; margin-top: 1px; }

/* กล่องแจ้ง "ไม่มีสิทธิ์เข้าใช้งาน" บนหน้าเข้าสู่ระบบ */
.na-ic {
  width: 58px; height: 58px; border-radius: 50%; margin: 2px auto 14px;
  background: var(--accent-light); color: var(--accent); display: grid; place-items: center;
}
.na-ic svg { width: 30px; height: 30px; }
.na-msg { font-size: 1rem; font-weight: 700; color: var(--ink); line-height: 1.7; }
.na-sub { font-size: .8rem; color: var(--ink-3); margin-top: 12px; line-height: 1.9; }
.na-sub b { color: var(--ink-2); word-break: break-all; }

@media (max-width: 420px) {
  .login-card { padding: 28px 22px; }
  .btn-cmu { font-size: .88rem; gap: 9px; }
}

/* ========================================================
   โทนสีการจัดกลุ่ม SO / AP / KPI (ใช้ร่วมทุกหน้าที่แสดงลำดับชั้น)
   SO1 Smart People — เขียว · SO2 Smart Services — ส้มทอง · SO3 Smart Management — น้ำเงิน
   Vision ใช้โทนหลักของระบบ (น้ำเงินม่วง) ตามเดิม
   ตัวอักษรบนแถบหัวและ AP สีเข้ม = ขาว · แถว KPI พื้นอ่อน = ตัวอักษรสีเข้ม #333
   ======================================================== */
:root {
  --so1: #4E8542; --so1-ap-bg: #EEF4E9; --so1-ap-ink: #35602c;
  --so2: #C6871C; --so2-ap-bg: #FBF1DE; --so2-ap-ink: #8a5a12;
  --so3: #2F5597; --so3-ap-bg: #E9EEF7; --so3-ap-ink: #2F5597;
}

/* ---- แถบหัว SO (พื้นทึบ ตัวอักษรขาว) — override พื้นเดิมด้วย specificity ที่สูงกว่า ---- */
.so-hd.so-c-SO1 > td { background: var(--so1); }
.so-hd.so-c-SO2 > td { background: var(--so2); }
.so-hd.so-c-SO3 > td { background: var(--so3); }

/* ---- แถบ AP (พื้นสีอ่อนมากของ SO + ตัวอักษรสีเข้มของ SO เป็นหัวข้อรอง) ---- */
.ap-hd.ap-c-SO1a > td, .ap-hd.ap-c-SO1b > td {
  background: var(--so1-ap-bg); color: var(--so1-ap-ink); border-left-color: var(--so1); }
.ap-hd.ap-c-SO2a > td {
  background: var(--so2-ap-bg); color: var(--so2-ap-ink); border-left-color: var(--so2); }
.ap-hd.ap-c-SO3a > td, .ap-hd.ap-c-SO3b > td {
  background: var(--so3-ap-bg); color: var(--so3-ap-ink); border-left-color: var(--so3); }

/* ---- แถว KPI: ไม่ลงพื้นสีตาม SO แล้ว เหลือเพียงแถบสีบางด้านซ้ายบอกกลุ่ม ---- */
.krow.krow-c-SO1 > td:first-child { border-left-color: var(--so1); }
.krow.krow-c-SO2 > td:first-child { border-left-color: var(--so2); }
.krow.krow-c-SO3 > td:first-child { border-left-color: var(--so3); }

/* ---- แถบสีบาง ๆ ด้านซ้าย (accent border) สำหรับรายการ KPI ในหน้าอื่น
        เช่น Dashboard, ตัวเลือกในหน้ากำหนดเป้าหมาย ---- */
.so-accent { border-left: 4px solid var(--line); padding-left: 11px; }
.so-accent-SO1 { border-left-color: var(--so1); }
.so-accent-SO2 { border-left-color: var(--so2); }
.so-accent-SO3 { border-left-color: var(--so3); }
.so-accent-Vision { border-left-color: var(--primary); }

/* ===== กราฟ (วาดเองด้วย SVG) ===== */
.chart-box { width: 100%; position: relative; }
/* เฉพาะ SVG ของกราฟ (ลูกโดยตรง) เท่านั้นที่ยืดเต็มความกว้าง
   ไม่ให้กระทบไอคอนของสถานะ "ยังไม่มีข้อมูล" ที่ซ้อนอยู่ใน .empty */
.chart-box > svg { width: 100%; height: auto; display: block; overflow: visible; }

/* ---- กราฟแท่งแนวนอน "ร้อยละความสำเร็จ รายตัวชี้วัด" ----
   วาดแบบ 1 หน่วย = 1 พิกเซล จึงไม่ให้ CSS ยืดขนาด และเลื่อนดูแนวตั้งแทน */
/* จองที่ให้แถบเลื่อนไว้ล่วงหน้า เพื่อให้วัดความกว้างตอนวาดได้ตรงกับพื้นที่จริง
   ไม่เช่นนั้นแถบเลื่อนที่โผล่ทีหลังจะบังข้อความริมขวา (เช่น ป้าย 100%) */
.chart-box.kpi-bars { max-height: 100%; overflow-y: scroll; overflow-x: hidden; }
.chart-box.kpi-bars > svg { width: auto; height: auto; overflow: hidden; }
.kpi-bars .kb-track { fill: #eceef5; }
/* กราฟนี้ไม่มี tooltip — ข้อมูลทั้งหมดอ่านได้จากบนกราฟโดยตรง */
.kpi-bars .kb-name { font-family: var(--thai-font); font-size: 11.5px; fill: var(--ink-2); }
.kpi-bars .kb-code { font-weight: 700; fill: var(--primary-dark); }
.kpi-bars .kb-pct { font-family: var(--thai-font); font-size: 11px; font-weight: 700; }
.kpi-bars .kb-pct.in { fill: #fff; text-anchor: end; }
.kpi-bars .kb-pct.out { fill: var(--ink-2); text-anchor: start; }
.kpi-bars .kb-nodata { font-family: var(--thai-font); font-size: 10.5px; fill: var(--ink-3); }
.kpi-bars .kb-val { font-family: var(--thai-font); font-size: 10.5px; fill: var(--ink-3); }
.chart-box .c-grid { stroke: #eceef5; stroke-width: 1; }
.chart-box .c-axis { stroke: #cfd2e0; stroke-width: 1; }
.chart-box .c-label { font-size: 10px; fill: var(--ink-3); font-family: var(--thai-font); }
.chart-box .c-val { font-size: 10px; fill: var(--ink-2); font-family: var(--thai-font); font-weight: 600; }
.chart-box .c-bar { transition: opacity .15s; cursor: pointer; }
.chart-box .c-bar:hover { opacity: .75; }
.chart-legend { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-top: 10px; font-size: .8rem; color: var(--ink-2); }
.chart-legend span.k { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
/* สัญลักษณ์แบบเส้น (ใช้กับเส้นเป้าหมาย) */
.chart-legend i.line-key {
  width: 22px; height: 0; border-radius: 0; border-top: 3px solid var(--accent); position: relative;
}
.chart-legend i.line-key::after {
  content: ''; position: absolute; left: 7px; top: -5px; width: 8px; height: 8px; border-radius: 50%;
  background: #fff; border: 2.4px solid var(--accent); box-sizing: border-box;
}
.chart-tip {
  position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: .76rem;
  padding: 7px 11px; border-radius: 8px; white-space: pre-line; line-height: 1.5;
  opacity: 0; transition: opacity .12s; z-index: 10; box-shadow: var(--shadow-lg); max-width: 300px;
}
.chart-tip.show { opacity: 1; }

/* ===== Dashboard: ตารางการ์ด 2×2 ขอบตรงแนว สูงเท่ากันทุกใบในแถวเดียวกัน ===== */
.dash-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px; align-items: stretch; margin-bottom: 18px;
}
.dash-grid > .card { display: flex; flex-direction: column; min-width: 0; }
/* หัวการ์ดสูงและสไตล์เดียวกันทุกใบ — ข้อความยาวตัดด้วย … ไม่ดันความสูง */
.dash-grid > .card > .card-head {
  height: 58px; align-items: center; flex-shrink: 0;
  flex-wrap: nowrap; overflow: hidden; gap: 12px;
}
.dash-grid > .card > .card-head h2 {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0;
}
.dash-grid > .card > .card-head .muted {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
/* เนื้อการ์ดยืดเต็มพื้นที่ที่เหลือ */
/* ความสูงคงที่ — การ์ดกราฟไม่ยืดหรือยุบตามเนื้อหาและไอคอน
   ใช้ flex-basis เป็น auto เพื่อไม่ให้ flex ทับค่าความสูงที่กำหนด */
.dash-body {
  flex: 1 1 auto; padding: 18px 20px; display: flex; flex-direction: column;
  justify-content: center; min-height: 360px; max-height: 360px; overflow: hidden;
}
.dash-body.scroll { justify-content: flex-start; overflow-y: auto; }
.dash-body > .chart-box { width: 100%; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }

/* กราฟหลัก (เด่นสุด เต็มความกว้าง) — สูงกว่ากราฟรอง เลื่อนดูได้ */
.dash-hero .dash-body { min-height: 300px; max-height: 460px; }
/* กล่องกราฟที่ยืดตามเนื้อหา (สถานะการส่งรายส่วนงาน) */
.chart-pad { padding: 16px 20px 20px; }
/* โดนัท: ขนาดคงที่ จัดกึ่งกลาง ไม่ยืดเต็มกว้าง */
#chDonut.chart-box { display: flex; flex-direction: column; align-items: center; justify-content: center; }
#chDonut > svg { width: auto; height: 200px; max-width: 100%; }
.donut-center { font-size: 30px; font-weight: 800; fill: var(--ink); font-family: var(--thai-font); }
.donut-sub { font-size: 11px; fill: var(--ink-3); font-family: var(--thai-font); }
.donut-legend { justify-content: center; }

/* ===== พิมพ์ ===== */
@media print {
  .topnav, .site-foot, .no-print, #toasts { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ===== จอแคบ: เมนูยุบเป็นแฮมเบอร์เกอร์ ===== */
@media (max-width: 980px) {
  .tn-burger { display: inline-grid; }
  .tn-menu {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 3px;
    background: var(--primary-dark); padding: 10px 14px 14px;
    box-shadow: var(--shadow-lg); border-top: 1px solid rgba(255,255,255,.14);
  }
  .topnav.open .tn-menu { display: flex; }
  .tn-menu .tn-link { width: 100%; justify-content: flex-start; font-size: .94rem; }
  .tn-menu .tn-link.active { background: #fff; color: var(--primary-dark); box-shadow: none; }
  .tn-menu .tn-dd { width: 100%; }
  .tn-menu .tn-dd-panel {
    position: static; box-shadow: none; border: 0; margin: 3px 0 3px 14px;
    background: rgba(255,255,255,.08); padding: 4px;
  }
  .tn-menu .tn-dd-panel a { color: rgba(255,255,255,.9); }
  .tn-menu .tn-dd-panel a svg { color: #fff; }
  .tn-menu .tn-dd-panel a:hover, .tn-menu .tn-dd-panel a.active { background: rgba(255,255,255,.14); color: #fff; }
  .tn-menu .tn-dd-sep { background: rgba(255,255,255,.2); }
  .tn-prof-txt { display: none; }
  .content { padding: 15px; }
  html { font-size: 14px; }
}
