/* Font: Sarabun (Cadson Demak, SIL OFL 1.1 — see fonts/Sarabun-OFL.txt), self-hosted so the app works on a LAN without internet. */
@font-face { font-family: 'Sarabun'; src: url('fonts/sarabun-thai-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC; }
@font-face { font-family: 'Sarabun'; src: url('fonts/sarabun-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Sarabun'; src: url('fonts/sarabun-thai-500-normal.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC; }
@font-face { font-family: 'Sarabun'; src: url('fonts/sarabun-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Sarabun'; src: url('fonts/sarabun-thai-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC; }
@font-face { font-family: 'Sarabun'; src: url('fonts/sarabun-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Sarabun'; src: url('fonts/sarabun-thai-700-normal.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC; }
@font-face { font-family: 'Sarabun'; src: url('fonts/sarabun-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* AI Learning & Performance 360 — UI styles
   Light/Dark via [data-theme], collapsible sidebar, mobile drawer, print-friendly. */

:root {
  --font: 'Sarabun', 'Noto Sans Thai', 'Leelawadee UI', Tahoma, sans-serif;
  --bg: #F3F4F1;
  --surface: #FFFFFF;
  --surface-2: #F7F8F6;
  --ink: #1B2326;
  --muted: #545E62;
  --line: #D9DDD8;
  --line-soft: #ECEEEA;
  --accent: #0E5A66;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3EFF0;
  --accent-strong: #0B3F48;
  --ok: #1F6B3A;
  --ok-soft: #E6F2EA;
  --warn: #9A3B0B;
  --warn-soft: #FBEDE3;
  --warn-line: #E8C3A8;
  --info: #0B3F48;
  --info-soft: #E3EFF0;
  --neutral-soft: #EEF0EC;
  --side-bg: #0B3F48;
  --side-ink: #D5E6E8;
  --side-active: rgba(255, 255, 255, .14);
  --shadow: 0 1px 2px rgba(20, 30, 30, .06);
  --radius: 14px;
  --side-w: 248px;
  --side-w-collapsed: 72px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #11171A;
  --surface: #182125;
  --surface-2: #1D282C;
  --ink: #E6ECEC;
  --muted: #A3B0B3;
  --line: #2E3B40;
  --line-soft: #253136;
  --accent: #5FB4C0;
  --accent-ink: #082A30;
  --accent-soft: #163A40;
  --accent-strong: #8FD0D9;
  --ok: #7ACB95;
  --ok-soft: #173326;
  --warn: #F0A673;
  --warn-soft: #3A2417;
  --warn-line: #5C3A24;
  --info: #9FD3DA;
  --info-soft: #163A40;
  --neutral-soft: #253136;
  --side-bg: #0C1416;
  --side-ink: #B9C9CC;
  --side-active: rgba(95, 180, 192, .18);
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
h1, h2, h3 { line-height: 1.3; margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }
.ico { width: 20px; height: 20px; flex: 0 0 20px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.hidden { display: none !important; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--side-w); flex: 0 0 var(--side-w); background: var(--side-bg); color: var(--side-ink);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; transition: width .18s ease, flex-basis .18s ease; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 16px 14px; }
.brand-mark { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; background: #FFFFFF; color: #0B3F48; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.brand-text { display: flex; flex-direction: column; color: #FFFFFF; white-space: nowrap; overflow: hidden; }
.brand-text small { color: var(--side-ink); font-size: 12px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; overflow-y: auto; flex: 1 1 auto; }
.nav-item, .collapse-btn {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px;
  color: var(--side-ink); text-decoration: none; font-size: 15px; white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #FFFFFF; }
.nav-item.active { background: var(--side-active); color: #FFFFFF; font-weight: 600; }
.collapse-btn { margin: 8px 10px 16px; background: none; border: 1px solid rgba(255, 255, 255, .14); cursor: pointer; font: inherit; }
.collapse-btn .ico { transition: transform .18s ease; }
html.side-collapsed .sidebar { width: var(--side-w-collapsed); flex-basis: var(--side-w-collapsed); }
html.side-collapsed .nav-label, html.side-collapsed .brand-text { display: none; }
html.side-collapsed .collapse-btn .ico { transform: rotate(180deg); }
html.side-collapsed .nav-item, html.side-collapsed .collapse-btn { justify-content: center; padding: 0; }
.scrim { display: none; }

.main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; min-height: 60px;
  padding: 8px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar-title { font-weight: 600; font-size: 16px; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions form { margin: 0; }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.when-dark { display: none; }
[data-theme="dark"] .when-dark { display: inline; }
[data-theme="dark"] .when-light { display: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-weight: 700; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta small { color: var(--muted); font-size: 12px; }
.only-mobile { display: none; }
.content { padding: 28px 24px 48px; width: 100%; max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

@media (max-width: 1100px) {
  .user-meta { display: none; }
}
@media (max-width: 900px) {
  .only-mobile { display: inline-grid; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s ease; width: var(--side-w); }
  html.side-collapsed .sidebar { width: var(--side-w); }
  html.side-collapsed .nav-label, html.side-collapsed .brand-text { display: initial; }
  html.side-collapsed .nav-item { justify-content: flex-start; padding: 0 12px; }
  .collapse-btn { display: none; }
  html.drawer-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  html.drawer-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 35; }
  .topbar { padding: 8px 12px; }
  .content { padding: 20px 14px 40px; }
}

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.grid-2 { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.grid-2 > .main { flex: 999 1 560px; min-width: 0; }
.grid-2 > .side { flex: 1 1 320px; min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--muted); font-size: 14px; }
.stat .value { font-size: 34px; font-weight: 700; line-height: 1.1; }
.stat .note { color: var(--muted); font-size: 13px; }
.stat .value.accent { color: var(--accent); }
.stat .value.warn { color: var(--warn); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn-outline { background: var(--surface); color: var(--accent); }
.btn-outline:hover { background: var(--accent-soft); color: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #FFFFFF; }
[data-theme="dark"] .btn-warn { color: #2A1508; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; filter: none; }

.chip { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.chip-neutral { background: var(--neutral-soft); color: var(--muted); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-bad { background: #E03131; color: #FFFFFF; }

.alert { border-radius: 12px; padding: 12px 16px; border: 1px solid var(--line); background: var(--surface); }
.alert-success, .alert-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.alert-error, .alert-warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.alert-info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.banner { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.banner .ico { color: var(--warn); }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th, .tbl td { padding: 10px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.tbl thead th { font-size: 13px; color: var(--muted); font-weight: 600; border-bottom-color: var(--line); white-space: nowrap; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }

label { font-weight: 600; font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field small { color: var(--muted); font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=date], input[type=number], input[type=datetime-local], input[type=search], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; min-height: 36px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .field { min-width: 160px; }

.list-item { padding: 14px 0; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 4px; }
.list-item:first-child { border-top: none; padding-top: 0; }
.tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }

.progress { height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* ---------- Login ---------- */
.bare-main { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-brand .brand-mark { background: var(--accent); color: var(--accent-ink); }
.theme-float { position: fixed; top: 14px; right: 14px; }

/* ---------- Exam (mobile-first) ---------- */
.exam { max-width: 640px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.exam-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.exam-head .count { color: var(--accent); font-weight: 600; white-space: nowrap; }
.scenario { display: flex; flex-direction: column; gap: 10px; }
.scenario .kicker { font-size: 13px; font-weight: 600; color: var(--accent); }
.scenario h1 { font-size: 20px; }
.scenario p { font-size: 17px; line-height: 1.7; }
.options { display: flex; flex-direction: column; gap: 12px; border: 0; padding: 0; margin: 0; }
.opt { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; min-height: 60px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; font-weight: 400; font-size: 16px; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .letter { flex: 0 0 32px; height: 32px; border-radius: 16px; display: grid; place-items: center; font-weight: 700; background: var(--neutral-soft); color: var(--ink); }
.opt .txt { padding-top: 3px; display: flex; flex-direction: column; gap: 4px; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt:has(input:checked) .letter { background: var(--accent); color: var(--accent-ink); }
.opt:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.opt.is-right { border-color: var(--ok); background: var(--ok-soft); cursor: default; }
.opt.is-right .letter { background: var(--ok); color: var(--surface); }
.opt.is-mine-wrong { border-color: var(--warn); background: var(--warn-soft); cursor: default; }
.opt.is-mine-wrong .letter { background: var(--warn); color: var(--surface); }
.opt.locked { cursor: default; }
.opt .mark { font-size: 13px; font-weight: 600; }
.opt.is-right .mark { color: var(--ok); }
.opt.is-mine-wrong .mark { color: var(--warn); }
.feedback { overflow: hidden; padding: 0; }
.feedback .verdict { display: flex; align-items: center; gap: 10px; padding: 14px 20px; font-size: 18px; font-weight: 700; }
.feedback .verdict.ok { background: var(--ok-soft); color: var(--ok); }
.feedback .verdict.no { background: var(--warn-soft); color: var(--warn); }
.feedback .body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.feedback .k { font-size: 13px; font-weight: 600; color: var(--muted); }
.key-learning { background: var(--accent-soft); border-radius: 12px; padding: 14px 16px; }
.key-learning .k { color: var(--accent); }
.key-learning strong { font-size: 17px; color: var(--accent-strong); }
.locked-note { display: flex; gap: 6px; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.locked-note .ico { width: 14px; height: 14px; flex-basis: 14px; }

.score-ring { font-size: 44px; font-weight: 700; color: var(--accent); }
.bar { height: 10px; background: var(--line-soft); border-radius: 5px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar.warn > span { background: var(--warn); }
.qpreview { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; max-width: 420px; }
.err-list { margin: 0; padding-left: 18px; }
.err-list li { margin: 2px 0; }
pre.raw { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 13px; max-height: 320px; overflow: auto; }

/* ---------- Tablet ---------- */
@media (min-width: 600px) and (max-width: 1024px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Print ---------- */
.print-only { display: none; }
@media print {
  @page { margin: 14mm; }
  :root, [data-theme="dark"] {
    --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #FFFFFF; --ink: #000000; --muted: #333333; --line: #999999; --line-soft: #CCCCCC;
    --accent: #000000; --accent-soft: #F0F0F0; --accent-strong: #000000; --ok: #000000; --ok-soft: #FFFFFF; --warn: #000000; --warn-soft: #FFFFFF;
  }
  body { font-size: 11pt; background: #FFFFFF; }
  .sidebar, .topbar, .scrim, .no-print, .btn, form.no-print, .skip, .theme-float { display: none !important; }
  .print-only { display: block; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .card, .stat { box-shadow: none; border-color: #999; break-inside: avoid; }
  .tbl th, .tbl td { padding: 5px 6px; }
  a { color: #000; text-decoration: none; }
  .chip { border: 1px solid #666; background: none !important; color: #000 !important; }
}

/* ---------- Full-height sidebar background on long pages (desktop) ---------- */
@media (min-width: 901px) {
  .shell { background: linear-gradient(to right, var(--side-bg) 0 var(--side-w), var(--bg) var(--side-w)); }
  html.side-collapsed .shell { background: linear-gradient(to right, var(--side-bg) 0 var(--side-w-collapsed), var(--bg) var(--side-w-collapsed)); }
  .main-col { background: var(--bg); }
}

/* ---------- Tables that become cards on phones ---------- */
@media (max-width: 640px) {
  .tbl-cards thead { display: none; }
  .tbl-cards, .tbl-cards tbody, .tbl-cards tr, .tbl-cards td, .tbl-cards th { display: block; width: 100%; }
  .tbl-cards tr { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface); }
  .tbl-cards tbody tr:hover { background: var(--surface); }
  .tbl-cards td, .tbl-cards th { border: 0; padding: 4px 0; text-align: left !important; }
  .tbl-cards td[data-label] { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .tbl-cards td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 13px; flex: 0 0 auto; }
  .tbl-cards td.card-title { font-weight: 600; font-size: 15px; }
  .tbl-cards td[data-label] > .row { flex: 1 1 auto; justify-content: flex-end; }
}

/* ---------- Nav groups, cycle pill, eyebrow ---------- */
.nav-group { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--side-ink); opacity: .65; padding: 14px 12px 4px; white-space: nowrap; overflow: hidden; }
.sidebar nav .nav-group:first-child { padding-top: 2px; }
html.side-collapsed .nav-group { visibility: hidden; height: 10px; padding: 0; }
@media (max-width: 900px) { html.side-collapsed .nav-group { visibility: visible; height: auto; padding: 14px 12px 4px; } }
.cycle-pill { font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); white-space: nowrap; }
@media (max-width: 600px) { .cycle-pill { display: none; } }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--accent); margin-bottom: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.bar.mid > span { background: #D9A400; }
.weak-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(90px, 1fr) 46px; gap: 12px; align-items: center; padding: 7px 0; }
.weak-row .name { font-size: 14px; line-height: 1.35; }
.weak-row .name small { display: block; color: var(--muted); font-size: 12px; }
.weak-row .pct { text-align: right; font-weight: 700; font-size: 14px; }
.iso-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.iso-card { display: flex; flex-direction: column; gap: 8px; }
.iso-card .std { font-size: 12px; font-weight: 700; letter-spacing: .05em; color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.check-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.check-row:first-child { border-top: 0; }
.check-mark { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; }
.check-mark.ok { background: var(--ok-soft); color: var(--ok); }
.check-mark.partial { background: var(--warn-soft); color: var(--warn); }
.check-mark.missing { background: var(--neutral-soft); color: var(--muted); }
.check-mark.manual { background: var(--info-soft); color: var(--info); }

/* ---------- Knowledge clips ---------- */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.video-card { padding: 0; overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.video-card:hover { color: inherit; }
.video-card .thumb { position: relative; aspect-ratio: 16 / 9; background: var(--neutral-soft); overflow: hidden; }
.video-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-card .play { position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.6); color: #fff; font-size: 20px; padding-left: 4px; }
.video-card .done-badge { position: absolute; top: 10px; left: 10px; background: var(--ok); color: #fff; font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.video-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.video-body h3 { font-size: 16px; }
.video-frame { position: relative; aspect-ratio: 16 / 9; width: 100%; background: #000; border-radius: var(--radius); overflow: hidden; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

[hidden] { display: none !important; }

.policy-body { font-size: 16px; line-height: 1.75; }

/* Compact sidebar on short screens (e.g. laptops at 125% zoom) so the whole menu fits */
@media (min-width: 901px) and (max-height: 860px) {
  .brand { padding: 12px 16px 8px; }
  .nav-item { min-height: 36px; font-size: 14.5px; }
  .nav-group { padding: 8px 12px 2px; }
  .collapse-btn { margin: 6px 10px 10px; min-height: 36px; }
}

/* ---------- Social login ---------- */
.or-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-social { justify-content: center; }
.btn-google { background: #FFFFFF; color: #1F1F1F; border-color: #747775; }
.btn-google:hover { color: #1F1F1F; background: #F2F2F2; }
.btn-line { background: #06C755; border-color: #06C755; color: #FFFFFF; }
.btn-line:hover { color: #FFFFFF; }
.btn-facebook { background: #1877F2; border-color: #1877F2; color: #FFFFFF; }
.btn-facebook:hover { color: #FFFFFF; }
.social-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; }
.btn-line .social-dot, .btn-facebook .social-dot { border-color: #FFFFFF; }
.social-google { color: #4285F4; } .social-line { color: #06C755; } .social-facebook { color: #1877F2; }

/* Sidebar: never squeeze group labels or items when the menu is taller than the screen; let it scroll instead */
.sidebar nav > * { flex-shrink: 0; }

.brand-mark { font-size: 13px; letter-spacing: -0.02em; }

/* Logo image inside the brand mark */
.brand-logo { padding: 0 !important; overflow: hidden; background: transparent !important; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-logo::before { content: none !important; }

/* Sketch logo: shield mark on the paper colour inside the brand box */
.brand-logo { background: #FBF6EA !important; padding: 3px !important; }
.brand-logo img { object-fit: contain; }

/* ---------- Radar charts ---------- */
.radar-wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .radar-wrap { grid-template-columns: 1fr; } }
.radar { width: 100%; max-width: 200px; height: auto; display: block; margin: 0 auto; }
.radar-grid { fill: none; stroke: var(--line-soft); stroke-width: 2; }
.radar-threshold { fill: none; stroke: var(--ok); stroke-width: 3; stroke-dasharray: 8 7; opacity: .9; }
.radar-axis { stroke: var(--line-soft); stroke-width: 2; }
.radar-num-bg { fill: var(--surface); stroke: var(--ink); stroke-width: 2.5; }
.radar-num { font: 700 22px var(--hand, inherit); fill: var(--ink); text-anchor: middle; }
.radar-scale { font-size: 9px; fill: var(--muted); }
.radar-area { fill-opacity: .10; stroke-width: 5; stroke-linejoin: round; }
.radar-dot { stroke-width: 3; }
.radar-legend-series { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: center; font-size: 12px; margin-top: 6px; }
.radar-legend-series i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.radar-legend-series i.th { background: transparent; border: 2px dashed var(--ok); }
.radar-legend { margin: 0; padding-left: 26px; display: flex; flex-direction: column; gap: 8px; }
.radar-legend li { font-size: 14px; line-height: 1.4; }
.radar-legend li::marker { font-weight: 700; }
.radar-li-name { display: block; }
.radar-li-vals { font-size: 13px; }
@media print { .radar-wrap { grid-template-columns: 200px 1fr; } }

/* dark mode: dots without data and number badges follow the surface colour */
[data-theme="dark"] .radar-dot.none, [data-theme="dark"] .radar-num-bg { fill: var(--surface); }
[data-theme="dark"] .radar-num-bg { stroke: var(--line); }
[data-theme="dark"] .radar-num { fill: var(--ink); }

/* Two radar cards side by side; stack on narrow screens */
.radar-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.radar-pair > .card { margin: 0; min-width: 0; }
.radar-pair .radar-wrap { grid-template-columns: 200px minmax(0, 1fr); gap: 16px; }
@media (max-width: 1100px) { .radar-pair { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .radar-pair .radar-wrap { grid-template-columns: 1fr; } }
@media print { .radar-pair { grid-template-columns: 1fr 1fr; } }

/* Short guide card (progress page) */
.guide-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; }
@media (max-width: 760px) { .guide-grid { grid-template-columns: 1fr; gap: 14px; } }
.guide-title { font-size: 17px; margin-bottom: 6px; }
.guide-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14.5px; line-height: 1.5; }

.focus-card { border-left-width: 6px; }
details.card > summary { cursor: pointer; }

.nav-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--warn, #E8590C); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
html.side-collapsed .nav-badge { position: absolute; margin: 0; transform: translate(14px, -10px); min-width: 16px; height: 16px; font-size: 10px; }

/* Knowledge documents */
.doc-thumb { display: flex; align-items: center; justify-content: center; background: var(--surface-2); }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-pdf { font: 700 28px var(--hand, inherit); color: #C92A2A; border: 3px solid currentColor; border-radius: 10px; padding: 10px 14px; background: var(--surface); }
.doc-image { width: 100%; height: auto; border-radius: 10px; border: 2px solid var(--line); display: block; }

/* ---------- News + blinking NEW badge ---------- */
.nav-new, .new-badge { display: inline-flex; align-items: center; justify-content: center; padding: 1px 7px; border-radius: 999px;
  background: #E03131; color: #fff; font: 700 11px/1.6 var(--hand, inherit); letter-spacing: .04em; }
.nav-new { margin-left: auto; animation: new-pulse 1.6s ease-in-out infinite; }
.new-badge { animation: new-pulse 1.6s ease-in-out infinite; }
@keyframes new-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.94); } }
html.side-collapsed .nav-new { position: absolute; margin: 0; transform: translate(12px, -10px); font-size: 9px; padding: 0 4px; }
.menu-btn { position: relative; }
.menu-dot { position: absolute; top: 6px; right: 6px; width: 10px; height: 10px; border-radius: 50%; background: #E03131; border: 2px solid var(--surface); animation: new-pulse 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .nav-new, .new-badge, .menu-dot { animation: none; } }
.news-row { display: flex; gap: 14px; color: inherit; text-decoration: none; align-items: flex-start; }
.news-row.is-new { border-left: 6px solid #E03131; }
.news-row h3 { margin: 6px 0 2px; }
.news-thumb { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 2px solid var(--line); flex: 0 0 auto; }
@media (max-width: 520px) { .news-thumb { width: 84px; height: 64px; } }
.news-main { min-width: 0; flex: 1; }
.news-body { white-space: normal; line-height: 1.75; font-size: 16px; }
.news-alert { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; border-left: 6px solid #E03131; }

/* ---------- Employee dashboard ---------- */
.hero-mission { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: center; }
@media (max-width: 560px) { .hero-mission { grid-template-columns: 1fr; justify-items: center; text-align: center; } .hero-mission .row { justify-content: center; } }
.ring-wrap { position: relative; width: 150px; height: 150px; }
.ring { width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--line-soft); stroke-width: 12; }
.ring-bar { fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.ring-ok .ring-bar { stroke: var(--ok); } .ring-warn .ring-bar { stroke: #E8590C; }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.ring-text strong { font: 700 32px var(--hand, inherit); }
.ring-text span { font-size: 13px; color: var(--muted); margin-top: 4px; }
.hero-main h2 { margin: 2px 0 6px; font-size: 26px; }
.countdown { font-size: 17px; margin: 0 0 6px; } .countdown b { font: 700 30px var(--hand, inherit); margin: 0 4px; color: var(--accent); }
.countdown.urgent b { color: #E03131; }
.hero-msg { margin: 0 0 12px; }
.btn-lg { font-size: 18px; padding: 12px 22px; }
.dash-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.dash-pair > .card { margin: 0; min-width: 0; }
@media (max-width: 760px) { .dash-pair { grid-template-columns: 1fr; } }
.task { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; }
.task:hover { background: var(--surface-2); }
.task .tick { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; }
.task.ok .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.ok .grow { color: var(--muted); }
.stamps { display: flex; flex-wrap: wrap; gap: 14px; }
.stamp { width: 104px; height: 104px; border-radius: 50%; border: 3px dashed currentColor; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-decoration: none; transform: rotate(-6deg); text-align: center; line-height: 1.15; padding: 6px; }
.stamp:nth-child(even) { transform: rotate(5deg); }
.stamp.ok { color: #2B8A3E; } .stamp.warn { color: #D9480F; }
.stamp strong { font: 700 22px var(--hand, inherit); } .stamp span { font-size: 12px; font-weight: 700; } .stamp small { font-size: 10px; color: var(--muted); margin-top: 2px; }
.tip-note { background: #FFF3BF; color: #1C1B1A; transform: rotate(-.6deg); }
.tip-note .eyebrow { background: transparent; padding: 0; color: #8F6A00; }
.tip-note h3 { margin: 4px 0 6px; }
.tip-key { font: 700 20px var(--hand, inherit); margin: 0 0 6px; }
.tip-note .muted { color: #6b5d2f; }
[data-theme="dark"] .tip-note { background: #4A3F14; color: #FFF3BF; } [data-theme="dark"] .tip-note .muted, [data-theme="dark"] .tip-note .eyebrow { color: #E9D98B; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .ring-bar { transition: none; } .stamp, .tip-note { transform: none; } }

/* ---------- Font size (whole page scales, so buttons grow too) ---------- */
html[data-font="s"] body { zoom: .9; }
html[data-font="l"] body { zoom: 1.15; }
html[data-font="xl"] body { zoom: 1.3; }
@media print { html body { zoom: 1 !important; } }
.font-ctl { position: relative; }
.font-ico { font: 700 18px var(--hand, inherit); line-height: 1; } .font-ico small { font-size: 12px; margin-left: 1px; }
.font-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 230px; padding: 12px; background: var(--surface); border: 2px solid var(--ink, #1C1B1A); border-radius: 14px; box-shadow: 4px 4px 0 var(--ink, #1C1B1A); }
.font-pop-title { margin: 0 0 8px; font-weight: 700; font-size: 14px; }
.font-opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.font-opts button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); color: inherit; font-size: 12px; cursor: pointer; }
.font-opts button[aria-checked="true"] { border-color: var(--accent); background: var(--surface-2); font-weight: 700; }
.font-sample { font-family: var(--hand, inherit); font-weight: 700; line-height: 1.1; }
.float-tools { display: flex; gap: 8px; align-items: flex-start; }
@media (max-width: 760px) { .topbar .font-pop { position: fixed; left: 8px; right: 8px; top: 60px; min-width: 0; } }

.btn-danger { background: #E03131; border-color: #1C1B1A; color: #fff; }
.reset-box { margin-top: 14px; padding: 12px 14px; border: 2px dashed #E03131; border-radius: 12px; }
.reset-box > summary { cursor: pointer; }

/* Decorative bits (sparkles, offset shadows) must never create sideways scrolling; tables scroll inside .table-wrap */
html, body { overflow-x: clip; }
/* Long Thai titles in list rows (e.g. policy names) wrap instead of pushing the row wider than the screen */
.list-item.row > div, .list-item .row > div, .row.between > div { min-width: 0; }
.list-item strong, .card h2, .card h3 { overflow-wrap: break-word; }

/* Clip viewing report */
.clip-matrix td.num, .clip-matrix th.num { text-align: center; }
.cm { display: inline-flex; min-width: 28px; height: 24px; padding: 0 5px; align-items: center; justify-content: center; border-radius: 6px; font-size: 13px; font-weight: 700; }
.cm-done { background: #D3F9D8; color: #2B8A3E; } .cm-soon { background: #FFF3BF; color: #8F6A00; }
.cm-part { background: var(--surface-2); color: var(--ink); font-weight: 600; } .cm-exp { background: #FFE3E3; color: #C92A2A; } .cm-none { color: var(--muted); }
.clip-legend { margin: 8px 0 0; padding-left: 22px; columns: 2; } @media (max-width: 640px) { .clip-legend { columns: 1; } }

@media print { .print-sign { break-inside: avoid; margin-top: 30px; } }
@media screen { .print-sign { display: none; } }

/* ---------- Games ---------- */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-bottom: 18px; }
.game-grid > .card { margin: 0; }
.board { margin: 8px 0 0; padding-left: 0; list-style: none; } .board li { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line-soft); }
.msg-card { min-height: 190px; } .msg-from { font-weight: 700; margin: 10px 0 2px; word-break: break-word; } .msg-subj { font-weight: 600; margin: 0 0 6px; }
.msg-body { margin: 0; font-size: 17px; line-height: 1.7; } .msg-link { margin: 8px 0 0; color: #1971C2; text-decoration: underline; word-break: break-all; }
.sort-actions .btn { justify-content: center; } .sort-actions { gap: 10px; }
[data-feedback] .verdict { padding: 10px 14px; border-radius: 10px; font-weight: 700; } [data-feedback] .verdict.ok { background: #D3F9D8; color: #2B8A3E; } [data-feedback] .verdict.no { background: #E03131; color: #fff; }
.spot-wrap { position: relative; border: 3px solid var(--ink, #1C1B1A); border-radius: 12px; overflow: hidden; cursor: crosshair; user-select: none; touch-action: manipulation; }
.spot-wrap img { display: block; width: 100%; height: auto; pointer-events: none; }
.spot-mark { position: absolute; border: 4px solid #2B8A3E; border-radius: 10px; background: rgba(64,192,87,.18); pointer-events: none; }
.spot-mark.is-missed { border-color: #E03131; background: rgba(224,49,49,.15); border-style: dashed; }
.spot-ping { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 4px solid #E03131; pointer-events: none; animation: ping .9s ease-out forwards; }
@keyframes ping { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.spot-tip { position: absolute; transform: translate(-50%, -130%); background: #1C1B1A; color: #fff; padding: 3px 8px; border-radius: 6px; font-size: 13px; white-space: nowrap; pointer-events: none; }
[data-list] li { margin-bottom: 6px; } [data-list] li.missed strong { color: #C92A2A; }
.puzzle { white-space: pre-wrap; word-break: break-word; background: #1C1B1A; color: #D3F9D8; padding: 14px; border-radius: 10px; font-size: 14px; line-height: 1.6; margin: 0; }
.hint { background: #FFF3BF; color: #1C1B1A; padding: 8px 12px; border-radius: 8px; margin: 0; }
.attack-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; } @media (max-width: 760px) { .attack-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.attack-card { min-height: 150px; border: 3px solid #1C1B1A; border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 6px; background: #343A40; color: #F8F9FA; }
.attack-card.is-found { background: #D3F9D8; color: #1C1B1A; } .attack-card.is-missed { background: #FFE3E3; color: #1C1B1A; }
.attack-card .hidden-mark { font-size: 46px; text-align: center; margin: auto; }
.proc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.proc { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); color: inherit; cursor: pointer; font: inherit; }
.proc:hover:not([disabled]) { border-color: var(--accent); } .proc.is-est { border-color: #F59F00; } .proc[disabled] { opacity: .45; cursor: not-allowed; }
.history { padding-left: 20px; margin: 0; } .history li { margin-bottom: 8px; }
