/* =========================================================
   Absensi Sekolah — tampilan
   Teal  : absen masuk & warna utama (diambil dari format rekap)
   Amber : absen pulang
   ========================================================= */
:root {
  --ink: #12302F;
  --ink-2: #3F5A58;
  --muted: #6B8381;
  --line: #DCE6E4;
  --line-2: #E9F0EF;
  --bg: #EDF3F2;
  --surface: #FFFFFF;
  --deep: #0B4F51;
  --deep-2: #083B3D;
  --teal: #0C7779;
  --teal-50: #E3F2F1;
  --teal-100: #C6E6E4;
  --amber: #DE8A2C;
  --amber-50: #FCF1E3;
  --amber-ink: #8A4E0B;
  --red: #CF3F3F;
  --red-50: #FBE9E8;
  --green: #2E9A5B;
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(18, 48, 47, .06), 0 8px 24px -12px rgba(18, 48, 47, .14);
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --side: 252px;
}
:root { box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
*, *::before, *::after { box-sizing: inherit; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
a { color: var(--teal); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--teal) 45%, transparent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hide { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Login ---------- */
.login { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login-art { background: var(--deep); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ""; position: absolute; inset: auto -80px -120px auto; width: 420px; height: 420px; border-radius: 50%; border: 56px solid rgba(255,255,255,.06); }
.login-art h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.08; letter-spacing: -.02em; margin: 0 0 14px; max-width: 13ch; font-weight: 800; }
.login-art p { color: rgba(255,255,255,.74); max-width: 42ch; margin: 0; }
.login-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.login-times { display: flex; gap: 12px; flex-wrap: wrap; position: relative; z-index: 1; }
.login-times div { background: rgba(255,255,255,.08); border-radius: var(--radius); padding: 12px 16px; min-width: 150px; }
.login-times b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.login-times span { color: rgba(255,255,255,.7); font-size: 13px; }
.login-form { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h2 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; }
.login-card p { margin: 0 0 24px; color: var(--muted); }
@media (max-width: 820px) { .login { grid-template-columns: 1fr; } .login-art { padding: 28px; gap: 28px; } .login-art::after { display: none; } }

/* ---------- Kerangka ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100%; }
.side { background: var(--deep); color: #E6F1F0; position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 20px 14px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: var(--teal); display: grid; place-items: center; flex: none; }
.brand b { display: block; font-size: 15px; line-height: 1.2; }
.brand span { font-size: 12px; color: rgba(230,241,240,.6); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 12px; color: rgba(230,241,240,.45); padding: 16px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: rgba(230,241,240,.82); text-decoration: none; font-weight: 500; }
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: #fff; color: var(--deep); font-weight: 700; }
.nav a.on svg { opacity: 1; }
.nav a.scan-link { margin: 6px 0; background: var(--teal); color: #fff; }
.nav a.scan-link.on { background: #fff; color: var(--deep); }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.12); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 12px; color: rgba(230,241,240,.55); }
.icon-btn { background: transparent; border: 0; color: inherit; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: rgba(127,127,127,.12); }
.icon-btn svg { width: 19px; height: 19px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); display: flex; align-items: center; gap: 14px; padding: 16px 28px; }
.top h1 { font-size: 21px; margin: 0; letter-spacing: -.015em; font-weight: 800; }
.top .sub { color: var(--muted); font-size: 13px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; }
.content { padding: 4px 28px 40px; }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 60; transform: translateX(-100%); transition: transform .2s ease; padding-top: calc(20px + env(safe-area-inset-top, 0px)); }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(8, 30, 30, .45); }
  .menu-btn { display: grid; }
  .top { padding: 12px 16px; }
  .content { padding: 4px 16px 32px; }
}

/* ---------- Pil status sesi ---------- */
.sesi-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px 7px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
.sesi-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sesi-pill.masuk { background: var(--teal-50); border-color: var(--teal-100); color: var(--deep); }
.sesi-pill.masuk i { background: var(--teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 20%, transparent); }
.sesi-pill.pulang { background: var(--amber-50); border-color: #F3D6B2; color: var(--amber-ink); }
.sesi-pill.pulang i { background: var(--amber); box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 22%, transparent); }
@media (max-width: 640px) { .top .sesi-pill { display: none; } }

/* ---------- Komponen dasar ---------- */
.panel { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { font-size: 15.5px; margin: 0; font-weight: 700; }
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.panel-head .right { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; background: var(--teal); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, transform .05s; }
.btn:hover { background: var(--deep); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--line-2); }
.btn.amber { background: var(--amber); }
.btn.amber:hover { background: #C4741B; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #A92F2F; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12.5px; }
.input, select.input, textarea.input { height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fff; width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
.input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 14%, transparent); }
.input.sm { height: 36px; font-size: 13.5px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { width: auto; }
.toolbar .grow { flex: 1; min-width: 180px; }

.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 0 12px; height: 34px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--ink-2); font-size: 13px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 600; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 999px; background: #C9D6D4; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--teal); }
.switch input:checked::after { transform: translateX(18px); }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.masuk { background: var(--teal-50); color: var(--deep); }
.badge.pulang { background: var(--amber-50); color: var(--amber-ink); }
.badge.red { background: var(--red-50); color: var(--red); }
.badge.green { background: #E4F4EA; color: #1F7343; }

/* Tabel */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #F7FAFA; }
.tbl .actions { display: flex; gap: 4px; justify-content: flex-end; }
.person { display: flex; align-items: center; gap: 11px; min-width: 180px; }
.person b { display: block; font-weight: 600; line-height: 1.25; }
.person span { font-size: 12.5px; color: var(--muted); }
.ph { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; background: var(--teal-50); color: var(--teal); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.empty { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------- Dasbor ---------- */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }
.dash > * { grid-column: span 12; }
.today { grid-column: span 5; background: var(--deep); color: #fff; border-radius: var(--radius-lg); padding: 24px; display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; position: relative; overflow: hidden; }
.today .ring { width: 150px; height: 150px; position: relative; }
.today .ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.today .ring .val { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.today .ring .val b { font-size: 25px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.today .ring .val span { font-size: 10.5px; color: rgba(255,255,255,.65); margin-top: 3px; max-width: 70px; line-height: 1.2; }
.today h2 { margin: 0 0 2px; font-size: 15px; font-weight: 600; color: rgba(255,255,255,.75); }
.today .date { font-size: 20px; font-weight: 800; margin-bottom: 14px; letter-spacing: -.01em; }
.today .split { display: grid; grid-template-columns: repeat(3, auto); gap: 4px 18px; justify-content: start; }
.today .split b { font-size: 22px; font-variant-numeric: tabular-nums; display: block; }
.today .split span { font-size: 12.5px; color: rgba(255,255,255,.68); display: flex; align-items: center; gap: 6px; }
.today .split i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.kpis { grid-column: span 7; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.kpi { background: var(--surface); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: space-between; min-height: 112px; }
.kpi span { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi b { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi small { color: var(--muted); font-size: 12.5px; }
.kpi.alert b { color: var(--red); }
.c-8 { grid-column: span 8; } .c-4 { grid-column: span 4; } .c-6 { grid-column: span 6; } .c-7 { grid-column: span 7; } .c-5 { grid-column: span 5; }
.chart-box { position: relative; height: 270px; }
.chart-box.short { height: 230px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.feed-item:last-child { border-bottom: 0; }
.feed-item .t { margin-left: auto; text-align: right; }
.feed-item .t b { display: block; font-variant-numeric: tabular-nums; }
.kelas-bars { display: flex; flex-direction: column; gap: 12px; }
.kbar { display: grid; grid-template-columns: 70px 1fr 64px; gap: 10px; align-items: center; font-size: 13px; }
.kbar .track { height: 10px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.kbar .fill { height: 100%; background: var(--teal); border-radius: 999px; }
.kbar b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kbar .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 1200px) { .today { grid-column: span 12; } .kpis { grid-column: span 12; grid-template-columns: repeat(4, minmax(0, 1fr)); } .c-8, .c-4, .c-6, .c-7, .c-5 { grid-column: span 12; } }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .today { grid-template-columns: 1fr; justify-items: start; } }

/* ---------- Halaman scan ---------- */
.scan { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 18px; min-height: calc(100vh - 110px); }
.clock-panel { background: var(--deep); color: #fff; border-radius: var(--radius-lg); padding: 28px; display: flex; flex-direction: column; gap: 22px; position: relative; overflow: hidden; }
.clock-panel.pulang { background: #5A3A12; }
.clock-panel.tutup { background: #263D3C; }
.clock { font-size: clamp(56px, 8vw, 104px); font-weight: 800; letter-spacing: -.04em; line-height: .95; font-variant-numeric: tabular-nums; }
.clock small { font-size: .38em; letter-spacing: -.01em; opacity: .55; margin-left: 4px; }
.clock-date { color: rgba(255,255,255,.7); font-weight: 600; margin-top: 8px; }
.sesi-big { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.sesi-note { color: rgba(255,255,255,.72); font-size: 14px; margin-top: 2px; }
.daybar { position: relative; height: 54px; }
.daybar .track { position: absolute; left: 0; right: 0; top: 18px; height: 12px; border-radius: 999px; background: rgba(255,255,255,.1); }
.daybar .win { position: absolute; top: 18px; height: 12px; border-radius: 999px; }
.daybar .win.m { background: #5FC6C3; }
.daybar .win.p { background: #F2B061; }
.daybar .now { position: absolute; top: 10px; width: 3px; height: 28px; background: #fff; border-radius: 2px; transform: translateX(-1px); }
.daybar .lbl { position: absolute; top: 38px; font-size: 11.5px; color: rgba(255,255,255,.6); transform: translateX(-50%); white-space: nowrap; font-variant-numeric: tabular-nums; }
.scan-input-row { display: flex; gap: 10px; margin-top: auto; }
.scan-input-row .input { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: #fff; height: 46px; }
.scan-input-row .input::placeholder { color: rgba(255,255,255,.55); }
.scan-input-row .input:focus { border-color: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.15); }
.ready { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: rgba(255,255,255,.8); }
.ready i { width: 10px; height: 10px; border-radius: 50%; background: #67D99A; box-shadow: 0 0 0 0 rgba(103,217,154,.6); animation: pulse 2s infinite; }
.ready.off i { background: #E8A13A; animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(103,217,154,0); } 100% { box-shadow: 0 0 0 0 rgba(103,217,154,0); } }

.result { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.result-card { flex: 1; display: grid; grid-template-columns: 200px 1fr; gap: 26px; align-items: center; padding: 30px; border-bottom: 1px solid var(--line-2); position: relative; min-height: 290px; }
.result-card .photo { width: 200px; height: 240px; border-radius: 16px; object-fit: cover; background: var(--line-2); display: grid; place-items: center; font-size: 54px; font-weight: 800; color: var(--muted); }
.result-card .status { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; padding: 7px 14px; border-radius: 999px; font-size: 14px; margin-bottom: 14px; }
.result-card h2 { font-size: clamp(26px, 3vw, 38px); margin: 0; letter-spacing: -.02em; line-height: 1.1; font-weight: 800; }
.result-card .meta { color: var(--muted); font-weight: 600; margin-top: 6px; font-size: 15px; }
.result-card .when { font-size: 54px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 14px; line-height: 1; }
.result-card .msg { margin-top: 10px; font-weight: 600; }
.result-card.idle { grid-template-columns: 1fr; text-align: center; place-items: center; color: var(--muted); }
.result-card.idle h2 { color: var(--ink); font-size: 24px; }
.result-card.s-masuk { background: linear-gradient(0deg, var(--teal-50), #fff 70%); }
.result-card.s-masuk .status { background: var(--teal); color: #fff; }
.result-card.s-masuk .when { color: var(--teal); }
.result-card.s-pulang { background: linear-gradient(0deg, var(--amber-50), #fff 70%); }
.result-card.s-pulang .status { background: var(--amber); color: #fff; }
.result-card.s-pulang .when { color: var(--amber); }
.result-card.s-sudah .status { background: var(--line-2); color: var(--ink-2); }
.result-card.s-error { background: linear-gradient(0deg, var(--red-50), #fff 70%); }
.result-card.s-error .status { background: var(--red); color: #fff; }
.result-card.s-error .msg { color: var(--red); }
.result-card.pop { animation: pop .35s ease; }
@keyframes pop { from { transform: scale(.985); opacity: .4; } to { transform: none; opacity: 1; } }
.result-tools { display: flex; gap: 10px; padding: 14px 20px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line-2); }
.result-tools .right { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.cam { display: none; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.cam.on { display: block; }
#qr-reader { max-width: 420px; margin: 0 auto; border-radius: 12px; overflow: hidden; border: 0 !important; }
#qr-reader video { border-radius: 12px; }
.scan-feed { padding: 6px 20px 14px; max-height: 300px; overflow-y: auto; }
@media (max-width: 1080px) { .scan { grid-template-columns: 1fr; min-height: 0; } .result-card { grid-template-columns: 140px 1fr; padding: 22px; min-height: 0; } .result-card .photo { width: 140px; height: 170px; } .result-card .when { font-size: 40px; } }
@media (max-width: 520px) { .result-card { grid-template-columns: 1fr; text-align: center; justify-items: center; } }

/* ---------- Rekap ---------- */
.rekap-scroll { overflow: auto; max-height: 64vh; border: 1px solid var(--line); border-radius: 12px; }
table.rk { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.rk th, .rk td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px 4px; text-align: center; min-width: 28px; background: #fff; }
.rk thead th { position: sticky; z-index: 2; font-weight: 700; }
.rk thead tr:nth-child(1) th { top: 0; height: 30px; }
.rk thead tr:nth-child(2) th { top: 30px; height: 26px; }
.rk .h-teal { background: var(--teal); color: #fff; }
.rk .h-org { background: #F4B183; color: #3B2410; }
.rk .h-red { background: #E04848; color: #fff; }
.rk .stick { position: sticky; left: 0; z-index: 3; }
.rk .stick2 { position: sticky; left: 38px; z-index: 3; text-align: left; min-width: 210px; padding-left: 10px; }
.rk thead .stick, .rk thead .stick2 { z-index: 4; }
.rk td.no { min-width: 38px; }
.rk td.m { color: var(--teal); font-weight: 700; }
.rk td.p { color: var(--amber); font-weight: 700; }
.rk td.lib { background: #EEF0F0; }
.rk td.tot { font-weight: 700; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 30, 30, .45); z-index: 80; display: grid; place-items: center; padding: 16px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 560px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: 0 30px 80px -20px rgba(0,0,0,.4); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line-2); gap: 12px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; }

/* Form siswa: foto */
.photo-pick { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.photo-pick .pv { width: 96px; height: 116px; border-radius: 14px; background: var(--line-2); object-fit: cover; display: grid; place-items: center; color: var(--muted); flex: none; overflow: hidden; }
.photo-pick .pv img { width: 100%; height: 100%; object-fit: cover; }
.photo-pick .pv svg { width: 30px; height: 30px; }
.rfid-field { position: relative; }
.rfid-field .input { padding-right: 104px; font-variant-numeric: tabular-nums; }
.rfid-field .hint { position: absolute; right: 8px; top: 7px; }
.rfid-field.listening .input { border-color: var(--amber); box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 18%, transparent); }

/* QR detail */
.qr-view { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; }
.qr-view .qr { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; }
.qr-view .qr img, .qr-view .qr svg { width: 100%; height: 100%; image-rendering: pixelated; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--line-2); padding: 2px 7px; border-radius: 6px; font-size: 13px; }

/* Editor pesan WhatsApp */
.msg-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 1000px) { .msg-grid { grid-template-columns: 1fr; } }
.editor { min-height: 150px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.75; background: #fff; }
.editor:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 14%, transparent); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: 6px; font-size: 13px; font-weight: 700; line-height: 22px; user-select: all; vertical-align: baseline; margin: 0 1px; }
.chip.lock { background: var(--deep); color: #fff; }
.chip.lock::before { content: ""; width: 9px; height: 10px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 12'%3E%3Cpath d='M2 5V3.5a3 3 0 0 1 6 0V5h1v7H1V5zm1.5 0h3V3.5a1.5 1.5 0 0 0-3 0z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 12'%3E%3Cpath d='M2 5V3.5a3 3 0 0 1 6 0V5h1v7H1V5zm1.5 0h3V3.5a1.5 1.5 0 0 0-3 0z'/%3E%3C/svg%3E") center/contain no-repeat; }
.chip.opt { background: var(--teal-50); color: var(--deep); }
.chip-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 10px; font-size: 13px; color: var(--muted); }
.chip-bar button { border: 1px dashed var(--teal-100); background: #fff; color: var(--deep); border-radius: 8px; padding: 3px 9px; cursor: pointer; font-weight: 600; font-size: 12.5px; }
.chip-bar button:hover { background: var(--teal-50); }
.phone { background: #E7DDD3; border-radius: 22px; padding: 18px 16px; min-height: 260px; }
.phone .bar { display: flex; align-items: center; gap: 10px; margin: -18px -16px 14px; padding: 12px 16px; background: #1F5C4F; color: #fff; border-radius: 22px 22px 0 0; font-weight: 600; font-size: 14px; }
.bubble { background: #fff; border-radius: 4px 12px 12px 12px; padding: 9px 12px 18px; max-width: 92%; white-space: pre-wrap; word-break: break-word; font-size: 14px; position: relative; box-shadow: 0 1px 1px rgba(0,0,0,.08); margin-bottom: 10px; }
.bubble time { position: absolute; right: 9px; bottom: 3px; font-size: 11px; color: #8A8A8A; }
.bubble .hl { font-weight: 700; color: var(--deep); }

/* Pengaturan: jadwal */
.timeline { position: relative; height: 70px; margin: 8px 0 18px; }
.timeline .track { position: absolute; left: 0; right: 0; top: 22px; height: 16px; border-radius: 999px; background: var(--line-2); }
.timeline .win { position: absolute; top: 22px; height: 16px; border-radius: 999px; }
.timeline .win.m { background: var(--teal); }
.timeline .win.p { background: var(--amber); }
.timeline .tick { position: absolute; top: 44px; font-size: 11.5px; color: var(--muted); transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.timeline .tag { position: absolute; top: 0; font-size: 12px; font-weight: 700; transform: translateX(-50%); white-space: nowrap; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { cursor: pointer; }
.days input { position: absolute; opacity: 0; pointer-events: none; }
.days span { display: inline-flex; padding: 7px 12px; border-radius: 9px; border: 1px solid var(--line); font-weight: 600; font-size: 13px; }
.days input:checked + span { background: var(--red-50); border-color: #F1C2C0; color: var(--red); }
.days input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--teal) 45%, transparent); }
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .settings { grid-template-columns: 1fr; } }
.notice { background: var(--amber-50); color: var(--amber-ink); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; }
.notice.teal { background: var(--teal-50); color: var(--deep); }

/* Kelas */
.kelas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.kelas-card { background: #fff; border-radius: 14px; padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; border-top: 4px solid var(--teal); }
.kelas-card h3 { margin: 0; font-size: 24px; letter-spacing: -.02em; font-weight: 800; }
.kelas-card .n { font-size: 13px; color: var(--muted); }
.kelas-card .acts { display: flex; gap: 6px; margin-top: 10px; }
.kelas-card.add { border: 2px dashed var(--teal-100); box-shadow: none; background: transparent; place-content: center; text-align: center; color: var(--teal); font-weight: 700; cursor: pointer; min-height: 132px; }

/* Kartu siswa (cetak) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.idcard { width: 100%; max-width: 340px; aspect-ratio: 85.6 / 54; border-radius: 12px; overflow: hidden; background: #fff; border: 1px solid var(--line); display: grid; grid-template-rows: auto 1fr; break-inside: avoid; }
.idcard .hd { background: var(--deep); color: #fff; padding: 7px 12px; font-size: 11px; font-weight: 700; display: flex; justify-content: space-between; gap: 8px; }
.idcard .hd span { opacity: .7; font-weight: 500; }
.idcard .bd { display: grid; grid-template-columns: 68px 1fr 96px; gap: 10px; padding: 10px 12px; align-items: center; min-height: 0; }
.idcard .bd .ph { width: 68px; height: 84px; border-radius: 8px; font-size: 20px; }
.idcard .bd b { display: block; font-size: 13.5px; line-height: 1.2; }
.idcard .bd small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.idcard .bd .qr img { width: 96px; height: 96px; image-rendering: pixelated; display: block; }
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  .side, .top, .no-print, #toasts { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .cards { grid-template-columns: repeat(2, 86mm); gap: 6mm; }
  .idcard { width: 86mm; max-width: none; height: 54mm; border-color: #999; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Toast */
#toasts { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; max-width: 380px; box-shadow: 0 12px 30px -10px rgba(0,0,0,.35); animation: tin .2s ease; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--deep); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
