/* ==========================================================================
   ARKAS Yayasan — Institutional Design System (Model ARKAS Dinas Pendidikan)
   Clean, High-Contrast, Tabular Financial Precision, Responsive
   ========================================================================== */

:root {
  --navy-950: #091a2c;
  --navy-900: #0f2942;
  --navy-800: #163a5f;
  --navy-700: #1e4d7b;
  --blue-600: #1d4ed8;
  --blue-500: #2563eb;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --sky-400: #38bdf8;
  --emerald-700: #047857;
  --emerald-600: #059669;
  --emerald-100: #d1fae5;
  --emerald-50: #ecfdf5;
  --amber-700: #b45309;
  --amber-600: #d97706;
  --amber-100: #fef3c7;
  --amber-50: #fffbeb;
  --red-700: #b91c1c;
  --red-600: #dc2626;
  --red-100: #fee2e2;
  --red-50: #fef2f2;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 42px rgba(15, 23, 42, 0.18);
  --sidebar-w: 236px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--slate-900);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.num, .rp, td.num, th.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

/* Boot Screen */
.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--slate-600);
}
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--slate-200);
  border-top-color: var(--navy-700);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Login View
   ========================================================================== */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  background: linear-gradient(135deg, #091a2c 0%, #123354 55%, #1c4e80 100%);
}
.login-hero {
  color: #fff;
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(56, 189, 248, 0.16), transparent 55%),
              radial-gradient(circle at 15% 85%, rgba(16, 185, 129, 0.14), transparent 50%);
  pointer-events: none;
}
.login-hero-content { position: relative; z-index: 1; max-width: 560px; }
.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: #bae6fd;
  margin-bottom: 24px;
}
.login-hero h1 {
  font-size: 36px;
  line-height: 1.18;
  margin: 0 0 14px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.login-hero p.lead {
  font-size: 15.5px;
  color: #cbd5e1;
  margin: 0 0 32px;
  line-height: 1.65;
}
.hero-units {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.hero-unit-pill {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
}
.hero-unit-pill strong { display: block; font-size: 14px; color: #fff; }
.hero-unit-pill span { font-size: 11px; color: #94a3b8; }
.hero-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.hero-feat {
  background: rgba(9, 26, 44, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 14px;
}
.hero-feat h4 { margin: 0 0 4px; font-size: 13px; color: #7dd3fc; }
.hero-feat p { margin: 0; font-size: 12px; color: #cbd5e1; }
.login-hero-footer {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: #94a3b8;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 18px;
}

.login-panel {
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
}
.login-card {
  width: 100%;
  max-width: 430px;
}
.login-card h2 { margin: 0 0 6px; font-size: 24px; color: var(--navy-900); }
.login-card .sub { margin: 0 0 24px; color: var(--slate-500); font-size: 13.5px; }

.quick-login-box {
  margin-top: 24px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 14px;
}
.quick-login-box summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--navy-800);
  user-select: none;
}
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.quick-btn:hover { border-color: var(--blue-500); background: var(--blue-50); }
.quick-btn.admin { grid-column: 1 / -1; border-color: #93c5fd; background: #eff6ff; }
.quick-btn strong { font-size: 12.5px; color: var(--navy-900); }
.quick-btn span { font-size: 11px; color: var(--slate-500); }

/* ==========================================================================
   Main App Shell (Sidebar + Topbar + Content)
   ========================================================================== */
.shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  transition: transform 0.2s ease;
}
.sidebar-header {
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
}
.sidebar-logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.35);
}
.sidebar-logo-text strong {
  display: block;
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.2px;
}
.sidebar-logo-text span {
  display: block;
  font-size: 11px;
  color: #93c5fd;
}

.sidebar-role-card {
  margin: 12px 14px 6px;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.sidebar-role-card .role-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.22);
  color: #7dd3fc;
  margin-bottom: 4px;
}
.sidebar-role-card.role-kepsek .role-tag {
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
}
.sidebar-role-card .role-name {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  word-break: break-word;
}
.sidebar-role-card .role-unit {
  font-size: 11px;
  color: #94a3b8;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 10px 16px;
  overflow-y: auto;
}
.nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #64748b;
  padding: 10px 10px 6px;
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 3px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.nav-item.active {
  background: linear-gradient(90deg, #1d4ed8, #2563eb);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
.nav-item .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}
.nav-item .nav-badge {
  margin-left: auto;
  background: #f59e0b;
  color: #111827;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--slate-200);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.menu-toggle {
  display: none;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
}
.topbar-title h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--navy-900);
  line-height: 1.2;
}
.topbar-title span {
  font-size: 12px;
  color: var(--slate-500);
}
.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.content {
  padding: 20px 24px 40px;
  max-width: 1580px;
  width: 100%;
  margin: 0 auto;
}

/* ==========================================================================
   Cards, Grids, KPIs, Ribbons
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1180px) {
  .kpi-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .kpi-grid-3, .kpi-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .kpi-grid-3, .kpi-grid-5 { grid-template-columns: 1fr; }
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--navy-700);
}
.kpi-card.blue { border-top-color: var(--blue-500); }
.kpi-card.emerald { border-top-color: var(--emerald-600); }
.kpi-card.amber { border-top-color: var(--amber-600); }
.kpi-card.red { border-top-color: var(--red-600); }
.kpi-card.slate { border-top-color: var(--slate-500); }
.kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  color: var(--slate-500);
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--slate-900);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.kpi-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--slate-500);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.card {
  background: var(--surface);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: #fafcff;
}
.card-header h2, .card-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy-900);
}
.card-header .card-sub {
  font-size: 12px;
  color: var(--slate-500);
  margin-top: 2px;
}
.card-body { padding: 16px 18px; }
.card-body.p0 { padding: 0; }

.two-col {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
}
.equal-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

/* Month Switcher Tabs (ARKAS Tahunan vs Jan-Des!) */
.month-tabs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
}
.month-tab {
  padding: 6px 11px;
  border: 1px solid var(--slate-200);
  border-radius: 7px;
  background: #fff;
  color: var(--slate-700);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.month-tab:hover { border-color: var(--blue-500); color: var(--blue-600); }
.month-tab.active {
  background: var(--navy-900);
  color: #fff;
  border-color: var(--navy-900);
}
.month-tab .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--slate-300);
}
.month-tab .dot.ok { background: var(--emerald-600); }
.month-tab .dot.warn { background: var(--amber-600); }
.month-tab .dot.err { background: var(--red-600); }

/* Plafon Ribbon */
.plafon-ribbon {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  padding: 11px 14px;
  background: linear-gradient(90deg, #f8fbff 0%, #f1f5f9 100%);
  border-bottom: 1px solid var(--slate-200);
  align-items: center;
}
@media (max-width: 1200px) {
  .plafon-ribbon { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
.ribbon-item label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  font-weight: 700;
  color: var(--slate-500);
}
.ribbon-item strong {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--slate-900);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Tables & ARKAS Signature Realization Indicators
   ========================================================================== */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  background: #f1f5f9;
  color: var(--slate-700);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  padding: 10px 10px;
  border-bottom: 2px solid var(--slate-200);
  text-align: left;
  white-space: nowrap;
}
tbody td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}
tbody tr:hover { background: #f8fafc; }
tfoot td, tr.total-row td {
  background: #eef2f7;
  font-weight: 700;
  border-top: 2px solid var(--slate-300);
  color: var(--navy-900);
}

/* ARKAS Realization Row Accent — Instantly see what's realized! */
tr.row-realized-100 {
  background: #f3fdf8;
}
tr.row-realized-100 td:first-child {
  box-shadow: inset 4px 0 0 var(--emerald-600);
}
tr.row-realized-partial td:first-child {
  box-shadow: inset 4px 0 0 var(--blue-500);
}
tr.row-realized-pending td:first-child {
  box-shadow: inset 4px 0 0 var(--amber-600);
}
tr.row-realized-over {
  background: #fff5f5;
}
tr.row-realized-over td:first-child {
  box-shadow: inset 4px 0 0 var(--red-600);
}
tr.row-rejected {
  opacity: 0.65;
  background: #fafafa;
}

/* Progress Bar inside RKAS Table */
.prog-wrap {
  min-width: 110px;
}
.prog-bar {
  height: 7px;
  background: var(--slate-200);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.prog-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}
.prog-fill.green { background: var(--emerald-600); }
.prog-fill.blue { background: var(--blue-500); }
.prog-fill.amber { background: var(--amber-600); }
.prog-fill.red { background: var(--red-600); }

/* 12-Month Mini Pill Strip (Signature ARKAS Monthly Tracker per Item!) */
.mini-months {
  display: flex;
  gap: 2px;
  margin-top: 5px;
  flex-wrap: nowrap;
}
.m-pill {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  cursor: default;
}
.m-pill.none { background: #f8fafc; color: #cbd5e1; border-color: #f1f5f9; }
.m-pill.planned { background: #e2e8f0; color: #475569; border-color: #cbd5e1; }
.m-pill.done { background: #059669; color: #ffffff; border-color: #047857; }
.m-pill.partial { background: #2563eb; color: #ffffff; border-color: #1d4ed8; }
.m-pill.pending { background: #f59e0b; color: #111827; border-color: #d97706; }
.m-pill.over { background: #dc2626; color: #ffffff; border-color: #b91c1c; }

/* ==========================================================================
   Badges, Buttons, Forms
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-green { background: var(--emerald-50); color: var(--emerald-700); border-color: #a7f3d0; }
.badge-blue { background: var(--blue-50); color: var(--blue-600); border-color: #bfdbfe; }
.badge-amber { background: var(--amber-50); color: var(--amber-700); border-color: #fde68a; }
.badge-red { background: var(--red-50); color: var(--red-700); border-color: #fecaca; }
.badge-slate { background: var(--slate-100); color: var(--slate-600); border-color: var(--slate-200); }
.badge-navy { background: #e0ecf8; color: var(--navy-900); border-color: #b8d3ee; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--navy-800); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-900); }
.btn-blue { background: var(--blue-500); color: #fff; }
.btn-blue:hover:not(:disabled) { background: var(--blue-600); }
.btn-emerald { background: var(--emerald-600); color: #fff; }
.btn-emerald:hover:not(:disabled) { background: var(--emerald-700); }
.btn-amber { background: var(--amber-600); color: #fff; }
.btn-amber:hover:not(:disabled) { background: var(--amber-700); }
.btn-red { background: var(--red-600); color: #fff; }
.btn-red:hover:not(:disabled) { background: var(--red-700); }
.btn-outline { background: #fff; border-color: var(--slate-300); color: var(--slate-700); }
.btn-outline:hover:not(:disabled) { background: var(--slate-50); border-color: var(--slate-400); }
.btn-ghost { background: transparent; color: var(--slate-600); }
.btn-ghost:hover:not(:disabled) { background: var(--slate-100); color: var(--slate-900); }
.btn-sm { padding: 5px 9px; font-size: 12px; border-radius: 6px; }
.btn-xs { padding: 3px 7px; font-size: 11px; border-radius: 5px; }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--slate-200);
  background: #fff;
}
.form-group { margin-bottom: 13px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-700);
  margin-bottom: 5px;
}
.input, .select, .textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--slate-300);
  border-radius: 7px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--slate-900);
  background: #fff;
  transition: border-color 0.14s, box-shadow 0.14s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.input-sm, .select-sm {
  padding: 6px 9px;
  font-size: 12.5px;
  width: auto;
}
.input-money {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* Monthly 12-Cell Input Grid inside RKAS Modal */
.month-input-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: var(--slate-50);
  padding: 12px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
}
.month-input-cell {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 7px;
  padding: 7px 8px;
}
.month-input-cell.has-val {
  border-color: #93c5fd;
  background: #f5f9ff;
}
.month-input-cell label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-600);
  margin-bottom: 4px;
}
.month-input-cell input {
  width: 100%;
  padding: 5px 7px;
  border: 1px solid var(--slate-300);
  border-radius: 5px;
  font-size: 13px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.month-input-cell .cell-sub {
  font-size: 10.5px;
  color: var(--blue-600);
  text-align: right;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

/* Editable Revenue Cell in Plafon Matrix */
.rev-input {
  width: 96px;
  padding: 4px 6px;
  border: 1px solid #eab308;
  background: #fefce8;
  border-radius: 5px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.nowrap { white-space: nowrap; }
table.compact-table th, table.compact-table td {
  padding: 8px 7px;
  font-size: 12.25px;
}
.rev-input:focus {
  outline: none;
  border-color: var(--blue-500);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Live Preview Box inside Modals */
.preview-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 10px;
}
.preview-box.warn { background: var(--amber-50); border-color: #fde68a; }
.preview-box.danger { background: var(--red-50); border-color: #fecaca; }
.preview-box.success { background: var(--emerald-50); border-color: #a7f3d0; }

/* Alerts */
.alert {
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-info { background: var(--blue-50); border-color: #bfdbfe; color: #1e40af; }
.alert-warn { background: var(--amber-50); border-color: #fde68a; color: #92400e; }
.alert-danger { background: var(--red-50); border-color: #fecaca; color: #991b1b; }
.alert-success { background: var(--emerald-50); border-color: #a7f3d0; color: #065f46; }

/* ==========================================================================
   Modal & Drawer
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
}
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 760px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popIn 0.16s ease-out;
}
.modal.modal-sm { max-width: 480px; }
@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 15px 20px;
  background: var(--navy-900);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { margin: 0; font-size: 15.5px; }
.modal-close {
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  font-size: 18px;
  cursor: pointer;
}
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 13px 20px;
  border-top: 1px solid var(--slate-200);
  background: var(--slate-50);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* Right Drawer (BKU History for RKAS Item) */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 110;
  display: flex;
  justify-content: flex-end;
}
.drawer {
  width: 100%;
  max-width: 600px;
  background: #fff;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(15, 23, 42, 0.2);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}
.toast {
  background: var(--navy-900);
  color: #fff;
  padding: 11px 15px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--sky-400);
  animation: popIn 0.16s ease-out;
}
.toast.success { border-left-color: #10b981; }
.toast.error { background: #7f1d1d; border-left-color: #f87171; }
.toast.warn { background: #78350f; border-left-color: #fbbf24; }

/* Charts */
.chart-svg { width: 100%; height: auto; display: block; }
.legend-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--slate-600);
  margin-top: 8px;
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: middle;
}

/* Empty State */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--slate-500);
}
.empty-state h4 { margin: 8px 0 4px; color: var(--slate-700); }

/* Utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.text-muted { color: var(--slate-500); }
.text-green { color: var(--emerald-700); font-weight: 700; }
.text-red { color: var(--red-700); font-weight: 700; }
.text-amber { color: var(--amber-700); font-weight: 700; }
.text-blue { color: var(--blue-600); font-weight: 700; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }

/* Mobile Overlay & Responsiveness */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 35;
}
@media (max-width: 1024px) {
  .login-page { grid-template-columns: 1fr; }
  .login-hero { padding: 32px 24px; }
  .hero-units { grid-template-columns: repeat(3, 1fr); }
  .two-col, .equal-two-col { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-area { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 14px 12px 32px; }
  .topbar { padding: 10px 14px; }
  .month-input-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .topbar-controls, .filter-bar, .no-print { display: none !important; }
  .main-area { margin-left: 0 !important; }
  .card { box-shadow: none; break-inside: avoid; }
}
