:root {
  --maroon: #7a0c18;
  --maroon-dark: #5e0912;
  --maroon-active: #8a2a34;
  --ink: #111827;
  --muted: #6b7280;
  --bg: #f5f6f8;
  --line: #e2e5ea;
  --header-h: 64px;
  --side-w: 92px;
  /* nama lama dipertahankan agar halaman yang sudah ada tetap cocok */
  --kpu-red: var(--maroon);
  --kpu-red-dark: var(--maroon-dark);
}

body { background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

.btn-kpu { background: var(--maroon); border-color: var(--maroon); color: #fff; font-weight: 600; }
.btn-kpu:hover, .btn-kpu:focus { background: var(--maroon-dark); border-color: var(--maroon-dark); color: #fff; }

/* ---------- Halaman masuk ---------- */
.login-body { min-height: 100vh; background: linear-gradient(160deg, #fff 0%, #f1f2f5 55%, #e8eaef 100%); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; box-shadow: 0 10px 30px rgba(17, 24, 39, .08); }
.login-title { font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: .3px; color: var(--maroon); }
.login-sub { color: var(--muted); font-size: .9rem; margin: 4px 0 0; }
.login-foot { text-align: center; color: var(--muted); font-size: .8rem; margin: 24px 0 0; }
.login-card .form-control:focus { border-color: var(--maroon); box-shadow: 0 0 0 .2rem rgba(122, 12, 24, .15); }

/* ---------- Header atas ---------- */
.app-header {
  position: sticky; top: 0; z-index: 1030;
  height: var(--header-h);
  background: #fff;
  border-bottom: 3px solid var(--maroon);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 16px;
}
.hdr-left { justify-self: start; }
.hdr-right { justify-self: end; display: flex; align-items: center; gap: 14px; }
.hdr-burger { border: 0; background: transparent; color: var(--maroon); font-size: 1.8rem; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.hdr-burger:hover { background: rgba(122, 12, 24, .08); }
.hdr-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.hdr-brand > span { display: flex; flex-direction: column; }
.hdr-brand-name { font-weight: 700; color: var(--maroon); font-size: 1.05rem; line-height: 1.15; }
.hdr-brand-sub { font-size: .68rem; color: var(--muted); line-height: 1.2; }
.hdr-user { font-size: .9rem; color: var(--ink); }
.hdr-logout { font-weight: 500; }

/* ---------- Sidebar ikon ---------- */
.app-frame { display: flex; align-items: flex-start; min-height: calc(100vh - var(--header-h)); }
.app-side {
  flex: 0 0 var(--side-w); width: var(--side-w);
  background: var(--maroon);
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.side-item { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 13px 6px; color: #fff; text-decoration: none; font-size: .72rem; line-height: 1.2; text-align: center; }
.side-item i { font-size: 1.35rem; line-height: 1; }
.side-item:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.side-item.active { background: var(--maroon-active); }
.side-item.soon { opacity: .45; cursor: default; }
.side-item.soon:hover { background: transparent; }
.side-sep { height: 1px; background: rgba(255, 255, 255, .22); margin: 8px 14px; }

.app-main { flex: 1; min-width: 0; }
.app-content { padding: 24px 16px 48px; }
@media (min-width: 992px) { .app-content { padding: 28px 24px 56px; } }

/* Layar lebar: sidebar bisa dilipat lewat tombol ☰ */
@media (min-width: 992px) {
  html.side-collapsed .app-side { display: none; }
}

/* Ponsel/tablet: sidebar menjadi panel geser dari kiri */
.app-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 1019; opacity: 0; visibility: hidden; transition: opacity .2s ease; }
@media (max-width: 991.98px) {
  .app-side { position: fixed; top: var(--header-h); left: 0; bottom: 0; height: auto; z-index: 1020; transform: translateX(-100%); transition: transform .2s ease; }
  html.side-open .app-side { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  html.side-open .app-overlay { opacity: 1; visibility: visible; }
  .app-header { padding: 0 10px; }
}
@media (max-width: 420px) {
  .hdr-brand-sub { display: none; }
}

/* ---------- Dashboard ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 1.6rem; font-weight: 700; margin: 0; color: var(--ink); }
.page-sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }

.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.status-standby { background: #e8f6ee; color: #17663a; }
.status-dinas { background: #fff3dc; color: #8a5a00; }

.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; height: 100%; }
.stat-num { font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--maroon); }
.stat-num.warn { color: #d97706; }
.stat-label { color: var(--muted); font-size: .9rem; margin-top: 4px; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; }
.panel-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 12px; color: var(--ink); }
.panel-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.panel-row:last-child { border-bottom: 0; }
.panel-row strong { font-weight: 700; }
.panel-empty { color: var(--muted); font-size: .92rem; margin: 0; }

/* ---------- Tabel data & formulir admin ---------- */
.tabel-data { font-size: .9rem; margin-bottom: 0; }
.tabel-data thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; border-bottom-width: 1px; white-space: nowrap; }
.tabel-data td { vertical-align: middle; }
.baris-nonaktif { opacity: .55; }
.btn-outline-secondary { --bs-btn-color: #4b5563; }
.form-control:focus, .form-select:focus { border-color: var(--maroon); box-shadow: 0 0 0 .2rem rgba(122, 12, 24, .15); }
.form-check-input:checked { background-color: var(--maroon); border-color: var(--maroon); }
.alert { white-space: normal; }

/* ---------- Surat Tugas ---------- */
.badge-kat { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.kat-ketua     { background: rgba(122, 12, 24, .10); color: var(--maroon); }
.kat-sekretaris{ background: #e6effb; color: #1e4f9a; }
.kat-sopir     { background: #eceff3; color: #4b5563; }
.kat-eksternal { background: #e3f4f1; color: #0f6b5e; }
.pel-row { margin-bottom: 12px; }
.pel-no { min-width: 40px; justify-content: center; }
.pel-info { margin-top: 4px; }
.detail-list dt { font-weight: 600; color: var(--muted); }
.detail-list dd { margin-bottom: .6rem; white-space: pre-line; }
