/* ========== RunxHunter Admin ========== */
:root {
  --side: 268px;
  --side-bg: #0d1526;
  --side-ink: #93a3bb;
}

body.adm { background: #f4f6fa; }

.adm-shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }

/* ---------- sidebar ---------- */
.side {
  background: var(--side-bg); color: #fff; position: fixed; inset: 0 auto 0 0; width: var(--side);
  display: flex; flex-direction: column; z-index: 70; overflow-y: auto;
}
.side::-webkit-scrollbar { width: 6px; }
.side::-webkit-scrollbar-thumb { background: #26334c; border-radius: 3px; }
.side-top { padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-top .brand { align-items: center; gap: 12px; }
.side-top .brand-mark { width: 46px; height: 46px; object-fit: contain; flex: none; background: #fff; border-radius: 12px; padding: 4px; box-sizing: border-box; }
.side-top .brand-text b { color: #fff; font-size: 18px; }
.side-top .brand-text i { color: #64748b; }
.side-ev { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-ev label { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: #64748b; display: block; margin-bottom: 6px; }
.side-ev select { background: #17223a; border-color: #26334c; color: #fff; font-size: 16px; padding: 9px 11px; }
.side-nav { flex: 1; padding: 12px 10px 20px; }
.side-nav .grp { font-size: 12.5px; letter-spacing: .13em; text-transform: uppercase; color: #4b5a72; padding: 16px 12px 7px; font-weight: 600; }
.side-nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: var(--side-ink); font-size: 16.5px; font-weight: 500; margin-bottom: 2px; transition: all .13s;
}
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.on { background: linear-gradient(135deg, var(--brand), #2563eb); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,.35); }
.side-nav a .ic { width: 20px; text-align: center; font-size: 17px; flex: none; }
.side-nav a .badge-n { margin-left: auto; background: var(--err); color: #fff; font-size: 13px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.side-user { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.side-user .av { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg,#0ea5e9,#1e3a8a); display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; }
.side-user .nm { flex: 1; min-width: 0; }
.side-user .nm b { display: block; font-size: 15.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .nm i { font-style: normal; font-size: 13.5px; color: #64748b; }
.side-user button { background: none; border: 0; color: #64748b; cursor: pointer; font-size: 19px; padding: 4px; }
.side-user button:hover { color: #fff; }

/* ---------- main ---------- */
.main { grid-column: 2; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); padding: 0 26px; height: 62px; display: flex; align-items: center; gap: 16px;
}
.topbar h1 { font-size: 21px; }
.topbar .sub { color: var(--ink-3); font-size: 15px; }
.topbar .acts { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.adm-body { padding: 24px 26px 60px; max-width: 1500px; }
.burger-adm { display: none; background: none; border: 0; font-size: 24px; cursor: pointer; padding: 4px 8px; }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; box-shadow: var(--sh-1); position: relative; overflow: hidden; }
.stat::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--brand); }
.stat.ok::before { background: var(--ok); } .stat.warn::before { background: var(--warn); }
.stat.err::before { background: var(--err); } .stat.info::before { background: var(--brand-2); }
.stat i { font-style: normal; font-size: 14.5px; color: var(--ink-3); display: block; }
.stat b { font-size: 29px; font-weight: 700; letter-spacing: -.02em; display: block; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat small { font-size: 14px; color: var(--ink-3); }

/* ---------- panels & tables ---------- */
.card-p { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh-1); margin-bottom: 20px; overflow: hidden; }
.card-p > h2 { font-size: 17.5px; padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card-p > h2 .acts { margin-left: auto; display: flex; gap: 8px; }
.card-p .bd { padding: 20px; }
.card-p .bd.flush { padding: 0; }

.dt { width: 100%; border-collapse: collapse; font-size: 16px; }
.dt th { background: #f8fafc; text-align: left; font-size: 14px; font-weight: 600; color: var(--ink-2); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.dt td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.dt tbody tr:hover { background: #f8fafc; }
.dt .num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 16px 20px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.filters .field { margin: 0; min-width: 150px; }
.filters .field > label { font-size: 13.5px; }
.filters input, .filters select { padding: 8px 11px; font-size: 16px; border-radius: 9px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 20px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 13px 14px; font: inherit; font-size: 16.5px; font-weight: 600; color: var(--ink-3); cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-color: var(--brand); }
.tabs button .n { background: #eef2f7; color: var(--ink-2); font-size: 13.5px; padding: 1px 7px; border-radius: 99px; margin-left: 5px; }
.tabs button.on .n { background: var(--brand); color: #fff; }

.pager { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 16px; }
.pager button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 15.5px; }
.pager button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager button:disabled { opacity: .4; cursor: default; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(9, 15, 30, .55); backdrop-filter: blur(3px); z-index: 200; display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 720px; box-shadow: var(--sh-3); max-height: 92vh; display: flex; flex-direction: column; animation: mIn .2s ease; }
.modal.wide { max-width: 1000px; }
.modal.narrow { max-width: 460px; }
@keyframes mIn { from { transform: translateY(14px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-h { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.modal-h h3 { font-size: 19px; flex: 1; }
.modal-h button { background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--ink-3); line-height: 1; }
.modal-b { padding: 22px; overflow-y: auto; flex: 1; }
.modal-f { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: #fbfcfe; border-radius: 0 0 18px 18px; }

/* ---------- charts ---------- */
.chart-bars { display: flex; align-items: flex-end; gap: 5px; height: 170px; padding-top: 10px; }
.chart-bars > div { flex: 1 1 0; max-width: 46px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; min-width: 0; }
.chart-bars .bar-v { width: 100%; background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-radius: 5px 5px 0 0; min-height: 3px; transition: opacity .15s; }
.chart-bars > div:hover .bar-v { opacity: .78; }
.chart-bars .lb { font-size: 12px; color: var(--ink-3); white-space: nowrap; transform: rotate(-45deg); transform-origin: center; height: 22px; }
.hbar { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 15.5px; }
.hbar .nm { width: 150px; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .tr { flex: 1; height: 20px; background: #eef2f7; border-radius: 6px; overflow: hidden; }
.hbar .fl { height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--brand)); border-radius: 6px; }
.hbar .vl { width: 92px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; flex: none; }

.slip-img { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.empty-sm { padding: 44px 20px; text-align: center; color: var(--ink-3); font-size: 16.5px; }

/* ---------- progress bar / key-value list (ใช้ในหน้า Dashboard, สมาชิก) ---------- */
.bar { height: 10px; background: #eef2f7; border-radius: 20px; overflow: hidden; }
.bar-in { height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--brand)); border-radius: 20px; }
.kv { display: grid; gap: 8px 14px; font-size: 16px; margin: 0; }
.kv dt { color: var(--ink-3); font-size: 14.5px; }
.kv dd { margin: 0 0 4px; font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .adm-shell { grid-template-columns: 1fr; }
  .side { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--sh-3); }
  .side.open { transform: none; }
  .main { grid-column: 1; }
  .burger-adm { display: block; }
  .adm-body { padding: 18px 16px 60px; }
  .topbar { padding: 0 16px; }
  .side-backdrop { position: fixed; inset: 0; background: rgba(9,15,30,.5); z-index: 65; }
}

/* ---------- SunEditor (โปรแกรมแก้ไขข้อความแบบ Word) ---------- */
.sun-editor {
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  overflow: hidden;
  font-family: 'IBM Plex Sans Thai', sans-serif;
}
.sun-editor .se-toolbar { background: var(--soft, #f1f5f9); outline: 0; }
.sun-editor .se-btn-tray { padding: 6px; }
.sun-editor .se-wrapper .sun-editor-editable,
.sun-editor .se-wrapper .se-wrapper-inner {
  font-family: 'IBM Plex Sans Thai', 'Sarabun', sans-serif;
  font-size: 17.5px; line-height: 1.7;
}
.sun-editor .se-wrapper .sun-editor-editable img { max-width: 100%; height: auto; }
/* ให้ dialog/เมนูย่อย/แถบควบคุมของ SunEditor ลอยเหนือ modal */
.sun-editor .se-dialog { z-index: 320 !important; }
.sun-editor .se-submenu,
.sun-editor .se-controller,
.sun-editor .se-menu-list,
.sun-editor .se-list-layer { z-index: 320 !important; }
.sun-editor .se-toolbar { z-index: 60; }

/* ==========================================================
   UI REFRESH 2026 — Admin: ตัวหนังสือใหญ่ขึ้น + มินิมอล
   (ต่อท้ายเพื่อ override — ลบออกได้ถ้าจะย้อนกลับ)
   ========================================================== */

/* ---- เมนูซ้าย: ใหญ่ขึ้น อ่านง่าย, active แบบมินิมอล (แถบเส้นข้าง) ---- */
.side-nav a{ font-size: 17.5px; padding: 11px 14px; border-radius: 10px; margin-bottom: 3px; }
.side-nav a.on{
  background: rgba(255,255,255,.08);
  color: #fff;
  box-shadow: none;
  border-left: 3px solid var(--brand);
  padding-left: 11px;
}
/* หัวข้อหลัก (กลุ่มเมนู) ให้ใหญ่และเด่นกว่าเมนูย่อยชัดเจน */
.side-nav .grp{
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: none;
  color: #f1f5f9;
  padding: 20px 12px 8px;
}
/* เมนูย่อยเล็กกว่าหัวข้อหลักเล็กน้อย เพื่อให้ลำดับชั้นชัด */
.side-nav a{ font-size: 17px; font-weight: 500; }
.side-nav a .badge-n{ font-size: 14px; }

/* ---- แถบบน ---- */
.topbar{ height: 66px; }
.topbar h1{ font-size: 23px; font-weight: 700; }
.topbar .sub{ font-size: 16px; }

/* ---- การ์ดสถิติ ---- */
.stat{ border-radius: 14px; box-shadow: var(--sh-1); padding: 20px 22px; }
.stat i{ font-size: 15.5px; }
.stat b{ font-size: 32px; }
.stat small{ font-size: 15px; }

/* ---- แผง & ตาราง ---- */
.card-p{ border-radius: 14px; box-shadow: var(--sh-1); }
.card-p > h2{ font-size: 19px; padding: 18px 22px; }
.dt{ font-size: 17px; }
.dt th{ font-size: 15px; padding: 13px 16px; }
.dt td{ padding: 13px 16px; }

/* ---- ตัวกรอง ---- */
.filters .field > label{ font-size: 15px; }
.filters input, .filters select{ padding: 10px 13px; font-size: 17px; border-radius: 10px; }

/* ---- แท็บ ---- */
.tabs button{ font-size: 17.5px; padding: 14px 16px; }
.tabs button .n{ font-size: 14.5px; }

/* ---- ปุ่มแท็บการเงิน / พัสดุ / ผลวิ่ง (หน้ารวม) ---- */
.pay-tab, .sh-tab, .res-tab{ font-size: 16.5px; padding: 9px 16px; }

/* ---- เลขหน้า ---- */
.pager button{ font-size: 16.5px; padding: 8px 14px; border-radius: 10px; }

/* ---- Modal ---- */
.modal-h{ padding: 20px 24px; }
.modal-h b, .modal-h h3{ font-size: 20px; }
.empty-sm{ font-size: 17.5px; }
