/* ITA — การเปิดเผยข้อมูล · ฟอนต์ Sarabun · ธีมตามวัน · โหมดสว่าง/มืด */

@font-face { font-family: "Sarabun"; src: url("../fonts/Sarabun-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Sarabun"; src: url("../fonts/Sarabun-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Sarabun"; src: url("../fonts/Sarabun-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Sarabun"; src: url("../fonts/Sarabun-Bold.ttf") format("truetype"); font-weight: 700 800; font-display: swap; }

/* ---------- โทเคนสี: ค่าเริ่มต้น = สว่าง, ประจำวันกำหนด --accent ---------- */
:root {
  --accent: #1b5fa8;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fa;
  --accent-line: #b9cfe8;
  --bg: #f4f6fb;
  --bg-grad: radial-gradient(1200px 500px at 0% -10%, var(--accent-soft), transparent 60%), #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e2e8f0;
  --text: #1c2433;
  --muted: #64748b;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 12px 32px -18px rgba(15, 23, 42, .25);
  --ok: #15803d; --ok-soft: #e7f7ee;
  --warn: #b45309; --warn-soft: #fff4e0;
  --bad: #b91c1c; --bad-soft: #fdecec;
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Sarabun", "Leelawadee UI", Tahoma, sans-serif;
  /* สีจุดกระจายในการ์ด (โหมดสว่าง) ตามสีประจำวัน */
  --art-1: #1b5fa8; --art-2: #38bdf8; --art-3: #a78bfa;
  --stripe: rgba(255, 255, 255, .5); /* แถวลายสลับในตาราง (โปร่งแสงให้เห็นจุดสีของการ์ด) */
  --card-bg:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--art-1) 20%, transparent) 0, transparent 42%),
    radial-gradient(circle at 100% 100%, color-mix(in srgb, var(--art-2) 22%, transparent) 0, transparent 46%),
    radial-gradient(circle at 92% 6%, color-mix(in srgb, var(--art-3) 18%, transparent) 0, transparent 30%),
    var(--surface);
}

/* ประจำวัน: ปรับสีเน้นและสีพื้นเบา ๆ ให้เข้ากับวัน */
html[data-day="sun"] { --accent: #dc2626; --accent-soft: #fdecec; --accent-line: #f5b5b5; --art-1: #dc2626; --art-2: #fb923c; --art-3: #f472b6; }
html[data-day="mon"] { --accent: #b7791f; --accent-soft: #fdf6dc; --accent-line: #f0dc8f; --art-1: #eab308; --art-2: #f59e0b; --art-3: #fb7185; }
html[data-day="tue"] { --accent: #db2777; --accent-soft: #fde8f2; --accent-line: #f5b7d3; --art-1: #db2777; --art-2: #a855f7; --art-3: #60a5fa; }
html[data-day="wed"] { --accent: #15803d; --accent-soft: #e7f7ee; --accent-line: #a9e0bf; --art-1: #16a34a; --art-2: #84cc16; --art-3: #22d3ee; }
html[data-day="thu"] { --accent: #c2410c; --accent-soft: #fdeee4; --accent-line: #f6c2a2; --art-1: #ea580c; --art-2: #fbbf24; --art-3: #f97316; }
html[data-day="fri"] { --accent: #0369a1; --accent-soft: #e6f3fb; --accent-line: #a6d4ef; --art-1: #0284c7; --art-2: #38bdf8; --art-3: #a78bfa; }
html[data-day="sat"] { --accent: #6d28d9; --accent-soft: #f0eafc; --accent-line: #cbb8f2; --art-1: #7c3aed; --art-2: #c084fc; --art-3: #f472b6; }

/* โหมดมืด: ค่าเริ่มต้นเมื่อผู้ใช้เลือก หรือตามระบบเครื่องเมื่อไม่ได้เลือก */
html[data-mode="dark"] {
  --bg: #0f1520;
  --bg-grad: radial-gradient(1200px 500px at 0% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%), #0f1520;
  --surface: #171f2e;
  --surface-2: #1d2839;
  --line: #2a3648;
  --text: #e6ecf5;
  --muted: #94a3b8;
  --accent-soft: color-mix(in srgb, var(--accent) 18%, #171f2e);
  --accent-line: color-mix(in srgb, var(--accent) 45%, #2a3648);
  --ok-soft: #123222; --warn-soft: #3a2a10; --bad-soft: #3a1717;
  --card-bg: var(--surface);
  --stripe: var(--surface-2);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 36px -18px rgba(0, 0, 0, .7);
}
@media (prefers-color-scheme: dark) {
  html:not([data-mode="light"]) {
    --bg: #0f1520;
    --bg-grad: radial-gradient(1200px 500px at 0% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%), #0f1520;
    --surface: #171f2e;
    --surface-2: #1d2839;
    --line: #2a3648;
    --text: #e6ecf5;
    --muted: #94a3b8;
    --accent-soft: color-mix(in srgb, var(--accent) 18%, #171f2e);
    --accent-line: color-mix(in srgb, var(--accent) 45%, #2a3648);
    --ok-soft: #123222; --warn-soft: #3a2a10; --bad-soft: #3a1717;
    --card-bg: var(--surface);
    --stripe: var(--surface-2);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 36px -18px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-grad);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 99; }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
[hidden] { display: none !important; }

/* ---------- หัวเว็บ ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 66px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); min-width: 0; }
.brand__mark {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #000));
  color: var(--accent-ink); font-weight: 800; letter-spacing: .5px; font-size: 14px; flex: none;
  box-shadow: 0 10px 22px -12px var(--accent);
}
.brand__logo { height: 44px; width: auto; max-width: 180px; object-fit: contain; flex: none; display: block; }
.logo-preview { display: inline-flex; align-items: center; justify-content: center; min-width: 200px; min-height: 84px; padding: 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px dashed var(--line); margin: 6px 0 10px; }
.logo-preview img { max-height: 72px; max-width: 240px; object-fit: contain; }
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__text strong { font-size: 1.05rem; line-height: 1.2; }
.brand__text small { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.day-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .9rem; border: 1px solid var(--accent-line);
}
.day-chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }

.mode-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer; font-weight: 600; font-size: .9rem;
}
.mode-btn__ic { width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(90deg, #fbbf24 50%, #1e293b 50%); border: 1px solid var(--line); }
html[data-mode="dark"] .mode-btn__ic { background: linear-gradient(90deg, #1e293b 50%, #cbd5e1 50%); }

/* ---------- ปุ่ม/ป้าย/การ์ด ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px;
  border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer;
  text-decoration: none; transition: transform .15s ease, box-shadow .2s ease, background .2s ease; line-height: 1.2;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 20px -12px var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn--ghost:hover { box-shadow: var(--shadow); }
.btn--soft { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.btn--danger { background: var(--bad); color: #fff; }
.btn--sm { padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn--block { width: 100%; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge--ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge--warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge--bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge--accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }

.card { background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card__pad { padding: 20px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.h1 { font-size: 1.55rem; font-weight: 800; margin: 0 0 4px; line-height: 1.3; }
.h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 10px; }
.stack > * + * { margin-top: 14px; }

/* ---------- หน้าบ้าน: เลือกปี / ค้นหา ---------- */
.hero { padding: 28px 0 8px; }
.hero__title { font-size: clamp(1.4rem, 2.5vw, 1.9rem); font-weight: 800; margin: 0 0 6px; line-height: 1.3; }
.hero__sub { color: var(--muted); margin: 0; }

.yearbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 18px 0 10px; }
.yearbar__label { font-weight: 700; margin-inline-end: 4px; }
.yearbtn {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  text-decoration: none; color: var(--text); font-weight: 700; transition: all .15s ease;
}
.yearbtn:hover { border-color: var(--accent-line); }
.yearbtn.is-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 10px 20px -14px var(--accent); }

.searchbar { display: flex; gap: 8px; margin: 6px 0 16px; }
.searchbar__box { position: relative; flex: 1; min-width: 0; }
.searchbar__box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); outline: none; transition: border-color .2s, box-shadow .2s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.searchbar .input { padding-inline-start: 42px; }
.label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
.textarea { min-height: 110px; resize: vertical; }

.resultinfo { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--muted); margin: 6px 2px 10px; font-size: .95rem; }

/* ---------- ตารางข้อมูล (หน้าบ้าน) ---------- */
.tablecard { overflow: clip; } /* clip (ไม่ใช่ hidden) เพื่อให้หัวตาราง sticky ทำงานกับหน้าจอ ไม่ใช่กับการ์ด */
.dtable { width: 100%; border-collapse: separate; border-spacing: 0; }
.dtable thead th {
  position: sticky; top: 66px; z-index: 2; text-align: start; padding: 14px 14px; font-weight: 700;
  background: var(--accent); color: var(--accent-ink); font-size: .95rem;
}
.dtable thead th:first-child { border-top-left-radius: var(--radius); }
.dtable thead th:last-child { border-top-right-radius: var(--radius); }
.dtable tbody td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dtable tbody tr:nth-child(even) td { background: var(--stripe); }
.dtable tbody tr:hover td { background: var(--accent-soft); }
.dtable tbody tr:last-child td { border-bottom: 0; }
.code { display: inline-block; min-width: 56px; text-align: center; padding: 4px 10px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: .92rem; }
.item-title { font-weight: 700; line-height: 1.45; }
.item-desc { color: var(--muted); font-size: .92rem; margin-top: 4px; white-space: pre-line; }

.links { display: flex; flex-direction: column; gap: 6px; }
.linkpill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--accent-line); color: var(--accent); font-weight: 600; font-size: .92rem;
  max-width: 100%; word-break: break-word; transition: background .15s ease;
}
.linkpill:hover { background: var(--accent-soft); }
.linkpill svg { flex: none; }
.linkpill small { color: var(--muted); font-weight: 500; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty__ic { font-size: 2.2rem; margin-bottom: 6px; }

/* การ์ดบนมือถือ */
.cards { display: none; }
.item-card { padding: 16px; }
.item-card + .item-card { margin-top: 12px; }

/* ---------- หลังบ้าน ---------- */
.admin-main { padding: 22px 0 60px; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat { padding: 18px; }
.stat__num { font-size: 1.9rem; font-weight: 800; color: var(--accent); line-height: 1.1; }
.stat__label { color: var(--muted); font-weight: 600; }

.yeargrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.yearcard { padding: 16px; text-decoration: none; color: var(--text); display: block; transition: transform .15s, border-color .2s; }
.yearcard:hover { transform: translateY(-2px); border-color: var(--accent-line); }
.yearcard__year { font-size: 1.5rem; font-weight: 800; color: var(--accent); }

/* รายการข้อ เรียงลากวางได้ */
.sortlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sortitem {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; transition: box-shadow .2s, transform .15s, opacity .15s;
}
.sortitem:hover { box-shadow: var(--shadow); }
.sortitem.is-dragging { opacity: .5; }
.sortitem.is-over { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.sortitem__handle { cursor: grab; color: var(--muted); padding: 4px 6px; border-radius: 8px; user-select: none; font-size: 1.1rem; line-height: 1; }
.sortitem__handle:active { cursor: grabbing; }
.sortitem__no { font-weight: 800; color: var(--muted); min-width: 28px; text-align: center; }
.sortitem__title { min-width: 0; }
.sortitem__title b { display: block; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sortitem__meta { color: var(--muted); font-size: .88rem; }
.sortitem__actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sortlist.is-saving { opacity: .7; pointer-events: none; }
/* แถวลิงก์ในตาราง: ใช้ระบบลากเดียวกับรายการข้อ แต่ไม่มีกรอบการ์ด */
tbody.sortlist { display: table-row-group; }
tr.sortitem { display: table-row; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
tr.sortitem > td { vertical-align: middle; }
tr.sortitem.is-dragging { opacity: .5; }
tr.sortitem.is-over > td { box-shadow: inset 0 3px 0 var(--accent); }

.filedrop {
  display: grid; place-items: center; gap: 4px; text-align: center; padding: 22px; border-radius: 14px;
  border: 2px dashed var(--accent-line); background: var(--accent-soft); cursor: pointer; transition: border-color .2s, background .2s;
}
.filedrop:hover, .filedrop.is-over { border-color: var(--accent); }
.filedrop input { display: none; }

.table-simple { width: 100%; border-collapse: collapse; }
.table-simple th, .table-simple td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
.table-simple th { background: var(--surface-2); font-weight: 700; font-size: .92rem; }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 12px; font-weight: 600; border: 1px solid transparent; }
.flash--ok { background: var(--ok-soft); color: var(--ok); }
.flash--bad { background: var(--bad-soft); color: var(--bad); }
.flash--warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- ช่องกรอก PIN แบบแป้นเด้ง ---------- */
.pinscreen { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 88%, #000 12%); backdrop-filter: blur(6px); padding: 16px; }
.pincard { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 30px 70px -28px rgba(0,0,0,.5); padding: 26px 22px 20px; text-align: center; animation: pop .25s cubic-bezier(.2,.9,.3,1.2) both; }
.pincard__ic { width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 1.5rem; }
.pincard h2 { margin: 0 0 2px; font-size: 1.2rem; }
.pincard__sub { color: var(--muted); font-size: .92rem; min-height: 1.4em; margin-bottom: 14px; }
.pindots { display: flex; justify-content: center; gap: 12px; margin: 6px 0 8px; }
.pindots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); transition: background .15s; }
.pindots span.on { background: var(--accent); }
.pindots.shake { animation: shake .45s; }
.pinmsg { min-height: 1.4em; color: var(--bad); font-weight: 600; font-size: .92rem; margin-bottom: 8px; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; }
.pinpad button { height: 60px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); font-size: 1.4rem; font-weight: 700; cursor: pointer; transition: transform .08s, background .15s; }
.pinpad button:active { transform: scale(.94); background: var(--accent-soft); }
.pinpad button.pinpad__del { font-size: 1.1rem; color: var(--muted); }
.pinpad button.pinpad__zero { grid-column: 2; }
.pinlinks { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.pinlinks button { background: none; border: 0; color: var(--accent); font-weight: 600; cursor: pointer; padding: 4px; }

/* ---------- กล่องยืนยัน/แจ้งเตือน ---------- */
.modal-back { position: fixed; inset: 0; z-index: 210; display: grid; place-items: center; padding: 18px; background: rgba(8, 12, 26, .45); backdrop-filter: blur(5px); animation: fade .18s ease both; }
.modal { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); padding: 24px; animation: pop .22s cubic-bezier(.2,.9,.3,1.2) both; }
.modal__ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 12px; background: var(--accent-soft); color: var(--accent); font-size: 1.4rem; }
.modal__ic.is-danger { background: var(--bad-soft); color: var(--bad); }
.modal h3 { margin: 0 0 6px; font-size: 1.15rem; }
.modal p { margin: 0 0 18px; color: var(--muted); }
.modal .row { justify-content: flex-end; }
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 230; display: grid; gap: 8px; justify-items: center; width: min(92vw, 420px); }
.toast { width: 100%; padding: 12px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 600; animation: rise .25s ease both; }
.toast--ok { border-inline-start: 4px solid var(--ok); }
.toast--bad { border-inline-start: 4px solid var(--bad); }

.foot { border-top: 1px solid var(--line); background: var(--surface); margin-top: auto; }
.foot .wrap { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 18px 0; color: var(--muted); font-size: .92rem; }

.authcard { width: min(440px, 100%); margin: 40px auto; padding: 28px; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }

/* ---------- ตอบสนองหน้าจอเล็ก ---------- */
@media (max-width: 860px) {
  .dtable { display: none; }
  .cards { display: block; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .searchbar { flex-direction: column; }
  .brand__text small { display: none; }
  .day-chip { display: none; }
}
@media (max-width: 600px) {
  .wrap { width: min(100% - 24px, 1180px); }
  .sortitem { grid-template-columns: auto 1fr; }
  .sortitem__no { display: none; }
  .sortitem__actions { grid-column: 1 / -1; justify-content: flex-start; }
}
/* ---------- ภาพรวม (หลังบ้าน) ---------- */
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.table-wrap { overflow-x: auto; }
.recentlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.recentlist a { font-weight: 700; color: var(--text); text-decoration: none; }
.recentlist a:hover { color: var(--accent); }
.pinforgot { margin: 0; display: inline; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--text); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 2px 12px; }
.toolbar .btn svg { margin-right: 4px; vertical-align: -3px; }
.print-only { display: none; }
@media print {
  .topbar, .toasts, .yearbar, .searchbar, .mode-btn, .day-chip, .foot, .hero, .no-print, .resultinfo { display: none !important; }
  .print-only { display: block !important; font-size: 1.1rem; margin: 0 0 10px; color: #000; }
  .tablecard, .dtable tbody td { break-inside: avoid; }
  .dtable thead th { background: #e5e7eb !important; color: #000 !important; position: static; }
  .dtable tbody tr:nth-child(even) td, .dtable tbody tr:hover td { background: transparent !important; }
  .dtable tbody td { padding: 8px 10px; }
  .linkpill { border: 0; padding: 0; color: #000; }
  .print-url { display: block !important; font-size: .78rem; color: #333; word-break: break-all; line-height: 1.35; margin-bottom: 4px; }
  .wrap { width: 100%; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
