/* ═══════════ ธีม console (2026-11-05) ═══════════
   แถบเมนูเข้มด้านซ้าย + พื้นที่ทำงานสว่าง การ์ดเส้นบาง ตัวเลข/หัวข้อฟอนต์ Anuphan — โหลดหลัง style.css เพื่อทับค่าเดิม
   ผู้ใช้ขอหน้าตามืออาชีพ ทันสมัย อ้างอิงแนวเว็บ SaaS ใน a1.gallery */
:root {
  --paper: #f5f6f8; --surface: #ffffff; --sunk: #f0f1f4; --ink: #12141a; --muted: #6a6f7d; --line: #e4e6eb;
  --accent: #4f46e5; --accent-ink: #ffffff; --accent-soft: #eef0fe;
  --side-bg: #0f1117; --side-ink: #c3c7d2; --side-dim: #7d8293; --side-line: #22252e; --side-hi: rgb(255 255 255 / .07);
  --f-display: "Anuphan", "IBM Plex Sans Thai", "Leelawadee UI", sans-serif;
  --r: 10px; --shadow: 0 1px 2px rgb(16 24 40 / .05);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #0b0c10; --surface: #13151b; --sunk: #0f1116; --ink: #e8e9ee; --muted: #8b90a0; --line: #23262e;
  --accent: #8b8cf8; --accent-ink: #0b0c10; --accent-soft: #1d1e3a;
  --side-bg: #08090c; --side-line: #1b1d24; color-scheme: dark; } }
:root[data-theme="dark"] {
  --paper: #0b0c10; --surface: #13151b; --sunk: #0f1116; --ink: #e8e9ee; --muted: #8b90a0; --line: #23262e;
  --accent: #8b8cf8; --accent-ink: #0b0c10; --accent-soft: #1d1e3a;
  --side-bg: #08090c; --side-line: #1b1d24; color-scheme: dark; }

h1, h2, .kpi-v, .auth h1 { font-family: var(--f-display); letter-spacing: -.005em; }
.donut-big { font-family: var(--f-display); }
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.main-col { min-width: 0; }
main.wrap { padding-block: 28px 64px; max-width: 1320px; }
.banner .wrap { max-width: 1320px; }

/* แถบเมนูซ้าย */
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side-bg); color: var(--side-ink); display: flex; flex-direction: column; gap: 18px; padding: 18px 14px 14px; border-right: 1px solid var(--side-line); }
.side-head { display: grid; gap: 16px; }
.side .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; padding: 2px 6px; }
.logo { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-family: var(--f-display); font-weight: 700; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #22d3ee); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .15); flex: none; }
.brand-t { display: grid; line-height: 1.1; }
.brand-t b { font-family: var(--f-display); font-size: 16px; letter-spacing: .04em; }
.brand-t small { font-size: 12px; color: var(--side-dim); font-weight: 500; }
.side .brand-t b, .login-art .brand-t b { color: #fff; }
.side .me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: var(--side-hi); margin: 0; width: auto; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: block; flex: none; overflow: hidden; box-shadow: 0 0 0 2px rgb(255 255 255 / .9), 0 2px 6px rgb(16 24 40 / .18); }
.avatar svg { display: block; }
.side .avatar { box-shadow: 0 0 0 2px rgb(255 255 255 / .15); }
.mem-top .avatar { width: 34px; height: 34px; }
.pname.person { grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; align-items: center; }
.pname.person .avatar { width: 28px; height: 28px; grid-row: span 2; box-shadow: none; }
.side .who { display: grid; line-height: 1.25; color: #fff; font-weight: 600; font-size: 14px; margin: 0; }
.side .who small { color: var(--side-dim); font-weight: 400; font-size: 12px; }
.side-sel { display: grid; gap: 12px; }
.side-sec { display: grid; gap: 6px; }
.side-lbl { font-size: 11px; letter-spacing: .08em; color: var(--side-dim); font-weight: 600; padding: 0 6px; }
.side .switch { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #1a1c24; border-color: #262934; }
.side .switch button { color: var(--side-dim); padding: 6px 8px; }
.side .switch button[aria-pressed="true"] { background: #2c2f3c; color: #fff; box-shadow: none; }
.side .switch button.prod[aria-pressed="true"] { background: #b4302a; color: #fff; }
.side .tabs { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 2px; border: 0; padding: 0; margin: 0; order: 0; flex: 1 1 auto; }
.side .nav-lbl { margin: 10px 0 4px; }
.side .tabs a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-ink); text-decoration: none; font-weight: 500; font-size: 14.5px; white-space: nowrap; }
.side .tabs a:hover { background: var(--side-hi); color: #fff; }
.side .tabs a[aria-current="page"] { background: #fff; color: #0f1117; }
.side .tabs a[aria-current="page"] .ic { color: #4f46e5; }
.side .tabs .tl { flex: 1; }
.side .tabs .count { font-family: var(--f-mono); font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: rgb(255 255 255 / .08); color: var(--side-ink); margin: 0; }
.side .tabs a[aria-current="page"] .count { background: #eef0fe; color: #4f46e5; }
.side .tabs .count.hot { background: #b4302a; color: #fff; }
.side-foot { display: grid; gap: 2px; border-top: 1px solid var(--side-line); padding-top: 10px; }
.side-btn { display: flex; align-items: center; gap: 10px; border: 0; background: none; color: var(--side-dim); padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; text-align: left; }
.side-btn:hover { background: var(--side-hi); color: #fff; }
.ic { flex: none; }
.theme-pick { display: grid; gap: 6px; padding: 2px 0 8px; }
.theme-pick .switch { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.side .theme-pick .switch button { font-size: 12.5px; padding: 5px 4px; }
@media (max-width: 900px) {
  .theme-pick { grid-auto-flow: column; align-items: center; padding: 0; margin-right: auto; } .theme-pick .side-lbl { display: none; }
  .side-foot { display: flex; align-items: center; gap: 6px; justify-content: flex-start; }
  .side-foot .side-btn .tl { display: none; }
  .side-foot .side-btn { padding: 6px; }
}
/* ธีมมืดทั้งหน้า: แถบเมนูกลืนกับพื้น เมนูที่เลือกเป็นสีม่วงแทนสีขาว */
:root[data-theme="dark"] .side .tabs a[aria-current="page"] { background: #262a45; color: #fff; }
:root[data-theme="dark"] .side .tabs a[aria-current="page"] .ic { color: #a5a6ff; }
:root[data-theme="dark"] .side .tabs a[aria-current="page"] .count { background: rgb(255 255 255 / .1); color: #fff; }
:root[data-theme="dark"] .kpi::after { opacity: .9; }
:root[data-theme="dark"] .login-pane .auth { box-shadow: none; }
.hbar-empty { font-size: 12.5px; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; padding: 1px 10px; justify-self: start; }

/* การ์ดและส่วนประกอบ */
.kpi, .dcard, .card-form, .list, .detail, .mods, .guide article, .aside-card, .bug-card, .stat, .tbl-wrap { border-radius: 14px; box-shadow: var(--shadow); }
.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--accent), transparent); opacity: .6; }
.kpi:nth-child(2)::after { background: linear-gradient(90deg, var(--pass), transparent); }
.kpi:nth-child(3)::after { background: linear-gradient(90deg, var(--bug), transparent); }
.kpi:nth-child(4)::after { background: linear-gradient(90deg, var(--block), transparent); }
.kpi-v { font-size: 36px; }
.btn { border-radius: 9px; }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.dash-head h1 { font-size: 26px; }
.detail, .aside-card { top: 20px; }
.detail { max-height: calc(100vh - 40px); }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* หน้า login แบบแบ่งครึ่ง */
.login-split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.login-art { position: relative; overflow: hidden; background: #0b0c12; color: #e8e9ee; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.login-art::before { content: ""; position: absolute; width: 620px; height: 620px; right: -180px; top: -160px; background: radial-gradient(closest-side, rgb(99 102 241 / .55), transparent 70%); }
.login-art::after { content: ""; position: absolute; width: 520px; height: 520px; left: -160px; bottom: -200px; background: radial-gradient(closest-side, rgb(34 211 238 / .28), transparent 70%); }
.login-art > * { position: relative; z-index: 1; }
.login-art .brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.login-art .brand-t small { color: #9aa0b2; }
.art-copy h2 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.2; color: #fff; text-wrap: balance; }
.art-copy p { max-width: 46ch; color: #a8aec0; font-size: 16px; margin: 14px 0 0; }
.art-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.art-stats div { border: 1px solid rgb(255 255 255 / .1); background: rgb(255 255 255 / .04); border-radius: 12px; padding: 14px; display: grid; gap: 2px; }
.art-stats b { font-family: var(--f-display); font-size: 26px; color: #fff; }
.art-stats span { font-size: 12.5px; color: #9aa0b2; }
.login-pane { display: grid; place-items: center; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); background: var(--paper); }
.login-pane .auth { margin: 0; width: 100%; max-width: 400px; box-shadow: 0 10px 30px rgb(16 24 40 / .08); border-radius: 16px; padding: 32px; }
.login-pane .auth h1 { font-size: 26px; }

/* มือถือ/แท็บเล็ต: แถบเมนูกลายเป็นแถบบน */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { z-index: 30; height: auto; gap: 10px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); padding-top: calc(10px + env(safe-area-inset-top, 0px)); border-right: 0; border-bottom: 1px solid var(--side-line); overflow: visible; }
  .side-head { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; }
  .side .me { justify-self: end; padding: 4px 10px 4px 4px; }
  .side .who small { display: none; }
  .side-sel { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .side-sel .side-lbl { display: none; }
  .side .tabs { flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px; }
  .side .tabs::-webkit-scrollbar { display: none; }
  .side .nav-lbl { display: none; }
  .side .tabs a { padding: 6px 10px; font-size: 13.5px; }
  .side-foot { grid-auto-flow: column; justify-content: end; border: 0; padding: 0; }
  .side-btn { padding: 4px 8px; font-size: 12.5px; }
  main.wrap { padding-block: 18px 48px; }
  .detail, .aside-card { position: static; max-height: none; }
  .login-split { grid-template-columns: minmax(0, 1fr); }
  .login-art { padding: 28px 24px; gap: 20px; }
  .art-stats { display: none; }
}
