@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;
  --green: #059669;
  --green-soft: #d1fae5;
  --orange: #ea580c;
  --orange-soft: #ffedd5;
  --bg: #f6f8fc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.08);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 16px 40px rgba(15, 23, 42, 0.12);
  --radius: 22px;
  --radius-sm: 14px;
  --sidebar-w: 250px;
  --header-h: 72px;
  --primary: var(--blue);
  --primary-hover: #1d4ed8;
  --border: #e2e8f0;
  --danger: #ef4444;
  --success: #10b981;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
.hidden { display: none !important; }

.app-shell { display: flex; min-height: 100dvh; }
.app-shell.locked { height: 100dvh; overflow: hidden; }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.35);
  z-index: 90; opacity: 0; visibility: hidden; transition: .2s;
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  padding: 18px 14px; gap: 8px; z-index: 100;
}
.sidebar-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: none; background: transparent; border-radius: 14px; cursor: pointer;
  color: var(--muted); font-size: 13px; font-weight: 600; text-align: left;
  min-height: 44px; width: 100%; transition: .18s;
}
.sidebar-link:hover { background: #f1f5f9; color: var(--text); }
.sidebar-link.active {
  background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff;
  box-shadow: 0 8px 20px rgba(37,99,235,.25);
}
.sidebar-link .ico {
  width: 28px; height: 28px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255,255,255,.14); flex-shrink: 0;
}
.sidebar-link:not(.active) .ico { background: #f1f5f9; }
.sidebar-foot {
  margin-top: auto; padding: 12px; border-radius: 16px; background: #f8fafc;
  border: 1px solid var(--line); font-size: 11px; color: var(--muted); line-height: 1.5;
}
.sidebar-foot a { color: var(--blue); font-weight: 700; }

.main-column { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--header-h); flex-shrink: 0; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; padding: 0 20px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 80;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo-wrap { width: 42px; height: 42px; flex-shrink: 0; position: relative; }
.logo-wrap img {
  width: 42px; height: 42px; border-radius: 14px; object-fit: cover;
  box-shadow: 0 8px 18px rgba(59,130,246,.2);
}
.logo-box {
  width: 42px; height: 42px; border-radius: 14px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 10px;
}
.brand-text h1 { font-size: 13px; font-weight: 800; line-height: 1.25; }
.brand-text p { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.icon-btn {
  display: none; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-size: 18px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px; border: none; cursor: pointer;
  font-size: 13px; font-weight: 700; min-height: 44px; transition: .18s;
}
.btn-primary, .btn-google {
  background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff;
  box-shadow: 0 8px 20px rgba(37,99,235,.22);
}
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.btn.active { box-shadow: inset 0 0 0 2px rgba(37,99,235,.25); }
.admin-pill, .superadmin-pill, .user-pill {
  display: none; font-size: 10px; font-weight: 800; padding: 6px 10px; border-radius: 999px;
}
.admin-pill { color: var(--success); background: #ecfdf5; border: 1px solid #bbf7d0; }
.superadmin-pill { color: #7c3aed; background: #f5f3ff; border: 1px solid #ddd6fe; }
.user-pill { color: var(--blue); background: var(--blue-soft); border: 1px solid #bfdbfe; }
.admin-pill.show, .superadmin-pill.show, .user-pill.show { display: inline-flex; }
.header-logout { display: none; }
.header-logout.show { display: inline-flex; }

.page-view { flex: 1; overflow-y: auto; }
.page-content { max-width: 1280px; margin: 0 auto; padding: 20px 20px 80px; }

.hero-strip {
  background: linear-gradient(135deg, rgba(37,99,235,.92), rgba(124,58,237,.88));
  color: #fff; border-radius: 22px; padding: 22px 24px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.hero-strip h2 { font-size: clamp(20px, 3vw, 28px); font-weight: 800; margin-bottom: 8px; }
.hero-strip p { font-size: 14px; opacity: .95; line-height: 1.55; max-width: 720px; }

.kpi-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px;
}
.kpi-grid-sm { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.kpi-clickable { cursor: pointer; }
.kpi-clickable:hover, .kpi-clickable:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.kpi-clickable.active { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.kpi-sm { padding: 14px; }
.kpi-icon {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0;
}
.kpi-icon.blue { background: var(--blue-soft); }
.kpi-icon.green { background: var(--green-soft); }
.kpi-icon.orange { background: var(--orange-soft); }
.kpi-icon.purple { background: var(--purple-soft); }
.kpi-val { font-size: 22px; font-weight: 800; line-height: 1.1; }
.kpi-label { font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 600; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h3 { font-size: 16px; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 12px; font-size: 14px;
}
.form-control:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-control[readonly] { background: #f8fafc; color: var(--muted); }

.autocomplete-wrap { position: relative; }
.ac-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff;
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-hover);
  max-height: 240px; overflow-y: auto; z-index: 50; display: none;
}
.ac-dropdown.show { display: block; }
.ac-item {
  display: block; width: 100%; text-align: left; padding: 10px 14px; border: none; background: #fff;
  cursor: pointer; font-size: 13px; font-weight: 600;
}
.ac-item:hover { background: #f1f5f9; }
.ac-empty { padding: 12px 14px; font-size: 12px; color: var(--muted); }

.alert-banner {
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  border-radius: 14px; padding: 12px 14px; font-size: 13px; margin: 12px 0;
}

.upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.upload-btn {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; border-radius: 14px; border: 1px dashed #93c5fd; background: #eff6ff;
  color: #1d4ed8; font-weight: 700; font-size: 13px; cursor: pointer; overflow: hidden;
}
.upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-btn.loading { opacity: .65; pointer-events: none; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px;
}
.search-wrap { flex: 1; min-width: 180px; position: relative; }
.search-wrap input {
  width: 100%; padding: 10px 14px 10px 38px; border-radius: 12px; border: 1px solid var(--border); background: #f8fafc;
}
.search-wrap .s-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: .45; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; font-size: 13px; }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.data-table th { background: #f8fafc; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.data-table tr:hover td { background: #fafbff; }
.empty-cell { text-align: center; color: var(--muted); padding: 28px !important; }
.status-cell { text-align: center; }
.status-btn {
  width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center;
  font-weight: 800; font-size: 16px; border: none; cursor: default;
}
button.status-btn { cursor: pointer; }
.status-ok { background: #ecfdf5; color: #047857; border: 1px solid #bbf7d0; }
.status-miss { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.link-btn { background: none; border: none; color: var(--blue); font-weight: 800; cursor: pointer; padding: 0; text-align: left; }
.actions-cell { white-space: nowrap; }
.btn-mini {
  padding: 6px 10px; border-radius: 8px; font-size: 11px; font-weight: 800;
  border: 1px solid var(--border); background: #fff; cursor: pointer; min-height: 32px; text-decoration: none;
  display: inline-flex; align-items: center;
}
.btn-mini.danger { color: var(--danger); border-color: #fecaca; background: #fff5f5; }

.tadika-cards { display: none; gap: 12px; flex-direction: column; }
.tadika-card {
  border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: #fff;
}
.tadika-card-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.tadika-card-status { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 12px; }
.tadika-card-status > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.admin-edit-bar {
  background: linear-gradient(135deg, #eff6ff, #f5f3ff);
  border: 1px solid #c7d2fe; border-radius: 20px; padding: 16px; margin-bottom: 18px;
}
.admin-edit-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.admin-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.help-text { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 6px; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  opacity: 0; visibility: hidden; transition: .25s; padding: 16px;
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal-content {
  background: #fff; border-radius: 22px; width: 100%; max-width: 680px; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-hover);
}
.modal-content.modal-lg { max-width: min(960px, 96vw); height: min(88vh, 900px); }
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.modal-header h3 { font-size: 16px; font-weight: 800; }
.close-modal { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); min-width: 44px; min-height: 44px; }
.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; flex: 1; min-height: 0; }
.preview-frame { flex: 1; width: 100%; min-height: 420px; border: none; background: #f8fafc; border-radius: 12px; }
.card-admin { background: #f8fafc; border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.card-admin h4 { font-size: 14px; color: var(--blue); font-weight: 800; margin-bottom: 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-list-item {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px;
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
}
.admin-list-title { font-weight: 800; font-size: 14px; }
.admin-list-url { font-size: 12px; color: var(--muted); margin-top: 4px; word-break: break-all; }
.admin-list-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 600; opacity: 0; visibility: hidden; transition: .25s; z-index: 2000;
}
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

.public-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.public-main { flex: 1; padding: 16px; }
.public-card { max-width: 720px; margin: 0 auto; }

.setup-banner {
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; font-size: 13px; line-height: 1.55;
}
.setup-banner strong { display: block; margin-bottom: 6px; font-size: 14px; }

.checklist-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
.check-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-105%);
    transition: transform .25s; box-shadow: var(--shadow-hover);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { display: block; }
  .icon-btn { display: inline-flex; align-items: center; justify-content: center; }
  .brand-text p { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-grid-sm { grid-template-columns: 1fr 1fr; }
  .form-grid, .form-row, .admin-edit-grid { grid-template-columns: 1fr; }
  .table-wrap { display: none; }
  .tadika-cards { display: flex; }
}
@media (max-width: 640px) {
  .page-content, .public-main { padding: 14px 14px 70px; }
  .kpi-grid, .kpi-grid-sm, .upload-grid, .checklist-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; }
  .btn .btn-label-long { display: none; }
  .modal-content.modal-lg { height: 92vh; max-height: none; }
  .preview-frame { min-height: 55vh; }
}

.login-gate {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, rgba(37,99,235,.94), rgba(124,58,237,.9));
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: 0 24px 60px rgba(15,23,42,.25);
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.login-brand h2 { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.login-brand p { font-size: 13px; color: var(--muted); }
.login-role-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.login-role {
  border: 1px solid var(--border); background: #fff; border-radius: 14px;
  padding: 12px 10px; cursor: pointer; font-weight: 700; font-size: 13px;
}
.login-role.active {
  border-color: var(--blue); background: var(--blue-soft); color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(37,99,235,.15);
}
.login-submit { width: 100%; margin-top: 6px; }
.login-help { margin-top: 14px; font-size: 12px; color: var(--muted); text-align: center; }
.login-help a { color: var(--blue); font-weight: 700; }
.check-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.check-actions { display: flex; align-items: center; gap: 8px; }
.header-logout { display: none; }
.header-logout.show { display: inline-flex; }
