/* ระบบบันทึกโครงการ — ฝ่ายการพยาบาล
   โทนสีและระยะห่างอ้างอิงจากแบบร่าง ระบบบันทึกโครงการ.dc.html */

:root {
  --bg: #eef2f8;
  --panel: #fff;
  --ink: #0f1b33;
  --ink-strong: #132a52;
  --head: #0d2145;
  --muted: #3d4a63;
  --muted-2: #5d6b85;
  --muted-3: #7b89a3;
  --muted-4: #8b97ae;
  --muted-5: #94a0b6;
  --muted-6: #a3aec2;
  --line: #e6ebf4;
  --line-soft: #eef2f8;
  --line-input: #dde5f1;
  --brand: #1657c2;
  --brand-dark: #0f4aab;
  --brand-tint: #f4f8ff;
  --navy-1: #08204f;
  --navy-2: #0d2f6d;
  --navy-3: #134289;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-btn: 0 2px 8px rgba(22, 87, 194, .28);
}

* { box-sizing: border-box; }

/* แอตทริบิวต์ hidden ต้องชนะเสมอ — คลาสที่ตั้ง display:flex/grid ไว้จะไปทับค่า
   display:none ของ hidden ทำให้ซ่อนไม่อยู่ ถ้าไม่มีบรรทัดนี้ */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  font-family: 'Noto Sans Thai', system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: #0b2a6b; text-decoration: underline; }
input, select, textarea, button { font-family: 'Noto Sans Thai', system-ui, sans-serif; }
h1, h2, h3 { font-family: Anuphan, 'Noto Sans Thai', sans-serif; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c8d4e8; border-radius: 8px; }

.shell { display: flex; min-height: 100vh; align-items: stretch; }

/* ---------------- Auth gate ---------------- */

.auth-gate {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(170deg, var(--navy-1) 0%, var(--navy-2) 55%, var(--navy-3) 100%);
}
.auth-card {
  background: #fff; border-radius: 22px; padding: 40px 36px; width: 100%; max-width: 400px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  box-shadow: 0 24px 60px rgba(4, 17, 45, .35);
}
/* ---------------- ตราสัญลักษณ์ ---------------- */

/* ไฟล์ logo.png พื้นโปร่งใส วงตรากินความกว้าง 81.9% ของภาพ ขอบบนอยู่ที่ 1.8%
   จึงวางวงกลมขาวไว้ด้านหลังตามสัดส่วนนั้นพอดี ให้ด้านในตราเป็นพื้นขาวตามต้นฉบับ
   ส่วนริบบิ้นด้านล่างยื่นออกนอกวงกลมได้เพราะไม่ได้ครอบภาพไว้ */
.logo-mark { position: relative; display: inline-block; flex: none; line-height: 0; }
.logo-mark::before {
  content: ''; position: absolute; left: 50%; top: 1.4%;
  width: 82.6%; aspect-ratio: 1; transform: translateX(-50%);
  border-radius: 50%; background: #fff;
}
.logo-mark img { position: relative; width: 100%; height: auto; display: block; }
.logo-sm { width: 46px; }
.logo-lg { width: 88px; }
.auth-title { font-family: Anuphan, sans-serif; font-size: 22px; font-weight: 600; color: var(--head); margin-top: 6px; }
.auth-sub { font-size: 12.5px; color: var(--muted-4); margin-bottom: 18px; }
.btn-google {
  width: 100%; cursor: pointer; border: 1px solid var(--line-input); background: #fff;
  color: var(--muted); font-size: 14px; font-weight: 500; padding: 13px;
  border-radius: 11px; display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-google:hover { background: #f5f8fd; border-color: #bcd0f0; }
.auth-note { margin: 6px 0 0; font-size: 12px; line-height: 1.6; color: var(--muted-4); min-height: 18px; }

/* ---------------- Pending gate ---------------- */

.pending-mark {
  width: 54px; height: 54px; border-radius: 16px; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  background: #fff8ee; border: 1px solid #f6e3c6;
}
.pending-mark.blocked { background: #fef2f2; border-color: #f3c9c9; }
.pending-text { margin: 0 0 4px; font-size: 13px; line-height: 1.8; color: var(--muted-2); }
.pending-user {
  width: 100%; display: flex; align-items: center; gap: 11px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius-md); padding: 11px 13px; margin: 6px 0;
}
.pending-signout { width: 100%; }

/* ---------------- Sidebar ---------------- */

.sidebar {
  width: 252px;
  flex: none;
  background: linear-gradient(170deg, var(--navy-1) 0%, var(--navy-2) 55%, var(--navy-3) 100%);
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 4px; }
.brand-text { display: flex; flex-direction: column; gap: 2px; }
.brand-title { font-family: Anuphan, sans-serif; font-weight: 600; font-size: 16px; letter-spacing: .2px; }
.brand-sub { font-size: 11.5px; color: rgba(255,255,255,.62); }

.nav { display: flex; flex-direction: column; gap: 5px; }
.nav button {
  border: none; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: 11px;
  font-size: 14px; background: transparent;
  color: rgba(255,255,255,.72);
  transition: background .15s;
}
.nav button:hover { background: rgba(255,255,255,.14); }
.nav button.is-active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.nav .nav-icon { width: 20px; text-align: center; font-size: 15px; opacity: .95; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.fy-card {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 14px; padding: 14px;
}
.fy-label { font-size: 11.5px; color: rgba(255,255,255,.6); margin-bottom: 8px; }
.fy-value { font-family: Anuphan, sans-serif; font-size: 22px; font-weight: 600; line-height: 1; }
.fy-range { font-size: 11px; color: rgba(255,255,255,.55); margin-top: 6px; }

/* สลับปีงบประมาณ — ปุ่ม ‹ › ขนาบตัวเลขปี */
.fy-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fy-arrow {
  cursor: pointer; width: 26px; height: 26px; flex: none; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.08);
  color: #fff; font-size: 15px; line-height: 1; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.fy-arrow:hover:not(:disabled) { background: rgba(255,255,255,.2); }
.fy-arrow:disabled { opacity: .3; cursor: not-allowed; }
.fy-reset {
  margin-top: 9px; width: 100%; cursor: pointer; padding: 6px 0; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.22); background: transparent;
  color: rgba(255,255,255,.8); font-family: inherit; font-size: 11px;
}
.fy-reset:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ตัวสลับปีชุดเดียวกันบนพื้นสว่าง (ในเมนูตั้งค่าสำหรับมือถือ) */
.fy-switch-light { gap: 10px; }
.fy-switch-light .fy-arrow {
  border-color: var(--line-input); background: #fff; color: var(--brand);
}
.fy-switch-light .fy-arrow:hover:not(:disabled) { background: var(--brand-tint); }
.fy-switch-light .fy-value { font-size: 18px; color: var(--head); }

.me { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.me-avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%; background: #2f6fd0;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  font-size: 12.5px; font-weight: 600;
}
.me-avatar img { width: 100%; height: 100%; object-fit: cover; }
.me-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.me-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 10.5px; color: rgba(255,255,255,.55); }
.me-signout {
  flex: none; cursor: pointer; border: none; background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.7); width: 28px; height: 28px; border-radius: 8px; font-size: 13px;
}
.me-signout:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ---------------- User management ---------------- */

.users-list { display: flex; flex-direction: column; gap: 10px; max-height: 380px; overflow-y: auto; }
.user-row {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid #e9eef7; border-radius: var(--radius-md); padding: 10px 12px;
}
.user-avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%; background: #2f6fd0; color: #fff;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  font-size: 12.5px; font-weight: 600;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.user-name { font-size: 13px; color: var(--ink-strong); overflow-wrap: anywhere; }
.user-email { font-size: 11px; color: var(--muted-5); overflow-wrap: anywhere; }
.user-role-select {
  flex: none; width: 168px; border: 1px solid var(--line-input); border-radius: 9px;
  padding: 8px 10px; font-size: 12.5px; color: var(--ink-strong); background: #fff; outline: none;
}
.user-role-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22,87,194,.12); }
.user-role-select:disabled { background: #f5f8fd; color: var(--muted-4); cursor: not-allowed; }

.user-status {
  display: inline-block; margin-left: 6px; padding: 2px 8px;
  border-radius: 99px; font-size: 10.5px; font-weight: 500; vertical-align: middle;
}
.pending-banner {
  background: #fff8ee; border: 1px solid #f6e3c6; color: #8a5a12;
  border-radius: var(--radius-md); padding: 10px 13px; font-size: 12.5px; margin-bottom: 4px;
}
.btn-user-approve, .btn-user-block {
  flex: none; cursor: pointer; border-radius: 9px; padding: 8px 13px;
  font-size: 12.5px; font-weight: 500; border: 1px solid;
}
.btn-user-approve { background: #15803d; border-color: #15803d; color: #fff; }
.btn-user-approve:hover { background: #126b33; }
.btn-user-block { background: #fff; border-color: var(--line-input); color: var(--muted-2); }
.btn-user-block:hover { background: #fef2f2; border-color: #f3c9c9; color: #b91c1c; }
.user-lock { flex: none; font-size: 13px; opacity: .45; cursor: help; padding: 0 6px; }

.modal-sm { max-width: 380px; }
.btn-danger {
  cursor: pointer; border: none; background: #dc2626; color: #fff;
  font-size: 13.5px; font-weight: 500; padding: 11px 18px; border-radius: 10px;
}
.btn-danger:hover { background: #b91c1c; }
.pending-request { width: 100%; justify-content: center; }

/* ---------------- Access request form ---------------- */

.pending-form { width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: left; margin: 4px 0; }
.pending-submitted {
  width: 100%; display: flex; flex-direction: column; gap: 8px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 12px 14px; background: #fafcff; margin: 4px 0;
}
.submitted-row { display: flex; justify-content: space-between; gap: 14px; font-size: 12.5px; }
.submitted-row span { color: var(--muted-4); flex: none; }
.submitted-row strong { color: var(--ink-strong); font-weight: 500; text-align: right; }
.user-org { font-size: 11px; color: var(--muted-3); }
.user-org.warn { color: #b45309; }

/* ---------------- Join project ---------------- */

.join-box {
  border: 1px solid var(--line); border-radius: 13px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 12px; background: #fff;
}
.join-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.btn-join {
  cursor: pointer; border: none; background: var(--brand); color: #fff;
  font-size: 12.5px; font-weight: 500; padding: 9px 15px; border-radius: 10px;
}
.btn-join:hover { background: var(--brand-dark); }
.btn-join:disabled, .join-head .btn-outline:disabled { opacity: .55; cursor: not-allowed; }
.join-list { display: flex; flex-direction: column; gap: 8px; }
.join-row { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; background: #f7faff; }
.join-avatar {
  width: 30px; height: 30px; flex: none; border-radius: 50%; background: #2f6fd0; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600;
}
.join-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.join-name { font-size: 13px; color: var(--ink-strong); }
.join-meta { font-size: 11px; color: var(--muted-5); }
.join-date { flex: none; font-size: 11px; color: var(--muted-5); }
.join-empty { font-size: 12.5px; color: var(--muted-4); padding: 6px 2px; }
.hero-lock {
  display: inline-flex; align-items: center; font-size: 12.5px;
  color: rgba(255,255,255,.75); border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08); padding: 10px 14px; border-radius: 10px;
}

/* ---------------- Top bar ---------------- */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: #fff;
  border-bottom: 1px solid #e2e8f2;
  padding: 16px 30px;
  display: flex; align-items: center; gap: 20px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.topbar-eyebrow { font-size: 11.5px; color: var(--muted-3); letter-spacing: .3px; }
.topbar-title h1 { margin: 0; font-size: 21px; font-weight: 600; color: var(--head); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.search {
  display: flex; align-items: center; gap: 8px;
  background: #f2f5fb; border: 1px solid #e2e8f2;
  border-radius: 10px; padding: 9px 13px; width: 250px;
}
.search:focus-within { border-color: #bcd0f0; background: #fff; }
.search-icon { color: var(--muted-4); font-size: 13px; }
.search input { border: none; background: transparent; outline: none; font-size: 13px; width: 100%; color: var(--ink); }
.search-clear { border: none; background: transparent; color: var(--muted-4); cursor: pointer; font-size: 12px; padding: 0; }
.search-clear:hover { color: var(--muted-2); }

.btn-primary {
  cursor: pointer; border: none; background: var(--brand); color: #fff;
  font-size: 13.5px; font-weight: 500; padding: 11px 18px; border-radius: 10px;
  display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow-btn);
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary .plus { font-size: 15px; line-height: 1; }

.btn-icon {
  cursor: pointer; width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--line-input); background: #fff; color: var(--muted-2); font-size: 16px;
}
.btn-icon:hover { background: #f5f8fd; }
.btn-icon { position: relative; }

/* จุดแจ้งเตือนจำนวนผู้ใช้ที่รออนุมัติ แสดงเฉพาะผู้มีสิทธิ์อนุมัติ */
.notif-badge {
  position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px;
  padding: 0 5px; border-radius: 99px; background: #dc2626; color: #fff;
  font-size: 11px; font-weight: 600; line-height: 19px; text-align: center;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(220, 38, 38, .4);
}
.notif-pill {
  display: inline-block; margin-left: 7px; min-width: 18px; padding: 1px 6px;
  border-radius: 99px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 600;
}

.btn-outline {
  cursor: pointer; border: 1px solid var(--line-input); background: #fff;
  color: var(--muted); font-size: 13px; padding: 9px 15px; border-radius: 10px;
}
.btn-outline:hover { background: #f5f8fd; }

.btn-ghost-danger {
  cursor: pointer; border: 1px solid #f3c9c9; background: #fff; color: #b91c1c;
  font-size: 12.5px; padding: 10px; border-radius: 10px; margin-top: 4px;
}
.btn-ghost-danger:hover { background: #fef2f2; }

/* ---------------- Settings popover ---------------- */

.popover {
  position: absolute; top: 72px; right: 30px; width: 290px; z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 40px rgba(11,26,53,.16);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 14px;
}
.popover-title { font-family: Anuphan, sans-serif; font-size: 15px; font-weight: 600; color: var(--head); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.field-hint { margin: -6px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--muted-4); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line-input); border-radius: 11px; padding: 12px 14px;
  font-size: 13.5px; outline: none; color: var(--ink-strong); background: #fff; width: 100%;
}
.field textarea { resize: vertical; line-height: 1.7; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22,87,194,.12);
}
.field.is-invalid input, .field.is-invalid textarea, .field.is-invalid select { border-color: #ef4444; background: #fff8f8; }
.field-error { font-size: 11.5px; color: #b91c1c; }
/* ช่องเลือกวันที่แสดงเป็น ค.ศ. จึงมีบรรทัดกำกับวันที่แบบไทยไว้ให้ตรวจสอบ */
.field-hint-inline { font-size: 11.5px; color: var(--muted-4); }
.check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); }

/* ---------------- Content shell ---------------- */

.content { padding: 26px 30px 44px; display: flex; flex-direction: column; gap: 22px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 16px; }

.card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 22px 24px;
}
.card-sm { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px; }
.card-title { font-family: Anuphan, sans-serif; font-size: 16px; font-weight: 600; color: var(--head); }
.card-title-sm { font-family: Anuphan, sans-serif; font-size: 15px; font-weight: 600; color: var(--head); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.card-note { font-size: 11.5px; color: var(--muted-4); }

.empty {
  padding: 46px 20px; text-align: center; color: var(--muted-4); font-size: 13.5px; line-height: 1.9;
}
.empty strong { display: block; font-size: 15px; color: var(--muted-2); font-weight: 600; margin-bottom: 4px; }

/* ---------------- Dashboard ---------------- */

.hero {
  border-radius: 20px; overflow: hidden;
  background: linear-gradient(120deg, var(--navy-1) 0%, #12408a 48%, #1a63c4 100%);
  padding: 26px 30px; display: flex; gap: 28px; align-items: center; flex-wrap: wrap; color: #fff;
}
/* เงาใต้ตราบนแถบหัว Dashboard ให้ลอยขึ้นจากพื้นหลังน้ำเงิน */
.hero-logo::before { box-shadow: 0 6px 18px rgba(4,17,45,.28); }
.hero-text { flex: 1; min-width: 250px; display: flex; flex-direction: column; gap: 7px; }
.hero-eyebrow { font-size: 13px; color: rgba(255,255,255,.72); }
.hero-title { font-family: Anuphan, sans-serif; font-size: 32px; font-weight: 700; line-height: 1.15; }
.hero-sub { font-size: 12.5px; color: rgba(255,255,255,.62); }
.hero-stats { display: flex; gap: 14px; flex-wrap: wrap; }

.stat {
  cursor: pointer; border: none; text-align: left; background: #fff;
  border-radius: 15px; padding: 15px 20px; min-width: 132px;
  display: flex; flex-direction: column; gap: 9px;
  box-shadow: 0 6px 18px rgba(4,17,45,.22); transition: transform .12s;
}
.stat:hover { transform: translateY(-2px); }
.stat-top { display: flex; align-items: center; gap: 8px; }
.stat-icon {
  width: 24px; height: 24px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.stat-label { font-size: 12px; color: var(--muted-2); }
.stat-value-row { display: flex; align-items: baseline; gap: 6px; }
.stat-value { font-family: Anuphan, sans-serif; font-size: 30px; font-weight: 700; line-height: 1; color: var(--head); }
.stat-unit { font-size: 11.5px; color: var(--muted-4); }

.grid-2a { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.25fr); gap: 20px; }
.grid-2b { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); gap: 20px; }
.grid-2c { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 20px; align-items: start; }
.grid-2d { display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 20px; align-items: start; }
.grid-2e { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 20px; align-items: start; }

.donut-row { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.donut {
  width: 150px; height: 150px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.donut-hole {
  width: 104px; height: 104px; border-radius: 50%; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.donut-pct { font-family: Anuphan, sans-serif; font-size: 31px; font-weight: 700; color: var(--head); line-height: 1; }
.donut-cap { font-size: 10.5px; color: var(--muted-4); }
.legend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 11px; }
.legend button {
  cursor: pointer; border: none; background: transparent; padding: 5px 7px; margin: 0 -7px;
  border-radius: 9px; display: flex; align-items: center; gap: 10px;
}
.legend button:hover { background: var(--brand-tint); }
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend-label { font-size: 13px; color: var(--muted); flex: 1; text-align: left; }
.legend-value { font-size: 13px; font-weight: 600; color: var(--head); }

.meters { margin-top: 20px; padding-top: 18px; border-top: 1px dashed #e2e8f2; display: flex; flex-direction: column; gap: 13px; }
.meter { display: flex; flex-direction: column; gap: 7px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; }
.meter-label { font-size: 12.5px; color: var(--muted-2); }
.meter-value { font-size: 12.5px; color: var(--head); font-weight: 600; }
.meter-track { height: 9px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 99px; }
.meter-fill.blue { background: linear-gradient(90deg, #1657c2, #3b82f6); }
.meter-fill.green { background: linear-gradient(90deg, #0f766e, #22c55e); }

.bars { flex: 1; display: flex; align-items: flex-end; gap: 10px; padding: 26px 0 0; }
.bar {
  cursor: pointer; border: none; background: transparent; padding: 0; flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 7px; border-radius: 9px;
}
.bar:hover { background: var(--brand-tint); }
.bar-count { font-size: 12px; font-weight: 600; color: var(--head); }
.bar-fill { width: 100%; border-radius: 8px 8px 3px 3px; }
.bar-label { font-size: 10.5px; color: var(--muted-3); white-space: nowrap; }

.followups { display: flex; flex-direction: column; gap: 10px; }
.followup {
  cursor: pointer; display: flex; align-items: center; gap: 14px;
  padding: 13px 15px; border: 1px solid #e9eef7; border-radius: 13px;
  background: #fafcff; text-align: left; width: 100%;
}
.followup:hover { border-color: #bcd0f0; background: var(--brand-tint); }
.followup-date {
  width: 42px; height: 42px; flex: none; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.followup-day { font-size: 14px; font-weight: 700; line-height: 1; }
.followup-mon { font-size: 9.5px; line-height: 1.4; }
.followup-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.followup-name { font-size: 13.5px; font-weight: 500; color: var(--ink-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.followup-meta { font-size: 11.5px; color: var(--muted-3); }

.types { display: flex; flex-direction: column; gap: 11px; }
.type-row { display: flex; align-items: center; gap: 11px; }
.type-chip {
  width: 24px; height: 24px; flex: none; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700;
}
.type-label { font-size: 13px; color: var(--muted); flex: 1; }
.type-count { font-size: 12.5px; color: var(--muted-4); }
.info-box {
  margin-top: 18px; padding: 13px 15px; border-radius: 13px;
  background: #f2f6fd; border: 1px solid #e0e9f8;
  font-size: 11.5px; line-height: 1.7; color: var(--muted-2);
}

/* ---------------- List ---------------- */

.filters { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.filter {
  cursor: pointer; font-size: 13px; padding: 9px 15px; border-radius: 99px;
  border: 1px solid var(--line-input); background: #fff; color: var(--muted-2);
  display: flex; align-items: center; gap: 8px;
}
.filter:hover { border-color: #bcd0f0; }
.filter-count { font-size: 11.5px; opacity: .7; }
.filters-right { margin-left: auto; display: flex; gap: 9px; }

/* แถวตัวกรองเป้าประสงค์ อยู่ใต้แถวตัวกรองสถานะ */
.filters-goal-row { gap: 7px; }
.filters-caption { font-size: 12px; color: var(--muted-4); margin-right: 3px; }
.filter-goal { padding: 7px 13px; font-size: 12.5px; }

.table-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.projects { width: 100%; border-collapse: collapse; min-width: 1120px; }
table.projects thead tr { background: #f5f8fd; }
table.projects th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted-2);
  padding: 13px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.projects th.num { text-align: right; }
table.projects th.mid { text-align: center; }
table.projects tbody tr { cursor: pointer; border-bottom: 1px solid #f0f4fa; }
table.projects tbody tr:hover { background: #f7faff; }
table.projects td { padding: 15px 16px; font-size: 12.5px; color: var(--muted); vertical-align: middle; }
.is-dense table.projects td { padding: 10px 16px; }
td.seq { color: var(--muted-4); }
td.num { text-align: right; }
td.mid { text-align: center; }
.cell-name { display: flex; align-items: center; gap: 10px; }
.cell-name-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cell-name-title { font-size: 13.5px; font-weight: 500; color: var(--ink-strong); }
.cell-name-type { font-size: 11px; color: var(--muted-5); }
.type-chip-sm {
  width: 22px; height: 22px; flex: none; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.files-cell { display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-size: 11.5px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 500; padding: 6px 12px; border-radius: 99px; white-space: nowrap;
}
.pill-dot { width: 7px; height: 7px; border-radius: 50%; }

.table-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: #fafcff; border-top: 1px solid var(--line-soft);
}
.table-count { font-size: 12px; color: var(--muted-4); }
.pager { display: flex; gap: 6px; }
.pager button {
  cursor: pointer; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 9px;
  border: 1px solid var(--line-input); background: #fff; color: var(--muted-2); font-size: 12px;
}
.pager button:hover:not(:disabled) { background: #f5f8fd; }
.pager button.is-active { border-color: var(--brand); background: var(--brand); color: #fff; }
.pager button:disabled { opacity: .45; cursor: not-allowed; }

/* ---------------- Form ---------------- */

.form-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.form-head {
  padding: 18px 24px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between;
}
.form-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 20px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.row-2 { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1fr); gap: 16px; }
.sub-row { margin-top: 6px; }

.dropzone {
  border: 1.5px dashed #c4d6f2; border-radius: 14px; background: #f7faff;
  padding: 20px; display: flex; align-items: center; gap: 16px;
}
.dropzone-icon {
  width: 40px; height: 40px; flex: none; border-radius: 11px; background: #fff;
  border: 1px solid #e2e8f2; display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.dropzone-text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.dropzone-title { font-size: 13px; font-weight: 500; color: var(--ink-strong); }
.dropzone-sub { font-size: 11.5px; color: var(--muted-4); }
.btn-drive {
  cursor: pointer; border: 1px solid var(--brand); background: #fff; color: var(--brand);
  font-size: 13px; font-weight: 500; padding: 10px 16px; border-radius: 10px;
}
.btn-drive:hover { background: #f0f6ff; }

.file-row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid #e9eef7; border-radius: var(--radius-md); padding: 11px 14px;
}
.file-kind {
  width: 28px; height: 28px; flex: none; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}
.file-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-name { font-size: 13px; color: var(--ink-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 11px; color: var(--muted-5); }
.file-remove { cursor: pointer; border: none; background: transparent; color: var(--muted-5); font-size: 15px; }
.file-remove:hover { color: #dc2626; }

.side-col { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 100px; }
.status-picker { display: flex; flex-direction: column; gap: 8px; }
.status-opt {
  text-align: left; display: flex; align-items: center; gap: 11px;
  padding: 12px 14px; border-radius: var(--radius-md);
  border: 1.5px solid var(--line); background: #fff;
  font-size: 13.5px; color: var(--ink-strong); cursor: pointer;
}
.status-opt.is-locked { opacity: .55; cursor: not-allowed; background: #fafbfd; }
.status-opt.is-on { font-weight: 600; }
.status-radio { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid; box-shadow: inset 0 0 0 2px #fff; }
.status-opt span:nth-child(2) { flex: 1; }
.note-warn {
  margin-top: 13px; padding: 12px 14px; border-radius: var(--radius-md);
  background: #fff8ee; border: 1px solid #f6e3c6; font-size: 11.5px; line-height: 1.7; color: #8a5a12;
}

/* ---------------- วันที่จัดโครงการ (หลายวัน) ---------------- */

.day-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.day-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 11px;
  padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fafcff;
}
.day-row.is-invalid { border-color: #f3c9c9; background: #fffafa; }
.day-no {
  font-size: 11.5px; font-weight: 600; color: var(--muted-4);
  padding: 9px 10px 0 0; white-space: nowrap;
}
.day-fields { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; min-width: 0; }
.day-remove {
  cursor: pointer; border: 1px solid var(--line-input); background: #fff; color: var(--muted-4);
  width: 30px; height: 30px; border-radius: 8px; margin-top: 22px; flex: none;
}
.day-remove:hover:not(:disabled) { background: #fef2f2; border-color: #f3c9c9; color: #b91c1c; }
.day-remove:disabled { opacity: .35; cursor: not-allowed; }
.day-error { grid-column: 1 / -1; }
.btn-addday {
  cursor: pointer; margin-top: 10px; align-self: flex-start;
  border: 1px dashed var(--line-input); background: #fff; color: var(--brand);
  font-size: 13px; padding: 10px 16px; border-radius: 10px;
}
.btn-addday:hover { border-color: var(--brand); background: #f5f9ff; }

/* รายการวันในหน้ารายละเอียดโครงการ */
.day-lines { display: flex; flex-direction: column; gap: 8px; }
.day-line {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fafcff;
}
.day-line-no {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.day-line-date { font-size: 13px; color: var(--ink-strong); }
.day-line-time { margin-left: auto; font-size: 12.5px; color: var(--muted-4); white-space: nowrap; }

/* ป้ายจำนวนวันในตารางรายการโครงการ */
.cell-days {
  display: inline-block; margin-left: 7px; padding: 1px 7px; border-radius: 99px;
  background: #e0edff; color: #1450a8; font-size: 10.5px; font-weight: 500;
}

/* ---------------- Goals (เป้าประสงค์) ---------------- */

/* ตัวเลือกในฟอร์ม — เลือกได้หลายข้อ */
.goal-picker { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.goal-opt {
  text-align: left; display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 13px; border-radius: var(--radius-md);
  border: 1.5px solid var(--line); background: #fff; cursor: pointer;
}
.goal-opt:hover { background: #fafcff; }
.goal-opt.is-on { background: #fafcff; }
.goal-check {
  width: 17px; height: 17px; flex: none; margin-top: 1px; border-radius: 5px; border: 2px solid;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.goal-opt-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.goal-opt-short { font-size: 11.5px; font-weight: 600; }
.goal-opt-label { font-size: 12.5px; line-height: 1.65; color: var(--muted-2); }
.goal-opt.is-on .goal-opt-label { color: var(--ink-strong); }
.goal-opt-dir { font-size: 11px; line-height: 1.6; color: var(--muted-4); }

/* ป้ายเป้าประสงค์ในหน้ารายละเอียดโครงการ */
.goal-tags { display: flex; flex-direction: column; gap: 7px; }
.goal-tag {
  display: flex; align-items: flex-start; gap: 8px; padding: 8px 11px;
  border: 1px solid; border-radius: 10px; background: #fff;
  font-size: 12.5px; line-height: 1.6;
}
.goal-tag-dot { width: 7px; height: 7px; flex: none; margin-top: 6px; border-radius: 50%; }

/* สรุปจำนวนโครงการรายเป้าประสงค์บน Dashboard */
.goal-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.goal-row {
  text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: #fff;
}
.goal-row:hover { border-color: #bcd0f0; background: #fafcff; }
.goal-row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.goal-row-short { font-size: 12px; font-weight: 600; }
.goal-row-count { font-size: 12px; color: var(--muted-4); }
.goal-row-label { font-size: 12.5px; line-height: 1.6; color: var(--muted-2); }
.note-info {
  padding: 12px 14px; border-radius: var(--radius-md);
  background: #f5f8fd; border: 1px solid #e6ecf7; font-size: 11.5px; line-height: 1.65; color: var(--muted-2);
}
.side-text { font-size: 12px; color: var(--muted-4); line-height: 1.7; }
.side-text strong { color: var(--ink-strong); font-weight: 500; }
.btn-warn {
  cursor: pointer; border: 1px solid #f0b563; background: #fff8ee; color: #8a5a12;
  font-size: 13.5px; font-weight: 500; padding: 12px; border-radius: 11px;
}
.btn-warn:hover { background: #fdf0dc; }
.btn-warn:disabled { opacity: .5; cursor: not-allowed; }
.btn-save {
  cursor: pointer; border: none; background: var(--brand); color: #fff;
  font-size: 14px; font-weight: 500; padding: 13px; border-radius: 11px; box-shadow: var(--shadow-btn);
}
.btn-save:hover { background: var(--brand-dark); }
.btn-draft {
  cursor: pointer; border: 1px solid var(--line-input); background: #fff; color: var(--muted);
  font-size: 14px; padding: 13px; border-radius: 11px;
}
.btn-draft:hover { background: #f5f8fd; }
.btn-cancel { cursor: pointer; border: none; background: transparent; color: var(--muted-4); font-size: 13px; padding: 4px; }
.btn-cancel:hover { color: var(--muted-2); }

/* ---------------- Detail ---------------- */

.back-link {
  cursor: pointer; align-self: flex-start; border: none; background: transparent;
  color: var(--muted-2); font-size: 13px; padding: 0; display: flex; align-items: center; gap: 7px;
}
.back-link:hover { color: var(--brand); }

.detail-hero {
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, #0b2757 0%, #14498f 100%);
  padding: 26px 30px; color: #fff;
  display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start;
}
.detail-hero-text { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 10px; }
.detail-hero-tags { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.detail-badge { font-size: 11.5px; font-weight: 600; padding: 5px 11px; border-radius: 99px; }
.detail-code { font-size: 11.5px; color: rgba(255,255,255,.6); }
.detail-name { font-family: Anuphan, sans-serif; font-size: 25px; font-weight: 600; line-height: 1.35; }
.detail-hero-actions { display: flex; gap: 9px; }
.btn-onhero {
  cursor: pointer; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12);
  color: #fff; font-size: 13px; padding: 10px 16px; border-radius: 10px;
}
.btn-onhero:hover { background: rgba(255,255,255,.2); }
.btn-onhero-solid {
  cursor: pointer; border: none; background: #fff; color: var(--head);
  font-size: 13px; font-weight: 500; padding: 10px 16px; border-radius: 10px;
}

.meta-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px 24px; }
.meta-item { display: flex; flex-direction: column; gap: 5px; }
.meta-label { font-size: 11.5px; color: var(--muted-4); }
.meta-value { font-size: 14px; font-weight: 500; color: var(--ink-strong); line-height: 1.5; }

.prose { margin: 0; font-size: 14px; line-height: 1.85; color: var(--muted); text-wrap: pretty; }
.box-neutral { margin-top: 6px; padding: 14px 16px; border-radius: 13px; background: #f5f8fd; border: 1px solid #e6ecf7; }
.box-green { padding: 14px 16px; border-radius: 13px; background: #f2fbf5; border: 1px solid #d8f0e2; }
.box-label { font-size: 11.5px; color: var(--muted-4); margin-bottom: 6px; }
.box-green .box-label { color: #4b7a5f; }
.box-text { font-size: 13.5px; color: var(--muted); line-height: 1.7; }
.box-green .box-text { color: #245b3a; }

.steps { display: flex; flex-direction: column; }
.step { display: flex; gap: 12px; }
.step-rail { display: flex; flex-direction: column; align-items: center; width: 18px; flex: none; }
.step-dot {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: #fff; margin-top: 3px;
}
.step-line { flex: 1; width: 2px; background: var(--line); }
.step:last-child .step-line { background: transparent; }
.step-body { padding-bottom: 15px; display: flex; flex-direction: column; gap: 2px; }
.step-label { font-size: 12.5px; font-weight: 500; }
.step-meta { font-size: 11px; color: var(--muted-6); }

.approve-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.approve-actions textarea {
  border: 1px solid var(--line-input); border-radius: 11px; padding: 10px 12px;
  font-size: 12.5px; outline: none; color: var(--ink-strong); resize: vertical; width: 100%;
}
.approve-actions textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22,87,194,.12); }
.approve-row { display: flex; gap: 8px; }
.btn-approve { flex: 1; border: none; border-radius: 11px; padding: 12px; font-size: 13.5px; font-weight: 500; }
.btn-reject {
  border: 1px solid var(--line-input); border-radius: 11px; padding: 12px 15px;
  font-size: 13.5px; background: #fff; color: var(--muted-2);
}
.btn-reset { border: none; background: transparent; color: var(--muted-6); font-size: 11.5px; cursor: pointer; padding: 2px; }
.btn-reset:hover { color: var(--muted-2); }

.file-links { display: flex; flex-direction: column; gap: 9px; }
.file-link {
  display: flex; align-items: center; gap: 11px; border: 1px solid #e9eef7;
  border-radius: var(--radius-md); padding: 11px 13px; text-decoration: none;
}
.file-link:hover { border-color: #bcd0f0; background: #f7faff; text-decoration: none; }
.file-link .file-name { font-size: 12.5px; }
.file-link .file-meta { font-size: 10.5px; }
.file-open { color: #b4c0d4; font-size: 13px; }

.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 13px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; width: 16px; flex: none; }
.tl-dot { width: 11px; height: 11px; border-radius: 50%; margin-top: 4px; }
.tl-line { flex: 1; width: 2px; background: var(--line); }
.tl-item:last-child .tl-line { background: transparent; }
.tl-body { padding-bottom: 18px; display: flex; flex-direction: column; gap: 3px; }
.tl-label { font-size: 13px; font-weight: 500; color: var(--ink-strong); }
.tl-meta { font-size: 11.5px; color: var(--muted-5); }

/* ---------------- Calendar ---------------- */

.month-tabs { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; }
.month-tab {
  cursor: pointer; flex: none; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 16px; border-radius: var(--radius-md);
  border: 1px solid var(--line-input); background: #fff; color: var(--muted-2);
}
.month-tab:hover { border-color: #bcd0f0; }
.month-tab.is-on { border-color: var(--brand); background: var(--brand); color: #fff; }
.month-tab-name { font-size: 12.5px; }
.month-tab.is-on .month-tab-name { font-weight: 600; }
.month-tab-count { font-size: 10.5px; opacity: .75; }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 7px; }
.dow { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted-2); padding: 6px 0; }
.dow.weekend { color: #dc2626; }
.cal-cell {
  min-height: 82px; border-radius: 11px; border: 1px solid var(--line-soft);
  background: #fff; padding: 7px 8px; display: flex; flex-direction: column; gap: 5px;
}
.cal-cell.blank { background: #fbfcfe; border-color: #f1f5fa; }
.cal-cell.weekend { background: #fdf6f7; }
.cal-cell.has-events { border-color: #cddcf5; }
.cal-day { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.cal-cell.weekend .cal-day { color: #dc2626; }
.cal-events { display: flex; flex-wrap: wrap; gap: 4px; }
.cal-event {
  cursor: pointer; border: none; padding: 0; width: 22px; height: 22px; flex: none;
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; transition: transform .12s;
}
.cal-event:hover { transform: scale(1.12); }

.agenda { display: flex; flex-direction: column; gap: 11px; }
.agenda-item {
  cursor: pointer; display: flex; gap: 11px; align-items: flex-start;
  border: none; background: transparent; padding: 4px; margin: -4px; border-radius: 9px; text-align: left;
}
.agenda-item:hover { background: var(--brand-tint); }
.agenda-day { width: 34px; flex: none; text-align: center; font-size: 12px; font-weight: 700; color: var(--brand); }
.agenda-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.agenda-name { font-size: 12.5px; color: var(--ink-strong); line-height: 1.5; }
.agenda-meta { font-size: 11px; color: var(--muted-5); }

/* ---------------- Modal / toast ---------------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 25, 60, .42); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  width: 100%; max-width: 420px; background: #fff; border-radius: var(--radius-lg);
  padding: 24px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 24px 60px rgba(11,26,53,.28);
}
.modal-lg { max-width: 560px; }
.modal-title { font-family: Anuphan, sans-serif; font-size: 17px; font-weight: 600; color: var(--head); }
.modal-note { margin: -6px 0 0; font-size: 12px; line-height: 1.7; color: var(--muted-4); }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--head); color: #fff; font-size: 13px;
  padding: 12px 20px; border-radius: 12px; z-index: 80;
  box-shadow: 0 12px 30px rgba(11,26,53,.3);
}

/* ---------------- Responsive ---------------- */

@media (max-width: 1180px) {
  .grid-2a, .grid-2b, .grid-2c, .grid-2d, .grid-2e { grid-template-columns: minmax(0, 1fr); }
  .side-col { position: static; }
}

/* ข้อมูลผู้ใช้ในกล่องตั้งค่า — ใช้เฉพาะบนมือถือที่ซ่อนแถบเมนูด้านข้างไว้ */
.popover-user { display: none; }
.popover-fy { display: none; }
.nav-label-short { display: none; }

@media (max-width: 900px) {
  /* แถบเมนูด้านข้างกลายเป็นแถบแท็บด้านล่างแบบแอปมือถือ */
  .shell { flex-direction: column; }
  .sidebar {
    /* top: auto จำเป็น เพราะกฎหลักตั้ง top:0 ไว้ ถ้ามีทั้ง top และ bottom
       องค์ประกอบ fixed จะยืดเต็มความสูงจอแทนที่จะเกาะขอบล่าง */
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 30;
    width: auto; height: auto; padding: 0;
    flex-direction: row; gap: 0;
    background: #fff; border-top: 1px solid var(--line);
    box-shadow: 0 -2px 12px rgba(11, 26, 53, .08);
  }
  .brand, .sidebar-foot { display: none; }

  .nav { flex-direction: row; width: 100%; gap: 0; }
  .nav button {
    flex: 1; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 9px 4px calc(9px + env(safe-area-inset-bottom, 0px));
    border-radius: 0; font-size: 10px; color: var(--muted-6);
  }
  .nav button:hover { background: transparent; }
  .nav button.is-active { background: transparent; color: var(--brand); font-weight: 600; }
  .nav .nav-icon { width: auto; font-size: 18px; }
  .nav-label { display: none; }
  .nav-label-short { display: block; font-size: 10px; }

  /* เว้นที่ให้แถบแท็บล่าง ไม่ให้บังเนื้อหา */
  .content { padding: 18px 14px calc(88px + env(safe-area-inset-bottom, 0px)); }

  .topbar { padding: 12px 14px; flex-wrap: wrap; gap: 12px; }
  .topbar-title h1 { font-size: 18px; }
  .search { width: 100%; }
  .topbar-actions { width: 100%; }
  .btn-primary { flex: 1; justify-content: center; }
  .popover { right: 14px; left: 14px; width: auto; top: 130px; }
  .popover-user {
    display: flex; align-items: center; gap: 10px;
    padding-bottom: 14px; border-bottom: 1px solid var(--line-soft);
  }
  .popover-user .btn-outline { flex: none; padding: 8px 12px; font-size: 12px; }
  .popover-fy { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

  .meta-grid { grid-template-columns: minmax(0, 1fr); }
  .row-3, .row-2 { grid-template-columns: minmax(0,1fr); }
  .hero { padding: 20px; }
  .hero-title { font-size: 24px; }
  .hero-stats { width: 100%; }
  .stat { flex: 1 1 calc(50% - 7px); min-width: 0; }
  .card, .card-sm { padding: 18px 16px; }

  /* กราฟรายเดือนเลื่อนดูในการ์ดของตัวเอง ไม่ดันหน้าจอให้กว้างเกิน */
  .bars { overflow-x: auto; gap: 6px; padding-bottom: 6px; }
  .bar { flex: 0 0 auto; min-width: 36px; }

  .donut-row { gap: 18px; }
  .filters-right { margin-left: 0; width: 100%; }
  .filters-right .btn-outline { flex: 1; }

  /* ตารางโครงการเปลี่ยนเป็นการ์ดต่อแถว อ่านง่ายกว่าเลื่อนตารางแนวนอนบนจอเล็ก */
  .table-card { border: none; background: transparent; }
  .table-scroll { overflow-x: visible; }
  table.projects { min-width: 0; }
  table.projects thead { display: none; }
  table.projects tbody, table.projects tr, table.projects td { display: block; width: 100%; }
  table.projects tr {
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    padding: 14px; margin-bottom: 10px;
  }
  table.projects tr:hover { background: #fff; }
  table.projects td { padding: 5px 0 !important; border: none; text-align: left !important; }
  table.projects td.seq { display: none; }
  table.projects td[data-label] { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
  table.projects td[data-label]::before {
    content: attr(data-label); flex: none;
    font-size: 11.5px; color: var(--muted-4);
  }
  .cell-name-td { padding-bottom: 10px !important; margin-bottom: 6px; border-bottom: 1px dashed var(--line) !important; }
  .cell-name-title { font-size: 14px; }

  .table-foot { flex-direction: column; gap: 12px; align-items: stretch; background: transparent; border: none; padding: 4px 0 0; }
  .table-count { text-align: center; }
  .pager { justify-content: center; }

  /* ปฏิทินบนจอเล็ก — ลดขนาดช่องลงให้พอดีจอ */
  .cal-grid { gap: 4px; }
  .cal-cell { min-height: 58px; padding: 5px 4px; border-radius: 8px; }
  .cal-day { font-size: 10.5px; }
  .cal-event { width: 18px; height: 18px; font-size: 9.5px; border-radius: 5px; }
  .dow { font-size: 10.5px; }

  .detail-hero { padding: 20px; }
  .detail-name { font-size: 20px; }
  .detail-hero-actions { width: 100%; }
  .detail-hero-actions button { flex: 1; }
  .side-col { position: static; }
  .modal { max-height: 82vh; overflow-y: auto; }
  .user-row { flex-wrap: wrap; }
  .user-role-select { width: 100%; }
  .goal-rows { grid-template-columns: minmax(0, 1fr); }
  .filters-goal-row { gap: 6px; }
  .day-fields { grid-template-columns: minmax(0, 1fr); }
  .day-remove { margin-top: 0; }
  .day-line { flex-wrap: wrap; }
  .day-line-time { margin-left: 33px; width: 100%; }
}

/* ---------------- ระดับกิจกรรม / กลุ่มผู้เข้าร่วม / งบประมาณ ---------------- */

/* แถวสรุปรายระดับกิจกรรมบน Dashboard กดเพื่อกรองรายการโครงการ */
.type-row-btn {
  cursor: pointer; border: none; background: transparent; padding: 4px; margin: -4px;
  border-radius: 9px; text-align: left; width: calc(100% + 8px); font-family: inherit;
}
.type-row-btn:hover { background: var(--brand-tint); }

/* ป้ายระดับกิจกรรมท้ายชื่อประเภทในตารางรายการโครงการ */
.level-tag {
  display: inline-block; margin-left: 7px; padding: 1px 7px; border-radius: 99px;
  border: 1px solid; font-size: 10.5px; line-height: 1.6; white-space: nowrap;
}

/* สรุปงบประมาณรายประเภทบน Dashboard */
.budget-rows { display: flex; flex-direction: column; gap: 12px; }
.budget-row { display: flex; align-items: baseline; gap: 11px; }
.budget-row-name { font-size: 13px; color: var(--muted); flex: 1; min-width: 0; }
.budget-row-count { font-size: 11.5px; color: var(--muted-4); white-space: nowrap; }
.budget-row-sum {
  font-size: 13px; font-weight: 600; color: var(--ink-strong);
  white-space: nowrap; min-width: 96px; text-align: right;
}

/* เลือกกลุ่มผู้เข้าร่วมได้หลายกลุ่ม */
.group-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.group-opt {
  cursor: pointer; display: flex; align-items: center; gap: 8px;
  padding: 8px 13px; border-radius: 99px; font-family: inherit; font-size: 12.5px;
  border: 1.5px solid var(--line); background: #fff; color: var(--muted-2);
}
.group-opt:hover { border-color: #bcd0f0; }
.group-opt.is-on { border-color: var(--brand); background: var(--brand-tint); color: var(--ink-strong); font-weight: 500; }
.group-check {
  width: 15px; height: 15px; flex: none; border-radius: 4px; border: 2px solid var(--line-input);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}
.group-opt.is-on .group-check { background: var(--brand); border-color: var(--brand); }

/* ---------------- วันสำคัญราชการ ---------------- */

/* ดาวมุมวันที่ในปฏิทิน — สีแดงเมื่อเป็นวันหยุดราชการ */
.cal-national { margin-left: 4px; font-size: 10px; color: var(--muted-4); }
.cal-national.is-holiday { color: #dc2626; }
.cal-cell.is-holiday { background: #fdf6f7; border-color: #f6dcdc; }
.cal-cell.is-holiday .cal-day { color: #dc2626; }

.national-list { display: flex; flex-direction: column; gap: 10px; }
.national-item { display: flex; align-items: baseline; gap: 10px; }
.national-day { width: 46px; flex: none; font-size: 11.5px; font-weight: 700; color: var(--muted-4); }
.national-item.is-holiday .national-day { color: #dc2626; }
.national-name { font-size: 12.5px; line-height: 1.55; color: var(--ink-strong); flex: 1; min-width: 0; }
.national-tag {
  flex: none; font-size: 10px; padding: 2px 8px; border-radius: 99px;
  background: #fee2e2; color: #b91c1c;
}

/* ปุ่มลบโครงการบนแถบหัวหน้ารายละเอียด — เฉพาะ Admin */
.btn-onhero-danger {
  cursor: pointer; border: 1px solid rgba(255,255,255,.4); background: rgba(220,38,38,.85);
  color: #fff; font-family: inherit; font-size: 13px; padding: 10px 16px; border-radius: 10px;
}
.btn-onhero-danger:hover:not(:disabled) { background: #dc2626; }
.btn-onhero-danger:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- Print ---------------- */

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .back-link, .detail-hero-actions, .approve-actions, .popover, .toast { display: none !important; }
  .content { padding: 0; }
  .detail-hero { background: #0b2757 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .grid-2d { grid-template-columns: minmax(0,1fr); }
  .card, .card-sm { break-inside: avoid; }
}
