/* =====================================================================
   SchoolMIS — Design system (mobile-first) บน Bootstrap 5.3
   ===================================================================== */
:root {
  --brand: #2563eb;
  --brand-600: #1d4ed8;
  --brand-50: #eff6ff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f4f6fb;
  --card: #ffffff;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
  --purple: #7c3aed;
  --orange: #ea580c;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --sidebar-w: 264px;
  --topbar-h: 60px;
  --bottomnav-h: 64px;
  --bs-body-font-family: 'Anuphan', 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bs-primary: var(--brand);
  --bs-primary-rgb: 37, 99, 235;
  --bs-border-color: var(--line);
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 15px; min-height: 100vh; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
.text-muted, .muted { color: var(--muted) !important; }
.fw-600 { font-weight: 600; }
.small-xs { font-size: .75rem; }
.num { font-variant-numeric: tabular-nums; }
.btn { border-radius: 12px; font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); }
.btn-soft { background: var(--brand-50); color: var(--brand); border: 0; }
.btn-soft:hover { background: #dbeafe; color: var(--brand-600); }
.btn-light { background: #fff; border: 1px solid var(--line); }
.form-control, .form-select { border-radius: 12px; border-color: var(--line); padding: .55rem .8rem; }
.form-control:focus, .form-select:focus { border-color: #93c5fd; box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .12); }
.form-label { font-weight: 500; font-size: .9rem; color: var(--ink-2); }
.modal-content { border: 0; border-radius: 20px; }
.dropdown-menu { border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: .4rem; }
.dropdown-item { border-radius: 8px; padding: .45rem .75rem; }
i.ph, i.ph-duotone, i.ph-fill, i.ph-bold { line-height: 1; vertical-align: -0.125em; }

/* ---------------- Layout ---------------- */
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 1045; transform: translateX(-100%); transition: transform .25s ease;
}
.app-sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .15); }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 1040; display: none; }
.sidebar-backdrop.show { display: block; }
.brand { display: flex; gap: .7rem; align-items: center; padding: 1rem 1rem .75rem; border-bottom: 1px solid var(--line); }
.brand-logo { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; display: grid; place-items: center; font-size: 1.4rem; flex: none; }
.brand-name { font-weight: 700; font-size: .92rem; line-height: 1.2; }
.brand-sub { font-size: .7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.side-nav { flex: 1; overflow-y: auto; padding: .6rem; }
.side-link {
  display: flex; align-items: center; gap: .7rem; width: 100%; padding: .6rem .75rem; border-radius: 12px; color: var(--ink-2);
  font-weight: 500; font-size: .92rem; border: 0; background: none; text-align: left;
}
.side-link > i:first-child { font-size: 1.25rem; color: var(--muted); }
.side-link:hover { background: #f1f5f9; color: var(--ink); }
.side-link.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, .3); }
.side-link.active > i:first-child { color: #fff; }
.side-link .chev { margin-left: auto; transition: transform .2s; font-size: .9rem; color: var(--muted); }
.side-link[aria-expanded="true"] .chev { transform: rotate(90deg); }
.side-link .nav-badge { margin-left: auto; }
.side-link .nav-badge + .chev { margin-left: .4rem; }
.side-sub { padding: .15rem 0 .35rem 2.4rem; }
.side-sub a { display: flex; align-items: center; justify-content: space-between; padding: .42rem .7rem; border-radius: 10px; color: var(--muted); font-size: .87rem; position: relative; }
.side-sub a::before { content: ''; position: absolute; left: -.9rem; top: 50%; width: 5px; height: 5px; border-radius: 50%; background: #cbd5e1; transform: translateY(-50%); }
.side-sub a:hover { color: var(--ink); background: #f8fafc; }
.side-sub a.active { color: var(--brand); background: var(--brand-50); font-weight: 600; }
.side-sub a.active::before { background: var(--brand); }
.nav-badge { background: #ef4444; color: #fff; font-size: .68rem; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: inline-grid; place-items: center; padding: 0 6px; }
.side-foot { padding: .8rem 1rem; border-top: 1px solid var(--line); font-size: .75rem; color: var(--muted); }

.app-main { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 1030; height: var(--topbar-h); background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .5rem; padding: 0 .75rem;
}
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--ink-2); font-size: 1.3rem; position: relative; flex: none; }
.icon-btn:hover { background: #f1f5f9; }
.icon-btn .dot { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; font-size: .62rem; }
.top-search { flex: 1; max-width: 460px; position: relative; }
.top-search input { background: #f1f5f9; border: 0; border-radius: 12px; padding-left: 2.3rem; height: 40px; }
.top-search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.term-chip { border: 1px solid var(--line); border-radius: 12px; padding: .35rem .7rem; font-size: .85rem; font-weight: 500; background: #fff; white-space: nowrap; }
.user-chip { display: flex; align-items: center; gap: .5rem; border: 0; background: none; padding: .2rem; border-radius: 12px; }
.user-chip .who { text-align: left; line-height: 1.15; }
.user-chip .who b { font-size: .85rem; display: block; max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who small { font-size: .72rem; color: var(--muted); }
.content { padding: 1rem .85rem 1.5rem; flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); display: flex;
}
.bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .68rem; color: var(--muted); border: 0; background: none; position: relative; }
.bottom-nav i { font-size: 1.45rem; }
.bottom-nav .active { color: var(--brand); font-weight: 600; }
.bottom-nav .fab { width: 54px; height: 54px; border-radius: 18px; background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; display: grid; place-items: center; margin-top: -22px; box-shadow: 0 8px 20px rgba(37, 99, 235, .35); }
.bottom-nav .fab i { font-size: 1.6rem; }
.bottom-nav .nav-badge { position: absolute; top: 6px; left: 55%; }

@media (min-width: 992px) {
  .app-sidebar { transform: none; }
  .sidebar-backdrop { display: none !important; }
  .app-main { margin-left: var(--sidebar-w); padding-bottom: 0; }
  .topbar { padding: 0 1.5rem; }
  .content { padding: 1.5rem 1.75rem 2rem; }
  .bottom-nav { display: none; }
}

/* ---------------- Page header ---------------- */
.crumbs { font-size: .78rem; color: var(--muted); margin-bottom: .35rem; display: flex; flex-wrap: wrap; gap: .3rem; }
.crumbs a { color: var(--muted); }
.crumbs span + span::before { content: '›'; margin-right: .3rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; }
.page-title { display: flex; align-items: center; gap: .7rem; }
.page-title .pi { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6); flex: none; }
.page-title h1 { font-size: 1.3rem; font-weight: 700; margin: 0; }
.page-title p { margin: 0; color: var(--muted); font-size: .85rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
@media (max-width: 575.98px) {
  .page-actions { width: 100%; }
  .page-actions > * { flex: 1 1 auto; }
  .page-actions .btn { width: 100%; white-space: nowrap; }
  .page-title h1 { font-size: 1.15rem; }
}

/* ---------------- Cards ---------------- */
.cardx { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(226, 232, 240, .7); }
.cardx-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .95rem 1.1rem .5rem; }
.cardx-head h3 { font-size: 1rem; font-weight: 700; margin: 0; display: flex; align-items: center; gap: .5rem; }
.cardx-head h3 i { color: var(--brand); font-size: 1.2rem; }
.cardx-head .more { font-size: .8rem; font-weight: 500; white-space: nowrap; }
.cardx-body { padding: .6rem 1.1rem 1.1rem; }
.cardx-body.flush { padding: 0; }
.stat { display: flex; gap: .85rem; align-items: center; padding: 1rem 1.1rem; height: 100%; }
.stat .si { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; color: #fff; flex: none; }
.stat .sl { font-size: .8rem; color: var(--muted); line-height: 1.25; }
.stat .sv { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat .sv small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.stat .sd { font-size: .75rem; color: var(--muted); }
@media (max-width: 575.98px) { .stat { padding: .8rem; gap: .6rem; } .stat .si { width: 40px; height: 40px; font-size: 1.25rem; } .stat .sv { font-size: 1.25rem; } }
.g-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.g-purple { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.g-green { background: linear-gradient(135deg, #4ade80, #16a34a); }
.g-orange { background: linear-gradient(135deg, #fb923c, #ea580c); }
.g-pink { background: linear-gradient(135deg, #f472b6, #db2777); }
.g-cyan { background: linear-gradient(135deg, #22d3ee, #0891b2); }
.g-red { background: linear-gradient(135deg, #f87171, #dc2626); }
.g-amber { background: linear-gradient(135deg, #fbbf24, #d97706); }
.g-slate { background: linear-gradient(135deg, #94a3b8, #475569); }

.hero {
  border-radius: 20px; padding: 1.3rem; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(circle at 90% 10%, rgba(255, 255, 255, .25), transparent 40%), linear-gradient(135deg, #2563eb 0%, #4f46e5 55%, #7c3aed 100%);
}
.hero h2 { font-weight: 700; font-size: 1.35rem; margin: 0 0 .2rem; }
.hero .chip { background: rgba(255, 255, 255, .18); color: #fff; }
.hero .quick a { background: #fff; color: var(--ink); border-radius: 12px; padding: .45rem .8rem; font-size: .85rem; font-weight: 500; display: inline-flex; align-items: center; gap: .4rem; }
.hero .quick a i { color: var(--brand); font-size: 1.1rem; }
.hero .deco { position: absolute; right: -10px; bottom: -30px; font-size: 9rem; opacity: .12; }

/* ---------------- Badges / chips ---------------- */
.badge-soft { display: inline-flex; align-items: center; gap: .25rem; font-size: .74rem; font-weight: 600; padding: .22rem .6rem; border-radius: 999px; white-space: nowrap; }
.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #cffafe; color: #0e7490; }
.badge-secondary { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; padding: .28rem .65rem; border-radius: 999px; background: #f1f5f9; color: var(--ink-2); }
.chip i { font-size: .95rem; }
.tabs-pill { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tabs-pill::-webkit-scrollbar { display: none; }
.tabs-pill a { white-space: nowrap; padding: .42rem .85rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); font-size: .85rem; font-weight: 500; }
.tabs-pill a.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.tabs-pill a .cnt { margin-left: .3rem; opacity: .7; }

/* ---------------- Avatar ---------------- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 600; flex: none; letter-spacing: -.5px; }
.avatar-sm { width: 32px; height: 32px; font-size: .75rem; }
.avatar-md { width: 40px; height: 40px; font-size: .85rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }
.avatar-xl { width: 88px; height: 88px; font-size: 1.8rem; }

/* ---------------- Lists ---------------- */
.list-rows > * { display: flex; gap: .75rem; align-items: center; padding: .7rem 0; border-bottom: 1px dashed var(--line); }
.list-rows > *:last-child { border-bottom: 0; }
.list-rows .grow { flex: 1; min-width: 0; }
.list-rows .t { font-weight: 600; font-size: .9rem; line-height: 1.35; }
.list-rows .s { font-size: .78rem; color: var(--muted); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-box { width: 48px; flex: none; text-align: center; border-radius: 12px; background: var(--brand-50); color: var(--brand); padding: .3rem 0; line-height: 1.1; }
.date-box b { display: block; font-size: 1.15rem; }
.date-box small { font-size: .7rem; }
.empty-state { text-align: center; color: var(--muted); padding: 1.8rem .5rem; font-size: .9rem; }
.empty-state i { font-size: 2.6rem; display: block; margin-bottom: .4rem; color: #cbd5e1; }

/* ---------------- Tables (stack on mobile) ---------------- */
.table-modern { margin: 0; font-size: .88rem; }
.table-modern thead th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: .78rem; border-bottom: 1px solid var(--line); white-space: nowrap; padding: .7rem .8rem; }
.table-modern td { padding: .7rem .8rem; vertical-align: middle; border-color: #f1f5f9; }
.table-modern tbody tr:hover { background: #fafbff; }
@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
  .table-stack td { border: 0; padding: .18rem 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .table-stack td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; text-align: left; flex: none; }
  .table-stack td.td-main { display: block; text-align: left; }
  .table-stack td.td-main::before { display: none; }
}

/* ---------------- Progress / meters ---------------- */
.progress-thin { height: 6px; border-radius: 99px; background: #eef2f7; overflow: hidden; }
.progress-thin > div { height: 100%; border-radius: 99px; background: var(--brand); }
.ring { --p: 50; --c: var(--brand); width: 96px; height: 96px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), #eef2f7 0); display: grid; place-items: center; flex: none; }
.ring > div { width: 76px; height: 76px; border-radius: 50%; background: #fff; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring b { font-size: 1.25rem; }
.ring small { font-size: .68rem; color: var(--muted); }
.ring.ring-sm { width: 64px; height: 64px; }
.ring.ring-sm > div { width: 50px; height: 50px; }
.ring.ring-sm b { font-size: .9rem; }

.mini-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.mini-tiles > div { border-radius: 12px; padding: .5rem .6rem; font-size: .75rem; }
.mini-tiles b { display: block; font-size: 1.2rem; }

/* ---------------- Timeline / steps ---------------- */
.steps { display: flex; align-items: flex-start; gap: .25rem; }
.steps .st { flex: 1; text-align: center; font-size: .72rem; color: var(--muted); position: relative; }
.steps .st .dot { width: 26px; height: 26px; border-radius: 50%; margin: 0 auto .25rem; display: grid; place-items: center; background: #e2e8f0; color: #64748b; font-size: .8rem; font-weight: 700; position: relative; z-index: 1; }
.steps .st::after { content: ''; position: absolute; top: 13px; left: 50%; width: 100%; height: 2px; background: #e2e8f0; }
.steps .st:last-child::after { display: none; }
.steps .st.done .dot { background: var(--success); color: #fff; }
.steps .st.done::after { background: var(--success); }
.steps .st.now .dot { background: var(--warning); color: #fff; }
.steps .st.bad .dot { background: var(--danger); color: #fff; }

/* ---------------- Timetable ---------------- */
.tt-wrap { overflow-x: auto; }
.tt { width: 100%; min-width: 820px; border-collapse: separate; border-spacing: 4px; }
.tt th { font-size: .74rem; color: var(--muted); font-weight: 600; text-align: center; padding: .3rem; }
.tt th.day { text-align: left; width: 80px; font-size: .85rem; color: var(--ink); }
.tt td { height: 72px; vertical-align: top; }
.tt .slot { border-radius: 10px; padding: .35rem .45rem; height: 100%; font-size: .72rem; line-height: 1.3; border-left: 3px solid; }
.tt .slot b { font-size: .75rem; display: block; }
.tt .lunch { background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 6px, #f1f5f9 6px, #f1f5f9 12px); border-radius: 10px; writing-mode: vertical-rl; text-align: center; font-size: .7rem; color: var(--muted); width: 28px; }
.tt tr.today th.day { color: var(--brand); }
.tt-list .day-block { margin-bottom: .8rem; }
.tt-list .day-block h4 { font-size: .9rem; font-weight: 700; margin-bottom: .4rem; }

/* ---------------- Rollcall cards ---------------- */
.rc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: .55rem; }
.rc-card { border: 2px solid; border-radius: 16px; padding: .6rem .4rem .5rem; text-align: center; background: #fff; cursor: pointer; user-select: none; position: relative; transition: transform .08s; }
.rc-card:active { transform: scale(.97); }
.rc-card .no { position: absolute; top: 6px; left: 8px; font-size: .72rem; color: var(--muted); font-weight: 600; }
.rc-card .nm { font-size: .78rem; font-weight: 600; margin-top: .3rem; line-height: 1.2; min-height: 2.4em; }
.rc-card .nk { font-size: .7rem; color: var(--muted); }
.rc-card .st { margin-top: .3rem; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: .15rem 0; }
.rc-card .more { position: absolute; top: 2px; right: 2px; border: 0; background: none; color: var(--muted); font-size: 1rem; padding: 2px 6px; }
.rc-present { border-color: #86efac; } .rc-present .st { background: #dcfce7; color: #15803d; }
.rc-late { border-color: #fcd34d; background: #fffbeb; } .rc-late .st { background: #fef3c7; color: #b45309; }
.rc-absent { border-color: #fca5a5; background: #fef2f2; } .rc-absent .st { background: #fee2e2; color: #b91c1c; }
.rc-leave { border-color: #67e8f9; } .rc-leave .st { background: #cffafe; color: #0e7490; }
.rc-sick { border-color: #c4b5fd; } .rc-sick .st { background: #ede9fe; color: #6d28d9; }
.rc-none { border-color: #e2e8f0; } .rc-none .st { background: #f1f5f9; color: #64748b; }
.sticky-actions { position: sticky; bottom: calc(var(--bottomnav-h) + 8px); z-index: 5; }
@media (min-width: 992px) { .sticky-actions { bottom: 12px; } }

/* ---------------- Gradebook ---------------- */
.gb-wrap { overflow: auto; max-height: 70vh; }
.gb { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .85rem; }
.gb th, .gb td { border-bottom: 1px solid #eef2f7; padding: .35rem .4rem; white-space: nowrap; background: #fff; }
.gb thead th { position: sticky; top: 0; z-index: 2; background: #f8fafc; font-size: .75rem; color: var(--muted); text-align: center; }
.gb .sticky-col { position: sticky; left: 0; z-index: 1; min-width: 170px; }
.gb thead .sticky-col { z-index: 3; }
.gb input.score { width: 64px; text-align: center; border: 1px solid transparent; border-radius: 8px; padding: .3rem; background: #f8fafc; font-variant-numeric: tabular-nums; }
.gb input.score:focus { outline: none; border-color: #93c5fd; background: #fff; }
.gb input.score.saving { border-color: #fcd34d; }
.gb input.score.saved { border-color: #86efac; }
.gb input.score.err { border-color: #fca5a5; background: #fef2f2; }
.gb .total { font-weight: 700; text-align: center; }
.gb .grade { font-weight: 700; text-align: center; color: var(--brand); }

/* ---------------- Calendar ---------------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .h { text-align: center; font-size: .72rem; color: var(--muted); font-weight: 600; padding: .2rem 0; }
.cal .d { min-height: 64px; border-radius: 10px; background: #f8fafc; padding: .25rem .3rem; font-size: .72rem; overflow: hidden; }
.cal .d.out { opacity: .4; }
.cal .d.today { outline: 2px solid var(--brand); background: #fff; }
.cal .d .n { font-weight: 700; font-size: .78rem; }
.cal .ev { display: block; border-radius: 4px; padding: 0 3px; margin-top: 2px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .66rem; }
@media (max-width: 575.98px) { .cal .d { min-height: 46px; } .cal .ev { font-size: 0; height: 5px; padding: 0; } }
.cat-academic { background: #2563eb; } .cat-exam { background: #dc2626; } .cat-activity { background: #16a34a; }
.cat-sport { background: #ea580c; } .cat-meeting { background: #7c3aed; } .cat-holiday { background: #64748b; }

/* ---------------- Kanban ---------------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: .8rem; overflow-x: auto; padding-bottom: .5rem; }
.kanban .col-k { background: #eef2f7; border-radius: 16px; padding: .7rem; }
.kanban .col-k h4 { font-size: .85rem; font-weight: 700; display: flex; justify-content: space-between; }
.kanban .kc { background: #fff; border-radius: 12px; padding: .7rem; margin-top: .5rem; box-shadow: var(--shadow); font-size: .85rem; }

/* ---------------- Chat ---------------- */
.chat-shell { display: grid; grid-template-columns: 1fr; height: calc(100vh - var(--topbar-h) - var(--bottomnav-h) - 2rem); min-height: 420px; }
@media (min-width: 992px) { .chat-shell { grid-template-columns: 340px 1fr; height: calc(100vh - var(--topbar-h) - 3rem); } }
.chat-list { overflow-y: auto; border-right: 1px solid var(--line); }
.chat-item { display: flex; gap: .65rem; padding: .7rem .9rem; align-items: center; color: var(--ink); border-bottom: 1px solid #f1f5f9; }
.chat-item:hover, .chat-item.active { background: var(--brand-50); }
.chat-room { display: flex; flex-direction: column; min-height: 0; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 1rem; background: #f8fafc; display: flex; flex-direction: column; gap: .45rem; }
.msg { max-width: 78%; padding: .5rem .8rem; border-radius: 16px; background: #fff; box-shadow: var(--shadow); font-size: .9rem; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.other { border-bottom-left-radius: 4px; }
.msg .who { font-size: .72rem; font-weight: 600; color: var(--brand); }
.msg .tm { font-size: .66rem; opacity: .7; text-align: right; }
.msg.me a { color: #fff; text-decoration: underline; }
.chat-input { display: flex; gap: .5rem; padding: .6rem; border-top: 1px solid var(--line); background: #fff; }
@media (max-width: 991.98px) { .chat-shell.in-room .chat-list { display: none !important; } .chat-shell:not(.in-room) .chat-room { display: none !important; } }

/* ---------------- ID card ---------------- */
.idc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.idc { border-radius: 14px; overflow: hidden; background: #fff; box-shadow: var(--shadow); border: 1px solid var(--line); break-inside: avoid; }
.idc .top { background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff; padding: .45rem .7rem; font-size: .72rem; font-weight: 600; display: flex; gap: .4rem; align-items: center; }
.idc .bd { display: flex; gap: .6rem; padding: .6rem .7rem; align-items: center; }
.idc .ph { width: 64px; height: 80px; border-radius: 8px; flex: none; display: grid; place-items: center; color: #fff; font-size: 1.3rem; font-weight: 700; }
.idc .inf { flex: 1; font-size: .72rem; line-height: 1.45; min-width: 0; }
.idc .inf b { font-size: .82rem; display: block; }
.idc .qr { width: 76px; height: 76px; flex: none; }
.idc .code { text-align: center; font-weight: 700; letter-spacing: 2px; padding-bottom: .4rem; color: var(--brand); }
@media print {
  .app-sidebar, .topbar, .bottom-nav, .no-print, .page-head { display: none !important; }
  .app-main { margin: 0 !important; padding: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  body { background: #fff; }
  .idc-grid { grid-template-columns: repeat(2, 1fr); gap: 6mm; }
  .idc { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cardx { box-shadow: none; border: 1px solid #ddd; }
  .tt .slot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------------- Auth ---------------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: #fff; }
@media (min-width: 992px) { .auth-wrap { grid-template-columns: 1.15fr 1fr; } }
.auth-hero { display: none; position: relative; overflow: hidden; color: #fff; padding: 2.5rem; background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, .18), transparent 40%), linear-gradient(160deg, #1e3a8a, #2563eb 45%, #7c3aed); }
@media (min-width: 992px) { .auth-hero { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-hero h1 { font-size: 2.6rem; font-weight: 800; line-height: 1.2; }
.auth-hero .feat { display: inline-flex; gap: .4rem; align-items: center; background: rgba(255, 255, 255, .14); border-radius: 12px; padding: .45rem .8rem; font-size: .85rem; margin: 0 .35rem .5rem 0; }
.auth-hero .kpi { background: rgba(255, 255, 255, .12); border-radius: 16px; padding: .9rem 1.1rem; min-width: 110px; }
.auth-hero .kpi b { font-size: 1.6rem; display: block; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 1.5rem 1.2rem; background: linear-gradient(180deg, #f8fafc, #fff); }
.auth-card { width: 100%; max-width: 420px; }
.auth-tabs { display: grid; grid-template-columns: repeat(3, 1fr); background: #f1f5f9; border-radius: 14px; padding: 4px; gap: 4px; }
.auth-tabs button { border: 0; background: none; border-radius: 10px; padding: .5rem .2rem; font-size: .85rem; font-weight: 500; color: var(--muted); }
.auth-tabs button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.demo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.demo-grid button { border: 1px solid var(--line); background: #fff; border-radius: 10px; font-size: .75rem; padding: .45rem .3rem; display: flex; gap: .3rem; align-items: center; justify-content: center; }
.demo-grid button:hover { border-color: #93c5fd; background: var(--brand-50); }

/* ---------------- Misc ---------------- */
.flash-toast { position: fixed; top: calc(var(--topbar-h) + 10px); right: 12px; left: 12px; z-index: 2000; max-width: 420px; margin-left: auto; }
.section-title { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin: 1rem 0 .5rem; }
.kv { display: grid; grid-template-columns: 1fr; gap: .7rem 1.2rem; }
@media (min-width: 768px) { .kv { grid-template-columns: repeat(2, 1fr); } }
.kv > div small { display: block; color: var(--muted); font-size: .75rem; }
.kv > div span { font-weight: 500; }
.sig-pad { width: 100%; height: 200px; border: 2px dashed var(--line); border-radius: 14px; background: #fff; touch-action: none; }
.scan-box { position: relative; border-radius: 18px; overflow: hidden; background: #0f172a; min-height: 280px; }
.scan-box video { width: 100%; display: block; }
.bar-chart { display: flex; align-items: flex-end; gap: .5rem; height: 110px; }
.bar-chart .b { flex: 1; text-align: center; font-size: .72rem; color: var(--muted); display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bar-chart .b span { display: block; background: linear-gradient(180deg, #60a5fa, #2563eb); border-radius: 8px 8px 4px 4px; margin: 0 auto .25rem; width: 70%; max-width: 34px; }
.bar-chart .b.today span { background: linear-gradient(180deg, #a78bfa, #7c3aed); }
.star-rate { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.star-rate input { display: none; }
.star-rate label { font-size: 1.6rem; color: #cbd5e1; cursor: pointer; }
.star-rate input:checked ~ label, .star-rate label:hover, .star-rate label:hover ~ label { color: #f59e0b; }

/* ---------------- Director / executive ---------------- */
.min-w-0 { min-width: 0; }
.si-sm { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 1.1rem; color: #fff; flex: none; }
.heat td, .heat th { border-color: #fff; border-width: 2px; }
.heat td { border-radius: 6px; }
.sticky-actions { position: sticky; top: calc(var(--topbar-h) + 6px); z-index: 5; }
.org { text-align: left; }
.org-node { display: inline-flex; gap: .7rem; align-items: center; background: #fff; border-radius: 16px; padding: .7rem 1rem; box-shadow: var(--shadow); min-width: 240px; }
.org-node > div small { display: block; color: var(--muted); font-size: .72rem; }
.org-node > div b { display: block; font-size: .95rem; }
.org-node > div span { display: block; font-size: .75rem; color: var(--muted); }
.org-top { display: flex; width: max-content; max-width: 100%; margin: 0 auto; border: 2px solid #fbbf24; }
.org > .d-flex, .org > .org-top { justify-content: center; }
.org-line { width: 2px; height: 22px; background: #cbd5e1; margin: 0 auto; }
.report-paper { max-width: 1000px; margin: 0 auto; }
@media print {
  .report-paper { box-shadow: none !important; border: 0 !important; max-width: none; }
  .cardx { break-inside: avoid; }
  canvas { max-width: 100% !important; }
}
@media print {
  .crumbs, .tabs-pill { display: none !important; }
  .heat td, .progress-thin > div, .badge-soft, .ring, .si { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* มุมมองรายบุคคล: 1 คนต่อแถว เรียงตามเลขที่ */
.rc-list { grid-template-columns: 1fr; gap: .4rem; }
.rc-list .rc-card { display: flex; align-items: center; gap: .65rem; text-align: left; padding: .45rem .6rem; border-radius: 12px; }
.rc-list .rc-card .no { position: static; min-width: 1.8rem; text-align: right; font-size: .85rem; }
.rc-list .rc-card .nm { margin-top: 0; min-height: 0; font-size: .9rem; }
.rc-list .rc-card .nk { flex: 1; font-size: .75rem; }
.rc-list .rc-card .st { margin-top: 0; min-width: 6.5rem; text-align: center; padding: .2rem .6rem; }
.rc-list .rc-card .more { position: static; order: 9; }
@media (max-width: 575.98px) { .rc-list .rc-card .nk { display: none; } .rc-list .rc-card .nm { flex: 1; } .rc-list .rc-card .st { min-width: 5.5rem; } }
.sticky-actions { position: sticky; bottom: calc(var(--bottomnav-h) + 8px); z-index: 5; }
@media (min-width: 992px) { .sticky-actions { bottom: 12px; } }

/* ---------------- Gradebook ---------------- */
.gb-wrap { overflow: auto; max-height: 70vh; }
.gb { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .85rem; }
.gb th, .gb td { border-bottom: 1px solid #eef2f7; padding: .35rem .4rem; white-space: nowrap; background: #fff; }
.gb thead th { position: sticky; top: 0; z-index: 2; background: #f8fafc; font-size: .75rem; color: var(--muted); text-align: center; }
.gb .sticky-col { position: sticky; left: 0; z-index: 1; min-width: 170px; }
.gb thead .sticky-col { z-index: 3; }
.gb input.score { width: 64px; text-align: center; border: 1px solid transparent; border-radius: 8px; padding: .3rem; background: #f8fafc; font-variant-numeric: tabular-nums; }
.gb input.score:focus { outline: none; border-color: #93c5fd; background: #fff; }
.gb input.score.saving { border-color: #fcd34d; }
.gb input.score.saved { border-color: #86efac; }
.gb input.score.err { border-color: #fca5a5; background: #fef2f2; }
.gb .total { font-weight: 700; text-align: center; }
.gb .grade { font-weight: 700; text-align: center; color: var(--brand); }

/* ---------------- Calendar ---------------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .h { text-align: center; font-size: .72rem; color: var(--muted); font-weight: 600; padding: .2rem 0; }
.cal .d { min-height: 64px; border-radius: 10px; background: #f8fafc; padding: .25rem .3rem; font-size: .72rem; overflow: hidden; }
.cal .d.out { opacity: .4; }
.cal .d.today { outline: 2px solid var(--brand); background: #fff; }
.cal .d .n { font-weight: 700; font-size: .78rem; }
.cal .ev { display: block; border-radius: 4px; padding: 0 3px; margin-top: 2px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .66rem; }
@media (max-width: 575.98px) { .cal .d { min-height: 46px; } .cal .ev { font-size: 0; height: 5px; padding: 0; } }
.cat-academic { background: #2563eb; } .cat-exam { background: #dc2626; } .cat-activity { background: #16a34a; }
.cat-sport { background: #ea580c; } .cat-meeting { background: #7c3aed; } .cat-holiday { background: #64748b; }

/* ---------------- Kanban ---------------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: .8rem; overflow-x: auto; padding-bottom: .5rem; }
.kanban .col-k { background: #eef2f7; border-radius: 16px; padding: .7rem; }
.kanban .col-k h4 { font-size: .85rem; font-weight: 700; display: flex; justify-content: space-between; }
.kanban .kc { background: #fff; border-radius: 12px; padding: .7rem; margin-top: .5rem; box-shadow: var(--shadow); font-size: .85rem; }

/* ---------------- Chat ---------------- */
.chat-shell { display: grid; grid-template-columns: 1fr; height: calc(100vh - var(--topbar-h) - var(--bottomnav-h) - 2rem); min-height: 420px; }
@media (min-width: 992px) { .chat-shell { grid-template-columns: 340px 1fr; height: calc(100vh - var(--topbar-h) - 3rem); } }
.chat-list { overflow-y: auto; border-right: 1px solid var(--line); }
.chat-item { display: flex; gap: .65rem; padding: .7rem .9rem; align-items: center; color: var(--ink); border-bottom: 1px solid #f1f5f9; }
.chat-item:hover, .chat-item.active { background: var(--brand-50); }
.chat-room { display: flex; flex-direction: column; min-height: 0; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 1rem; background: #f8fafc; display: flex; flex-direction: column; gap: .45rem; }
.msg { max-width: 78%; padding: .5rem .8rem; border-radius: 16px; background: #fff; box-shadow: var(--shadow); font-size: .9rem; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.other { border-bottom-left-radius: 4px; }
.msg .who { font-size: .72rem; font-weight: 600; color: var(--brand); }
.msg .tm { font-size: .66rem; opacity: .7; text-align: right; }
.msg.me a { color: #fff; text-decoration: underline; }
.chat-input { display: flex; gap: .5rem; padding: .6rem; border-top: 1px solid var(--line); background: #fff; }
@media (max-width: 991.98px) { .chat-shell.in-room .chat-list { display: none !important; } .chat-shell:not(.in-room) .chat-room { display: none !important; } }

/* ---------------- ID card ---------------- */
.idc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.idc { border-radius: 14px; overflow: hidden; background: #fff; box-shadow: var(--shadow); border: 1px solid var(--line); break-inside: avoid; }
.idc .top { background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff; padding: .45rem .7rem; font-size: .72rem; font-weight: 600; display: flex; gap: .4rem; align-items: center; }
.idc .bd { display: flex; gap: .6rem; padding: .6rem .7rem; align-items: center; }
.idc .ph { width: 64px; height: 80px; border-radius: 8px; flex: none; display: grid; place-items: center; color: #fff; font-size: 1.3rem; font-weight: 700; }
.idc .inf { flex: 1; font-size: .72rem; line-height: 1.45; min-width: 0; }
.idc .inf b { font-size: .82rem; display: block; }
.idc .qr { width: 76px; height: 76px; flex: none; }
.idc .code { text-align: center; font-weight: 700; letter-spacing: 2px; padding-bottom: .4rem; color: var(--brand); }
@media print {
  .app-sidebar, .topbar, .bottom-nav, .no-print, .page-head { display: none !important; }
  .app-main { margin: 0 !important; padding: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  body { background: #fff; }
  .idc-grid { grid-template-columns: repeat(2, 1fr); gap: 6mm; }
  .idc { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cardx { box-shadow: none; border: 1px solid #ddd; }
  .tt .slot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------------- Auth ---------------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: #fff; }
@media (min-width: 992px) { .auth-wrap { grid-template-columns: 1.15fr 1fr; } }
.auth-hero { display: none; position: relative; overflow: hidden; color: #fff; padding: 2.5rem; background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, .18), transparent 40%), linear-gradient(160deg, #1e3a8a, #2563eb 45%, #7c3aed); }
@media (min-width: 992px) { .auth-hero { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-hero h1 { font-size: 2.6rem; font-weight: 800; line-height: 1.2; }
.auth-hero .feat { display: inline-flex; gap: .4rem; align-items: center; background: rgba(255, 255, 255, .14); border-radius: 12px; padding: .45rem .8rem; font-size: .85rem; margin: 0 .35rem .5rem 0; }
.auth-hero .kpi { background: rgba(255, 255, 255, .12); border-radius: 16px; padding: .9rem 1.1rem; min-width: 110px; }
.auth-hero .kpi b { font-size: 1.6rem; display: block; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 1.5rem 1.2rem; background: linear-gradient(180deg, #f8fafc, #fff); }
.auth-card { width: 100%; max-width: 420px; }
.auth-tabs { display: grid; grid-template-columns: repeat(3, 1fr); background: #f1f5f9; border-radius: 14px; padding: 4px; gap: 4px; }
.auth-tabs button { border: 0; background: none; border-radius: 10px; padding: .5rem .2rem; font-size: .85rem; font-weight: 500; color: var(--muted); }
.auth-tabs button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.demo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.demo-grid button { border: 1px solid var(--line); background: #fff; border-radius: 10px; font-size: .75rem; padding: .45rem .3rem; display: flex; gap: .3rem; align-items: center; justify-content: center; }
.demo-grid button:hover { border-color: #93c5fd; background: var(--brand-50); }

/* ---------------- Misc ---------------- */
.flash-toast { position: fixed; top: calc(var(--topbar-h) + 10px); right: 12px; left: 12px; z-index: 2000; max-width: 420px; margin-left: auto; }
.section-title { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin: 1rem 0 .5rem; }
.kv { display: grid; grid-template-columns: 1fr; gap: .7rem 1.2rem; }
@media (min-width: 768px) { .kv { grid-template-columns: repeat(2, 1fr); } }
.kv > div small { display: block; color: var(--muted); font-size: .75rem; }
.kv > div span { font-weight: 500; }
.sig-pad { width: 100%; height: 200px; border: 2px dashed var(--line); border-radius: 14px; background: #fff; touch-action: none; }
.scan-box { position: relative; border-radius: 18px; overflow: hidden; background: #0f172a; min-height: 280px; }
.scan-box video { width: 100%; display: block; }
.bar-chart { display: flex; align-items: flex-end; gap: .5rem; height: 110px; }
.bar-chart .b { flex: 1; text-align: center; font-size: .72rem; color: var(--muted); display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bar-chart .b span { display: block; background: linear-gradient(180deg, #60a5fa, #2563eb); border-radius: 8px 8px 4px 4px; margin: 0 auto .25rem; width: 70%; max-width: 34px; }
.bar-chart .b.today span { background: linear-gradient(180deg, #a78bfa, #7c3aed); }
.star-rate { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.star-rate input { display: none; }
.star-rate label { font-size: 1.6rem; color: #cbd5e1; cursor: pointer; }
.star-rate input:checked ~ label, .star-rate label:hover, .star-rate label:hover ~ label { color: #f59e0b; }

/* ---------------- Director / executive ---------------- */
.min-w-0 { min-width: 0; }
.si-sm { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 1.1rem; color: #fff; flex: none; }
.heat td, .heat th { border-color: #fff; border-width: 2px; }
.heat td { border-radius: 6px; }
.sticky-actions { position: sticky; top: calc(var(--topbar-h) + 6px); z-index: 5; }
.org { text-align: left; }
.org-node { display: inline-flex; gap: .7rem; align-items: center; background: #fff; border-radius: 16px; padding: .7rem 1rem; box-shadow: var(--shadow); min-width: 240px; }
.org-node > div small { display: block; color: var(--muted); font-size: .72rem; }
.org-node > div b { display: block; font-size: .95rem; }
.org-node > div span { display: block; font-size: .75rem; color: var(--muted); }
.org-top { display: flex; width: max-content; max-width: 100%; margin: 0 auto; border: 2px solid #fbbf24; }
.org > .d-flex, .org > .org-top { justify-content: center; }
.org-line { width: 2px; height: 22px; background: #cbd5e1; margin: 0 auto; }
.report-paper { max-width: 1000px; margin: 0 auto; }
@media print {
  .report-paper { box-shadow: none !important; border: 0 !important; max-width: none; }
  .cardx { break-inside: avoid; }
  canvas { max-width: 100% !important; }
}
@media print {
  .crumbs, .tabs-pill { display: none !important; }
  .heat td, .progress-thin > div, .badge-soft, .ring, .si { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------------- งานสารบรรณ: ฟอร์มแบ่งขั้น การ์ดเลือกชนิดหนังสือ พื้นที่วางไฟล์ แถบสถานะ (ใช้สีธีมเดิม) ---------------- */
.step-box { border: 1px solid var(--line); border-radius: 14px; padding: 1rem; background: #fff; height: 100%; }
.step-title { display: flex; align-items: center; gap: .5rem; font-weight: 700; margin-bottom: .75rem; }
.step-title small { font-weight: 400; color: var(--muted); }
.step-no { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-grid; place-items: center; font-size: .85rem; flex: none; }
.dropzone { border: 2px dashed #93c5fd; border-radius: 14px; background: var(--brand-50); min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; cursor: pointer; padding: 1rem; transition: background .15s, border-color .15s; }
.dropzone.drag { background: #dbeafe; border-color: var(--brand); }
.dropzone .dz-icon { width: 52px; height: 52px; border-radius: 14px; background: #fff; display: grid; place-items: center; font-size: 1.6rem; color: var(--brand); box-shadow: 0 2px 8px rgba(15, 23, 42, .08); margin-bottom: .6rem; }
.dropzone.has-file .dz-icon { color: #16a34a; }
.pick { display: flex; flex-wrap: wrap; gap: .4rem; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick label { border: 1px solid var(--line); border-radius: 10px; padding: .4rem .95rem; cursor: pointer; font-weight: 500; background: #fff; margin: 0; }
.pick input:checked + label { border-color: var(--brand); background: var(--brand-50); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.pick input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 2px; }
.type-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.type-card { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: .8rem; cursor: pointer; background: #fff; display: block; color: inherit; height: 100%; text-align: left; width: 100%; }
.type-card:hover { border-color: #93c5fd; color: inherit; }
.type-card.active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-50); }
.type-card.active::after { content: '\2713'; position: absolute; top: .55rem; right: .65rem; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: .75rem; }
.type-card .si { width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; color: #fff; font-size: 1.1rem; margin-bottom: .35rem; }
.type-card .tc-name { font-weight: 700; line-height: 1.2; }
.type-card .tc-desc { font-size: .76rem; color: var(--muted); min-height: 2.2em; }
.type-card .tc-next { border-top: 1px dashed var(--line); margin-top: .5rem; padding-top: .4rem; font-size: .76rem; color: var(--muted); display: flex; justify-content: space-between; gap: .3rem; }
.type-card .tc-next b { color: var(--brand); white-space: nowrap; }
.status-strip { display: flex; flex-wrap: wrap; padding: .4rem; }
.status-strip .ss { flex: 1 1 160px; display: flex; align-items: center; gap: .6rem; padding: .45rem .7rem; border-radius: 12px; color: inherit; }
.status-strip .ss:hover { background: #f8fafc; }
.status-strip .ss .si { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 1.1rem; flex: none; }
.status-strip .ss small { display: block; color: var(--muted); font-size: .76rem; }
.status-strip .ss b { font-size: 1.2rem; }
.status-strip .ss.alert-on { background: #fef2f2; }
.hero-clock { background: rgba(255, 255, 255, .16); border-radius: 16px; padding: .6rem 1rem; text-align: center; min-width: 180px; }
.hero-clock b { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.hero-clock small { display: block; opacity: .85; font-size: .78rem; }
.reg-preview { font-size: .85rem; color: var(--muted); }
.reg-preview b { color: var(--brand); font-size: 1rem; }
