* { box-sizing: border-box; }

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.02); } }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0; background: #eef1f5; color: #1f2933; font-size: 15px;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #1e3a5f; color: #fff; padding: 12px 20px; position: sticky; top: 0; z-index: 10;
}
.topbar .brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; }
.topbar .brand span { font-weight: 400; opacity: .8; }
.topbar nav a { color: #dbe4ee; text-decoration: none; margin-left: 16px; }
.topbar nav a:hover { color: #fff; text-decoration: underline; }
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; animation: fadeIn 0.4s ease-out; }
.card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 20px; animation: slideUp 0.5s ease-out; transition: box-shadow 0.2s; }
.card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.12); }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; color: #1e3a5f; }

/* ── Hero + KPI ── */
.hero { background: linear-gradient(135deg,#1e3a5f,#2b5286); color: #fff; border-radius: 14px; padding: 22px; margin-bottom: 20px; box-shadow: 0 4px 14px rgba(30,58,95,.25); animation: slideUp 0.6s ease-out; }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.hero-title { font-size: 22px; font-weight: 700; }
.hero-sub { font-size: 13px; opacity: .8; margin-top: 3px; }
.year-nav { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.year-nav a { color: #fff; text-decoration: none; background: rgba(255,255,255,.15); padding: 5px 12px; border-radius: 8px; font-size: 13px; }
.year-nav a:hover { background: rgba(255,255,255,.3); }
.year-nav span { font-size: 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 12px; }
.kpi { background: #fff; border-radius: 10px; padding: 14px; border-top: 3px solid var(--c,#1e3a5f); box-shadow: 0 1px 3px rgba(0,0,0,.06); min-height: 104px; display: flex; flex-direction: column; justify-content: flex-start; transition: transform 0.2s, box-shadow 0.2s; animation: fadeIn 0.5s ease-out backwards; }
.kpi:nth-child(1) { animation-delay: 0.05s; }
.kpi:nth-child(2) { animation-delay: 0.1s; }
.kpi:nth-child(3) { animation-delay: 0.15s; }
.kpi:nth-child(4) { animation-delay: 0.2s; }
.kpi:nth-child(5) { animation-delay: 0.25s; }
.kpi:nth-child(6) { animation-delay: 0.3s; }
.kpi:hover { transform: translateY(-3px); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.hero .kpi { box-shadow: none; }
.kpi-ico { font-size: 18px; margin-bottom: 4px; }
.kpi-val { font-size: 24px; font-weight: 700; color: var(--c,#1e3a5f); line-height: 1.1; }
.kpi-val.kpi-neg, .kpi-neg { color: #c0392b !important; }
.kpi-lbl { font-size: 12px; font-weight: 600; color: #334155; margin-top: 3px; }
.kpi-sub { font-size: 11px; color: #94a3b8; }

/* ── Menu cards ── */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 12px; }
.menu-card { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid #e2e8f0; border-left: 4px solid var(--c,#1e3a5f); border-radius: 10px; padding: 16px; text-decoration: none; color: inherit; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.menu-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,.15); transform: translateY(-4px) scale(1.02); border-color: var(--c); }
.menu-ico { font-size: 26px; }
.menu-body { flex: 1; }
.menu-title { font-weight: 700; font-size: 15px; color: var(--c); }
.menu-sub { font-size: 12px; color: #64748b; }
.menu-arrow { font-size: 20px; color: var(--c); opacity: .5; }

.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.sec-head h2 { margin: 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border: 1px solid #d7dee7; padding: 6px 8px; text-align: left; vertical-align: top; }
th { background: #eef2f7; font-weight: 600; white-space: nowrap; }
tr:nth-child(even) td { background: #fafbfc; }
.total-row td { background: #e8eef5 !important; font-weight: 600; }
.neg { color: #c0392b; font-weight: 600; }
.note { font-size: 12px; color: #64748b; margin-top: 12px; line-height: 1.6; }
.table-wrap { overflow-x: auto; }
.month-link { color: #1e3a5f; font-weight: 600; text-decoration: none; }
.month-link:hover { text-decoration: underline; }
.btn {
  display: inline-block; background: #1e3a5f; color: #fff; text-decoration: none;
  padding: 7px 13px; border-radius: 7px; font-size: 13px; border: none; cursor: pointer; white-space: nowrap;
  transition: all 0.2s;
}
.btn:hover { background: #2b4f7d; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(30,58,95,.3); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn.ghost { background: transparent; color: #1e3a5f; border: 1px solid #1e3a5f; }
.btn.ghost:hover { background: #eef2f7; }
.breadcrumb { margin-bottom: 12px; font-size: 13px; }
.breadcrumb a { color: #1e3a5f; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 10px; }
.summary-grid span { background: #f4f7fa; padding: 10px 12px; border-radius: 6px; font-size: 13px; }
.act a { text-decoration: none; color: #1e3a5f; margin-right: 6px; }
.flash { background: #e6f4ea; color: #1e7a3d; padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; animation: slideUp 0.4s ease-out; }

/* ── Toast notifications ── */
.toast { position: fixed; top: 20px; right: 20px; background: #fff; padding: 14px 18px; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.2); z-index: 1000; max-width: 360px; animation: slideUp 0.3s ease-out; border-left: 4px solid #059669; }
.toast.error { border-left-color: #c0392b; }
.toast.info { border-left-color: #2563eb; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.2s; }
.modal { background: #fff; border-radius: 12px; padding: 24px; max-width: 400px; width: 90%; box-shadow: 0 8px 32px rgba(0,0,0,.3); animation: slideUp 0.3s ease-out; }
.modal h3 { margin: 0 0 12px; font-size: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Search bar ── */
.search-bar { margin-bottom: 12px; }
.search-bar input { width: 100%; max-width: 320px; padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; transition: border-color 0.2s; }
.search-bar input:focus { outline: none; border-color: #1e3a5f; box-shadow: 0 0 0 3px rgba(30,58,95,.1); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.pill-aman { background: #e6f4ea; color: #1e7a3d; }
.pill-waspada { background: #fef3c7; color: #b45309; }
.pill-cabut { background: #fdecea; color: #c0392b; }

/* ── Mobile nav ── */
.hamburger { display: none; background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; padding: 4px 8px; }
@media (max-width: 640px) {
  .topbar nav { position: fixed; top: 52px; left: 0; right: 0; background: #1e3a5f; flex-direction: column; padding: 12px 0; box-shadow: 0 4px 12px rgba(0,0,0,.2); display: none; z-index: 9; }
  .topbar nav.open { display: flex; animation: slideUp 0.3s ease-out; }
  .topbar nav a { margin: 0; padding: 10px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
  .hamburger { display: block; }
}

/* ── Pagination ── */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-block; padding: 5px 10px; border-radius: 5px; text-decoration: none; color: #1e3a5f; border: 1px solid #cbd5e1; transition: all 0.2s; }
.pagination a:hover { background: #eef2f7; border-color: #1e3a5f; }
.pagination .current { background: #1e3a5f; color: #fff; font-weight: 600; border-color: #1e3a5f; }
.pagination .disabled { color: #94a3b8; cursor: not-allowed; }

/* ── Sortable table ── */
th.sortable { cursor: pointer; user-select: none; position: relative; padding-right: 20px; }
th.sortable:hover { background: #dce3ec; }
th.sortable::after { content: '⇅'; position: absolute; right: 6px; opacity: .4; font-size: 11px; }
th.sortable.asc::after { content: '↑'; opacity: 1; }
th.sortable.desc::after { content: '↓'; opacity: 1; }

/* ── Login ── */
.login-card { max-width: 360px; margin: 80px auto; background: #fff; padding: 28px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.1); }
.login-card h1 { text-align: center; }
form label { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 600; }
form input { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 15px; }
form button[type=submit] { background: #1e3a5f; color: #fff; border: none; padding: 10px 18px; border-radius: 6px; font-size: 15px; cursor: pointer; }
form button[type=submit]:hover { background: #2b4f7d; }

/* ── Print ── */
.print-only { display: none; }
@media print {
  @page { margin: 14mm 12mm; size: A4 portrait; }
  .topbar, .btn, .act, .breadcrumb, .year-nav, .noprint, .toolbar { display: none !important; }
  body { background: #fff; font-size: 10pt; }
  main { max-width: none; padding: 0; margin: 0; }
  .card { box-shadow: none; padding: 0; margin: 0; border-radius: 0; }
  .hero { background: #fff !important; color: #111 !important; box-shadow: none; padding: 0; margin-bottom: 10px; }
  .hero-title { color: #111; }
  .hero-sub { color: #444; }
  .kpi-grid { display: flex; gap: 14px; flex-wrap: wrap; }
  .kpi { border: 1px solid #999; border-top: 3px solid var(--c,#333); box-shadow: none; padding: 8px 12px; min-width: 90px; }
  .kpi-val { font-size: 16pt; }
  .menu-grid { display: none; }
  .print-only { display: block; }
  .print-head { text-align: center; margin-bottom: 12px; }
  .print-head h1 { font-size: 14pt; margin: 0; }
  .print-head p { margin: 2px 0 0; font-size: 9pt; color: #444; }
  .signatures { display: flex; justify-content: space-between; margin-top: 30px; }
  .sign-block { text-align: center; width: 42%; font-size: 9pt; }
  .sign-block .line { margin-top: 46px; border-top: 1px solid #333; padding-top: 4px; font-weight: 600; }
  .print-date { text-align: right; font-size: 8pt; color: #666; margin-top: 10px; }
  th, td { padding: 3px 5px; font-size: 8.5pt; }
  th { background: #e0e4ea !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  tr:nth-child(even) td { background: #f7f8fa !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .neg { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── Bottom Navigation (Mobile) ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -2px 10px rgba(0,0,0,.08);
  z-index: 100;
  padding: 8px 0;
}

.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-decoration: none;
  color: #64748b;
  padding: 6px 0;
  transition: all 0.2s;
  border-radius: 8px;
  margin: 0 4px;
}

.bottom-nav .nav-item:hover,
.bottom-nav .nav-item:active {
  background: #f1f5f9;
  color: #1e3a5f;
}

.bottom-nav .nav-item.active {
  color: #1e3a5f;
  font-weight: 600;
}

.bottom-nav .icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.bottom-nav .label {
  font-size: 11px;
  font-weight: 500;
}

/* Show bottom nav on mobile */
@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
  }
  
  main {
    padding-bottom: 80px; /* Extra space for bottom nav */
  }
  
  /* Hide hamburger on mobile (use bottom nav instead) */
  .topbar .hamburger {
    display: none;
  }
  
  .topbar nav {
    display: none !important;
  }
}

/* Smooth scroll */
html {
  scroll-behavior: smooth;
}

/* ── Status Form & Badges ── */
.status-form td {
  border-top: none !important;
}

.archived {
  opacity: 0.6;
}

.archived:hover {
  opacity: 1;
}

.badge {
  display: inline-block;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 600;
}

.btn-sm {
  background: #3b82f6;
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-sm:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.pill-warning {
  background: #fef3c7;
  color: #92400e;
}

.pill-success {
  background: #d1fae5;
  color: #065f46;
}

.pill-dark {
  background: #e2e8f0;
  color: #334155;
}

/* Back button (topbar) */
.back-btn {
  background: rgba(255,255,255,.14);
  color: #fff; border: 1px solid rgba(255,255,255,.3);
  border-radius: 8px; padding: 6px 12px; margin-right: 12px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s, transform .15s;
}
.back-btn:hover { background: rgba(255,255,255,.28); transform: translateX(-2px); }

/* Dashboard guide + quick actions */
.hero-guide {
  margin: 14px 0 10px; font-size: 14px; font-weight: 600;
  color: #eaf2fb; background: rgba(255,255,255,.12);
  display: inline-block; padding: 8px 14px; border-radius: 8px;
}
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.quick-btn {
  display: inline-block; text-decoration: none;
  background: #fff; color: #1e3a5f; font-weight: 700;
  padding: 10px 16px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: transform .15s, box-shadow .15s;
}
.quick-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(0,0,0,.22); }
.quick-btn.ghost {
  background: rgba(255,255,255,.16); color: #fff;
  border: 1px solid rgba(255,255,255,.4);
}
.quick-btn.ghost:hover { background: rgba(255,255,255,.28); }
