/* ============================================================
   SIMPADU — Sistem Absensi Digital MAN 3 Sukabumi
   Tema: Madrasah Modern (hijau emerald + emas, bersih & responsif)
   ============================================================ */
:root {
  --g950: #04240f;
  --g900: #06371a;
  --g800: #0b4a24;
  --g700: #14602f;
  --g600: #1c7a3d;
  --g100: #e3f4e9;
  --gold: #d99a06;
  --gold-soft: #f5c542;
  --bg: #f4f7f4;
  --surface: #ffffff;
  --text: #1c2b21;
  --muted: #64756b;
  --border: #e2e9e4;
  --ok: #16a34a;
  --warn: #d97706;
  --info: #0d9488;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(6, 55, 26, .07), 0 4px 14px rgba(6, 55, 26, .05);
  --sidebar-w: 252px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
}
a { color: var(--g700); text-decoration: none; }
a:hover { color: var(--g800); }
img, svg { vertical-align: middle; }
h1, h2, h3 { line-height: 1.25; }
.muted { color: var(--muted); }
.text-sm { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; }
.nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.mt-2 { margin-top: .5rem; } .mt-4 { margin-top: 1rem; } .mb-4 { margin-bottom: 1rem; }

/* ---------------- Layout ---------------- */
.layout { min-height: 100vh; }
.main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
  transition: margin .25s ease;
}
.content { flex: 1; padding: 22px 24px 32px; max-width: 1280px; width: 100%; margin: 0 auto; }
.app-footer {
  margin-top: auto;
  padding: 14px 24px;
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ---------------- Sidebar ---------------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(175deg, var(--g950), var(--g800));
  color: #e7f3ea;
  display: flex; flex-direction: column;
  padding: 18px 14px;
  z-index: 60;
}
.sidebar::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(circle at 85% -5%, rgba(245, 197, 66, .14), transparent 42%),
    radial-gradient(circle at -10% 100%, rgba(28, 122, 61, .35), transparent 45%);
}
.brand { position: relative; display: flex; gap: 12px; align-items: center; padding: 6px 8px 16px; border-bottom: 1px solid rgba(255, 255, 255, .09); }
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: #06371a; box-shadow: 0 4px 12px rgba(217, 154, 6, .35);
}
.brand-logo svg { width: 22px; height: 22px; }
.brand-name { font-weight: 800; letter-spacing: .14em; font-size: 1.05rem; color: #fff; }
.brand-sub { font-size: .72rem; color: rgba(231, 243, 234, .75); }
.nav { position: relative; flex: 1; overflow-y: auto; padding: 14px 0; display: flex; flex-direction: column; gap: 3px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  color: rgba(231, 243, 234, .82); font-weight: 600; font-size: .88rem;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-link.active { background: rgba(245, 197, 66, .16); color: var(--gold-soft); box-shadow: inset 3px 0 0 var(--gold-soft); }
.nav-ico { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-link-ext { border: 1px dashed rgba(255, 255, 255, .18); margin-top: 6px; }
.sidebar-foot { position: relative; border-top: 1px solid rgba(255, 255, 255, .09); padding-top: 12px; }
.user-chip { display: flex; gap: 10px; align-items: center; padding: 4px 6px 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 800;
  background: rgba(245, 197, 66, .2); color: var(--gold-soft);
  border: 1px solid rgba(245, 197, 66, .4);
}
.user-name { font-weight: 700; font-size: .85rem; color: #fff; }
.user-role { font-size: .72rem; color: rgba(231, 243, 234, .65); }

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-title { font-size: 1.12rem; font-weight: 800; color: var(--g900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.top-clock { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--g700); font-size: .9rem; }
.hamburger { display: none; background: none; border: 1px solid var(--border); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; color: var(--g800); }
.hamburger svg { width: 20px; height: 20px; }

/* Bell / notifikasi */
.bell { position: relative; }
.bell-btn {
  position: relative; width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--g800);
  display: grid; place-items: center;
}
.bell-btn svg { width: 19px; height: 19px; }
.bell-btn:hover { background: var(--g100); }
.bell-count {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
  padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff;
  font-size: .68rem; font-weight: 800; display: grid; place-items: center;
}
.bell-menu {
  display: none; position: absolute; right: 0; top: 48px; width: 330px; max-width: 86vw;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; z-index: 70;
}
.bell-menu.open { display: block; }
.bell-head { padding: 11px 14px; font-weight: 800; font-size: .85rem; border-bottom: 1px solid var(--border); background: var(--g100); color: var(--g900); }
.bell-list { max-height: 330px; overflow-y: auto; }
.bell-item { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.bell-item:last-child { border-bottom: 0; }
.bell-item.unread { background: #f6fbf7; border-left: 3px solid var(--g600); }
.bell-title { font-weight: 700; font-size: .82rem; color: var(--g900); }
.bell-msg { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.bell-time { font-size: .7rem; color: #9aa8a0; margin-top: 3px; }
.bell-empty { padding: 26px; text-align: center; color: var(--muted); font-size: .82rem; }

/* ---------------- Kartu & grid ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-title { font-weight: 800; font-size: .95rem; color: var(--g900); margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; position: relative; overflow: hidden;
}
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--g600); }
.stat-card.ok::before { background: var(--ok); }
.stat-card.warn::before { background: var(--warn); }
.stat-card.info::before { background: var(--info); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.gold::before { background: var(--gold); }
.stat-label { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.stat-value { font-size: 1.7rem; font-weight: 800; color: var(--g900); font-variant-numeric: tabular-nums; }
.stat-sub { font-size: .75rem; color: var(--muted); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { font-size: 1.35rem; font-weight: 800; color: var(--g900); }
.page-head p { color: var(--muted); font-size: .87rem; }
.chart-box { position: relative; height: 280px; }
.chart-box-sm { position: relative; height: 230px; }

/* ---------------- Tabel ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 640px; }
.table th {
  text-align: left; padding: 11px 14px; background: var(--g100); color: var(--g900);
  font-weight: 800; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #f8fbf9; }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------- Badge & chip ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .73rem; font-weight: 800; letter-spacing: .02em; white-space: nowrap;
}
.badge-ok { background: #dcfce7; color: #15803d; }
.badge-warn { background: #fef3c7; color: #b45309; }
.badge-info { background: #ccfbf1; color: #0f766e; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-muted { background: #eef1ef; color: #5b6b61; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  border-radius: 999px; background: var(--g100); color: var(--g800);
  font-size: .8rem; font-weight: 700;
}

/* ---------------- Tombol ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font-family: inherit; font-size: .86rem; font-weight: 700; cursor: pointer;
  transition: filter .15s, background .15s; text-decoration: none; min-height: 38px;
}
.btn:hover { filter: brightness(.96); }
.btn-primary { background: var(--g700); color: #fff; }
.btn-primary:hover { color: #fff; background: var(--g800); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-soft)); color: #3c2a00; }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--g800); }
.btn-outline:hover { background: var(--g100); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: rgba(255, 255, 255, .08); color: #e7f3ea; border-color: rgba(255, 255, 255, .16); }
.btn-ghost:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: .78rem; min-height: 30px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------------- Form ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field label { font-weight: 700; font-size: .8rem; color: var(--g900); }
.field .hint { font-size: .73rem; color: var(--muted); }
.field input, .field select, .field textarea, .input {
  font-family: inherit; font-size: .88rem; color: var(--text);
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 10px;
  background: #fbfdfb; outline: none; transition: border .15s, box-shadow .15s;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  border-color: var(--g600); box-shadow: 0 0 0 3px rgba(28, 122, 61, .13); background: #fff;
}
.field textarea { resize: vertical; min-height: 70px; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filter-bar .field { margin-bottom: 0; min-width: 150px; }
.inline-form { display: inline; }

/* ---------------- Alert ---------------- */
.alert {
  padding: 12px 16px; border-radius: 12px; margin-bottom: 14px;
  font-size: .87rem; font-weight: 600; border: 1px solid;
  transition: opacity .4s;
}
.alert-ok { background: #ecfdf3; border-color: #a7f3c9; color: #136c34; }
.alert-info { background: #effefb; border-color: #99f6e4; color: #0f766e; }
.alert-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-danger { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 9px 18px; border-radius: 10px 10px 0 0; font-weight: 700; font-size: .87rem;
  color: var(--muted); border: none; background: none; cursor: pointer; text-decoration: none;
}
.tab:hover { color: var(--g800); background: var(--g100); }
.tab.active { color: var(--g900); background: var(--g100); box-shadow: inset 0 -2px 0 var(--g700); }

/* ---------------- Feed ---------------- */
.feed { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.feed-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px; background: #fbfdfb;
}
.feed-item.flagged { border-color: #fecaca; background: #fff7f7; }
.feed-time { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--g700); font-size: .82rem; min-width: 44px; }
.feed-name { font-weight: 700; font-size: .87rem; }
.feed-sub { font-size: .76rem; color: var(--muted); }

/* ---------------- Pagination & empty ---------------- */
.pagination { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
  font-size: .82rem; font-weight: 700; background: var(--surface);
}
.pagination span.current { background: var(--g700); color: #fff; border-color: var(--g700); }
.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-state svg { width: 46px; height: 46px; opacity: .4; margin-bottom: 10px; }

/* ---------------- Progress ---------------- */
.progress { height: 8px; border-radius: 99px; background: #e8efe9; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--g600), var(--ok)); }

/* ---------------- Kustom scrollbar ---------------- */
.feed::-webkit-scrollbar, .bell-list::-webkit-scrollbar, .table-wrap::-webkit-scrollbar,
.nav::-webkit-scrollbar, .scroll-y::-webkit-scrollbar { width: 8px; height: 8px; }
.feed::-webkit-scrollbar-thumb, .bell-list::-webkit-scrollbar-thumb, .table-wrap::-webkit-scrollbar-thumb,
.nav::-webkit-scrollbar-thumb, .scroll-y::-webkit-scrollbar-thumb { background: #c6d3c9; border-radius: 8px; }
.feed::-webkit-scrollbar-thumb:hover, .bell-list::-webkit-scrollbar-thumb:hover { background: #a9baae; }
.scroll-y { max-height: 420px; overflow-y: auto; }

/* ---------------- Login ---------------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(circle at 12% 18%, rgba(245, 197, 66, .16), transparent 30%),
    radial-gradient(circle at 88% 80%, rgba(28, 122, 61, .3), transparent 40%),
    linear-gradient(165deg, var(--g950), var(--g800));
}
.login-card {
  width: 100%; max-width: 420px; background: var(--surface);
  border-radius: 20px; box-shadow: 0 24px 60px rgba(4, 36, 15, .45);
  padding: 34px 30px;
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: #06371a; box-shadow: 0 8px 22px rgba(217, 154, 6, .4);
}
.login-logo svg { width: 32px; height: 32px; }
.login-brand h1 { font-size: 1.3rem; font-weight: 800; color: var(--g900); letter-spacing: .08em; }
.login-brand p { color: var(--muted); font-size: .85rem; margin-top: 3px; }
.login-foot { text-align: center; margin-top: 18px; font-size: .76rem; color: var(--muted); }

/* ---------------- Kartu ID (cetak) ---------------- */
.idcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.idcard {
  border: 1.5px solid var(--g800); border-radius: 14px; overflow: hidden;
  background: #fff; page-break-inside: avoid;
}
.idcard-head { background: linear-gradient(135deg, var(--g900), var(--g700)); color: #fff; padding: 10px 12px; text-align: center; }
.idcard-head .t { font-weight: 800; font-size: .82rem; letter-spacing: .04em; }
.idcard-head .s { font-size: .68rem; opacity: .85; }
.idcard-body { display: flex; gap: 12px; padding: 12px; align-items: center; }
.idcard-info { flex: 1; min-width: 0; }
.idcard-info .nm { font-weight: 800; font-size: .95rem; color: var(--g900); line-height: 1.3; }
.idcard-info .meta { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.idcard-qr { width: 104px; height: 104px; flex: none; background: #fff; }
.idcard-foot { background: var(--g100); text-align: center; font-size: .68rem; font-weight: 700; color: var(--g800); padding: 6px; letter-spacing: .06em; }

/* ---------------- Responsif ---------------- */
@media (max-width: 960px) {
  .main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: none; }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 20px 0 60px rgba(0, 0, 0, .3); }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(4, 36, 15, .5); z-index: 55; }
  body.sidebar-open .sidebar-overlay { display: block; }
  .hamburger { display: grid; place-items: center; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 16px 14px 26px; }
  .topbar { padding: 10px 14px; }
  .top-clock { display: none; }
}
@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 1.4rem; }
  .page-head h2 { font-size: 1.15rem; }
}

/* ---------------- Aksesibilitas ---------------- */
:focus-visible { outline: 2.5px solid var(--gold); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
