/* ================================================
   SiAbsen — app.css
   ================================================ */

:root {
  --navy        : #0B1E3D;
  --navy-mid    : #1A3460;
  --accent      : #00C2A8;
  --accent-dim  : #00A38D;
  --accent-faint: rgba(0,194,168,.10);
  --surface     : #ffffff;
  --surface-alt : #F5F7FA;
  --border      : rgba(11,30,61,.09);
  --border-mid  : rgba(11,30,61,.16);
  --text-primary: #0B1E3D;
  --text-secondary: #4A5D7A;
  --text-muted  : #8A9BB3;
  --success     : #00C2A8;
  --warn        : #F59E0B;
  --danger      : #EF4444;
  --info        : #3B82F6;
  --radius      : 12px;
  --radius-sm   : 8px;
  --shadow      : 0 2px 16px rgba(11,30,61,.07);
  --shadow-lg   : 0 8px 40px rgba(11,30,61,.12);
  --sidebar-w   : 240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--surface-alt);
  color: var(--text-primary);
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
code {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 12px;
  background: var(--surface-alt);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ── Shell / Layout ──────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 1.4rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.logo-mark { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.logo-text { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; color: #fff; }
.logo-sub  { font-size: 10px; color: rgba(255,255,255,.38); text-transform: uppercase; letter-spacing: .08em; }

.sidebar-nav  { flex: 1; padding: .75rem 0; }
.nav-group-label {
  font-size: 10px; font-weight: 600;
  color: rgba(255,255,255,.28);
  letter-spacing: .1em; text-transform: uppercase;
  padding: .5rem 1.25rem .2rem;
  margin-top: .4rem;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: .58rem 1.25rem;
  color: rgba(255,255,255,.58);
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all .15s;
  cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: rgba(255,255,255,.9); }
.nav-item.active {
  background: rgba(0,194,168,.12);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}
.nav-icon { font-size: 16px; flex-shrink: 0; }
.nav-dot  { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: auto; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.07);
}
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; color: rgba(255,255,255,.85); }
.user-role { font-size: 11px; color: rgba(255,255,255,.38); }

/* ── Main area ───────────────────────────────────────────────────── */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 60px;
  padding: 0 1.75rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-date  { font-size: 13px; color: var(--text-secondary); }
.page-wrap    { padding: 1.75rem; display: flex; flex-direction: column; gap: 1.25rem; flex: 1; }

/* ── Alert / Flash ───────────────────────────────────────────────── */
.alert {
  padding: .75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  border-left: 4px solid;
}
.alert-success { background: rgba(0,194,168,.1);  border-color: var(--accent);  color: #00836F; }
.alert-danger  { background: rgba(239,68,68,.1);  border-color: var(--danger);  color: #B91C1C; }
.alert-info    { background: rgba(59,130,246,.1); border-color: var(--info);    color: #1D4ED8; }

/* ── Stat cards ──────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat-value { font-family: 'Syne', sans-serif; font-size: 30px; font-weight: 700; line-height: 1; }
.stat-delta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.stat-accent { border-top: 3px solid var(--accent); }
.stat-warn   { border-top: 3px solid var(--warn);   }
.stat-danger { border-top: 3px solid var(--danger);  }
.stat-info   { border-top: 3px solid var(--info);    }

/* ── Card ────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body  { padding: 0; }

/* ── Table ───────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: var(--surface-alt); }
th {
  text-align: left;
  padding: .6rem 1.25rem;
  color: var(--text-muted);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
}
td { padding: .72rem 1.25rem; border-top: 1px solid var(--border); }
tr:hover td { background: rgba(245,247,250,.7); }
tfoot td { padding: .72rem 1.25rem; border-top: 2px solid var(--border); }
.empty-td { text-align: center; padding: 2.5rem; color: var(--text-muted); font-size: 13px; }

/* ── Pills ───────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.pill-success { background: rgba(0,194,168,.1);  color: #00836F; }
.pill-warn    { background: rgba(245,158,11,.1); color: #B45309; }
.pill-danger  { background: rgba(239,68,68,.1);  color: #B91C1C; }
.pill-info    { background: rgba(59,130,246,.1); color: #1D4ED8; }
.pill-gray    { background: rgba(11,30,61,.07);  color: var(--text-secondary); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: .44rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; font-family: inherit;
  transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--navy);   color: #fff; }
.btn-primary:hover { background: var(--navy-mid); }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-accent:hover  { background: var(--accent-dim); }
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
}
.btn-outline:hover { background: var(--surface-alt); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Form ────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .05em;
}
.form-input, .form-select {
  padding: .55rem .85rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus { border-color: var(--accent); }
.form-select { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Two-col layout ──────────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

/* ── Summary grid ────────────────────────────────────────────────── */
.summary-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.5rem; }
.summary-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.summary-value { font-family: 'Syne',sans-serif; font-size: 26px; font-weight: 700; }

/* ── Bar chart ───────────────────────────────────────────────────── */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 130px; }
.bar-col   { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.bar-val   { font-size: 10px; color: var(--text-muted); }
.bar-fill  {
  width: 100%; border-radius: 4px 4px 0 0;
  background: var(--accent); opacity: .8;
  min-height: 4px;
  transition: opacity .15s;
}
.bar-fill:hover { opacity: 1; }
.bar-lbl { font-size: 10px; color: var(--text-muted); }

/* ── Progress bar ────────────────────────────────────────────────── */
.progress-bar-bg   { background: var(--surface-alt); border-radius: 20px; height: 8px; overflow: hidden; width: 100%; }
.progress-bar-fill { height: 100%; border-radius: 20px; background: var(--accent); }

/* ── Mini avatar ─────────────────────────────────────────────────── */
.mini-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}

/* ── Live dot ────────────────────────────────────────────────────── */
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  display: inline-block;
  animation: livePulse 2s infinite;
}
@keyframes livePulse {
  0%,100% { opacity: 1; }
  50% { opacity: .3; }
}

/* ── Absen page ──────────────────────────────────────────────────── */
.absen-layout { display: grid; grid-template-columns: 320px 1fr; gap: 1.25rem; align-items: start; }
.absen-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex; flex-direction: column; align-items: center; gap: 1.1rem;
  text-align: center;
}
.time-display { font-family: 'Syne',sans-serif; font-size: 38px; font-weight: 700; letter-spacing: -.02em; }
.date-display { font-size: 13px; color: var(--text-secondary); }
.fp-ring {
  width: 116px; height: 116px; border-radius: 50%;
  border: 3px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color .2s;
}
.fp-ring:hover  { border-color: var(--accent); }
.fp-ring.scanning { border-color: var(--accent); animation: fpPulse 1.4s infinite; }
.fp-ring.success  { border-color: var(--accent); }
.fp-ring.fail     { border-color: var(--danger); }
@keyframes fpPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(0,194,168,.35); }
  50%     { box-shadow: 0 0 0 18px rgba(0,194,168,0); }
}
.fp-icon   { font-size: 52px; }
.fp-label  { font-size: 13px; color: var(--text-muted); }
.fp-status { font-size: 13px; font-weight: 500; min-height: 18px; }
.fp-status.ok  { color: var(--success); }
.fp-status.err { color: var(--danger);  }
.time-stat { font-family: 'Syne',sans-serif; font-size: 22px; font-weight: 700; }

/* ── Profile page ────────────────────────────────────────────────── */
.profile-grid { display: grid; grid-template-columns: 240px 1fr; gap: 1.25rem; align-items: start; }
.profile-card { display: flex; flex-direction: column; align-items: center; gap: .85rem; padding: 2rem; text-align: center; }
.profile-avatar {
  width: 78px; height: 78px; border-radius: 50%;
  background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne',sans-serif; font-size: 28px; font-weight: 700; color: #fff;
}
.profile-name { font-size: 17px; font-weight: 600; }
.profile-id   { font-size: 12px; color: var(--text-muted); }

/* ── Modal ───────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(11,30,61,.45);
  z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.75rem;
  width: 490px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 1.1rem;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; }
.modal-title  { font-size: 16px; font-weight: 600; }
.modal-close  { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--text-muted); }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding-top: .75rem; border-top: 1px solid var(--border);
}

/* ── Toast ───────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--navy); color: #fff;
  padding: .75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  display: none; align-items: center; gap: 8px;
  animation: slideUp .25s ease;
}
.toast.show { display: flex; }
@keyframes slideUp {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Login page ──────────────────────────────────────────────────── */
.guest-body { background: var(--surface); }
.login-page { display: flex; min-height: 100vh; }
.login-left {
  flex: 1;
  background: var(--navy);
  display: flex; flex-direction: column; justify-content: center;
  padding: 4rem 3.5rem;
  position: relative; overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute; top: -100px; right: -100px;
  width: 340px; height: 340px; border-radius: 50%;
  background: rgba(0,194,168,.08);
}
.login-left::after {
  content: '';
  position: absolute; bottom: -80px; left: -80px;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(0,194,168,.05);
}
.login-headline {
  font-family: 'Syne',sans-serif;
  font-size: 38px; font-weight: 700;
  color: #fff; line-height: 1.2;
  max-width: 360px; margin-top: 2rem;
}
.login-sub {
  font-size: 14px; color: rgba(255,255,255,.5);
  margin-top: 1rem; max-width: 320px; line-height: 1.7;
}
.login-features { display: flex; flex-direction: column; gap: 6px; margin-top: 1.75rem; }
.login-feat-item { font-size: 13px; color: rgba(255,255,255,.65); }
.login-right {
  width: 460px;
  display: flex; align-items: center; justify-content: center;
  padding: 3rem 2.5rem;
}
.login-form-wrap { width: 100%; }
.login-title { font-family: 'Syne',sans-serif; font-size: 22px; font-weight: 700; margin-bottom: .4rem; }
.login-form-subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 1.25rem; }
.divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-muted); font-size: 12px;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border-mid);
}
.webauthn-btn {
  width: 100%; padding: .8rem;
  background: var(--accent-faint);
  border: 1.5px dashed var(--accent);
  border-radius: var(--radius);
  color: var(--accent-dim);
  font-size: 14px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s;
}
.webauthn-btn:hover { background: rgba(0,194,168,.15); }
.webauthn-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .two-col   { grid-template-columns: 1fr; }
  .absen-layout  { grid-template-columns: 1fr; }
  .profile-grid  { grid-template-columns: 1fr; }
  .summary-grid  { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
  .login-left    { display: none; }
  .login-right   { width: 100%; }
  .stat-grid     { grid-template-columns: 1fr 1fr; }
  .sidebar       { transform: translateX(-100%); }
  .main          { margin-left: 0; }
}
