/* style.css — tema & komponen PROGO Absensi V3 (dark default, light via data-theme) */
:root, [data-theme="dark"] {
  --bg: #0a0f1f; --card: #131b33; --card2: #1b2545; --line: #263156; --txt: #e8ecf9; --muted: #8a95b8;
  --brand: #6366f1; --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444; --info: #38bdf8; --vio: #a78bfa;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f3f5fb; --card: #ffffff; --card2: #eef1fa; --line: #dde2f0; --txt: #151b33; --muted: #667092;
  --brand: #4f46e5; --ok: #16a34a; --warn: #d97706; --bad: #dc2626; --info: #0284c7; --vio: #7c3aed;
  color-scheme: light;
}
* { -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--txt); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior-y: none; }
[hidden] { display: none !important; }
body.no-scroll { overflow: hidden; }
.no-scrollbar, .chips { scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.muted { color: var(--muted); }
.t-ok { color: var(--ok); } .t-warn { color: var(--warn); } .t-bad { color: var(--bad); } .t-info { color: var(--info); }

/* Komponen dasar */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.card2 { background: var(--card2); border-radius: 14px; }
.lbl { display: block; margin: 1rem 0 .35rem; font-size: .75rem; font-weight: 600; color: var(--muted); }
.input { width: 100%; background: var(--card2); border: 1px solid var(--line); color: var(--txt); border-radius: 12px; padding: .7rem .85rem; font-size: 16px; outline: none; }
.input:focus { border-color: var(--brand); }
.input:disabled { opacity: .6; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font-weight: 600; border-radius: 14px; padding: .8rem 1rem; border: 1px solid transparent; cursor: pointer; user-select: none; transition: transform .12s, opacity .12s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-lg { width: 100%; padding: 1.05rem 1.25rem; font-size: 1.05rem; border-radius: 18px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-bad { background: var(--bad); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--txt); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--txt); flex-shrink: 0; }
.chips { display: flex; gap: .5rem; overflow-x: auto; }
.chip { padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: .85rem; font-weight: 600; white-space: nowrap; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.seg button { padding: .6rem 0; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Badge & status */
.badge { display: inline-flex; align-items: center; padding: .12rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.b-ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.b-warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.b-bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.b-info { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }
.b-vio { background: color-mix(in srgb, var(--vio) 18%, transparent); color: var(--vio); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); } .dot-bad { background: var(--bad); } .dot-info { background: var(--info); }
.dot-pulse { animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }
.note { padding: .6rem .8rem; border-radius: 12px; font-size: .8rem; font-weight: 600; }
.note-ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.note-warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.res-card { border-color: var(--ok); }

/* Absen */
.big-time { font-size: 3rem; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin: .25rem 0; }
.bar { height: 10px; border-radius: 999px; background: var(--card2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--ok)); border-radius: 999px; transition: width .6s linear; }

/* List */
.log-item { border-left: 4px solid var(--line); }
.l-ok { border-left-color: var(--ok); } .l-warn { border-left-color: var(--warn); } .l-bad { border-left-color: var(--bad); }
.l-info { border-left-color: var(--info); } .l-vio { border-left-color: var(--vio); }
.row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .65rem .75rem; background: var(--card2); border-radius: 14px; }
.sum-row { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; cursor: pointer; list-style: none; }
.sum-row::-webkit-details-marker { display: none; }
.sum-box { padding: .6rem .2rem; text-align: center; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.tbl { width: 100%; border-collapse: collapse; font-size: .8rem; white-space: nowrap; }
.tbl th, .tbl td { padding: .55rem .6rem; text-align: center; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-weight: 600; font-size: .7rem; }
.tbl th:first-child, .tbl td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); }
.tbl tfoot td { font-weight: 800; border-bottom: 0; }

/* Layout */
.app-head { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.avatar { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--brand), var(--ok)); flex-shrink: 0; }
#view { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
#bottom-nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 430px; display: flex; gap: .25rem; padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); z-index: 30; }
.nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .45rem 0; border-radius: 12px; color: var(--muted); font-size: .7rem; font-weight: 600; }
.nav-btn.on { color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); }

/* PIN pad */
.pin-dots { display: flex; justify-content: center; gap: 1rem; margin-top: 1.25rem; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); transition: .15s; }
.pin-dot.on { background: var(--brand); border-color: var(--brand); transform: scale(1.15); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; max-width: 320px; width: 100%; margin-left: auto; margin-right: auto; }
.pin-key { height: 64px; border-radius: 20px; font-size: 1.6rem; font-weight: 700; background: var(--card); border: 1px solid var(--line); color: var(--txt); display: grid; place-items: center; }
.pin-key:active { background: var(--card2); transform: scale(.95); }
.shake { animation: shake .4s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }

/* Sheet, toast, loader */
.sheet-back { position: fixed; inset: 0; background: rgba(2, 6, 23, .6); display: flex; align-items: flex-end; justify-content: center; z-index: 50; animation: fade .15s; }
.sheet { width: 100%; max-width: 430px; max-height: 88vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-bottom: 0; border-radius: 24px 24px 0 0; padding: .6rem 1rem calc(1rem + env(safe-area-inset-bottom)); animation: up .22s ease; }
.sheet-grip { width: 42px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto .8rem; }
.sheet-back.out { opacity: 0; transition: opacity .18s; }
.sheet-back.out .sheet { transform: translateY(30px); transition: transform .18s; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }
#toast-root { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: .5rem; pointer-events: none; padding: 0 1rem; }
.toast { max-width: 398px; width: 100%; padding: .75rem 1rem; border-radius: 14px; font-size: .85rem; font-weight: 600; color: #fff; box-shadow: 0 10px 28px rgba(0, 0, 0, .35); animation: up .2s ease; }
.toast.t-ok { background: #15803d; } .toast.t-bad { background: #b91c1c; } .toast.t-warn { background: #b45309; } .toast.t-info { background: #4338ca; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .2s; }
.skeleton { border-radius: 18px; background: linear-gradient(90deg, var(--card) 25%, var(--card2) 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
