
 

 
:root {
  --paper:        oklch(98.2% 0.006 85);    
  --paper-2:      oklch(96% 0.009 85);      
  --line:         oklch(90% 0.01 85);
  --ink:          oklch(26% 0.02 260);      
  --ink-2:        oklch(48% 0.015 260);     
  --ink-3:        oklch(64% 0.012 260);

  --primary:      oklch(42% 0.11 258);      
  --primary-600:  oklch(36% 0.11 258);
  --primary-soft: oklch(94% 0.03 258);

  --accent:       oklch(55% 0.19 27);       
  --accent-soft:  oklch(95% 0.03 27);

  --sb-bg:        oklch(25% 0.015 255);     
  --sb-bg-2:      oklch(30% 0.017 255);
  --sb-text:      oklch(86% 0.01 255);
  --sb-muted:     oklch(64% 0.015 255);

  --ok:           oklch(52% 0.12 150);
  --ok-soft:      oklch(95% 0.035 150);
  --warn:         oklch(62% 0.13 75);
  --warn-soft:    oklch(96% 0.045 85);
  --danger:       oklch(53% 0.19 27);
  --danger-soft:  oklch(95% 0.03 27);

  --q-good:   #2e8a55;    
  --q-revise: #d4a017;
  --q-drop:   #c73a2b;

  --radius: 10px;
  --sb-w: 248px;
  --tb-h: 60px;
}

 
:root {
  --bs-body-font-family: 'Sarabun', system-ui, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-border-color: var(--line);
  --bs-primary: var(--primary);
  --bs-link-color: var(--primary);
  --bs-link-hover-color: var(--primary-600);
  --bs-border-radius: var(--radius);
  --bs-secondary-color: var(--ink-2);
}
body { font-size: 15px; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
.btn { font-weight: 500; border-radius: 8px; background-image: none; }
h1, h2, h3, h4, h5, .modal-title { color: var(--ink); }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-600); --bs-btn-hover-border-color: var(--primary-600); --bs-btn-active-bg: var(--primary-600); --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); }
.btn-outline-primary { --bs-btn-color: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary); --bs-btn-active-bg: var(--primary-600); }
.btn-light { --bs-btn-bg: var(--paper-2); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: var(--line); }
.btn-danger { --bs-btn-bg: var(--danger); --bs-btn-border-color: var(--danger); }
.btn-icon { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; font-size: 1.25rem; border: 0; background: transparent; color: var(--ink); }
.form-control, .form-select { border-color: var(--line); border-radius: 8px; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem var(--primary-soft); }
.form-label { font-weight: 500; font-size: .92rem; color: var(--ink-2); margin-bottom: .3rem; }
.form-text { color: var(--ink-3); }
.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { padding: .65rem .8rem; border-color: var(--line); }
.table thead th { background: var(--paper-2); color: var(--ink-2); font-weight: 600; font-size: .86rem; white-space: nowrap; }
.table tbody tr:hover > * { background: oklch(97.5% 0.008 85); }
.nav-tabs { border-color: var(--line); gap: .25rem; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.nav-tabs .nav-link { color: var(--ink-2); border: 0; border-bottom: 2px solid transparent; font-weight: 500; white-space: nowrap; border-radius: 0; padding: .6rem .9rem; }
.nav-tabs .nav-link:hover { color: var(--ink); border-color: transparent; }
.nav-tabs .nav-link.active { color: var(--primary); background: transparent; border-bottom-color: var(--accent); }
.modal-content { border: 0; border-radius: 14px; }
.modal-header { border-color: var(--line); }
.modal-footer { border-color: var(--line); background: var(--paper-2); border-radius: 0 0 14px 14px; }
.dropdown-menu { border-color: var(--line); border-radius: 10px; box-shadow: 0 10px 30px oklch(26% 0.02 260 / .12); }

 
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sb-w); z-index: 1040;
  background: var(--sb-bg); color: var(--sb-text); overflow-y: auto;
  transition: transform .2s ease;
}
.sb-brand { height: var(--tb-h); padding: 0 1.1rem; display: flex; align-items: center; gap: .7rem; border-bottom: 1px solid var(--sb-bg-2); }
.sb-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; padding: 2px; }
.sb-mark { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 1.1rem; flex: none; }
.sb-title { line-height: 1.15; min-width: 0; }
.sb-title b { display: block; font-size: 1.05rem; color: #fff; }
.sb-title small { display: block; font-size: .78rem; color: var(--sb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-nav { padding: .8rem .6rem 1.5rem; }
.sb-group { font-size: .72rem; letter-spacing: .06em; color: var(--sb-muted); padding: 1rem .75rem .4rem; }
.sb-link {
  display: flex; align-items: center; gap: .7rem; padding: .58rem .75rem; margin: 1px 0;
  color: var(--sb-text); text-decoration: none; border-radius: 8px; position: relative; font-weight: 500;
}
.sb-link i { font-size: 1.08rem; width: 1.2rem; text-align: center; color: var(--sb-muted); }
.sb-link:hover { background: var(--sb-bg-2); color: #fff; }
.sb-link.active { background: var(--sb-bg-2); color: #fff; }
.sb-link.active i { color: #fff; }
.sb-link.active::before { content: ''; position: absolute; left: -.6rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sb-badge { margin-left: auto; font-size: .72rem; background: var(--accent); color: #fff; border-radius: 99px; padding: 0 .45rem; }
.sb-foot { padding: .8rem 1.2rem 1.2rem; font-size: .75rem; color: var(--sb-muted); }

.topbar {
  position: fixed; top: 0; left: var(--sb-w); right: 0; height: var(--tb-h); z-index: 1030;
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem;
}
.tb-title { min-width: 0; line-height: 1.2; }
.tb-title b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title small { color: var(--ink-3); font-size: .8rem; }
.tb-user { margin-left: auto; }
.tb-user-btn { display: flex; align-items: center; gap: .65rem; background: transparent; border: 0; padding: .25rem; border-radius: 10px; color: var(--ink); }
.tb-user-btn:hover { background: var(--paper-2); }
.tb-user-text { text-align: right; line-height: 1.15; }
.tb-user-text b { display: block; font-size: .9rem; font-weight: 600; }
.tb-user-text small { color: var(--ink-3); font-size: .76rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 700; }

.content { margin-left: var(--sb-w); padding-top: var(--tb-h); min-height: 100vh; box-sizing: border-box; }
.content-inner { padding: 1.5rem 1.75rem 3rem; max-width: none; }

.sb-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  body.sb-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  body.sb-open .sb-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1035; }
  .topbar { left: 0; padding: 0 .75rem; }
  .content { margin-left: 0; }
  .content-inner { padding: 1rem 1rem 3rem; }
  .tb-user-text { display: none; }
}

 
.page-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h2 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--ink-2); font-size: .92rem; margin-top: .15rem; }
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

 
.guide-page-head { align-items: center; }
.guide-kicker { color: var(--primary); font-size: .82rem; font-weight: 700; letter-spacing: .04em; margin-bottom: .2rem; }
.guide-hero { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 1.5rem; align-items: center; padding: 2rem 2.25rem; border-radius: 18px; overflow: hidden; position: relative; background: linear-gradient(135deg, var(--primary) 0%, #3b5f9d 58%, #668bc4 100%); color: #fff; box-shadow: 0 16px 38px oklch(42% 0.11 258 / .18); }
.guide-hero::after { content: ''; position: absolute; width: 300px; height: 300px; right: 80px; top: -180px; border-radius: 50%; background: rgba(255,255,255,.08); }
.guide-hero-copy, .guide-hero-mark { position: relative; z-index: 1; }
.guide-eyebrow { display: inline-block; padding: .25rem .65rem; border: 1px solid rgba(255,255,255,.35); border-radius: 99px; font-size: .78rem; margin-bottom: .7rem; }
.guide-hero h3 { color: #fff; font-size: clamp(1.45rem, 2.5vw, 2.1rem); margin: 0 0 .5rem; }
.guide-hero p { color: rgba(255,255,255,.86); max-width: 720px; margin: 0; }
.guide-hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; }
.guide-hero .btn-outline-light { --bs-btn-color: #fff; --bs-btn-border-color: rgba(255,255,255,.65); --bs-btn-hover-bg: rgba(255,255,255,.15); --bs-btn-hover-border-color: #fff; }
.guide-hero-mark { width: 170px; height: 170px; border-radius: 50%; display: grid; place-items: center; align-content: center; justify-self: end; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.25); box-shadow: inset 0 0 0 12px rgba(255,255,255,.04); }
.guide-hero-mark i { font-size: 3.6rem; line-height: 1; }
.guide-hero-mark span { font-weight: 700; margin-top: .35rem; }
.guide-hero-mark small { color: rgba(255,255,255,.75); font-size: .72rem; }
.guide-layout { display: grid; grid-template-columns: 235px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.guide-toc { position: sticky; top: calc(var(--tb-h) + 1rem); overflow: hidden; }
.guide-toc .card-header { padding: .8rem 1rem; }
.guide-toc-body { padding: .45rem; }
.guide-toc-body button { width: 100%; display: flex; align-items: center; gap: .65rem; padding: .55rem .6rem; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); text-align: left; font: inherit; font-size: .88rem; }
.guide-toc-body button:hover { background: var(--primary-soft); color: var(--primary); }
.guide-toc-no { width: 27px; height: 27px; display: inline-grid; place-items: center; border-radius: 8px; background: var(--paper-2); color: var(--primary); font-size: .73rem; font-weight: 700; flex: none; }
.guide-toc-tip { padding: .8rem 1rem 1rem; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .78rem; line-height: 1.5; }
.guide-toc-tip i { color: var(--accent); }
.guide-section { margin-bottom: 1rem; scroll-margin-top: calc(var(--tb-h) + 1rem); overflow: hidden; }
.guide-section-head { display: flex; gap: .85rem; align-items: flex-start; padding: 1.05rem 1.2rem; background: linear-gradient(90deg, var(--paper-2), #fff); border-bottom: 1px solid var(--line); }
.guide-section-head h3 { margin: .05rem 0 .15rem; font-size: 1.08rem; }
.guide-section-head p { margin: 0; color: var(--ink-3); font-size: .84rem; }
.guide-num { width: 39px; height: 39px; display: grid; place-items: center; flex: none; border-radius: 12px; background: var(--primary); color: #fff; font-weight: 700; font-size: .82rem; }
.guide-section-body { padding: 1.15rem 1.2rem 1.3rem; }
.guide-step-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.guide-step { display: flex; gap: .7rem; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.guide-step > span { width: 27px; height: 27px; display: grid; place-items: center; flex: none; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .78rem; }
.guide-step b, .guide-mini-grid b, .guide-choice-title, .guide-report-card b { display: block; color: var(--ink); font-weight: 700; }
.guide-step p, .guide-choice p, .guide-report-card p { margin: .25rem 0 0; color: var(--ink-2); font-size: .86rem; line-height: 1.55; }
.guide-callout { display: flex; gap: .75rem; align-items: flex-start; margin-top: 1rem; padding: .85rem 1rem; border-radius: 11px; font-size: .86rem; line-height: 1.55; }
.guide-callout > i { font-size: 1.15rem; margin-top: .1rem; flex: none; }
.guide-callout-info { background: var(--primary-soft); color: var(--ink-2); border: 1px solid oklch(86% .035 258); }
.guide-callout-info > i { color: var(--primary); }
.guide-callout-warn { background: var(--accent-soft); color: var(--ink-2); border: 1px solid oklch(88% .04 27); }
.guide-callout-warn > i { color: var(--accent); }
.guide-numbered { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; padding-left: 0; list-style: none; counter-reset: guide-counter; }
.guide-numbered li { counter-increment: guide-counter; position: relative; padding: 1rem .85rem .85rem 2.55rem; min-height: 108px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); }
.guide-numbered li::before { content: counter(guide-counter); position: absolute; left: .75rem; top: .85rem; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: .75rem; }
.guide-numbered li b { display: block; margin-bottom: .25rem; }
.guide-numbered li span { color: var(--ink-2); font-size: .84rem; line-height: 1.5; }
.guide-mini-grid, .guide-review-grid, .guide-report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-top: 1rem; }
.guide-mini-grid > div, .guide-review-grid > div, .guide-report-card { padding: .9rem; border-radius: 11px; background: var(--paper-2); }
.guide-mini-grid i, .guide-review-grid i, .guide-report-card i { display: block; color: var(--primary); font-size: 1.35rem; margin-bottom: .35rem; }
.guide-mini-grid small { display: block; color: var(--ink-3); font-size: .78rem; margin-top: .25rem; line-height: 1.45; }
.guide-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.guide-choice { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; }
.guide-choice.recommended { border-color: oklch(78% .08 258); background: var(--primary-soft); }
.guide-choice-title i { color: var(--primary); }
.guide-choice-title span { display: inline-block; margin-left: .35rem; padding: .13rem .45rem; border-radius: 99px; color: var(--primary); background: #fff; font-size: .7rem; font-weight: 600; }
.guide-scan-flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: .65rem; }
.guide-scan-flow > div { position: relative; text-align: center; padding: .9rem .55rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.guide-scan-flow span { position: absolute; top: .5rem; right: .55rem; color: var(--ink-3); font-size: .7rem; font-weight: 700; }
.guide-scan-flow i { display: block; color: var(--primary); font-size: 1.65rem; margin: .35rem 0 .35rem; }
.guide-scan-flow b { display: block; font-size: .85rem; }
.guide-scan-flow small { display: block; color: var(--ink-3); font-size: .73rem; line-height: 1.4; margin-top: .2rem; }
.guide-review-grid > div { display: grid; grid-template-columns: 28px 1fr; column-gap: .55rem; }
.guide-review-grid i { grid-row: span 2; }
.guide-review-grid span { color: var(--ink-2); font-size: .82rem; line-height: 1.45; }
.guide-inline-tip { margin: 1rem 0 0; padding-top: .8rem; border-top: 1px dashed var(--line); color: var(--ink-2); font-size: .86rem; }
.guide-report-card p { font-size: .82rem; }
.guide-faq-list details { border-bottom: 1px solid var(--line); padding: .75rem 0; }
.guide-faq-list details:last-child { border-bottom: 0; padding-bottom: 0; }
.guide-faq-list summary { cursor: pointer; list-style: none; color: var(--ink); font-weight: 600; }
.guide-faq-list summary::-webkit-details-marker { display: none; }
.guide-faq-list summary::after { content: '+'; float: right; color: var(--primary); font-size: 1.1rem; }
.guide-faq-list details[open] summary::after { content: '−'; }
.guide-faq-list summary i { color: var(--primary); }
.guide-faq-list p { margin: .5rem 1.7rem 0; color: var(--ink-2); font-size: .86rem; line-height: 1.6; }
.guide-media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.guide-media { margin: 0; padding: .65rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.guide-media img { display: block; width: 100%; height: 230px; object-fit: contain; border-radius: 8px; background: #f3f4f6; cursor: zoom-in; transition: transform .18s ease, box-shadow .18s ease; }
.guide-media img:hover { transform: scale(1.015); box-shadow: 0 8px 20px rgba(15, 23, 42, .14); }
.guide-media figcaption { margin: .55rem .2rem .05rem; color: var(--ink-3); font-size: .78rem; line-height: 1.4; text-align: center; }
.guide-lightbox[hidden] { display: none !important; }
.guide-lightbox { position: fixed; inset: 0; z-index: 2050; display: grid; place-items: center; padding: 1.25rem; }
.guide-lightbox-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .78); backdrop-filter: blur(3px); }
.guide-lightbox-panel { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; width: min(1100px, 96vw); max-height: 94vh; padding: .75rem; border: 1px solid rgba(255,255,255,.35); border-radius: 16px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.guide-lightbox-panel img { display: block; max-width: 100%; max-height: calc(94vh - 3.8rem); width: auto; height: auto; object-fit: contain; border-radius: 9px; }
.guide-lightbox-panel > div { margin-top: .5rem; color: var(--ink-2); font-size: .82rem; text-align: center; }
.guide-lightbox-close { position: absolute; top: .55rem; right: .55rem; z-index: 2; width: 2.15rem; height: 2.15rem; display: grid; place-items: center; border: 0; border-radius: 50%; color: var(--ink); background: rgba(255,255,255,.9); box-shadow: 0 2px 8px rgba(15,23,42,.15); }
.guide-lightbox-close:hover { color: #fff; background: var(--primary); }
body.guide-lightbox-open { overflow: hidden; }
@media (max-width: 991.98px) { .guide-layout { grid-template-columns: 1fr; } .guide-toc { position: static; } .guide-toc-body { display: grid; grid-template-columns: 1fr 1fr; } .guide-toc-tip { display: none; } }
@media (max-width: 767.98px) { .guide-hero { grid-template-columns: 1fr; padding: 1.4rem; } .guide-hero-mark { display: none; } .guide-step-grid, .guide-choice-grid, .guide-media-grid, .guide-numbered, .guide-mini-grid, .guide-review-grid, .guide-report-grid { grid-template-columns: 1fr; } .guide-scan-flow { grid-template-columns: 1fr 1fr; } .guide-media img { height: 210px; } }
@media print { .sidebar, .topbar, .guide-toc, .guide-page-head .actions, .sb-backdrop, .toast-zone { display: none !important; } .content { margin-left: 0 !important; padding-top: 0 !important; } .content-inner { max-width: none !important; padding: 0 !important; } .guide-hero { color: #000 !important; box-shadow: none; } .guide-hero h3, .guide-hero p, .guide-hero .btn { color: #000 !important; } .guide-section { break-inside: avoid; } }

.card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.card-header { background: var(--paper-2); border-color: var(--line); font-weight: 600; padding: .75rem 1rem; display: flex; align-items: center; gap: .5rem; }
.card-header .ms-auto { font-weight: 400; }
.card-body { padding: 1rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .95rem 1.1rem; }
.stat .lbl { font-size: .84rem; color: var(--ink-2); display: flex; align-items: center; gap: .4rem; }
.stat .val { font-size: 1.9rem; font-weight: 700; line-height: 1.1; margin-top: .3rem; font-variant-numeric: tabular-nums; }
.stat .val small { font-size: .85rem; font-weight: 500; color: var(--ink-3); margin-left: .25rem; }
.stat.is-alert .val { color: var(--accent); }

.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .6rem; border-radius: 99px; font-size: .8rem; font-weight: 500; white-space: nowrap; line-height: 1.5; }
.pill-solid  { background: var(--primary); color: #fff; }
.pill-soft   { background: var(--primary-soft); color: var(--primary); }
.pill-line   { border: 1px solid var(--line); color: var(--ink-2); background: #fff; }
.pill-ok     { background: var(--ok-soft); color: var(--ok); }
.pill-warn   { background: var(--warn-soft); color: oklch(45% 0.1 70); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-mute   { background: var(--paper-2); color: var(--ink-3); }

.layout-rail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.25rem; align-items: start; }
@media (max-width: 1199.98px) { .layout-rail { grid-template-columns: 1fr; } }

.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .9rem; }
.toolbar .form-control, .toolbar .form-select { width: auto; min-width: 180px; }
.toolbar .grow { flex: 1 1 220px; }
@media (max-width: 575.98px) { .toolbar .form-control, .toolbar .form-select { flex: 1 1 100%; } }

.table-wrap { overflow-x: auto; }
.td-actions { white-space: nowrap; text-align: right; width: 1%; }
.td-actions .btn { padding: .2rem .5rem; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.muted { color: var(--ink-3); }

.pager { display: flex; align-items: center; gap: .5rem; justify-content: space-between; padding: .7rem 1rem; border-top: 1px solid var(--line); font-size: .88rem; color: var(--ink-2); flex-wrap: wrap; }
.pager .btn { padding: .2rem .65rem; }

.empty { text-align: center; padding: 2.75rem 1rem; color: var(--ink-3); }
.empty i { font-size: 2.6rem; display: block; margin-bottom: .6rem; opacity: .45; }
.empty b { display: block; color: var(--ink-2); font-weight: 600; margin-bottom: .2rem; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: .45rem .9rem; font-size: .92rem; }
.kv dt { color: var(--ink-3); font-weight: 400; }
.kv dd { margin: 0; }

.room-list { list-style: none; margin: 0; padding: 0; }
.room-list li { display: flex; align-items: center; gap: .6rem; padding: .55rem 1rem; border-bottom: 1px solid var(--line); }
.room-list li:last-child { border-bottom: 0; }
.room-list .code { font-weight: 700; color: var(--primary); width: 3.2rem; }
.room-list .n { margin-left: auto; color: var(--ink-2); }

.logo-box { width: 120px; height: 120px; border: 1px dashed var(--line); border-radius: 12px; display: grid; place-items: center; background: var(--paper); overflow: hidden; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-box i { font-size: 2.2rem; color: var(--ink-3); }

textarea.import-area { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; min-height: 170px; }
.import-table td, .import-table th { font-size: .85rem; padding: .35rem .6rem !important; }
.row-err > * { background: var(--danger-soft) !important; }

 
.sheet-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1099.98px) { .sheet-layout { grid-template-columns: 1fr; } }
.sheet-preview-card { position: sticky; top: calc(var(--tb-h) + 1rem); }
.sheet-preview { padding: 1rem; background: oklch(93% 0.008 85); border-radius: 0 0 var(--radius) var(--radius); }
.sheet-preview svg { display: block; width: 100%; height: auto; max-width: 640px; margin: 0 auto; box-shadow: 0 4px 18px oklch(26% 0.02 260 / .16); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; height: 100%; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .75rem; background: #fff; }
.seg span b { display: block; font-weight: 600; }
.seg span small { color: var(--ink-3); font-size: .8rem; }
.seg input:checked + span { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); background: var(--primary-soft); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); }

 
.table-click tbody tr { cursor: pointer; }
kbd { background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 .3rem; font-size: .78rem; font-family: inherit; }
.key-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding: .6rem 1rem; }
.key-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 0 1.25rem; padding: .75rem 1rem 1rem; outline: none; }
.key-grid:focus-visible { box-shadow: inset 0 0 0 2px var(--primary-soft); }
.key-col { padding: .25rem 0; }
.key-row { display: flex; align-items: center; gap: .3rem; padding: .18rem .35rem; border-radius: 8px; }
.key-row:nth-child(5) { margin-bottom: .45rem; }
.key-row.is-cur { background: var(--primary-soft); }
.key-row.is-empty .key-no { color: var(--accent); }
.key-no { width: 1.9rem; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; margin-right: .2rem; }
.key-ch { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; color: var(--ink-2); font-weight: 600; font-size: .95rem; padding: 0; line-height: 1; }
.key-ch:hover { border-color: var(--primary); color: var(--primary); }
.key-ch.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.key-x { width: 28px; height: 28px; border: 0; background: transparent; color: var(--ink-3); border-radius: 6px; margin-left: .15rem; padding: 0; }
.key-x:hover { color: var(--accent); background: var(--accent-soft); }
.key-row.is-cancel .key-ch { opacity: .3; pointer-events: none; }
.key-row.is-cancel .key-no { text-decoration: line-through; color: var(--ink-3); }
.key-row.is-cancel .key-x { color: #fff; background: var(--accent); }
.seg-sm { grid-template-columns: auto auto; }
.seg-sm span { padding: .38rem .7rem; font-size: .9rem; }
.room-picks { display: flex; flex-wrap: wrap; gap: .5rem; }
.room-pick input { position: absolute; opacity: 0; }
.room-pick span { display: inline-block; border: 1px solid var(--line); border-radius: 99px; padding: .3rem .8rem; cursor: pointer; background: #fff; font-size: .9rem; }
.room-pick input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.room-pick input:focus-visible + span { outline: 2px solid var(--primary); }
.test-marks { display: flex; flex-wrap: wrap; gap: 3px; margin-top: .4rem; }
.test-marks .tm { width: 30px; text-align: center; font-size: .66rem; line-height: 1.15; border-radius: 5px; padding: 2px 0; color: var(--ink-3); background: var(--paper-2); }
.test-marks .tm b { display: block; font-size: .8rem; }
.test-marks .tm.y { background: var(--ok-soft); color: var(--ok); }
.test-marks .tm.n { background: var(--danger-soft); color: var(--danger); }
.test-marks .tm.c { background: var(--paper-2); text-decoration: line-through; }

.qr-box { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: #fff; flex: none; }
.qr-box svg { width: 100%; height: 100%; display: block; }

 
.table-click-row { cursor: pointer; }
.rv-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 1.25rem; align-items: start; }
@media (max-width: 991.98px) { .rv-wrap { grid-template-columns: 1fr; } }
.rv-sheet { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow-y: auto; cursor: zoom-in; max-height: 72vh; }
.rv-page { position: relative; }                  
.rv-page img { display: block; width: 100%; height: auto; }
.rv-page svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.rv-sheet.zoom { max-height: none; cursor: zoom-out; }
.rv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 2px 10px; max-height: 46vh; overflow-y: auto; padding-right: 4px; }
.rv-row { display: flex; align-items: center; gap: 3px; padding: 2px 4px; border-radius: 6px; }
.rv-row.is-flag { background: var(--warn-soft); }
.rv-row.is-cancel { opacity: .45; }
.rv-no { width: 1.7rem; text-align: right; font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums; margin-right: 2px; }
.rv-ch { width: 27px; height: 27px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; font-size: .8rem; font-weight: 600; padding: 0; color: var(--ink-2); line-height: 1; }
.rv-ch.key { border-color: var(--ok); color: var(--ok); }
.rv-ch.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.rv-ch.on.ok { background: var(--ok); border-color: var(--ok); }
.rv-ch.on.bad { background: var(--danger); border-color: var(--danger); }
.rv-st { width: 18px; text-align: center; font-size: .85rem; }
.rv-score b { font-size: 1.25rem; }

 
.ps-list { display: flex; flex-direction: column; gap: .5rem; max-height: 52vh; overflow-y: auto; }
.ps-row { display: flex; gap: .75rem; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; background: #fff; }
.ps-row img { width: 48px; height: 68px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); flex: none; }
.ps-row.warn { border-color: oklch(85% 0.08 80); background: var(--warn-soft); }
.ps-row.bad { border-color: oklch(85% 0.06 27); background: var(--danger-soft); color: var(--danger); }
.ps-row.bad i { font-size: 1.3rem; }

 
.an-tools .seg-sm { flex: none; }
.an-meta .kv { grid-template-columns: 150px 1fr 150px 1fr; }
@media (max-width: 767.98px) { .an-meta .kv { grid-template-columns: 120px 1fr; } }
.an-grid { display: grid; grid-template-columns: minmax(240px, .8fr) 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 1199.98px) { .an-grid { grid-template-columns: 1fr 1fr; } .an-grid > :first-child { grid-column: 1 / -1; } }
@media (max-width: 767.98px) { .an-grid { grid-template-columns: 1fr; } }
.an-q + .an-q { margin-top: .85rem; }
.an-q-h { display: flex; align-items: center; gap: .4rem; margin-bottom: .35rem; }
.an-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.an-chip { min-width: 30px; text-align: center; padding: .1rem .35rem; border-radius: 6px; background: var(--paper-2); color: var(--ink); text-decoration: none; font-size: .85rem; font-variant-numeric: tabular-nums; }
.an-chip:hover { background: var(--primary-soft); color: var(--primary); }
.qicon { flex: none; overflow: visible; }
.qtag { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; color: var(--ink-2); margin-top: .2rem; white-space: nowrap; }
.an-chart { width: 100%; height: auto; display: block; font-family: inherit; }
.an-chart .grid { stroke: var(--line); stroke-width: 1; }
.an-chart .grid.base { stroke: oklch(80% 0.01 85); }
.an-chart .tick { font-size: 10px; fill: var(--ink-3); }
.an-chart .axis { font-size: 10.5px; fill: var(--ink-2); }
.an-chart .plabel { font-size: 9.5px; fill: var(--ink-2); }
.an-chart .zone { fill: var(--q-good); opacity: .08; }
.an-chart .hit { fill: transparent; }
.mk-good { fill: var(--q-good); stroke: #fff; stroke-width: 2; }
.mk-revise { fill: var(--q-revise); stroke: #fff; stroke-width: 1.5; }
.mk-drop { stroke: var(--q-drop); stroke-width: 2.6; stroke-linecap: round; fill: none; }
.an-chart .bar { fill: var(--primary); }
.an-chart .pt.on .bar { fill: var(--primary-600); }
.an-chart .pt.on .mk { transform-box: fill-box; transform-origin: center; transform: scale(1.3); }
.an-chart .meanline { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 3 3; }
.an-legend { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .8rem; color: var(--ink-2); margin-top: .35rem; }
.an-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.an-legend .zone-key { display: inline-block; width: 14px; height: 10px; background: color-mix(in oklab, var(--q-good) 14%, white); border-radius: 2px; }
.chart-tip { position: fixed; display: none; pointer-events: none; z-index: 3000; background: var(--ink); color: #fff; font-size: .8rem; padding: .3rem .55rem; border-radius: 6px; white-space: nowrap; }
.an-table th, .an-table td { padding: .32rem .6rem !important; font-size: .88rem; }
.an-table tbody.an-item { border-top: 2px solid var(--line); }
.an-table tr.is-key td { background: var(--primary-soft); }
.an-table td.an-no { vertical-align: top; background: #fff !important; border-right: 1px solid var(--line); min-width: 92px; }
.an-table .an-cmt { color: var(--ink-2); white-space: nowrap; }
.an-table tr.an-notes td { font-size: .8rem; color: var(--ink-2); background: var(--paper) !important; }
.an-table tbody.q-row-drop tr.an-notes td { color: var(--q-drop); }
.an-table tbody.flash-row td { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 40% { background: oklch(93% 0.08 90); } }

 
.toast-zone { position: fixed; top: calc(var(--tb-h) + 12px); right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: .5rem; max-width: min(380px, calc(100vw - 32px)); }
.sp-toast { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--primary); border-radius: 10px; padding: .7rem .9rem; box-shadow: 0 10px 30px oklch(26% 0.02 260 / .14); display: flex; gap: .6rem; align-items: flex-start; animation: tIn .18s ease-out; font-size: .92rem; }
.sp-toast.ok { border-left-color: var(--ok); }
.sp-toast.err { border-left-color: var(--danger); }
.sp-toast.warn { border-left-color: var(--warn); }
.sp-toast i { font-size: 1.1rem; margin-top: .05rem; }
.sp-toast.ok i { color: var(--ok); } .sp-toast.err i { color: var(--danger); } .sp-toast.warn i { color: var(--warn); }
@keyframes tIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

 
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem;
  background:
    repeating-linear-gradient(0deg, transparent 0 31px, oklch(92% 0.012 250 / .55) 31px 32px),
    var(--paper); }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 2rem 1.75rem 1.5rem; box-shadow: 0 20px 50px oklch(26% 0.02 260 / .08); }
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-brand h1 { font-size: 1.6rem; font-weight: 700; margin: .7rem 0 .15rem; }
.login-brand p { color: var(--ink-2); margin: 0; }
.login-logo { width: 84px; height: 84px; object-fit: contain; }
.login-mark { width: 60px; height: 60px; margin: 0 auto; border-radius: 16px; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 1.8rem; }
.login-foot { text-align: center; font-size: .78rem; color: var(--ink-3); margin-top: 1.25rem; }

.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--paper); z-index: 3000; }

 
#printArea { display: none; }
@media print {
  body > *:not(#printArea):not(#appView) { display: none !important; }
  #appView { display: none !important; }
  body.guide-printing #appView { display: block !important; }
  body.guide-printing #printArea { display: none !important; }
  #printArea { display: block !important; }
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  .print-omr .omr-page { width: 210mm; height: 297mm; overflow: hidden; page-break-after: always; break-after: page; }
  .print-omr .omr-page:last-child { page-break-after: auto; break-after: auto; }
  .print-omr svg { display: block; width: 210mm; height: 297mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-doc { padding: 12mm 12mm 10mm; font-family: 'Sarabun', sans-serif; color: #000; font-size: 10.5pt; }
  .print-doc h1 { font-size: 13pt; margin: 2mm 0 1mm; text-align: center; }
  .print-doc .rp-head { text-align: center; margin-bottom: 3mm; }
  .print-doc .rp-school { font-weight: 700; font-size: 12pt; }
  .print-doc table { width: 100%; border-collapse: collapse; }
  .print-doc .rp-sum td { border: 0.3mm solid #999; padding: 1mm 2mm; }
  .print-doc .rp-sum td:nth-child(odd) { background: #eee; width: 22%; }
  .print-doc .rp-q { margin: 3mm 0; line-height: 1.5; }
  .print-doc .rp-items { font-size: 9pt; }
  .print-doc .rp-items th, .print-doc .rp-items td { border: 0.25mm solid #aaa; padding: 0.4mm 1.5mm; text-align: center; }
  .print-doc .rp-items th { background: #e6e6e6; }
  .print-doc .rp-items .l { text-align: left; }
  .print-doc .rp-items tr.k td { font-weight: 700; background: #f1f1f1; }
  .print-doc .rp-items tr td.no { font-weight: 700; background: #fff; }
  .print-doc .rp-items td.no small { font-weight: 400; font-size: 7.5pt; }
  .print-doc .rp-items thead { display: table-header-group; }
  .print-doc .rp-items tbody { break-inside: avoid; }
  .print-doc .rp-foot { margin-top: 3mm; font-size: 8pt; color: #555; text-align: right; }
}

/* ============================================================
 * ScanGrade — theming, dark mode, branding, larger mobile UI
 * ============================================================ */
:root { --card: #ffffff; }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

/* branding เด่นขึ้น */
.sb-brand { height: 68px; padding: 0 1.1rem; }
.sb-logo { width: 46px; height: 46px; border-radius: 10px; }
.sb-mark { width: 46px; height: 46px; font-size: 1.35rem; }
.sb-title b { font-size: 1.15rem; }
.sb-title small { font-size: .8rem; }
.login-logo { width: 104px; height: 104px; }
.login-brand h1 { font-size: 1.75rem; }

/* โหมดมืด */
html[data-theme="dark"] {
  --paper:        oklch(23% 0.012 260);
  --paper-2:      oklch(27% 0.014 260);
  --line:         oklch(35% 0.012 260);
  --ink:          oklch(93% 0.008 260);
  --ink-2:        oklch(78% 0.012 260);
  --ink-3:        oklch(63% 0.012 260);
  --primary-soft: oklch(34% 0.05 258);
  --accent-soft:  oklch(34% 0.06 27);
  --ok-soft:      oklch(30% 0.05 150);
  --warn-soft:    oklch(33% 0.05 80);
  --danger-soft:  oklch(31% 0.06 27);
  --card:         oklch(27% 0.014 260);
  --sb-bg:        oklch(19% 0.012 260);
  --sb-bg-2:      oklch(25% 0.014 260);
  --sb-text:      oklch(88% 0.01 255);
  --sb-muted:     oklch(62% 0.015 255);
}
html[data-theme="dark"] body { background: var(--paper); color: var(--ink); }
html[data-theme="dark"] .topbar { background: var(--card); }
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .sp-toast,
html[data-theme="dark"] .seg span,
html[data-theme="dark"] .key-ch,
html[data-theme="dark"] .room-pick span,
html[data-theme="dark"] .qr-box,
html[data-theme="dark"] .rv-sheet,
html[data-theme="dark"] .rv-ch,
html[data-theme="dark"] .ps-row,
html[data-theme="dark"] .pill-line,
html[data-theme="dark"] .guide-step,
html[data-theme="dark"] .guide-scan-flow > div,
html[data-theme="dark"] .guide-media,
html[data-theme="dark"] .guide-lightbox-panel,
html[data-theme="dark"] .guide-choice-title span { background: var(--card); }
html[data-theme="dark"] .guide-section-head { background: linear-gradient(90deg, var(--paper-2), var(--card)); }
html[data-theme="dark"] .table tbody tr:hover > * { background: var(--paper-2); }
html[data-theme="dark"] .dropdown-menu { background: var(--card); --bs-dropdown-bg: var(--card); --bs-dropdown-link-color: var(--ink); }
html[data-theme="dark"] .an-table td.an-no { background: var(--card) !important; }
html[data-theme="dark"] .modal-content { background: var(--card); }
html[data-theme="dark"] .login-wrap { background: repeating-linear-gradient(0deg, transparent 0 31px, oklch(32% 0.012 250 / .5) 31px 32px), var(--paper); }
html[data-theme="dark"] .sheet-preview { background: var(--paper-2); }
html[data-theme="dark"] .guide-hero { box-shadow: 0 16px 38px rgba(0,0,0,.4); }
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select { background: var(--paper-2); color: var(--ink); }

/* ปุ่มสลับธีมใน topbar */
.mode-btn { position: relative; }
.mode-btn .bi { font-size: 1.15rem; }

/* มือถือ: ใหญ่ขึ้น อ่านง่ายขึ้น */
@media (max-width: 575.98px) {
  body { font-size: 16px; }
  .content-inner { padding: 1rem .9rem 3rem; }
  .btn { padding: .55rem .95rem; }
  .btn-sm { padding: .4rem .7rem; font-size: .92rem; }
  .sb-link { padding: .72rem .8rem; font-size: 1.02rem; }
  .form-control, .form-select { padding: .6rem .8rem; font-size: 1rem; }
  .form-label { font-size: 1rem; }
  .table > :not(caption) > * > * { padding: .7rem .7rem; }
  .page-head h2 { font-size: 1.35rem; }
  .stat .val { font-size: 1.7rem; }
}
