:root {
  --bg: #f3f4f7;
  --card: #ffffff;
  --ink: #1b2430;
  --muted: #68727f;
  --line: #e3e6eb;
  --primary: #1f3a5f;
  --primary-ink: #ffffff;
  --accent: #a9762a;
  --danger: #b3261e;
  --soft: #e9eef5;
  --radius: 14px;
  --tab-h: 62px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --card: #1c222b;
    --ink: #e8ebf0;
    --muted: #98a2af;
    --line: #2c3440;
    --primary: #3b6aa8;
    --accent: #d7a65a;
    --danger: #f2796f;
    --soft: #252d38;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 'Sarabun', -apple-system, 'Segoe UI', sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

.shell { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
.icon { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.grow { flex: 1; min-width: 0; }

/* ---------- สถานะเต็มจอ ---------- */
.center-screen {
  min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 32px 24px; text-align: center;
}
.big-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--soft); color: var(--primary); display: grid; place-items: center; }
.big-icon .icon { width: 34px; height: 34px; }
.big-icon.warn { color: var(--danger); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--primary); animation: spin .8s linear infinite; }
.spinner.light { border-color: rgba(255,255,255,.25); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- แถบบน ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 6px;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 10px; background: var(--primary); color: var(--primary-ink);
}
.topbar h1 { flex: 1; font-size: 18px; font-weight: 600; padding-left: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  position: relative; width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: inherit; text-decoration: none;
}
.icon-btn:active { background: rgba(127,127,127,.2); }
.icon-btn:disabled { opacity: .3; }
.icon-btn.danger { color: var(--danger); }
.dot {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #d93025; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px;
}

.content { padding: 14px 14px calc(var(--tab-h) + env(safe-area-inset-bottom) + 96px); }

/* ---------- หน้าแรก ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-align: left;
}
.stat b { font-size: 28px; line-height: 1.1; color: var(--primary); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 14px; }
@media (prefers-color-scheme: dark) { .stat b { color: var(--ink); } }

.sec {
  display: flex; align-items: center; justify-content: space-between; margin: 22px 4px 8px;
  font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .02em;
}
.link { border: 0; background: none; padding: 4px 0; color: var(--accent); font-weight: 600; font-size: 14px; text-align: left; }
.link.danger { color: var(--danger); }
.plain { border: 0; background: none; padding: 0; }

/* ---------- รายการ ---------- */
.row, .row-main { display: flex; align-items: center; gap: 12px; text-align: left; }
.row {
  width: 100%; padding: 12px 14px; margin-bottom: 8px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
}
button.row:active, .row-main:active { opacity: .7; }
.row-main { flex: 1; min-width: 0; border: 0; background: none; padding: 0; }
.title { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.sub { color: var(--muted); font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.sub.accent { color: var(--accent); font-weight: 500; }
.chev { color: var(--line); }
.empty { padding: 22px 12px; text-align: center; color: var(--muted); font-size: 14px; border: 1px dashed var(--line); border-radius: var(--radius); }
.hint { color: var(--muted); font-size: 13px; margin: 0 2px 12px; }
.error { color: var(--danger); font-size: 14px; font-weight: 500; }

.avatar { width: 46px; height: 46px; flex: none; border-radius: 50%; object-fit: cover; background: var(--soft); }
.avatar.ph { display: grid; place-items: center; color: var(--primary); font-weight: 700; font-size: 18px; }
.avatar.xl { width: 104px; height: 104px; font-size: 38px; }
.avatar.xl .icon { width: 44px; height: 44px; }
@media (prefers-color-scheme: dark) { .avatar.ph { color: var(--ink); } }

.datebox {
  width: 48px; flex: none; padding: 5px 0; border-radius: 10px; background: var(--primary); color: #fff;
  display: flex; flex-direction: column; align-items: center; line-height: 1.15;
}
.datebox b { font-size: 19px; }
.datebox span { font-size: 12px; opacity: .85; }
.datebox.past { background: var(--soft); color: var(--muted); }

.filebox {
  width: 44px; height: 50px; flex: none; border-radius: 8px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; background: var(--soft); color: var(--muted); border-left: 4px solid var(--muted);
}
.filebox.c0 { border-left-color: var(--accent); }
.filebox.c1 { border-left-color: var(--primary); }
.filebox.c2 { border-left-color: var(--muted); }
.filebox.c3 { border-left-color: #2f8f6b; }
.filebox.c4 { border-left-color: #7a5bb5; }
.filebox.c5 { border-left-color: #c2553f; }

/* ---------- การ์ด ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h2 { font-size: 19px; line-height: 1.35; margin-bottom: 4px; }
.card.profile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.card.profile h2 { margin-top: 8px; }
.note { margin-top: 10px; font-size: 14px; color: var(--muted); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0 0; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions.center { justify-content: center; }
.actions.end { justify-content: flex-end; }

/* ---------- ปุ่ม ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-weight: 600; text-decoration: none; color: var(--ink);
}
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn.small .icon { width: 16px; height: 16px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; margin-top: 16px; }
.btn:disabled { opacity: .5; }
.chip {
  display: inline-block; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.gray { border: 0; background: var(--soft); color: var(--muted); font-size: 12px; padding: 2px 8px; }
.chip.demo { border: 0; background: rgba(255,255,255,.18); color: #fff; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }

.fab {
  position: fixed; z-index: 15; right: max(16px, calc(50vw - 264px)); bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px);
  width: 56px; height: 56px; border: 0; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0,0,0,.25);
}
.fab .icon { width: 26px; height: 26px; }

/* ---------- ช่องกรอก ---------- */
input, select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
input[type=file] { padding: 8px; font-size: 14px; }
label { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 500; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 4px; font-size: 16px; font-weight: 400; color: var(--ink); }
label.btn { margin: 0; color: var(--ink); }
.two { display: flex; gap: 10px; }
.two > label { flex: 1; min-width: 0; }
.two > label.narrow { flex: 0 0 34%; }
.search { position: relative; margin-bottom: 12px; }
.search .icon { position: absolute; left: 12px; top: 12px; color: var(--muted); }
.search input { padding-left: 40px; border-radius: 12px; }
.filters { margin-bottom: 12px; }
.role { width: auto; min-height: 38px; padding: 4px 8px; font-size: 14px; font-weight: 600; }
.role.pending { color: var(--accent); border-color: var(--accent); }
.role.blocked { color: var(--danger); }
.photo-pick { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.photo-pick > div:last-child { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.roster-row { display: flex; align-items: center; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.roster-row input { margin-top: 4px; min-height: 38px; font-size: 14px; }
.roster-row + label { margin-top: 16px; }

/* ---------- แถบล่าง ---------- */
.tabbar {
  position: fixed; z-index: 12; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 560px;
  display: flex; padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1; min-width: 0; height: var(--tab-h); border: 0; background: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 500; white-space: nowrap; padding: 0;
}
.tabbar button.on { color: var(--primary); font-weight: 700; }
.tabbar .icon { width: 22px; height: 22px; }
@media (prefers-color-scheme: dark) { .tabbar button.on { color: var(--accent); } }

/* ---------- แผ่นฟอร์ม / กล่องยืนยัน ---------- */
.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(10,16,24,.5); display: flex; align-items: flex-end; justify-content: center; }
.overlay.mid { z-index: 50; align-items: center; padding: 24px; }
.overlay.clear { background: rgba(255,255,255,.35); }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 20px 20px 0 0; animation: rise .22s ease-out;
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 6px 18px; }
.sheet-head h2 { font-size: 18px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 8px 18px 4px; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; gap: 8px; padding: 12px 18px calc(env(safe-area-inset-bottom) + 14px); border-top: 1px solid var(--line); }
.dialog { width: 100%; max-width: 360px; padding: 20px; background: var(--card); border-radius: 18px; }

/* ---------- ตัวเปิดไฟล์ ---------- */
.viewer { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; background: #20242b; color: #fff; }
.viewer-head { display: flex; align-items: center; gap: 6px; padding: calc(env(safe-area-inset-top) + 8px) 8px 8px; background: #14171c; }
.viewer-head h2 { flex: 1; font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-body { flex: 1; overflow: auto; text-align: center; -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom); }
.viewer-body img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.viewer-body .pdf-page { display: block; width: 100%; max-width: 900px; height: auto; margin: 0 auto 8px; background: #fff; }

.toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 20px); transform: translateX(-50%);
  padding: 10px 18px; border-radius: 999px; background: #1b2430; color: #fff; font-size: 14px; max-width: 86vw; text-align: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
}

/* ---------- เข้าสู่ระบบ ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 380px; padding: 28px 22px; background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; text-align: center;
}
.auth-card .big-icon { margin: 0 auto 12px; }
.auth-card h1 { font-size: 21px; line-height: 1.35; margin-bottom: 4px; }
.auth-card > .muted { margin-bottom: 18px; }
.auth-card label, .auth-card .hint, .auth-card .error { text-align: left; }
.auth-card .btn.block { margin-top: 8px; }
.chip.role-admin { border-color: var(--accent); color: var(--accent); }
.chip.role-blocked { border-color: var(--danger); color: var(--danger); }
form.card .btn { margin-top: 4px; }

.period { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.period input, .period select { flex: 1; min-width: 0; }
.period select.year { flex: 0 0 96px; }
.period-label { margin: 0 4px 12px; font-size: 14px; font-weight: 600; color: var(--accent); }
@media (min-width: 900px) { .period { max-width: 460px; } }
/* ---------- หน้าตั้งค่า: รายการเมนูในการ์ด ---------- */
.menu { background: var(--card); border: 1px solid var(--line); border-radius: 20px; margin-bottom: 14px; overflow: hidden; }
.menu-item {
  position: relative; width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 0; background: none; text-align: left;
}
button.menu-item:active { background: var(--soft); }
.menu-item + .menu-item::before { content: ''; position: absolute; top: 0; left: 78px; right: 0; border-top: 1px solid var(--line); }
.menu-item .title { font-size: 17px; }
.tile { width: 48px; height: 48px; flex: none; border-radius: 14px; background: var(--soft); color: var(--primary); display: grid; place-items: center; }
.tile .icon { width: 24px; height: 24px; }
@media (prefers-color-scheme: dark) { .tile { color: var(--ink); } }
.version { margin: 18px 0 28px; text-align: center; color: var(--muted); font-size: 14px; }
.btn.logout { min-height: 54px; border-radius: 16px; border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); color: var(--danger); margin-top: 0; }
@media (min-width: 900px) {
  .narrow-page { max-width: 560px; margin: 0 auto; }
  button.menu-item:hover { background: var(--soft); }
}

.card.term { margin-bottom: 12px; }
.card.term h2 { font-size: 17px; margin-bottom: 10px; }
.card.term .two > label.narrow { flex: 0 0 42%; }
.chips.terms { margin: 6px 0 8px; }
.chips.terms .chip { font-size: 12.5px; padding: 3px 10px; }

.scan { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; padding: 8px 12px; border-radius: 10px; background: var(--soft); font-size: 13.5px; color: var(--muted); }
.scan.ok { color: var(--ink); border-left: 4px solid var(--accent); }
.spinner.tiny { width: 16px; height: 16px; border-width: 2px; flex: none; }

.clip { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--ink); font-weight: 500; white-space: nowrap; }
.clip .icon { width: 12px; height: 12px; }
.att-box { margin-bottom: 12px; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; }
.att-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.att-head label.link { margin: 0; cursor: pointer; }
.att { display: flex; align-items: center; gap: 8px; padding: 4px 0 4px 2px; font-size: 14px; border-top: 1px solid var(--line); }
.att .grow { overflow-wrap: anywhere; }
.att .icon-btn { width: 34px; height: 34px; }
.att.new .grow { color: var(--accent); font-weight: 500; }
.viewer-tabs { display: flex; gap: 6px; padding: 8px; overflow-x: auto; background: #14171c; border-top: 1px solid #2a2f37; }
.viewer-tabs button { flex: none; max-width: 220px; padding: 6px 12px; border: 1px solid #3a404a; border-radius: 999px; background: none; color: #c9cfd8; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-tabs button.on { background: #fff; border-color: #fff; color: #14171c; font-weight: 600; }

/* ผู้ใช้ที่ไม่มีสิทธิ์ดาวน์โหลด: ปิดการกดค้าง/ลากเพื่อบันทึกภาพ */
.viewer-body.locked img, .viewer-body.locked canvas { pointer-events: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.chip.role-superadmin { border-color: var(--primary); background: var(--primary); color: #fff; }

.card .facts { margin: 4px 0 12px; }

.add-option { display: flex; gap: 8px; margin-top: 10px; }
.add-option input { flex: 1; min-width: 0; }
.add-option .btn { min-height: 44px; }
.card.term .att:first-of-type { border-top: 0; }

/* ---------- ปฏิทิน ---------- */
.cal-head { display: flex; align-items: center; gap: 4px; margin-bottom: 10px; }
.cal-head h2 { flex: 1; font-size: 18px; text-align: center; }
.cal-head .btn { margin-left: 4px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { padding: 4px 0; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.cal-cell {
  position: relative; min-width: 0; aspect-ratio: 1; padding: 4px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); overflow: hidden;
}
.cal-cell .num { font-size: 15px; font-weight: 600; line-height: 1.5; width: 26px; text-align: center; border-radius: 50%; }
.cal-cell.out { background: none; border-color: transparent; color: var(--muted); opacity: .55; }
.cal-cell.today .num { background: var(--primary); color: #fff; }
.cal-cell.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-ev, .cal-more { display: none; }
.cal-dot { min-width: 8px; height: 8px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; line-height: 14px; text-align: center; }
.cal-dot:not(:empty) { min-width: 16px; height: 14px; padding: 0 3px; }
.row.event { align-items: flex-start; }
/* วันหยุด: ตัวเลขสีแดง พื้นช่องอมแดง — เสาร์อาทิตย์ตัวเลขสีแดงจาง */
.cal { --hol: #c0392b; }
@media (prefers-color-scheme: dark) { .cal { --hol: #f08a7c; } }
.cal-cell.we .num { color: color-mix(in srgb, var(--hol) 70%, var(--muted)); }
.cal-cell.hol { background: color-mix(in srgb, var(--hol) 9%, var(--card)); border-color: color-mix(in srgb, var(--hol) 30%, var(--line)); }
.cal-cell.hol .num { color: var(--hol); }
.cal-cell.today .num { color: #fff; }
.cal-cell.hol.today .num { background: var(--hol); }
.cal-hol { display: none; }
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 8px 2px 0; font-size: 12.5px; color: var(--muted); }
.cal-legend .key { width: 12px; height: 12px; border-radius: 4px; margin-left: 6px; }
.cal-legend .key:first-child { margin-left: 0; }
.cal-legend .key.hol { background: color-mix(in srgb, #c0392b 25%, var(--card)); border: 1px solid #c0392b; }
.cal-legend .key.ev { background: var(--accent); border-radius: 50%; width: 9px; height: 9px; }
.cal-legend .warn { color: var(--accent); }
.row.event.holiday .datebox { background: #c0392b; }
.tag-hol { display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 999px; background: #c0392b; color: #fff; font-size: 12px; font-weight: 600; }
@media (min-width: 900px) {
  .cal-cell { aspect-ratio: auto; min-height: 92px; align-items: stretch; padding: 6px; }
  .cal-cell .num { align-self: flex-start; }
  .cal-cell:hover { border-color: var(--muted); }
  .cal-ev { display: block; padding: 1px 6px; border-radius: 6px; background: var(--soft); border-left: 3px solid var(--accent); font-size: 12px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cal-hol { display: block; font-size: 11.5px; line-height: 1.3; color: var(--hol); text-align: left; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .cal-more { display: block; font-size: 11.5px; color: var(--muted); text-align: left; }
  .cal-dot { display: none; }
  .fab.calendar { display: none; }
}

.test-accounts { margin-bottom: 14px; padding: 10px 12px; border: 1px dashed var(--accent); border-radius: 12px; text-align: left; font-size: 13px; }
.test-accounts b { display: block; margin-bottom: 6px; }
.test-accounts button { display: flex; gap: 8px; align-items: center; width: 100%; padding: 6px 4px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; }
.test-accounts button span { flex: 0 0 84px; font-weight: 600; }
.test-accounts code { font-size: 13px; }
.test-accounts small { color: var(--muted); }

.toolbar { display: flex; gap: 10px; align-items: flex-start; }
.toolbar .search { flex: 1; }
.add-wide { display: none; }
.topnav { display: none; }
.chip .n { opacity: .6; margin-left: 2px; font-variant-numeric: tabular-nums; }
.sub.small { font-size: 12.5px; }

/* ---------- จอคอมพิวเตอร์: เนื้อหากว้างขึ้น ฟอร์มเปิดกลางจอ ---------- */
@media (min-width: 900px) {
  .shell { max-width: 960px; }
  .topbar { padding: 14px 28px; border-radius: 0 0 16px 16px; }
  .topbar h1 { font-size: 20px; }
  .tabbar { display: none; }
  .topnav { display: flex; gap: 4px; margin-right: 8px; }
  .topnav button {
    height: 38px; padding: 0 16px; border: 0; border-radius: 10px; background: none;
    color: rgba(255,255,255,.75); font-weight: 600;
  }
  .topnav button:hover { background: rgba(255,255,255,.1); }
  .topnav button.on { background: rgba(255,255,255,.18); color: #fff; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .content { padding: 24px 28px 64px; }
  .add-wide { display: inline-flex; white-space: nowrap; }
  .fab.documents, .fab.admin { display: none; }
  .fab { right: calc(50vw - 480px + 28px); bottom: 28px; }
  .toast { bottom: 28px; }
  .row:hover { border-color: var(--muted); }
  .overlay { align-items: center; padding: 24px; }
  .sheet { max-width: 560px; max-height: 88vh; border-radius: 20px; }
  .viewer-body .pdf-page { box-shadow: 0 2px 12px rgba(0,0,0,.4); margin-top: 12px; }
}
