* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --primary-soft: #e0f2fe;
  --accent: #facc15;
  --bg: #f5f7fb;
  --card: #ffffff;
  --border: #e7edf4;
  --text: #0f172a;
  --muted: #64748b;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 20px -6px rgba(15, 23, 42, 0.10);
  --radius: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ===== Layout ===== */
.layout { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  width: 280px; flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 22px 14px;
  position: sticky; top: 0; height: 100vh;
  transition: width .22s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: 78px; }

.sidebar-brand { padding: 0 6px 20px; }
.sidebar-brand a { display: block; }
.brand-full { display: block; width: 100%; max-width: 160px; }
.brand-mark { display: none; width: 44px; margin: 0 auto; }
.sidebar.collapsed .brand-full { display: none; }
.sidebar.collapsed .brand-mark { display: block; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;
  font-size: 14px; font-weight: 600; text-decoration: none;
  color: var(--muted); transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.nav-item:hover { background: #f1f5f9; color: var(--text); }
.nav-item.active {
  background: #e9eef5;
  color: #0f172a;
}
.nav-item.disabled { opacity: 0.5; cursor: default; }
.nav-item.disabled:hover { background: transparent; color: var(--muted); }
.nav-item .label { flex: 1; text-transform: uppercase; letter-spacing: 0.05em; font-size: 12.5px; }
.nav-item .icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-item .icon svg { width: 20px; height: 20px; }
.nav-item .soon {
  font-size: 10px; background: var(--accent); color: #713f12;
  padding: 2px 7px; border-radius: 999px; font-weight: 700; flex-shrink: 0;
}

.sidebar.collapsed .nav-item { justify-content: center; padding: 11px; }
.sidebar.collapsed .nav-item .label,
.sidebar.collapsed .nav-item .soon { display: none; }

.collapse-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 9px; margin: 6px 0;
  border: 1px solid var(--border); border-radius: 10px;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit;
  transition: all .15s; white-space: nowrap;
}
.collapse-btn:hover { background: #f1f5f9; color: var(--text); }
.collapse-btn .chev { width: 18px; height: 18px; flex-shrink: 0; transition: transform .22s ease; }
.sidebar.collapsed .collapse-btn .chev { transform: rotate(180deg); }
.sidebar.collapsed .collapse-btn .label { display: none; }

.sidebar-logout {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none;
  padding: 10px 14px; border-radius: 10px; transition: all .15s; white-space: nowrap;
}
.sidebar-logout:hover { background: #fee2e2; color: #dc2626; }
.sidebar-logout .icon { display: inline-flex; flex-shrink: 0; }
.sidebar-logout .icon svg { width: 20px; height: 20px; }
.sidebar.collapsed .sidebar-logout { justify-content: center; padding: 10px; }
.sidebar.collapsed .sidebar-logout .label { display: none; }

/* ===== Main ===== */
.main { flex: 1; max-width: 1180px; min-width: 0; padding: 28px 32px; }

.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 5px; }

/* ===== Panel Kondisi Terkini ===== */
.snapshot-panel {
  background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
  border: 1px solid #bae6fd; border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.snapshot-head {
  font-size: 12px; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--primary-dark);
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.snapshot-tag {
  font-size: 11px; font-weight: 600; color: var(--primary-dark);
  background: rgba(255,255,255,0.7); padding: 2px 9px; border-radius: 999px;
}
.snapshot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.snapshot-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.snap-item {
  background: #fff; border: 1px solid #e2ebf5; border-radius: 12px;
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.snap-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
.snap-value { font-size: 24px; font-weight: 800; margin: 6px 0 3px; letter-spacing: -0.02em; }
.snap-note { font-size: 12px; color: var(--muted); }

/* ===== Section label ===== */
.section-label {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 10px;
}

/* ===== Filter bar ===== */
.filter-bar {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.filter-group { display: flex; align-items: center; gap: 6px; }
.filter-group label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
.filter-group select, .filter-group input[type="date"] {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; background: #fff; color: var(--text); font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.filter-group select:focus, .filter-group input[type="date"]:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}
.filter-group input[type="text"] {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; background: #fff; color: var(--text); font-family: inherit;
  min-width: 190px; transition: border-color .15s, box-shadow .15s;
}
.filter-group input[type="text"]:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}
.filter-group select.m { min-width: 76px; }
.hidden { display: none; }
.period-status {
  margin-left: auto; font-size: 13px; font-weight: 700; color: var(--primary-dark);
  background: var(--primary-soft); padding: 6px 12px; border-radius: 999px;
}

/* ===== KPI cards ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.kpi-value { font-size: 28px; font-weight: 800; margin: 9px 0 4px; letter-spacing: -0.02em; }
.kpi-note { font-size: 12px; color: var(--muted); }

/* ===== Charts ===== */
.charts { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-bottom: 16px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
  min-width: 0; position: relative;
}
.card h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h3 { margin: 0; }
.card-head select {
  padding: 7px 11px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; font-family: inherit;
}
.card canvas { height: 340px !important; max-width: 100%; }

/* ===== Table ===== */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }
td.r, th.r { text-align: right; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }
.table-count { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ===== Pagination ===== */
.pagination {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  margin-top: 16px;
}
.page-btn {
  width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--text); cursor: pointer; font-size: 18px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s, opacity .15s;
}
.page-btn:hover:not(:disabled) { background: #f1f5f9; border-color: #cbd5e1; }
.page-btn:disabled { opacity: 0.35; cursor: default; }
.page-info { font-size: 13px; color: var(--muted); font-weight: 600; }
td.mono { font-family: 'SFMono-Regular', ui-monospace, monospace; font-size: 12.5px; color: #475569; }
td.judul { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.muted { color: var(--muted); }

/* ===== Warna teks util ===== */
.red { color: #dc2626 !important; }
.green { color: #16a34a !important; }
.amber { color: #d97706 !important; }
.blue { color: var(--primary-dark) !important; }

/* ===== Badge status ===== */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-gray { background: #e2e8f0; color: #475569; }

/* ===== Serapan progress list ===== */
.serapan-list { display: flex; flex-direction: column; gap: 16px; }
.serapan-row { display: flex; flex-direction: column; gap: 5px; }
.serapan-top { display: flex; align-items: center; justify-content: space-between; }
.serapan-name { font-size: 13px; font-weight: 600; }
.serapan-pct { font-size: 13px; font-weight: 700; }
.serapan-bar { height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.serapan-fill { height: 100%; border-radius: 999px; transition: width .3s ease; }
.bar-blue { background: linear-gradient(90deg, #38bdf8, #0ea5e9); }
.bar-green { background: linear-gradient(90deg, #34d399, #10b981); }
.bar-amber { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.bar-red { background: linear-gradient(90deg, #f87171, #dc2626); }
.serapan-meta { font-size: 11.5px; color: var(--muted); }

/* ===== Login ===== */
.login-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: radial-gradient(1200px 600px at 20% 0%, #dbeafe 0%, transparent 55%),
              radial-gradient(1000px 600px at 90% 100%, #bae6fd 0%, transparent 50%),
              linear-gradient(160deg, #0c4a6e, #075985);
}
.login-card {
  background: #fff; padding: 40px 36px; border-radius: 20px; width: 380px;
  box-shadow: 0 24px 60px -12px rgba(2, 6, 23, 0.35); text-align: center;
}
.login-logo { width: 100%; max-width: 260px; display: block; margin: 0 auto 6px; }
.login-sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.login-card input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px;
  font-size: 15px; font-family: inherit; margin-bottom: 14px; transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,165,233,0.15); }
.login-card button {
  width: 100%; padding: 12px; border: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease; font-family: inherit;
}
.login-card button:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(14,165,233,0.35); }

.err { color: #dc2626; font-size: 13px; margin-bottom: 10px; }

@media (max-width: 900px) {
  .sidebar { width: 78px; padding: 16px 8px; }
  .brand-full { display: none; }
  .brand-mark { display: block; }
  .nav-item { justify-content: center; padding: 11px; }
  .nav-item .label, .nav-item .soon { display: none; }
  .collapse-btn .label { display: none; }
  .sidebar-logout { justify-content: center; padding: 10px; }
  .sidebar-logout .label { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts { grid-template-columns: 1fr; }
  .snapshot-grid { grid-template-columns: repeat(2, 1fr); }
}
