/* ============ Pantauan Pengajian — gaya antarmuka ============ */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #fafbff;
  --text: #1e2433;
  --muted: #6b7280;
  --muted-2: #9aa1ad;
  --border: #e7e9f2;
  --border-2: #eef0f6;
  --primary: #4f46e5;
  --primary-d: #4338ca;
  --primary-soft: #eef2ff;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 40px rgba(16,24,40,.16);
  --sidebar-w: 244px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-family: var(--font);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
button { font-family: inherit; }
a { color: var(--primary); }

/* Ikon SVG sebaris — mewarisi warna teks, tak menangkap klik (selalu sampai ke tombol). */
.icon { display: inline-block; vertical-align: middle; flex: 0 0 auto; pointer-events: none; }

/* ============ Tata letak ============ */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 22px 16px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; }
.brand-logo { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #7c6cf0); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.35); }
.brand-text strong { display: block; font-size: 15px; line-height: 1.15; }
.brand-text span { font-size: 12px; color: var(--muted); }

.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14.5px; cursor: pointer;
  border: none; background: none; width: 100%; text-align: left; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-d); }
.nav-item .ic { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; }
.nav-spacer { flex: 1; }
.nav-foot { font-size: 11.5px; color: var(--muted-2); padding: 10px 10px 0; text-align: center; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view-root { padding: 24px 34px 72px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 25px; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============ Topbar + akun (kanan atas) ============ */
.topbar { position: sticky; top: 0; z-index: 45; display: none; align-items: center; gap: 12px;
  padding: 11px 24px; min-height: 60px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(8px); }
.topbar-spacer { flex: 1; }
.topbar-brand { display: none; align-items: center; gap: 9px; font-size: 15px; font-weight: 700; }
.brand-logo-sm { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 4px 10px rgba(79,70,229,.3); }

.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--primary), #7c6cf0); color: #fff; font-weight: 700; font-size: 14px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12.5px; }

.acct { position: relative; }
.acct-btn { display: flex; align-items: center; gap: 9px; padding: 5px 9px 5px 5px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.acct-btn:hover { border-color: #d7dae6; box-shadow: var(--shadow); }
.acct.open .acct-btn { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.acct-name { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.acct-name strong { font-size: 13.5px; }
.acct-name span { font-size: 11.5px; color: var(--muted); }
.acct-caret { color: var(--muted-2); transition: transform .18s; }
.acct.open .acct-caret { transform: rotate(180deg); }
.acct-menu { display: none; position: absolute; right: 0; top: calc(100% + 8px); min-width: 244px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 7px; }
.acct.open .acct-menu { display: block; animation: acct-pop .14s ease; }
@keyframes acct-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.acct-menu-head { display: flex; align-items: center; gap: 11px; padding: 9px 10px 12px; margin-bottom: 5px; border-bottom: 1px solid var(--border-2); }
.acct-menu-id { min-width: 0; }
.acct-menu-id strong { display: block; font-size: 14px; }
.acct-menu-id span { font-size: 12px; color: var(--muted); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; border: none; background: none; cursor: pointer;
  padding: 9px 10px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text); text-align: left; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--red); }
.menu-item.danger:hover { background: #fef2f2; }

/* Akun di dasar sidebar (tampilan web): tombol selebar sidebar, menu membuka ke atas */
.acct-sidebar { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--border-2); }
.acct-sidebar .acct-btn { width: 100%; border-radius: 12px; padding: 7px 10px 7px 7px; }
.acct-sidebar .acct-name { flex: 1; min-width: 0; }
.acct-sidebar .acct-name strong, .acct-sidebar .acct-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-sidebar .acct-caret { margin-left: auto; }
.acct-sidebar .acct-menu { left: 0; right: 0; top: auto; bottom: calc(100% + 8px); min-width: 0; }
.acct-sidebar.open .acct-menu { animation: acct-pop-up .14s ease; }
@keyframes acct-pop-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============ Tombol ============ */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 10px;
  border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn:disabled:active { transform: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.28); }
.btn-primary:hover { background: var(--primary-d); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); border-color: #d7dae6; }
.btn-danger { background: #fff; border-color: #f3c6c6; color: var(--red); }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-icon { padding-left: 8px; padding-right: 8px; }
.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 12px 18px; font-size: 15px; border-radius: 12px; }
.icon-btn { background: none; border: none; color: var(--muted-2); cursor: pointer; width: 34px; height: 34px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

/* ============ Kartu ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.grid { display: grid; gap: 16px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); margin: 30px 0 12px; }

/* ============ Ringkasan (stat) ============ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 14px;
  background: color-mix(in srgb, var(--c) 13%, #fff); color: var(--c); }
.stat .v { font-size: 27px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ============ Kartu kategori ============ */
.kat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.kat-card { border-left: 4px solid var(--c, var(--primary)); }
.kat-card h3 { font-size: 16px; }
.kat-stat-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pill { font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-2); color: var(--muted); }
.pill b { color: var(--text); }
.ring-wrap { display: flex; align-items: center; gap: 13px; margin-top: 14px; }
.ring { --p: 0; --c: var(--green); width: 54px; height: 54px; border-radius: 50%; flex: 0 0 auto;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--border) 0); display: grid; place-items: center; }
.ring::before { content: ''; position: absolute; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; font-size: 13px; font-weight: 800; }

/* ============ Chip / badge ============ */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 10px 3px 8px;
  border-radius: 999px; background: color-mix(in srgb, var(--c) 12%, #fff); color: color-mix(in srgb, var(--c) 70%, #333); border: 1px solid color-mix(in srgb, var(--c) 22%, #fff); }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.s-terjadwal { background: #eaf1fe; color: #2563eb; }
.s-terlaksana { background: #e7f7ef; color: #059669; }
.s-ditunda { background: #fef3e2; color: #d97706; }
.s-dibatalkan { background: #fdeaea; color: #dc2626; }

/* ============ Daftar pertemuan ============ */
.list { display: flex; flex-direction: column; gap: 10px; }
.row-item { display: flex; align-items: center; gap: 14px; padding: 13px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.row-item:hover { border-color: #d3d7e6; box-shadow: 0 4px 14px rgba(16,24,40,.09); }
.date-box { flex: 0 0 56px; text-align: center; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 10px; padding: 6px 4px; }
.date-box .d { font-size: 20px; font-weight: 800; line-height: 1; }
.date-box .m { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.date-box .w { font-size: 10.5px; color: var(--muted-2); }
.row-main { flex: 1; min-width: 0; }
.row-main .t { font-weight: 700; font-size: 14.5px; }
.row-main .meta { color: var(--muted); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; margin-top: 3px; }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.row-side { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.resched-tag { font-size: 11.5px; color: var(--amber); font-weight: 600; }

/* ============ Tabel ============ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); min-width: 640px; }
.tbl th, .tbl td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border-2); font-size: 14px; }
.tbl th { background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--surface-2); }

/* ============ Filter bar ============ */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: none; background: none; padding: 6px 13px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--primary-soft); color: var(--primary-d); }
.spacer { flex: 1; }

/* ============ Form / field ============ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text); }
.field-hint { font-size: 12px; color: var(--muted); }
.input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14.5px; font-family: inherit; background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea.input { resize: vertical; }
.input-color { padding: 4px; height: 42px; cursor: pointer; }
.input-color::-webkit-color-swatch-wrapper { padding: 0; }
.input-color::-webkit-color-swatch { border: none; border-radius: 6px; }

/* Sub-teks dalam sel tabel (mis. wilayah jamaah) + pembatas seksi form */
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.form-divider { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 8px 0 -2px; }

/* Pohon wilayah (admin → pengaturan) */
.wilayah-tree { display: flex; flex-direction: column; gap: 5px; }
.wil-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.wil-row[data-level="2"] { margin-left: 22px; }
.wil-row[data-level="3"] { margin-left: 44px; background: var(--surface-2); }
.wil-name { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; min-width: 0; }
.wil-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wil-ic { color: var(--muted-2); flex: 0 0 auto; }
.wil-row[data-level="1"] .wil-ic { color: var(--primary); }
.wil-acts { display: flex; gap: 6px; flex: 0 0 auto; }
@media (max-width: 860px) {
  .wil-row[data-level="2"] { margin-left: 12px; }
  .wil-row[data-level="3"] { margin-left: 24px; }
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Field dengan ikon di dalam (login & form) */
.field-ico { position: relative; display: flex; align-items: center; }
.field-ico-lead { position: absolute; left: 12px; color: var(--muted-2); }
.field-ico .input { padding-left: 38px; }
.field-ico:has(.field-eye) .input { padding-right: 42px; }
.field-eye { position: absolute; right: 7px; width: 30px; height: 30px; border: none; background: none; cursor: pointer;
  color: var(--muted-2); display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }
.field-eye:hover { color: var(--text); background: var(--surface-2); }

/* ============ Layar masuk (login) ============ */
#app.app-auth { display: block; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1100px 560px at 50% -12%, var(--primary-soft), transparent 62%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow-lg); padding: 30px 28px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-logo { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--primary), #7c6cf0); box-shadow: 0 8px 20px rgba(79,70,229,.35); }
.auth-brand-text strong { display: block; font-size: 15px; line-height: 1.2; }
.auth-brand-text span { font-size: 12px; color: var(--muted); }
.auth-title { font-size: 22px; }
.auth-sub { color: var(--muted); font-size: 14px; margin: 4px 0 22px; }
.auth-form { display: flex; flex-direction: column; gap: 4px; }
.auth-form .btn-lg { margin-top: 10px; }
.auth-error { display: flex; align-items: center; gap: 8px; background: #fef2f2; border: 1px solid #fbd5d5; color: #b42318;
  font-size: 13px; font-weight: 600; padding: 9px 12px; border-radius: 10px; margin: 2px 0 6px; }
.auth-foot { display: flex; align-items: center; gap: 7px; justify-content: center; margin-top: 18px; font-size: 12px; color: var(--muted-2); }

/* ============ Panel admin ============ */
.role-admin { background: #ede9fe; color: #6d28d9; }
.role-petugas { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-2); }
.user-cell { display: flex; align-items: center; gap: 11px; }
.you-tag { display: inline-block; margin-left: 7px; font-size: 10.5px; font-weight: 700; color: var(--primary-d);
  background: var(--primary-soft); padding: 1px 7px; border-radius: 999px; vertical-align: middle; }

/* ============ Modal ============ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(17,22,38,.5); backdrop-filter: blur(2px); display: grid; place-items: center; padding: 20px; z-index: 100; opacity: 0; transition: opacity .18s; }
.modal-backdrop.show { opacity: 1; }
.modal { background: var(--surface); border-radius: 18px; width: 100%; max-width: 480px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateY(8px) scale(.98); transition: transform .18s; }
.modal-backdrop.show .modal { transform: none; }
.modal-wide { max-width: 620px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border-2); }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border-2); }
.confirm-text { color: var(--muted); }

/* ============ Absensi ============ */
.absen-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.absen-sum { display: flex; gap: 8px; flex-wrap: wrap; }
.absen-row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--border-2); }
.absen-row .nm { flex: 1; font-weight: 600; font-size: 14px; }
.absen-row .nm small { display: block; color: var(--muted-2); font-weight: 500; font-size: 11.5px; }
.absen-seg { display: inline-flex; gap: 4px; }
.ab-btn { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 8px; padding: 5px 10px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.ab-btn:hover { border-color: #cdd2e2; }
.ab-btn.on.h-hadir { background: #e7f7ef; color: #059669; border-color: #a7e8c8; }
.ab-btn.on.h-izin { background: #eaf1fe; color: #2563eb; border-color: #b9d2fb; }
.ab-btn.on.h-sakit { background: #fef3e2; color: #d97706; border-color: #f6d79a; }
.ab-btn.on.h-alpa { background: #fdeaea; color: #dc2626; border-color: #f6bcbc; }

/* ============ Kalender ============ */
.cal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border-2); }
.cal-head h3 { font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 8px 0; background: var(--surface-2); text-transform: uppercase; }
.cal-cell { min-height: 86px; border-right: 1px solid var(--border-2); border-top: 1px solid var(--border-2); padding: 6px; cursor: pointer; transition: background .12s; position: relative; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.muted { background: #fbfcfe; }
.cal-cell.muted .cal-num { color: var(--muted-2); }
.cal-cell.today .cal-num { background: var(--primary); color: #fff; border-radius: 50%; width: 23px; height: 23px; display: grid; place-items: center; }
.cal-num { font-size: 13px; font-weight: 700; }
.cal-ev { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 6px; margin-top: 4px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--c, var(--primary)); opacity: .92; }
.cal-ev.done { opacity: .5; }
.cal-ev.cancel { text-decoration: line-through; opacity: .5; }
.cal-more { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ============ Tren chart (SVG) ============ */
.trend { width: 100%; height: 180px; }
.trend .area { fill: url(#g); }
.trend .line { fill: none; stroke: var(--primary); stroke-width: 2.5; }
.trend .dot { fill: #fff; stroke: var(--primary); stroke-width: 2.5; }
.trend .lbl { font-size: 10px; fill: var(--muted-2); }
.trend .val { font-size: 10.5px; font-weight: 700; fill: var(--primary-d); }

/* ============ Aneka ============ */
.loader { display: grid; place-items: center; padding: 60px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-ikon { width: 60px; height: 60px; border-radius: 17px; margin: 0 auto 14px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); }
.empty-ikon[data-tone="danger"] { background: #fdeaea; color: var(--red); }
.kebab { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; z-index: 30; min-width: 168px; }
.menu button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border: none; background: none; padding: 8px 10px; border-radius: 7px; font-size: 13.5px; font-weight: 500; cursor: pointer; color: var(--text); }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--red); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; }
.note { background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 10px; padding: 11px 13px; font-size: 13.5px; color: var(--muted); }

/* ============ Toast ============ */
#toast-root { position: fixed; left: 0; right: 0; bottom: 22px; z-index: 200; display: flex; flex-direction: column;
  align-items: center; gap: 10px; padding: 0 16px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(440px, 100%);
  background: #1b2030; color: #fff; padding: 11px 16px 11px 14px; border-radius: 12px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(14px) scale(.98); transition: opacity .22s, transform .22s; }
.toast.show { opacity: 1; transform: none; }
.toast .toast-ic { flex: 0 0 auto; }
.toast-sukses .toast-ic { color: #34d399; }
.toast-galat .toast-ic { color: #f87171; }

/* ============ Responsif ============ */
@media (max-width: 860px) {
  #app { flex-direction: column; }

  /* Sidebar menjadi bilah navigasi bawah (bottom nav) */
  .sidebar {
    width: 100%; height: auto; flex: none; gap: 2px;
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 50;
    flex-direction: row; justify-content: space-around; align-items: stretch;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: none; border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(16,24,40,.06);
  }
  .brand, .nav-spacer, .nav-foot, .acct-sidebar { display: none; }
  .nav-item { flex: 1 1 0; flex-direction: column; gap: 3px; width: auto; padding: 7px 4px;
    border-radius: 12px; font-size: 11px; text-align: center; }
  .nav-item:hover { background: none; }
  .nav-item .lbl { display: block; font-size: 10.5px; line-height: 1; }
  .nav-item .ic { width: 100%; max-width: 60px; height: 26px; border-radius: 999px; transition: background .15s; }
  .nav-item.active { background: none; color: var(--primary-d); }
  .nav-item.active .ic { background: var(--primary-soft); }

  /* Topbar: tampilkan merek di kiri, akun tetap di kanan atas */
  .topbar { display: flex; padding: 10px 16px; min-height: 56px; }
  .topbar-brand { display: flex; }
  .acct-name { display: none; }
  .acct-btn { padding: 4px; }

  .view-root { padding: 18px 16px 92px; } /* sisakan ruang untuk bottom nav */
  .page-head h1 { font-size: 21px; }
  .form-row { grid-template-columns: 1fr; }
  .cal-cell { min-height: 62px; }

  /* Jangan tertutup bottom nav */
  #toast-root { bottom: calc(74px + env(safe-area-inset-bottom)); }
  .modal-backdrop { padding-bottom: 84px; }
}
