/* =========================================================
   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: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(440px, 46%) minmax(0, 1fr); }
.login-art { background: var(--deep); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; position: relative; overflow: hidden; }
.login-art > * { position: relative; z-index: 1; }
.login-hero { max-width: 520px; }
.login-art::after { content: ""; position: absolute; right: -140px; bottom: -160px; width: 460px; height: 460px; border-radius: 50%; border: 60px solid rgba(255,255,255,.05); z-index: 0; }
.login-art h1 { font-size: clamp(32px, 3.4vw, 50px); line-height: 1.08; letter-spacing: -.025em; margin: 0 0 18px; max-width: 14ch; font-weight: 800; }
.login-art p { color: rgba(255,255,255,.74); max-width: 44ch; margin: 0; font-size: 15.5px; line-height: 1.6; }
.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: 14px 18px; min-width: 170px; }
.login-times-h { font-size: 12.5px; color: rgba(255,255,255,.6); margin-bottom: 10px; }
.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: 40px 24px; }
.login-foot { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 28px; margin: 0 0 6px; letter-spacing: -.02em; font-weight: 800; }
.login-card p { margin: 0 0 24px; color: var(--muted); }
@media (max-width: 980px) { .login { grid-template-columns: minmax(360px, 44%) minmax(0, 1fr); } .login-art { padding: 40px; } }
@media (max-width: 820px) { .login { grid-template-columns: 1fr; grid-template-rows: auto 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(2, auto); gap: 10px 28px; justify-content: start; }
@media (max-width: 1200px) and (min-width: 761px) { .today .split { grid-template-columns: repeat(4, auto); } }
.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); }
.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); } }

/* ---------- PWA ---------- */
.side-install { margin-top: auto; padding: 12px 0 4px; }
.side-install + .side-foot { margin-top: 0; }
.install-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px dashed rgba(255,255,255,.28); background: transparent; color: #fff; font-weight: 600; cursor: pointer; }
.install-btn:hover { background: rgba(255,255,255,.06); }
.install-btn svg { width: 18px; height: 18px; }
.top-install { display: none; color: var(--deep); background: var(--surface); border: 1px solid var(--line); }
@media (max-width: 980px) { .top-install:not(.hide) { display: grid; } }
.login-install { margin-top: 12px; }
.steps { margin: 0; padding-left: 20px; line-height: 1.7; }
.steps li { margin-bottom: 6px; }
.inline-ic { width: 18px; height: 18px; vertical-align: -3px; color: #0A84FF; }
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; -webkit-user-select: none; user-select: none; }
  input, textarea, .editor, .tbl, .code { -webkit-user-select: text; user-select: text; }
}
@media (max-width: 820px) {
  .login-art { padding: 22px 20px 24px; gap: 18px; }
  .login-art h1 { font-size: 24px; max-width: none; margin-bottom: 0; }
  .login-art p { display: none; }
  .login-times { flex-wrap: nowrap; gap: 10px; }
  .login-times div { min-width: 0; flex: 1; padding: 10px 12px; }
  .login-times b { font-size: 16px; }
  .login-form { place-items: start center; padding-top: 24px; }
}

/* ---------- Logo sekolah ---------- */
.brand-mark.has-logo { background: #fff; padding: 4px; overflow: hidden; }
.brand-mark.has-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-set { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.logo-box { width: 132px; height: 132px; border-radius: 16px; border: 1px solid var(--line); flex: none; display: grid; place-items: center; padding: 12px;
  background-color: #fff; background-image: linear-gradient(45deg, #F1F5F4 25%, transparent 25%, transparent 75%, #F1F5F4 75%), linear-gradient(45deg, #F1F5F4 25%, transparent 25%, transparent 75%, #F1F5F4 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.logo-box canvas { max-width: 100%; max-height: 100%; }
.logo-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; text-align: center; }
.logo-empty svg { width: 34px; height: 34px; opacity: .5; }
.logo-side { flex: 1; min-width: 200px; }
.icon-preview { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; background: linear-gradient(135deg, #1D3D3C, #3B5F5D); border-radius: 14px; padding: 16px 18px; color: #fff; }
.icon-preview .muted { color: rgba(255,255,255,.7); }
.icon-preview .seg { background: rgba(255,255,255,.12); }
.icon-preview .seg button { color: rgba(255,255,255,.85); }
.icon-preview .seg button.on { color: var(--ink); }
.phone-home { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 72px; }
.phone-home small { font-size: 11.5px; color: #fff; white-space: nowrap; }
.app-ic { width: 60px; height: 60px; border-radius: 15px; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,.25); }
.app-ic canvas, .app-ic img { width: 100%; height: 100%; display: block; }
.idcard .hd-name { display: flex; align-items: center; gap: 6px; opacity: 1 !important; font-weight: 700 !important; min-width: 0; }
.idcard .hd-logo { width: 18px; height: 18px; object-fit: contain; background: #fff; border-radius: 4px; padding: 1px; flex: none; }

/* ---------- Pengaturan: menu kategori + baris isian ---------- */
.set { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; align-items: start; max-width: 1080px; }
.set-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 4px; }
.set-nav button { display: flex; align-items: center; gap: 12px; text-align: left; border: 0; background: transparent; padding: 11px 12px; border-radius: 12px; cursor: pointer; color: var(--ink-2); position: relative; }
.set-nav button svg { width: 19px; height: 19px; flex: none; color: var(--muted); }
.set-nav button b { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.set-nav button small { display: block; font-size: 12px; color: var(--muted); }
.set-nav button:hover { background: rgba(255,255,255,.6); }
.set-nav button.on { background: var(--surface); box-shadow: var(--shadow); }
.set-nav button.on svg { color: var(--teal); }
.set-nav button.on b { font-weight: 700; }
.set-nav .dot { width: 8px; height: 8px; border-radius: 50%; background: #C9D6D4; margin-left: auto; flex: none; }
.set-nav .dot.on { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }
.set-body { min-width: 0; }
.set-tab { display: flex; flex-direction: column; gap: 18px; }
.scard { padding: 0; }
.scard-h { padding: 20px 24px 16px; border-bottom: 1px solid var(--line-2); }
.scard-h h2 { margin: 0; font-size: 16px; font-weight: 700; }
.scard-h p { margin: 3px 0 0; font-size: 13px; color: var(--muted); max-width: 62ch; }
.srow { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 8px 28px; padding: 18px 24px; border-bottom: 1px solid var(--line-2); align-items: start; }
.srow:last-child { border-bottom: 0; }
.srow-l h3 { margin: 0; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; line-height: 1.4; padding-top: 10px; }
.srow-l p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.srow-r { min-width: 0; display: flex; flex-direction: column; gap: 12px; justify-content: center; min-height: 42px; }
.srow-r > .switch { align-self: flex-start; }
.sfoot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; background: #F7FAF9; border-top: 1px solid var(--line-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.scard .timeline { margin: 20px 24px 10px; }
.range { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.range .input { width: 150px; }
.range span { color: var(--muted); font-size: 13px; }
.lg-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.lg-dot.m { background: var(--teal); } .lg-dot.p { background: var(--amber); }
.test-row { display: flex; gap: 8px; }
.test-row .input { flex: 1; min-width: 0; }
.grid-2.tight { gap: 10px; }
.scard .logo-set { gap: 16px; }
.scard .logo-box { width: 112px; height: 112px; }
.scard .logo-side { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 180px; }
.scard .icon-preview { align-self: flex-start; padding: 14px 20px; gap: 16px; }
.icon-opts { display: flex; flex-direction: column; gap: 12px; }
.icon-latar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); font-weight: 600; }
@media (max-width: 1100px) { .srow { grid-template-columns: 180px minmax(0, 1fr); } }
@media (max-width: 860px) {
  .set { grid-template-columns: 1fr; gap: 14px; }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 2px; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-nav button { flex: none; padding: 9px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); gap: 8px; }
  .set-nav button.on { background: var(--deep); border-color: var(--deep); box-shadow: none; }
  .set-nav button.on b, .set-nav button.on svg { color: #fff; }
  .set-nav button small { display: none; }
  .set-nav button svg { width: 17px; height: 17px; }
  .srow { grid-template-columns: 1fr; padding: 16px 18px; gap: 10px; }
  .srow-l h3 { padding-top: 0; }
  .scard-h { padding: 16px 18px 14px; }
  .sfoot { padding: 12px 18px; }
  .sfoot .btn { width: 100%; }
  .scard .timeline { margin: 18px 18px 6px; }
  .range .input { flex: 1; width: auto; min-width: 0; }
  .test-row { flex-direction: column; }
}

/* =========================================================
   Desain kartu
   ========================================================= */
/* Kartu hasil desain (dipakai di editor, daftar, dan cetak) */
.kd { position: relative; overflow: hidden; container-type: inline-size; background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.kd.portrait { aspect-ratio: 54 / 86; }
.kd.landscape { aspect-ratio: 86 / 54; }
.kd-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.kd-el { position: absolute; box-sizing: border-box; overflow: hidden; }
.kd-field, .kd-text { display: flex; flex-direction: column; white-space: pre-wrap; overflow-wrap: anywhere; overflow: visible; }
.kd-field.kd-fit, .kd-text.kd-fit { overflow: hidden; }
.kd-el > img { width: 100%; height: 100%; display: block; }
.kd-qr { object-fit: contain; image-rendering: pixelated; background: #fff; }
.kd-ph { width: 100%; height: 100%; display: grid; place-items: end center; background: #E6EFEE; color: #6B8381; }
.kd-ph svg { width: 76%; height: 84%; }
.kd-ph-t { place-items: center; text-align: center; font-size: 2.6cqw; line-height: 1.15; padding: 2px; font-weight: 600; overflow: hidden; border: 1px dashed #9DB5B3; }
.kd-ph-t small { font-weight: 400; font-size: .8em; }

/* Daftar desain */
.kd-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; align-items: start; }
.kd-item { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.kd-thumb { background: repeating-linear-gradient(45deg, #EEF3F2 0 10px, #E6EDEC 10px 20px); display: grid; place-items: center; height: 300px; padding: 16px; }
.kd-thumb .kd { box-shadow: 0 8px 22px -10px rgba(0,0,0,.35); border-radius: 8px; }
.kd-thumb.portrait .kd { height: 100%; }
.kd-thumb.landscape .kd { width: 100%; max-width: 330px; }
.kd-item-b { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 16px 4px; }
.kd-item-b b { display: block; font-size: 15px; }
.kd-item-b span:not(.badge) { font-size: 12.5px; color: var(--muted); }
.kd-item-acts { display: flex; gap: 6px; padding: 10px 16px 16px; flex-wrap: wrap; }
.kd-item-acts .kd-del { margin-left: auto; color: var(--red); }
.kd-new { border: 2px dashed var(--teal-100); border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; justify-content: center; }
.kd-new > b { color: var(--deep); font-size: 15px; }
.kd-new-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.kd-new-opt:hover { outline: 2px solid var(--teal-100); }
.kd-new-opt small { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 12px; }
.kd-new-ic { border: 2px solid var(--teal); border-radius: 4px; flex: none; background: var(--teal-50); }
.kd-new-ic.p { width: 18px; height: 28px; } .kd-new-ic.l { width: 28px; height: 18px; }

/* Editor */
.kd-editor { display: grid; grid-template-columns: 290px minmax(0, 1fr) 300px; grid-template-areas: "top top top" "tools stage props"; gap: 16px; align-items: start; }
.kd-top { grid-area: top; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 10px 12px; }
.kd-name { flex: 1 1 160px; max-width: 260px; min-width: 140px; font-weight: 600; }
.kd-top-r { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.kd-top-r .icon-btn[disabled] { opacity: .35; pointer-events: none; }
.kd-tools { grid-area: tools; padding: 14px; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; }
.kd-tabs { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 14px; width: 100%; }
.kd-tabs button { white-space: nowrap; padding: 0 6px; }
.kd-pane-h { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 4px 0 8px; }
.kd-pane-note { font-size: 12.5px; color: var(--muted); margin: 8px 0 12px; line-height: 1.45; }
.kd-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.kd-btns button { display: flex; align-items: center; gap: 7px; justify-content: center; text-align: center; min-height: 40px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--ink); line-height: 1.2; }
.kd-btns button:hover { border-color: var(--teal); background: var(--teal-50); color: var(--deep); }
.kd-btns button svg { width: 16px; height: 16px; flex: none; color: var(--teal); }
.kd-gal { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kd-g-w { position: relative; }
.kd-g { width: 100%; aspect-ratio: 54 / 86; border: 2px solid var(--line); border-radius: 8px; padding: 3px; background: #fff; cursor: pointer; display: grid; place-items: center; overflow: hidden; }
.kd-g img { width: 100%; height: 100%; object-fit: contain; border-radius: 4px; }
.kd-g.on { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-100); }
.kd-g-none { font-size: 11.5px; color: var(--muted); font-weight: 600; text-align: center; }
.kd-g-x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: var(--red); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.kd-g-x svg { width: 12px; height: 12px; }

.kd-stage { grid-area: stage; background: repeating-linear-gradient(45deg, #E9F0EF 0 12px, #E2EAE9 12px 24px); border-radius: var(--radius-lg); padding: 24px 16px 14px; display: flex; flex-direction: column; align-items: center; min-height: 420px; position: sticky; top: 84px; }
.kd-box { flex: none; position: relative; }
.kd-scale { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.kd-canvas { touch-action: none; user-select: none; -webkit-user-select: none; }
.kd-canvas .kd { box-shadow: 0 18px 40px -16px rgba(8,30,30,.45); border-radius: 10px; }
.kd-canvas .kd-el { cursor: move; outline: 1px dashed transparent; }
.kd-canvas .kd-el:hover { outline-color: rgba(12,119,121,.55); }
.kd-sel { position: absolute; outline: 2px solid #1E88E5; pointer-events: none; z-index: 50; }
.kd-sel i { position: absolute; width: 11px; height: 11px; background: #fff; border: 2px solid #1E88E5; border-radius: 3px; pointer-events: auto; transform: translate(-50%, -50%); }
.kd-sel .h-nw { left: 0; top: 0; cursor: nwse-resize; } .kd-sel .h-n { left: 50%; top: 0; cursor: ns-resize; } .kd-sel .h-ne { left: 100%; top: 0; cursor: nesw-resize; }
.kd-sel .h-e { left: 100%; top: 50%; cursor: ew-resize; } .kd-sel .h-se { left: 100%; top: 100%; cursor: nwse-resize; } .kd-sel .h-s { left: 50%; top: 100%; cursor: ns-resize; }
.kd-sel .h-sw { left: 0; top: 100%; cursor: nesw-resize; } .kd-sel .h-w { left: 0; top: 50%; cursor: ew-resize; }
.kd-guide { position: absolute; z-index: 49; pointer-events: none; background: #E91E63; }
.kd-guide.v { left: 50%; top: 0; bottom: 0; width: 1px; } .kd-guide.h { top: 50%; left: 0; right: 0; height: 1px; }
.kd-hint { font-size: 12.5px; color: var(--muted); text-align: center; max-width: 440px; margin: 16px 0 0; }

.kd-props { grid-area: props; padding: 16px; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; }
.kd-ph3 { font-size: 15px; margin: 0 0 12px; font-weight: 700; }
.kd-props-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.kd-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.kd-acts .btn { flex: 1; padding: 0 8px; }
.kd-sec { font-size: 12px; font-weight: 700; color: var(--muted); margin: 16px 0 8px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.kd-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.kd-props .field { margin-bottom: 10px; }
.kd-props .field > span { font-size: 12.5px; }
.kd-color { width: 42px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; flex: none; }
.kd-tgs { display: inline-flex; background: var(--line-2); border-radius: 9px; padding: 2px; gap: 2px; }
.kd-tg { width: 32px; height: 30px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--ink-2); font-size: 13px; font-family: Georgia, serif; }
.kd-tg svg { width: 16px; height: 16px; }
.kd-tg.on { background: #fff; color: var(--deep); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.kd-size { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.kd-size button { width: 28px; height: 34px; border: 0; background: #fff; cursor: pointer; font-size: 16px; color: var(--ink-2); }
.kd-size input { width: 52px; border: 0; border-radius: 0; text-align: center; padding: 0 2px; height: 34px; }
.kd-sw { font-size: 13px; margin: 2px 0 10px; }
.kd-sw input { width: 36px; height: 20px; } .kd-sw input::after { width: 14px; height: 14px; } .kd-sw input:checked::after { transform: translateX(16px); }
.kd-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.kd-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.kd-grid4 label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.kd-grid4 .input { padding: 0 6px; }
.kd-fitseg { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
.kd-layers { display: flex; flex-direction: column; gap: 4px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.kd-layers button { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; border: 1px solid var(--line-2); background: #fff; border-radius: 9px; padding: 8px 10px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink); }
.kd-layers button:hover { border-color: var(--teal); }
.kd-layers small { color: var(--muted); font-weight: 500; font-size: 11.5px; white-space: nowrap; }

@media (max-width: 1280px) {
  .kd-editor { grid-template-columns: 270px minmax(0, 1fr); grid-template-areas: "top top" "tools stage" "props stage"; }
  .kd-props { position: static; max-height: none; }
  .kd-tools { position: static; max-height: none; }
}
@media (max-width: 760px) {
  .kd-editor { grid-template-columns: 1fr; grid-template-areas: "top" "stage" "props" "tools"; }
  .kd-stage { position: static; padding: 16px 8px 10px; }
  .kd-name { width: 100%; order: -1; }
  .kd-top-r { margin-left: 0; }
}

/* Cetak kartu dengan desain */
.cards.kd-mode { grid-template-columns: repeat(auto-fill, 54mm); gap: 4mm; }
.cards.kd-mode.landscape { grid-template-columns: repeat(auto-fill, 86mm); }
.cards.kd-mode .kd { width: 54mm; break-inside: avoid; page-break-inside: avoid; }
.cards.kd-mode.landscape .kd { width: 86mm; }
.cards.kd-mode.cut .kd { outline: .2mm dashed #9AA8A7; outline-offset: 0; }
@media screen { .cards.kd-mode .kd { box-shadow: 0 6px 16px -8px rgba(0,0,0,.35); } }
@media print {
  .cards.kd-mode { grid-template-columns: repeat(3, 54mm); gap: 3mm; justify-content: center; }
  .cards.kd-mode.landscape { grid-template-columns: repeat(2, 86mm); }
}

/* =========================================================
   Ceklok guru
   ========================================================= */
.ck { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.ck-main { background: var(--deep); color: #fff; border-radius: var(--radius-lg); padding: 26px; display: flex; flex-direction: column; gap: 18px; align-items: center; text-align: center; }
.ck-clock .clock { font-size: clamp(54px, 9vw, 84px); }
.ck-today { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 420px; }
.ck-chip { background: rgba(255,255,255,.08); border-radius: 14px; padding: 12px 14px; text-align: left; border: 1px solid transparent; }
.ck-chip span { display: block; font-size: 12.5px; color: rgba(255,255,255,.65); }
.ck-chip b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.ck-chip small { font-size: 12px; color: rgba(255,255,255,.6); }
.ck-chip.ok { border-color: rgba(103,217,154,.45); } .ck-chip.ok small { color: #8BE3B2; }
.ck-chip.bad { border-color: rgba(242,176,97,.55); } .ck-chip.bad small { color: #F7C68A; }
.ck-radar-w { width: 100%; max-width: 260px; }
.ck-radar { width: 100%; display: block; }
.ck-ring { fill: none; stroke: rgba(255,255,255,.1); }
.ck-axis { stroke: rgba(255,255,255,.07); }
.ck-area { fill: rgba(95,198,195,.18); stroke: #5FC6C3; stroke-width: 2; stroke-dasharray: 5 4; }
.ck-n { fill: rgba(255,255,255,.5); font-size: 11px; text-anchor: middle; font-weight: 700; font-family: var(--font); }
.ck-sch { fill: #fff; } .ck-sch-r { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linejoin: round; }
.ck-acc { fill-opacity: .16; stroke-width: 1; } .ck-acc.in { fill: #67D99A; stroke: #67D99A; } .ck-acc.out { fill: #F2B061; stroke: #F2B061; }
.ck-me { stroke: #fff; stroke-width: 2; } .ck-me.in { fill: #2E9A5B; } .ck-me.out { fill: #DE8A2C; }
.ck-loc { min-height: 48px; }
.ck-msg { font-size: 15px; color: rgba(255,255,255,.85); line-height: 1.45; max-width: 380px; margin: 0 auto; }
.ck-msg:has(.ck-spin) { display: inline-flex; align-items: center; gap: 8px; }
.ck-msg.good b { color: #8BE3B2; } .ck-msg.bad { color: #F7C68A; } .ck-msg b { font-size: 18px; }
.ck-acc-t { font-size: 12.5px; color: rgba(255,255,255,.6); margin-top: 4px; }
.ck-spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.ck-actions { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.ck-btn { width: 100%; height: 64px; border: 0; border-radius: 18px; font: inherit; font-size: 19px; font-weight: 800; cursor: pointer; color: #fff; transition: transform .06s, filter .15s; }
.ck-btn.masuk { background: #2E9A5B; box-shadow: 0 10px 24px -10px rgba(46,154,91,.8); }
.ck-btn.keluar { background: var(--amber); box-shadow: 0 10px 24px -10px rgba(222,138,44,.8); }
.ck-btn:active { transform: translateY(2px); }
.ck-btn[disabled] { background: rgba(255,255,255,.12); color: rgba(255,255,255,.5); box-shadow: none; cursor: not-allowed; }
.btn.ck-refresh { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }
.btn.ck-refresh:hover { background: rgba(255,255,255,.08); }
.ck-done { background: rgba(103,217,154,.15); color: #A8EBC4; border-radius: 14px; padding: 16px; font-weight: 700; width: 100%; }
.ck-side { min-width: 0; }
.ck-jadwal { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ck-jadwal div { background: var(--line-2); border-radius: 12px; padding: 10px 12px; }
.ck-jadwal span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.ck-jadwal b { font-size: 18px; font-variant-numeric: tabular-nums; }
.ck-jadwal small { display: block; font-size: 11.5px; color: var(--muted); }
.ck-hist { display: flex; flex-direction: column; }
.ck-h-row { display: grid; grid-template-columns: 44px 1fr 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.ck-h-row:last-child { border-bottom: 0; }
.ck-h-d { text-align: center; line-height: 1.1; } .ck-h-d b { display: block; font-size: 17px; } .ck-h-d span { font-size: 11.5px; color: var(--muted); }
@media (max-width: 900px) { .ck { grid-template-columns: 1fr; } .ck-main { padding: 22px 16px; } }

/* Admin */
.ca-sum { display: flex; gap: 6px; flex-wrap: wrap; }
.rk td.late { color: var(--red); font-weight: 800; }

/* Pengaturan ceklok */
.ck-koord-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ck-koord-row .input { flex: 1 1 220px; font-variant-numeric: tabular-nums; }
.ck-map { height: 320px; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; background: var(--line-2); position: relative; z-index: 0; isolation: isolate; }
.ck-radius { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ck-radius input[type=range] { flex: 1 1 200px; accent-color: var(--teal); }
.ck-radius b { min-width: 64px; font-variant-numeric: tabular-nums; }
.ck-radius .input { width: 96px; }
.ck-jam-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ck-jam-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
@media (max-width: 1100px) { .ck-jam-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Impor siswa ---------- */
.im-steps { list-style: none; counter-reset: st; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.im-steps li { counter-increment: st; background: var(--line-2); border-radius: 12px; padding: 12px 14px 12px 46px; position: relative; font-size: 13px; }
.im-steps li::before { content: counter(st); position: absolute; left: 12px; top: 12px; width: 24px; height: 24px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; }
.im-steps b { display: block; font-size: 14px; }
.im-steps span { color: var(--muted); line-height: 1.4; display: block; margin-top: 2px; }
.im-dl { display: flex; gap: 8px; flex-wrap: wrap; }
.im-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 30px 16px; border: 2px dashed var(--teal-100); border-radius: 16px; cursor: pointer; background: #FAFCFC; transition: background .15s, border-color .15s; }
.im-drop:hover, .im-drop.over { background: var(--teal-50); border-color: var(--teal); }
.im-drop-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--teal-50); color: var(--teal); display: grid; place-items: center; margin-bottom: 4px; }
.im-drop-ic svg { width: 24px; height: 24px; }
.im-drop b { font-size: 15px; } .im-drop span { font-size: 12.5px; color: var(--muted); }
.im-loading { text-align: center; padding: 30px 0; color: var(--muted); }
.im-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--line-2); border-radius: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.im-file svg { width: 20px; height: 20px; color: var(--teal); }
.im-file span { color: var(--muted); font-size: 13px; }
.im-file .btn { margin-left: auto; }
.im-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.im-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.im-card b { display: block; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.im-card span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.im-card.ok b { color: var(--green); } .im-card.bad b { color: var(--red); } .im-card.bad { border-color: #F1C2C0; background: var(--red-50); }
.im-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--amber-50); margin-bottom: 8px; font-size: 13.5px; cursor: pointer; }
.im-opt input[type=checkbox] { margin-top: 3px; accent-color: var(--teal); width: 16px; height: 16px; }
.im-opt small { display: block; color: var(--amber-ink); opacity: .8; font-size: 12.5px; margin-top: 2px; }
.im-radio { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 6px; }
.im-radio label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.im-radio input { accent-color: var(--teal); }
.im-table { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.im-table .tbl th { position: sticky; top: 0; background: #fff; z-index: 1; }
.im-table .tbl td, .im-table .tbl th { padding: 8px 10px; }
.im-err td { background: #FFF8F7; }
.im-msg { color: var(--red); font-size: 12px; margin-top: 3px; line-height: 1.35; }
.im-foot { display: flex; align-items: center; gap: 10px; width: 100%; flex-wrap: wrap; }
@media (max-width: 640px) { .im-steps, .im-sum { grid-template-columns: 1fr; } .im-dl .btn { flex: 1; } }
/* Garis waktu jam ceklok */
.ck-tl-w { padding: 18px 24px 4px; border-bottom: 1px solid var(--line-2); }
.ck-tl-w .timeline { margin: 4px 0 6px; }
.timeline .win.tp { background: var(--teal); }
.timeline .win.tl { background: #E07B6B; }
.timeline .win.pl { background: var(--amber); }
.timeline .win.pa { background: repeating-linear-gradient(45deg, #F3C68F 0 5px, #FBE5C9 5px 10px); }
.ck-tl-key { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; padding-bottom: 12px; }
.ck-tl-key i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.ck-tl-key .tp { background: var(--teal); } .ck-tl-key .tl { background: #E07B6B; } .ck-tl-key .pl { background: var(--amber); }
.ck-tl-key .pa { background: repeating-linear-gradient(45deg, #F3C68F 0 3px, #FBE5C9 3px 6px); }
@media (max-width: 860px) { .ck-tl-w { padding: 16px 18px 4px; } }
.ck-btn small { display: block; font-size: 12.5px; font-weight: 600; margin-top: 2px; opacity: .9; }
.ck-btn:has(small) { height: auto; padding: 12px 10px; }
.ck-note { font-size: 13px; color: #F7C68A; line-height: 1.4; }
.ck-jadwal .ck-j-m { border-left: 3px solid var(--teal); }
.ck-jadwal .ck-j-p { border-left: 3px solid var(--amber); }

/* Ukuran QR di desain kartu */
.kd-qrsize { border-radius: 10px; padding: 10px 12px; margin: 4px 0 10px; font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.kd-qrsize b { font-size: 13px; }
.kd-qrsize.ok { background: #E4F4EA; color: #1F7343; }
.kd-qrsize.warn { background: var(--amber-50); color: var(--amber-ink); }
.kd-qrsize.bad { background: var(--red-50); color: var(--red); }
.kd-qrsize .btn { margin-top: 4px; }
.kd-warn { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 3px; }
.kd-warn.warn { color: var(--amber-ink); } .kd-warn.bad { color: var(--red); }
/* QR vektor: biarkan tajam */
.kd-qr { image-rendering: auto; }
.idcard .bd .qr img { image-rendering: auto; }
.cards .empty { grid-column: 1 / -1; }

/* Izin / sakit */
.badge.izin { background: #E6F0FD; color: #1E6FD9; }
.badge.sakit { background: #F3E8F9; color: #8E44AD; }
.h-ket { font-size: 12px; color: var(--muted); margin-top: 3px; max-width: 240px; line-height: 1.35; }
.h-seg { flex-wrap: wrap; }
.h-seg .h-n { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: rgba(0,0,0,.06); font-size: 11.5px; margin-left: 4px; font-variant-numeric: tabular-nums; }
.st-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.st-opt { border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 14px; text-align: left; cursor: pointer; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; font: inherit; color: var(--ink); }
.st-opt b { grid-row: span 2; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; font-weight: 800; }
.st-opt span { font-weight: 700; }
.st-opt small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.st-opt.izin b { background: #E6F0FD; color: #1E6FD9; } .st-opt.izin.on { border-color: #1E6FD9; background: #F5F9FF; }
.st-opt.sakit b { background: #F3E8F9; color: #8E44AD; } .st-opt.sakit.on { border-color: #8E44AD; background: #FBF6FD; }
.st-opt.hapus b { background: var(--line-2); color: var(--muted); } .st-opt.hapus.on { border-color: var(--muted); }
.rk td.izin { color: #1E6FD9; font-weight: 800; } .rk td.sakit { color: #8E44AD; font-weight: 800; }
.rk td.tot.izin, .rk td.tot.sakit { font-weight: 700; }
.t-izin { color: #1E6FD9; } .t-sakit { color: #8E44AD; }

