/* ==========================================================================
   ใบฮับ · BaiHub — ระบบรวบรวมงานวิชาการ
   Brand: "Matcha Morning" — กระดาษสีมิ้นต์ ใบไม้อ่อน หมึกสีเขียวมอส
   ลายเซ็นของแบรนด์: มุมทรงใบไม้ (radius ไม่สมมาตร 14/4/14/4)
   ========================================================================== */

:root {
  /* พื้น */
  --paper:      #f9fbf7;
  --paper-2:    #f0f5ec;
  --surface:    #ffffff;
  --surface-2:  #f8fbf5;
  --line:       #dce9d3;
  --line-2:     #c9dcbe;

  /* หมึก */
  --ink:        #1e3a2b;
  --ink-2:      #44614f;
  --muted:      #7b9384;
  --faint:      #a7b9ab;

  /* ใบไม้ */
  --leaf:       #3e9b63;
  --leaf-600:   #2f8051;
  --leaf-700:   #23663f;
  --leaf-50:    #ebf6e7;
  --leaf-100:   #d6edcc;
  --sprout:     #cfe8b5;
  --sage:       #9cc3a6;
  --lime:       #d7f08a;
  --lime-ink:   #4f6a12;

  /* สถานะ */
  --st-sent:     #3e9b63;  --st-sent-bg:     #e6f4e2;
  --st-ok:       #23663f;  --st-ok-bg:       #d6edcc;
  --st-late:     #c98a1f;  --st-late-bg:     #fcf1d9;
  --st-miss:     #d1624c;  --st-miss-bg:     #fbe8e2;
  --st-back:     #4f8fb3;  --st-back-bg:     #e3eff6;

  /* รูปทรง */
  --r-xs: 8px;
  --r-sm: 12px;
  --r:    18px;
  --r-lg: 26px;
  --leaf-shape: 14px 4px 14px 4px;

  --shadow-sm: 0 1px 0 rgba(30,58,43,.04), 0 1px 3px rgba(30,58,43,.06);
  --shadow:    0 1px 0 rgba(30,58,43,.04), 0 8px 24px -10px rgba(30,58,43,.18);
  --shadow-lg: 0 24px 60px -24px rgba(30,58,43,.35);

  --font-display: "Anuphan", "IBM Plex Sans Thai", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Thai", "Anuphan", system-ui, sans-serif;

  --side-w: 264px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; line-height: 1.3; letter-spacing: -.005em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 19px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
a { color: var(--leaf-600); text-decoration: none; }
a:hover { color: var(--leaf-700); }
img, svg { display: block; }
button { font: inherit; color: inherit; }
::selection { background: var(--lime); color: var(--ink); }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- ไอคอน (สโตรก + เงาสีอ่อนแบบ duotone) ---------- */
.ic {
  width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: -0.28em;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic .d { fill: currentColor; stroke: none; opacity: .16; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 26px; height: 26px; }
.ic-xl { width: 34px; height: 34px; stroke-width: 1.6; }

/* ==========================================================================
   โครงหน้า
   ========================================================================== */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }

.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9f3 100%);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark { width: 40px; height: 40px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 19px; line-height: 1.1; }
.brand-sub { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }

.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--faint); padding: 14px 12px 4px; text-transform: uppercase; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; margin: 1px 0;
  border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--leaf-50); color: var(--ink); }
.nav a.on { background: var(--surface); color: var(--leaf-700); box-shadow: var(--shadow-sm); }
.nav a.on::before {
  content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--leaf);
}
.nav a.on .ic { color: var(--leaf); }
.nav .count {
  margin-left: auto; min-width: 22px; padding: 0 7px;
  font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
  border-radius: 99px; background: var(--st-miss-bg); color: var(--st-miss);
}
.nav .count.ok { background: var(--leaf-100); color: var(--leaf-700); }

/* เมนูยาวเกินจอ = แถบข้างเลื่อนลงได้ (overflow-y: auto) — ห้ามหดของในแถบ ไม่งั้นการ์ดล่างสุดถูกบีบจนเหลือแค่หัว */
.side > * { flex-shrink: 0; }
.side-card {
  margin-top: auto;
  padding: 16px; border-radius: var(--r);
  background: var(--leaf-700); color: #eaf6e4;
  position: relative; overflow: hidden;
}
.side-card b { display: block; font-family: var(--font-display); font-size: 15px; color: #fff; }
.side-card p { font-size: 12.5px; opacity: .85; margin: 2px 0 12px; }
.side-card svg.deco { position: absolute; right: -10px; bottom: -14px; width: 92px; opacity: .9; }
.side-card .btn { position: relative; }

.scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 32px;
  background: rgba(249,251,247,.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .menu-btn { display: none; }
.search {
  flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 42px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 99px;
  color: var(--muted);
}
.search input { flex: 1; border: 0; outline: 0; background: none; font: inherit; color: var(--ink); }
.search:focus-within { border-color: var(--sage); box-shadow: 0 0 0 4px var(--leaf-50); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 99px; }
.me div b { display: block; font-size: 14px; line-height: 1.2; }
.me div span { font-size: 12px; color: var(--muted); }

.page { padding: 8px 32px 56px; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 10px 0 22px; }
.page-head .grow { flex: 1; min-width: 240px; }
.crumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--leaf-600); }
.page-head p { color: var(--ink-2); margin-top: 4px; }

/* ==========================================================================
   ปุ่ม
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 12px;
  font-weight: 600; font-size: 14.5px; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  transition: transform .08s, background .15s, border-color .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--leaf); color: #fff; box-shadow: 0 6px 16px -8px rgba(47,128,81,.7), inset 0 -2px 0 rgba(0,0,0,.08); }
.btn-primary:hover { background: var(--leaf-600); color: #fff; }
.btn-lime { background: var(--lime); color: var(--ink); }
.btn-lime:hover { background: #cbe874; color: var(--ink); }
.btn-soft { background: var(--leaf-50); color: var(--leaf-700); }
.btn-soft:hover { background: var(--leaf-100); color: var(--leaf-700); }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--line-2); color: var(--ink); }
.btn-danger { background: var(--st-miss-bg); color: var(--st-miss); }
.btn-danger:hover { background: #f7d8ce; color: #b5462f; }
.btn-line { background: #06c755; color: #fff; }
.btn-line:hover { background: #05b04b; color: #fff; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 10px; gap: 6px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15.5px; border-radius: 14px; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ==========================================================================
   การ์ด
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 0; }
.card-head h2, .card-head h3 { flex: 1; }
.card-head .sub { font-size: 13px; color: var(--muted); font-weight: 400; }
.card-body { padding: 16px 22px 20px; }
.card-foot { padding: 12px 22px; border-top: 1px dashed var(--line); }

.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; }
.g-side.wide { grid-template-columns: minmax(0, 1fr) 410px; }
.grid > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* ไอคอนในกรอบทรงใบไม้ — ลายเซ็นของแบรนด์ */
.leafbox {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--leaf-shape);
  background: var(--leaf-50); color: var(--leaf-600);
}
.leafbox.sm { width: 34px; height: 34px; border-radius: 11px 3px 11px 3px; }
.leafbox.sm .ic { width: 17px; height: 17px; }
.leafbox.lime { background: var(--lime); color: var(--lime-ink); }
.leafbox.dark { background: var(--leaf-700); color: var(--lime); }
.leafbox.late { background: var(--st-late-bg); color: var(--st-late); }
.leafbox.miss { background: var(--st-miss-bg); color: var(--st-miss); }
.leafbox.back { background: var(--st-back-bg); color: var(--st-back); }
.leafbox.line { background: #e1f7e9; color: #06a648; }

/* ---------- KPI ---------- */
.kpi { padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; }
.kpi .val { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1.1; }
.kpi .val small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.kpi .lbl { font-size: 13.5px; color: var(--ink-2); }
.kpi .hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.kpi .hint b { color: var(--leaf-600); font-weight: 600; }
.kpi .hint b.bad { color: var(--st-miss); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px;
  padding: 28px 32px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 140% at 100% 0%, #e2f3c6 0%, transparent 55%),
    linear-gradient(135deg, #2f8051 0%, #3e9b63 55%, #5cb276 100%);
  color: #fff;
  box-shadow: var(--shadow);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.07' stroke-width='1.5'%3E%3Cpath d='M10 110C10 60 40 20 100 10C100 70 60 110 10 110Z'/%3E%3Cpath d='M10 110L80 30'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 120px;
  mask-image: linear-gradient(90deg, transparent 0%, #000 70%);
}
.hero h1 { font-size: 28px; color: #fff; }
.hero p { color: #e1f2da; margin-top: 6px; max-width: 520px; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--lime); letter-spacing: .03em; margin-bottom: 8px; }
.hero .btn-row { margin-top: 18px; position: relative; z-index: 1; }
.hero .art { width: 300px; position: relative; z-index: 1; margin: -10px -6px -28px 0; }
.hero-stats { display: flex; gap: 26px; margin-top: 16px; }
.hero-stats div { font-size: 12.5px; color: #d7eccd; }
.hero-stats b { display: block; font-family: var(--font-display); font-size: 22px; color: #fff; }

/* ==========================================================================
   ชิป · สถานะ
   ========================================================================== */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border-radius: 99px; font-size: 12.5px; font-weight: 500;
  background: var(--paper-2); color: var(--ink-2);
  white-space: nowrap;
}
.chip .ic { width: 14px; height: 14px; }
.chip.cat { background: var(--leaf-50); color: var(--leaf-700); border-radius: 8px 3px 8px 3px; }
.chip.lime { background: var(--lime); color: var(--lime-ink); }
.chip.outline { background: transparent; border: 1px solid var(--line-2); }

.st {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px 0 8px;
  border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.st::before { content: ""; width: 8px; height: 8px; border-radius: 4px 1px 4px 1px; background: currentColor; }
.st-submitted { background: var(--st-sent-bg); color: var(--st-sent); }
.st-approved  { background: var(--st-ok-bg); color: var(--st-ok); }
.st-late      { background: var(--st-late-bg); color: var(--st-late); }
.st-missing   { background: var(--st-miss-bg); color: var(--st-miss); }
.st-returned  { background: var(--st-back-bg); color: var(--st-back); }
.st-closed    { background: var(--paper-2); color: var(--muted); }

.due { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.due .ic { width: 16px; height: 16px; color: var(--muted); }
.due.soon { color: var(--st-late); } .due.soon .ic { color: var(--st-late); }
.due.over { color: var(--st-miss); } .due.over .ic { color: var(--st-miss); }

/* ---------- อวาตาร์ ---------- */
.av {
  --c: var(--leaf);
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  font-family: var(--font-display); font-weight: 600; font-size: 14px;
  color: #fff; background: var(--c);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}
.av.sm { width: 28px; height: 28px; font-size: 12px; }
.av.lg { width: 52px; height: 52px; font-size: 20px; }
.av-stack { display: flex; }
.av-stack .av { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.av-stack .av:first-child { margin-left: 0; }
.av-stack .more { background: var(--paper-2); color: var(--ink-2); font-size: 11.5px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who > div > b, .who > span > b { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.who > div:not(.av-stack) > span, .who > span > span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- วงแหวน / แถบ ---------- */
.ring { position: relative; width: 64px; height: 64px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .bg { stroke: var(--leaf-50); }
.ring .fg { stroke: var(--leaf); transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.ring .lt { stroke: var(--st-late); }
.ring b {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
}
.ring.lg { width: 132px; height: 132px; }
.ring.lg b { font-size: 30px; }
.ring.lg b small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); text-align: center; margin-top: -4px; }

.bar { height: 8px; border-radius: 99px; background: var(--leaf-50); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; background: var(--leaf); }
.bar i.lt { background: #e3b155; }
.bar i.bk { background: #8dbbd5; }
.bar.thin { height: 6px; }

/* ==========================================================================
   รายการ / ตาราง
   ========================================================================== */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px dashed var(--line); }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; display: block; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted);
  padding: 10px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table th:first-child { border-top-left-radius: 12px; }
.table th:last-child { border-top-right-radius: 12px; }
.table td { padding: 12px 14px; border-bottom: 1px dashed var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #fbfdf9; }
.table .r { text-align: right; }
.table .c { text-align: center; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--paper-2); border-radius: 14px; width: max-content; max-width: 100%; overflow-x: auto; }
.tabs a, .tabs button {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border: 0; border-radius: 10px; background: none;
  font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs .on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.tabs .n { font-size: 12px; padding: 0 7px; border-radius: 99px; background: rgba(30,58,43,.07); line-height: 19px; }
.tabs .on .n { background: var(--leaf-50); color: var(--leaf-700); }

/* ==========================================================================
   ฟอร์ม
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.field .help { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px;
  font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 110px; padding: 11px 14px; resize: vertical; line-height: 1.6; }
.select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%237b9384' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--leaf); box-shadow: 0 0 0 4px var(--leaf-50); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; user-select: none; }
.check input { appearance: none; width: 20px; height: 20px; margin: 0; border: 1.6px solid var(--line-2); border-radius: 6px 2px 6px 2px; background: var(--surface); display: grid; place-items: center; cursor: pointer; transition: .15s; }
.check input:checked { background: var(--leaf); border-color: var(--leaf); }
.check input:checked::after { content: ""; width: 10px; height: 6px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px,-1px); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 42px; height: 24px; margin: 0; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; transition: .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .2s; }
.switch input:checked { background: var(--leaf); }
.switch input:checked::after { left: 21px; }

.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--paper-2); border-radius: 14px; flex-wrap: wrap; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.seg input:checked + span { background: var(--surface); color: var(--leaf-700); box-shadow: var(--shadow-sm); font-weight: 600; }

.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; max-height: 300px; overflow-y: auto; padding: 4px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); }
.pick:has(input:checked) { border-color: var(--leaf); background: var(--leaf-50); }
.pick input { accent-color: var(--leaf); }

/* ---------- Dropzone ---------- */
.drop {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 28px 20px;
  border: 2px dashed var(--sage); border-radius: var(--r);
  background: linear-gradient(180deg, #fbfdf8, var(--leaf-50));
  cursor: pointer; transition: .2s;
}
.drop:hover, .drop.over { border-color: var(--leaf); background: var(--leaf-50); }
.drop.over { transform: scale(1.01); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .art { width: 120px; margin-bottom: 4px; }
.drop b { font-family: var(--font-display); font-size: 16px; }
.drop span { font-size: 13px; color: var(--muted); }

.files { display: flex; flex-direction: column; gap: 8px; }
.file {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
}
.file .grow { flex: 1; min-width: 0; }
.file .grow b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .grow > span { font-size: 12px; color: var(--muted); }
.ftype {
  width: 38px; height: 44px; flex: none; position: relative;
  display: grid; place-items: end center; padding-bottom: 6px;
  font-family: var(--font-display); font-size: 10px; font-weight: 700; color: #fff; letter-spacing: .03em;
  background: var(--c, var(--leaf)); border-radius: 6px 12px 6px 6px;
}
.ftype::before { content: ""; position: absolute; top: 0; right: 0; width: 12px; height: 12px; background: rgba(255,255,255,.45); border-radius: 0 12px 0 6px; }
.ftype.pdf { --c: #d1624c; } .ftype.doc { --c: #4f8fb3; } .ftype.xls { --c: #3e9b63; }
.ftype.ppt { --c: #d98a3a; } .ftype.img { --c: #8b72b8; } .ftype.zip { --c: #7b9384; } .ftype.etc { --c: #9cb0a3; }
.drive-dot { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.drive-dot.done { color: var(--leaf-600); }
.drive-dot.pending { color: var(--st-late); }
.drive-dot.error { color: var(--st-miss); }
.drive-dot.off { color: var(--faint); }

/* ==========================================================================
   การ์ดงาน
   ========================================================================== */
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.task-card {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  padding: 20px; color: var(--ink);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.task-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); color: var(--ink); }
.task-card h3 { font-size: 16.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-card .top { display: flex; align-items: center; gap: 8px; }
.task-card .mid { display: flex; align-items: center; gap: 16px; }
.task-card .counts { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.task-card .counts div { font-size: 12px; color: var(--muted); }
.task-card .counts b { display: block; font-family: var(--font-display); font-size: 19px; color: var(--ink); line-height: 1.2; }
.task-card .counts .miss b { color: var(--st-miss); }
.task-card .counts .late b { color: var(--st-late); }
.task-card .foot { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px dashed var(--line); }
.task-card.closed { opacity: .75; }
.task-card .corner { position: absolute; top: 0; right: 0; width: 64px; height: 64px; pointer-events: none; }

/* งานของครู */
.my-card { display: flex; gap: 16px; align-items: flex-start; padding: 18px 20px; color: var(--ink); transition: .18s; }
.my-card:hover { box-shadow: var(--shadow); border-color: var(--line-2); color: var(--ink); }
.my-card .grow { flex: 1; min-width: 0; }
.my-card h3 { font-size: 16px; }
.my-card .meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.my-card.urgent { border-color: #f1c9bd; background: linear-gradient(90deg, #fff7f4, #fff 40%); }
.my-card.done { background: linear-gradient(90deg, #f4faf1, #fff 40%); }

.notice {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 16px; border-radius: 16px;
  background: var(--leaf-50); color: var(--leaf-700);
}
.notice b { display: block; color: var(--ink); }
.notice p { color: var(--ink-2); font-size: 14px; }
.notice.warn { background: var(--st-late-bg); color: var(--st-late); }
.notice.back { background: var(--st-back-bg); color: var(--st-back); }
.notice.miss { background: var(--st-miss-bg); color: var(--st-miss); }

/* ไทม์ไลน์สถานะ */
.steps { display: flex; gap: 0; }
.steps .s { flex: 1; position: relative; text-align: center; font-size: 12.5px; color: var(--muted); }
.steps .s::before { content: ""; position: absolute; top: 15px; left: -50%; right: 50%; height: 3px; background: var(--line); z-index: 0; }
.steps .s:first-child::before { display: none; }
.steps .s i { position: relative; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; margin: 0 auto 6px; border-radius: 11px 3px 11px 3px; background: var(--paper-2); color: var(--faint); }
.steps .s i .ic { width: 17px; height: 17px; }
.steps .s.on { color: var(--ink); font-weight: 600; }
.steps .s.on i { background: var(--leaf); color: #fff; }
.steps .s.on::before { background: var(--leaf); }
.steps .s.cur i { box-shadow: 0 0 0 5px var(--leaf-100); }
.steps .s.back i { background: var(--st-back); color: #fff; }

/* ==========================================================================
   ตารางติดตาม (matrix)
   ========================================================================== */
.matrix { border-collapse: separate; border-spacing: 0; font-size: 13.5px; min-width: 100%; }
.matrix th, .matrix td { padding: 0; border-bottom: 1px dashed var(--line); }
.matrix thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; vertical-align: bottom; border-bottom: 1px solid var(--line); }
.matrix .who-col { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 240px; padding: 10px 16px; border-right: 1px solid var(--line); }
.matrix thead .who-col { z-index: 3; background: var(--surface-2); }
.matrix .th-task { width: 92px; min-width: 92px; padding: 12px 6px 10px; text-align: center; font-weight: 500; }
.matrix .th-task a { display: block; color: var(--ink-2); font-size: 12.5px; line-height: 1.35; height: 52px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.matrix .th-task a:hover { color: var(--leaf-600); }
.matrix .th-task small { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.matrix td.cell { text-align: center; padding: 8px 4px; }
.matrix .sum { padding: 8px 14px; text-align: right; font-family: var(--font-display); font-weight: 600; white-space: nowrap; }
.mc {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  border-radius: 10px 3px 10px 3px; font-size: 0; vertical-align: middle;
}
.mc .ic { width: 16px; height: 16px; stroke-width: 2.2; }
.mc.submitted { background: var(--st-sent-bg); color: var(--st-sent); }
.mc.approved { background: var(--leaf); color: #fff; }
.mc.late { background: var(--st-late-bg); color: var(--st-late); }
.mc.returned { background: var(--st-back-bg); color: var(--st-back); }
.mc.missing { background: transparent; color: var(--st-miss); border: 1.6px dashed #e9a798; }
.mc.na { color: var(--line-2); }
.mc.na::after { content: ""; width: 10px; height: 2px; border-radius: 2px; background: currentColor; }
.matrix tr.dept td { background: var(--paper); font-weight: 600; font-size: 12.5px; color: var(--ink-2); padding: 7px 16px; position: sticky; left: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend .mc { width: 22px; height: 22px; }
.legend .mc .ic { width: 13px; height: 13px; }

/* ==========================================================================
   LINE preview
   ========================================================================== */
.line-phone {
  border-radius: 30px; padding: 12px;
  background: #1e3a2b; box-shadow: var(--shadow-lg);
}
.line-screen { border-radius: 22px; overflow: hidden; background: #8cabd9; background: linear-gradient(180deg, #a5c3a9 0%, #93b79a 100%); }
.line-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: rgba(30,58,43,.88); color: #fff; font-size: 14px; font-weight: 600; }
.line-top .gi { width: 30px; height: 30px; border-radius: 50%; background: var(--lime); color: var(--ink); display: grid; place-items: center; }
.line-top .gi .ic { width: 16px; height: 16px; }
.line-body { padding: 16px 14px 20px; min-height: 340px; display: flex; flex-direction: column; gap: 10px; }
.line-msg { display: flex; gap: 8px; align-items: flex-start; }
.line-msg .bot { width: 34px; height: 34px; flex: none; border-radius: 50%; overflow: hidden; background: #23663f; display: grid; place-items: center; }
.line-msg .bot svg { width: 100%; height: 100%; }
.line-msg .nm { font-size: 11.5px; color: #24402f; margin-bottom: 3px; }
.line-bubble {
  max-width: 300px; padding: 10px 13px;
  background: #fff; color: #1d2b22; border-radius: 4px 18px 18px 18px;
  font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  box-shadow: 0 1px 1px rgba(0,0,0,.06);
}
.line-bubble .mention { color: #2e7bd0; font-weight: 600; }
.line-time { font-size: 10.5px; color: #335043; align-self: flex-end; margin-left: 4px; }
.line-flex { width: 270px; border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.line-flex .h { background: var(--leaf); color: #fff; padding: 10px 14px; font-size: 12.5px; font-weight: 700; }
.line-flex .b { padding: 12px 14px; font-size: 13px; }
.line-flex .b b { display: block; font-size: 14.5px; margin-bottom: 6px; }
.line-flex .f { padding: 0 14px 12px; }
.line-flex .f span { display: block; text-align: center; padding: 8px; border-radius: 8px; background: var(--leaf); color: #fff; font-size: 13px; font-weight: 600; }

/* แบบข้อความ LINE — กล่องแก้ข้อความ (เลือกแบบ · คำแทนที่) + จอตัวอย่างที่เปลี่ยนตาม */
.lt-editor { display: flex; flex-direction: column; gap: 10px; }
.lt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.lt-presets { display: inline-flex; gap: 4px; padding: 4px; background: var(--paper-2); border-radius: 12px; max-width: 100%; overflow-x: auto; }
.lt-preset { position: relative; display: inline-flex; }
.lt-preset input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.lt-preset span { padding: 6px 13px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; transition: background .15s, color .15s, box-shadow .15s; }
.lt-preset:hover span { color: var(--ink); }
.lt-preset input:checked + span { background: var(--surface); color: var(--leaf-700); font-weight: 600; box-shadow: var(--shadow-sm); }
.lt-preset input:focus-visible + span { outline: 2px solid var(--leaf); outline-offset: 1px; }
.lt-preset input:disabled { cursor: not-allowed; }
.lt-preset input:disabled + span { opacity: .5; }
.lt-text { min-height: 200px; font-size: 14px; line-height: 1.65; }
.lt-tokens { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lt-token {
  padding: 3px 10px; border: 1px dashed var(--line-2); border-radius: 99px; background: var(--surface-2);
  font: inherit; font-size: 12.5px; color: var(--leaf-700); cursor: pointer; transition: background .15s, border-color .15s, transform .1s;
}
.lt-token:hover { background: var(--leaf-50); border-color: var(--leaf); }
.lt-token:active { transform: scale(.95); }
.lt-token:disabled { opacity: .5; cursor: not-allowed; }
.lt-foot { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; }
.lt-side { position: sticky; top: 86px; }
.lt-meta { margin: 8px 0 0; text-align: center; }
.lt-warn { color: var(--st-late); }
.lt-unk { text-decoration: underline wavy #e08a1e; text-underline-offset: 3px; }
.lt-top-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.lt-top-txt small { font-size: 11px; font-weight: 500; color: var(--lime); }
.lt-top-txt small:empty, .lt-status:empty { display: none; }
.lt-status { margin: -4px 0 6px; font-size: 11px; color: #24402f; }
.line-msg[hidden] { display: none; }
.line-bubble.empty { background: rgba(255,255,255,.55); color: #46604f; }
.line-typing { display: inline-flex; gap: 4px; padding: 13px 15px; }
.line-typing i { width: 7px; height: 7px; border-radius: 50%; background: #86a393; animation: ltDot 1s ease-in-out infinite; }
.line-typing i:nth-child(2) { animation-delay: .15s; }
.line-typing i:nth-child(3) { animation-delay: .3s; }
.lt-in { animation: ltIn .4s cubic-bezier(.2, .9, .3, 1.2) both; transform-origin: 0 100%; }
.lt-flash { animation: ltFlash .55s ease-out; }
@keyframes ltDot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes ltIn { from { opacity: 0; transform: translateY(12px) scale(.92); } }
@keyframes ltFlash { from { box-shadow: 0 0 0 0 rgba(215, 240, 138, .95); } to { box-shadow: 0 0 0 10px rgba(215, 240, 138, 0); } }
@media (max-width: 1180px) { .lt-side { position: static; } }

/* ==========================================================================
   ป็อปอัป · โทสต์ · ว่าง
   ========================================================================== */
dialog.modal {
  width: min(560px, calc(100vw - 32px));
  padding: 0; border: 0; border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(30,58,43,.35); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: pop .22s cubic-bezier(.2,.9,.3,1.2); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 0; }
.modal-head h2 { flex: 1; }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; }
@keyframes pop { from { transform: translateY(10px) scale(.97); opacity: 0; } }

.toasts { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 12px;
  min-width: 280px; max-width: 420px; padding: 12px 16px 12px 12px;
  background: var(--ink); color: #eaf6e4; border-radius: 16px;
  box-shadow: var(--shadow-lg); font-size: 14px;
  animation: toastIn .35s cubic-bezier(.2,.9,.3,1.2);
}
.toast .leafbox { width: 32px; height: 32px; background: rgba(215,240,138,.16); color: var(--lime); }
.toast.error .leafbox { background: rgba(209,98,76,.2); color: #ffb3a3; }
.toast.out { opacity: 0; transform: translateX(20px); transition: .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 36px 20px; }
.empty .art { width: 180px; margin-bottom: 8px; }
.empty b { font-family: var(--font-display); font-size: 17px; }
.empty p { color: var(--muted); font-size: 14px; max-width: 360px; }
.empty .btn { margin-top: 10px; }

/* ต้นไม้โฟลเดอร์ (หน้า Drive) */
.tree { list-style: none; margin: 0; padding: 0 0 0 4px; font-size: 14px; }
.tree li { position: relative; padding: 5px 0 5px 26px; }
.tree li::before { content: ""; position: absolute; left: 8px; top: -6px; bottom: 50%; width: 14px; border-left: 1.5px dashed var(--sage); border-bottom: 1.5px dashed var(--sage); border-bottom-left-radius: 6px; }
.tree > li:first-child::before { display: none; }
.tree > li:first-child { padding-left: 0; }
.tree ul { list-style: none; margin: 0; padding-left: 22px; }
.tree span { display: inline-flex; align-items: center; gap: 8px; }
.tree .ic { width: 17px; height: 17px; color: var(--leaf); }
.tree .ic.file-ic { color: var(--muted); }

/* แถบความคืบหน้าตามกลุ่มสาระ */
.hbars { display: flex; flex-direction: column; gap: 14px; }
.hbar .top { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 6px; }
.hbar .top b { font-family: var(--font-display); }

/* ==========================================================================
   หน้าเข้าสู่ระบบ
   ========================================================================== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 40px 48px;
  background:
    radial-gradient(90% 70% at 85% 10%, #e4f4c7 0%, transparent 60%),
    linear-gradient(160deg, #2f8051 0%, #3e9b63 60%, #67b97c 100%);
  color: #fff;
}
.auth-art .brand { color: #fff; padding: 0; }
.auth-art .brand-sub { color: #cfe8c4; }
.auth-art h2 { font-size: 34px; line-height: 1.3; max-width: 460px; }
.auth-art h2 em { font-style: normal; color: var(--lime); }
.auth-art p { color: #d9eed0; max-width: 420px; margin-top: 10px; }
.auth-art .art { width: min(520px, 100%); align-self: center; margin: 10px 0; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-box { width: min(400px, 100%); }
.auth-box h1 { font-size: 28px; }
.auth-box > p { color: var(--muted); margin: 6px 0 26px; }
.auth-box .field { margin-bottom: 16px; }
.input-icon { position: relative; }
.input-icon .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon .input { padding-left: 44px; }
.demo-hint { margin-top: 22px; padding: 12px 14px; border-radius: 14px; background: var(--leaf-50); font-size: 13px; color: var(--ink-2); }
.demo-hint code { font-family: ui-monospace, Consolas, monospace; background: #fff; padding: 1px 6px; border-radius: 6px; color: var(--leaf-700); }

/* ==========================================================================
   Brand board
   ========================================================================== */
.bb { max-width: 1180px; margin: 0 auto; padding: 40px 28px 80px; }
.bb-sec { margin-top: 44px; }
.bb-sec > h2 { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.bb-sec > h2 small { font-family: var(--font-body); font-size: 13px; font-weight: 400; color: var(--muted); }
.bb-num { font-family: var(--font-display); color: var(--leaf); font-size: 14px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.sw { border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.sw i { display: block; height: 92px; }
.sw div { padding: 10px 12px; font-size: 12.5px; }
.sw b { display: block; font-size: 14px; font-family: var(--font-display); }
.sw code { color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.icon-cell { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 6px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.icon-cell .ic { width: 28px; height: 28px; color: var(--ink); stroke-width: 1.7; }
.illus-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.illus-cell { padding: 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.illus-cell .frame { height: 190px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-2); margin-bottom: 10px; }
.illus-cell .frame svg { max-height: 170px; max-width: 92%; }
.illus-cell.dark .frame { background: linear-gradient(135deg, #2f8051, #4aa86c); }
.type-spec { display: grid; gap: 4px; }
.type-spec .big { font-family: var(--font-display); font-size: 56px; font-weight: 700; line-height: 1.1; }

/* ==========================================================================
   ตอบสนองหน้าจอ
   ========================================================================== */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g-main, .g-side, .g-side.wide { grid-template-columns: 1fr; }
  .g-side > .stack, .g-side > form.card, .g-main > .card { position: static !important; }
  .hero .art { width: 230px; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: fixed; left: 0; top: 0; z-index: 60; width: 280px;
    transform: translateX(-102%); transition: transform .25s;
    box-shadow: var(--shadow-lg);
  }
  .side.open { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 50; background: rgba(30,58,43,.3); display: none; }
  .scrim.on { display: block; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar, .page { padding-left: 16px; padding-right: 16px; }
  .auth { grid-template-columns: 1fr; }
  /* จอแคบ (โทรศัพท์/แท็บเล็ต): เหลือแถบชื่อโรงเรียน ซ่อนภาพประกอบ ให้ฟอร์มเข้าสู่ระบบขึ้นมาในจอแรก */
  .auth-art { padding: 16px 20px; }
  .auth-art .art { display: none; }
  .auth-art h2 { font-size: 26px; }
  .g-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .g-2, .g-4, .form-grid { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; padding: 24px 20px; }
  .hero .art { display: none; }
  .search { display: none; }
  .me div { display: none; }
  .task-grid { grid-template-columns: 1fr; }
  h1 { font-size: 22px; }
  .table { font-size: 13px; }
  .hide-sm { display: none; }
  /* ตัวกรองแบบดรอปดาวน์ที่กำหนดความกว้างไว้ (เช่น ปีการศึกษา/หมวดงาน) — ให้ตัดบรรทัดและยืดหดตามจอ ไม่ดันหน้าล้น */
  form.row { flex-wrap: wrap; }
  .row > .select { flex: 1 1 140px; min-width: 0; width: auto !important; }
}
/* ข้อความยาวที่ไม่มีช่องว่าง (พาธไฟล์ ลิงก์ ข้อความผิดพลาด) ตัดคำได้ ไม่ดันรายการล้นจอ */
.list .meta, .notice p, .notice div { overflow-wrap: anywhere; }
.select, .input { max-width: 100%; }

/* วงกลมภาพประกอบในแบนเนอร์ฝั่งครู */
.hero-badge { width: 200px; height: 200px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.92); position: relative; z-index: 1; box-shadow: 0 0 0 10px rgba(255,255,255,.12); }
.hero-badge svg.art { width: 170px; margin: 0; }
@media (max-width: 640px) { .hero-badge { display: none; } }

/* ==========================================================================
   v2 — กระดิ่ง · ประกาศ · ตัวพรีวิวไฟล์ · ชิปไฟล์/ลิงก์ · ตัวเลือกชนิดไฟล์
   ========================================================================== */
.nav .count.muted { background: var(--paper-2); color: var(--muted); }
.ftype.vid { --c: #6a5acd; } .ftype.aud { --c: #c2557a; }

.bell { position: relative; }
.bell > .btn { position: relative; }
.bell-n {
  position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 99px; background: var(--st-miss); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; box-shadow: 0 0 0 2px var(--paper);
}
.bell-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 360px; max-width: calc(100vw - 24px);
  box-shadow: var(--shadow-lg); display: none; overflow: hidden;
}
.bell.open .bell-menu { display: block; animation: pop .18s ease; }
.bell-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 16px; color: var(--ink); border-top: 1px dashed var(--line); }
.bell-item:hover { background: var(--surface-2); color: var(--ink); }
.bell-item.unread { background: linear-gradient(90deg, var(--leaf-50), transparent 70%); }
.bell-item .grow { min-width: 0; }
.bell-item b { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bell-item .grow > span { font-size: 12px; color: var(--muted); }
.bell-all { display: flex; justify-content: center; align-items: center; gap: 4px; padding: 10px; font-size: 13px; border-top: 1px solid var(--line); }
.dot-new { width: 9px; height: 9px; border-radius: 50%; background: var(--st-miss); flex: none; }

.notice.ann { margin-bottom: 14px; align-items: center; background: linear-gradient(90deg, var(--lime), #e8f6bf); color: var(--lime-ink); }
.notice.ann.warn { background: var(--st-late-bg); color: var(--st-late); }
.notice.ann.back { background: var(--st-back-bg); color: var(--st-back); }
.notice .grow { flex: 1; min-width: 0; }

/* ชิปไฟล์ในตาราง — คลิกเพื่อพรีวิว */
.fchips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fchip-wrap { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.fchip, .lchip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 240px; height: 32px; padding: 0 10px 0 4px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 12.5px;
}
.fchip:hover, .lchip:hover { border-color: var(--sage); background: var(--leaf-50); color: var(--ink); }
.fchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip .ftype { width: 24px; height: 26px; font-size: 7.5px; padding-bottom: 3px; border-radius: 4px 8px 4px 4px; }
.fchip .ftype::before { width: 8px; height: 8px; border-radius: 0 8px 0 4px; }
.fchip img { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; flex: none; }
.lchip { padding-left: 9px; color: #2e6fb0; }
.lchip .ic { color: #2e6fb0; }
.file .thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; }

/* ตัวพรีวิว */
dialog.viewer { width: min(1000px, calc(100vw - 24px)); }
.viewer-body { padding: 14px 18px 18px; display: grid; place-items: center; min-height: 240px; }
.viewer-body img { max-width: 100%; max-height: 72vh; border-radius: 12px; }
.viewer-body video { width: 100%; max-height: 72vh; border-radius: 12px; background: #000; }
.viewer-body audio { width: 100%; }
.viewer-body iframe { width: 100%; height: 74vh; border: 0; border-radius: 12px; background: var(--surface-2); }
.viewer-body .empty { padding: 20px; }

/* ชนิดไฟล์ในฟอร์มสั่งงาน */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.type-pick { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; background: var(--surface); transition: .15s; }
.type-pick input { position: absolute; opacity: 0; pointer-events: none; }
.type-pick b { display: block; font-size: 13.5px; }
.type-pick small { display: block; font-size: 11px; color: var(--muted); }
.type-pick .ftype { width: 30px; height: 36px; font-size: 8px; }
.type-pick:has(input:checked) { border-color: var(--leaf); background: var(--leaf-50); box-shadow: inset 0 0 0 1px var(--leaf); }
.type-pick:has(input:checked)::after { content: ""; position: absolute; top: 8px; right: 9px; width: 16px; height: 16px; border-radius: 50%; background: var(--leaf) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center/11px no-repeat; }

.task-card .owner { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-top: -6px; }
.sticky-col { position: sticky; top: 86px; }

/* อัปโหลดหลายไฟล์ */
.upl { padding: 12px 14px; border-radius: 14px; background: var(--leaf-50); }
.upl .bar { margin-top: 8px; background: #fff; }
.file .pbar { height: 4px; border-radius: 99px; background: var(--leaf-50); margin-top: 6px; overflow: hidden; }
.file .pbar i { display: block; height: 100%; width: 0; background: var(--leaf); transition: width .2s; }
.file.err { border-color: #f1c9bd; background: #fff7f4; }
.file.ok .pbar i { background: var(--leaf-700); }

.bulkbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; position: sticky; top: 80px; z-index: 5; background: var(--leaf-700); color: #fff; border-color: var(--leaf-700); }
.bulkbar .select { background-color: #fff; }
@media (max-width: 1180px) { .sticky-col { position: static; } }
@media (max-width: 640px) {
  .bell-menu { position: fixed; left: 12px; right: 12px; top: 68px; width: auto; }
  .bulkbar { top: 70px; }
}

/* ==========================================================================
   v3 — ขยายเวลา · ฉบับก่อนหน้า · ปฏิทิน · ค่าการแจ้งเตือน · หน้าพิมพ์รายงาน
   ========================================================================== */
.ext-chip { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--lime); color: var(--lime-ink); white-space: nowrap; }
.ext-chip .ic { width: 13px; height: 13px; }
details.oldver { font-size: 12.5px; color: var(--muted); }
details.oldver summary { cursor: pointer; display: inline-flex; align-items: center; gap: 5px; list-style: none; padding: 2px 0; }
details.oldver summary::-webkit-details-marker { display: none; }
details.oldver[open] summary { color: var(--ink-2); margin-bottom: 6px; }
details.oldver .fchip { opacity: .75; }
.ver { font-size: 11px; color: var(--muted); padding: 0 2px 0 6px; }

/* ปฏิทิน */
.cal-card { overflow: hidden; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wd { padding: 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: center; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-wd.we { color: var(--st-miss); opacity: .75; }
.cal-day { min-height: 118px; padding: 6px; border-right: 1px dashed var(--line); border-bottom: 1px dashed var(--line); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.off { background: repeating-linear-gradient(135deg, transparent 0 8px, rgba(30,58,43,.025) 8px 16px); }
.cal-day.we:not(.off) { background: #fbfdf9; }
.cal-day.past .cal-n { color: var(--faint); }
.cal-n { font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--ink-2); width: 26px; height: 26px; display: grid; place-items: center; border-radius: 9px 3px 9px 3px; }
.cal-day.today .cal-n { background: var(--leaf); color: #fff; }
.cal-ev { display: flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 7px; font-size: 11.5px; line-height: 1.35; color: var(--ink); border-left: 3px solid currentColor; min-width: 0; }
.cal-ev span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.cal-ev b { font-family: var(--font-display); font-size: 11px; flex: none; }
.cal-ev:hover { filter: brightness(.97); }
.cal-ev.ev-closed { opacity: .55; }
.ev-missing { background: var(--st-miss-bg); color: var(--st-miss); }
.ev-submitted { background: var(--st-sent-bg); color: var(--st-sent); }
.ev-approved { background: var(--st-ok-bg); color: var(--st-ok); }
.ev-late { background: var(--st-late-bg); color: var(--st-late); }
.ev-returned { background: var(--st-back-bg); color: var(--st-back); }
.ev-manage { background: var(--surface); color: var(--leaf-600); border: 1px solid var(--line-2); border-left: 3px solid var(--leaf); }
.ev-manage.ev-full { background: var(--leaf-50); }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.cal-dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px 1px 4px 1px; border-left: 3px solid currentColor; }
.cal-date { width: 48px; flex: none; text-align: center; padding: 4px 0; border-radius: 12px 4px 12px 4px; background: var(--leaf-50); }
.cal-date b { display: block; font-family: var(--font-display); font-size: 19px; line-height: 1.1; color: var(--leaf-700); }
.cal-date span { font-size: 11px; color: var(--muted); }
@media (max-width: 760px) {
  .cal-day { min-height: 64px; padding: 4px; }
  .cal-ev span { display: none; }
  .cal-ev { padding: 0; height: 7px; border-radius: 4px; border-left: 0; background: currentColor; }
  .cal-ev b { display: none; }
  .cal-more { display: none; }
}

/* ค่าการแจ้งเตือน */
.pref-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.pref { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-top: 1px dashed var(--line); cursor: pointer; }
.pref:first-child { border-top: 0; }
.pref .grow { flex: 1; font-size: 14px; font-weight: 500; }
.pref small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.pref-list.off { opacity: .45; pointer-events: none; }

/* หน้าพิมพ์รายงาน (A4) */
.print-body { background: #e9efe5; }
.print-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 18px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.sheet { width: 210mm; min-height: 297mm; margin: 22px auto; padding: 16mm 15mm; background: #fff; box-shadow: var(--shadow-lg); border-radius: 6px; font-size: 13px; }
.print-head { display: flex; align-items: center; gap: 14px; padding-bottom: 12px; border-bottom: 3px solid var(--leaf); margin-bottom: 16px; }
.print-mark { width: 52px; height: 52px; }
.print-head h1 { font-size: 22px; }
.print-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.print-kpis div { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.print-kpis b { display: block; font-family: var(--font-display); font-size: 22px; color: var(--leaf-700); line-height: 1.1; }
.print-kpis span { display: block; font-weight: 600; font-size: 12.5px; }
.print-kpis small { color: var(--muted); font-size: 11px; }
.sheet h2 { font-size: 15px; margin: 16px 0 8px; color: var(--leaf-700); }
.ptable { width: 100%; border-collapse: collapse; font-size: 12px; }
.ptable th { background: var(--leaf-50); color: var(--ink-2); font-weight: 600; text-align: left; padding: 6px 8px; border-bottom: 1.5px solid var(--sage); }
.ptable td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ptable .c { text-align: center; }
.ptable .bad { color: var(--st-miss); font-weight: 700; }
.ptable tr { break-inside: avoid; }
.pbar { display: inline-block; width: 70px; height: 6px; border-radius: 9px; background: var(--leaf-50); margin-right: 6px; vertical-align: middle; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--leaf); }
.print-foot { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 20px; align-items: end; margin-top: 30px; font-size: 11.5px; color: var(--muted); }
.sign { text-align: center; color: var(--ink-2); }
.sign span { display: block; border-bottom: 1px dotted var(--ink-2); height: 40px; margin-bottom: 4px; }
@media print {
  @page { size: A4; margin: 12mm; }
  .no-print { display: none !important; }
  .print-body { background: #fff; }
  .sheet { width: auto; min-height: 0; margin: 0; padding: 0; box-shadow: none; }
  .page-break { break-before: page; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (max-width: 820px) { .sheet { width: auto; margin: 10px; padding: 16px; overflow-x: auto; } .print-kpis { grid-template-columns: repeat(2, 1fr); } .print-foot { grid-template-columns: 1fr; } }

/* ตราโรงเรียน (รูปที่อัปโหลด) */
img.school-logo { object-fit: contain; }
.brand img.brand-mark { width: 42px; height: 42px; }
.auth-art .brand img.school-logo { width: 60px; height: 60px; padding: 4px; border-radius: 14px; background: #fff; box-shadow: 0 6px 18px -8px rgba(0,0,0,.35); }
.logo-preview { width: 96px; height: 96px; flex: none; display: grid; place-items: center; border: 1px dashed var(--line-2); border-radius: 18px; background: var(--surface-2); padding: 8px; }
.logo-preview img, .logo-preview svg { width: 100%; height: 100%; object-fit: contain; }

/* ---------- คลังเอกสาร ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.lib-folder { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; min-width: 0; }
.lib-folder:hover { border-color: var(--sage); transform: translateY(-1px); box-shadow: 0 8px 20px -14px rgba(0,0,0,.35); }
.lib-folder .grow { min-width: 0; }
.lib-folder b { display: block; font-size: 14px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lib-folder .muted { font-size: 12px; }
.lib-acts { display: flex; gap: 2px; flex: none; }
/* ปุ่มจัดการในการ์ด/แถวไฟล์ — แบน เล็ก ไม่แย่งที่ชื่อ */
.lib-acts .btn { --push-lift: 0px; width: 32px; min-height: 32px; height: 32px; padding: 0; margin-bottom: 0; border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); }
.lib-acts .btn:hover { background: var(--leaf-50); color: var(--leaf-700); transform: none; box-shadow: none; filter: none; }
.lib-acts form:last-child .btn:hover { background: color-mix(in srgb, var(--st-miss) 12%, transparent); color: var(--st-miss); }
.lib-acts .btn .ic { width: 17px; height: 17px; }
/* การ์ดโฟลเดอร์: ชื่อได้ความกว้างเต็มการ์ด (สูงสุด 3 บรรทัด) ปุ่มอยู่แถวล่าง */
.lib-fcard { flex-direction: column; align-items: stretch; gap: 6px; padding: 12px 12px 8px 14px; }
.lib-fcard-main { display: flex; align-items: flex-start; gap: 12px; color: inherit; text-decoration: none; min-width: 0; flex: 1; }
.lib-fcard-main:hover b { color: var(--leaf-700); }
.lib-fcard-main .grow { min-width: 0; padding-top: 2px; }
.lib-fcard-main b { -webkit-line-clamp: 3; font-size: 14.5px; line-height: 1.4; overflow-wrap: anywhere; }
.lib-fcard-main .muted { display: block; margin-top: 3px; line-height: 1.35; }
.lib-fcard .lib-acts { justify-content: flex-end; padding-top: 4px; border-top: 1px dashed var(--line); }
.lib-file { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.lib-file:first-child { border-top: 0; }
.lib-file .fchip-wrap { min-width: 0; max-width: 100%; }
.lib-file .lib-meta { flex: 1 1 220px; min-width: 0; font-size: 12.5px; color: var(--muted); }
.lib-hint { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--leaf-50); color: var(--ink); font-size: 13.5px; margin-bottom: 14px; }
.lib-hint b { color: var(--leaf-700); }
.lib-units { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.chip.year { cursor: pointer; text-decoration: none; }
.chip.year.on { background: var(--leaf); color: #fff; }

/* ---------- ตัวชี้วัด สมศ. (pages/onesqa.php) ----------
   สี 3 มาตรฐาน ผ่านตัวตรวจสีสำหรับคนตาบอดสี (ทั้งธีมสว่าง/มืด) · ทุกแท่งมีตัวเลขกำกับ + คำอธิบายสี + ตาราง */
.qa-viz { --qa-s1: #1baf7a; --qa-s2: #2a78d6; --qa-s3: #eb6834; }
html[data-theme="dark"] .qa-viz { --qa-s1: #199e70; --qa-s2: #3987e5; --qa-s3: #d95926; }
.qa-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.qa-kpis .kpi .grow { flex: 1; min-width: 0; }
.qa-kpis > *, .qa-charts > * { min-width: 0; }
.qa-charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr); gap: 18px; margin-top: 18px; }
.qa-ready { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.qa-ready .ring { flex: none; }
.qa-levels { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 170px; display: grid; gap: 7px; }
.qa-levels li { display: grid; grid-template-columns: 10px 1fr auto; column-gap: 8px; align-items: center; font-size: 13.5px; }
.qa-levels li .bar { grid-column: 2 / 4; height: 5px; margin-top: 2px; }
.qa-dot { width: 10px; height: 10px; border-radius: 5px 2px 5px 2px; }
.qa-dot.great, .qa-lv-great { background: var(--st-ok) !important; }
.qa-dot.ready, .qa-lv-ready { background: var(--st-sent) !important; }
.qa-dot.dev, .qa-lv-dev { background: var(--st-late) !important; }
.qa-dot.urgent, .qa-lv-urgent { background: var(--st-miss) !important; }
.qa-dot.none, .qa-lv-none { background: var(--line-2) !important; }
.qa-std { display: grid; gap: 14px; }
.qa-std-row .bar { margin: 6px 0 4px; }
.qa-std-name { margin-top: 2px; }
.qa-sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; flex: none; }
.qa-bars-wrap { overflow-x: auto; }
.qa-bars { display: block; width: 100%; min-width: 440px; height: auto; }
.qa-bars .qa-grid { stroke: var(--line); stroke-width: 1; }
.qa-bars .qa-grid.base { stroke: var(--line-2); }
.qa-bars .qa-ax { font-size: 10px; fill: var(--muted); font-family: var(--font-body); }
.qa-bars .qa-val { font-size: 11px; font-weight: 700; fill: var(--ink-2); font-family: var(--font-body); }
.qa-bars .qa-none { font-size: 12px; fill: var(--faint); }
.qa-bars .qa-bar:hover rect { fill: var(--leaf-50); }
.qa-legend { gap: 14px; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); }
.qa-legend span { display: inline-flex; align-items: center; gap: 6px; }
.qa-table td { vertical-align: middle; }
.qa-act { font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }
.qa-quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.qa-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: .15s; }
.qa-tile:hover { border-color: var(--leaf); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.qa-level-box { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; }
.qa-level-box b { display: block; color: var(--leaf-700); margin-bottom: 2px; }
.qa-crit { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; }
.qa-ev { padding: 14px 0; border-top: 1px dashed var(--line); }
.qa-ev:first-of-type { border-top: 0; padding-top: 2px; }
.qa-ev-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.qa-ev-files { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.qa-score { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.qa-score label { position: relative; cursor: pointer; }
.qa-score input { position: absolute; opacity: 0; }
.qa-score span { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--surface); text-align: center; transition: .15s; }
.qa-score span b { font-family: var(--font-display); font-size: 20px; line-height: 1.1; }
.qa-score span small { font-size: 11px; color: var(--muted); }
.qa-score input:checked + span { border-color: var(--leaf); background: var(--leaf-50); box-shadow: 0 0 0 3px var(--leaf-50); }
.qa-score input:focus-visible + span { outline: 2px solid var(--leaf); outline-offset: 2px; }
.qa-score-view { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.qa-score-view b { font-family: var(--font-display); font-size: 40px; line-height: 1; }
.qa-note { margin-top: 10px; font-size: 14px; }
.qa-note p { margin: 2px 0 0; color: var(--ink-2); }
.qa-edit summary { list-style: none; display: inline-flex; margin-top: 10px; }
.qa-edit summary::-webkit-details-marker { display: none; }
.lib-qa { margin-bottom: 14px; }
.lib-qa .qa-inds { display: flex; flex-wrap: wrap; gap: 6px 12px; }
@media (max-width: 1180px) {
  .qa-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .qa-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qa-charts .qa-wide { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .qa-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qa-charts { grid-template-columns: minmax(0, 1fr); }
}
.qa-tscore { display: inline-block; min-width: 18px; font-size: 16px; }
/* ---------- รายงาน SAR (pages/onesqa_sar.php) — ขึ้นหน้าใหม่ตาม page-break ในเนื้อเล่ม ---------- */
.sar-sheet { font-size: 14px; line-height: 1.7; }
.sar-sheet h2 { font-size: 19px; margin: 22px 0 8px; color: var(--leaf-700); border-bottom: 2px solid var(--leaf-100); padding-bottom: 4px; }
.sar-sheet .sar-cover h2 { border: 0; color: var(--ink); }
.sar-sheet h3 { font-size: 16px; margin: 18px 0 6px; }
.sar-sheet h4 { font-size: 14.5px; margin: 14px 0 4px; }
.sar-sheet p { margin: 4px 0 8px; }
.sar-sheet ul, .sar-sheet ol { margin: 4px 0 10px; padding-left: 22px; }
.sar-sheet a { word-break: break-all; }
/* ---------- แผนดำเนินงาน สมศ. (pages/onesqa_plan.php) ---------- */
.qa-plan-date { flex: none; width: 52px; display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: 12px; background: var(--leaf-50); color: var(--leaf-700); line-height: 1.1; }
.qa-plan-date b { font-family: var(--font-display); font-size: 20px; }
.qa-plan-date span { font-size: 11px; }
.qa-plan-date.sm { width: 44px; padding: 4px 0; }
.qa-plan-date.sm b { font-size: 16px; }
.qa-plan li.is-done .title { text-decoration: line-through; color: var(--muted); }
.qa-plan li .title { white-space: normal; }
.lib-shared { background: var(--st-back-bg); }
.lt-editor.off { opacity: .45; }
.lt-ret { margin-top: 4px; }
.lt-ann .lt-text { min-height: 170px; }
/* หน้าตั้งค่า LINE › แบบข้อความ */
.tpl-item { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); transition: border-color .15s, box-shadow .15s; }
.tpl-item.on { border-color: var(--leaf); box-shadow: 0 0 0 3px var(--leaf-50); }
.tpl-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tpl-row .input { flex: 1 1 160px; max-width: 240px; height: 38px; }
.tpl-no { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--leaf-50); color: var(--leaf-700); font-size: 13px; font-weight: 700; }
.tpl-item .lt-text { min-height: 150px; }
.lt-ret[hidden], .lt-ann[hidden], .tpl-pane[hidden] { display: none; }   /* display ของ .pg-grid / .stack ชนะ hidden */
