:root {
  /* Softer, modern blue palette */
  --c-primary: #1e40af;          /* deep blue for emphasis / brand */
  --c-primary-2: #3b82f6;        /* main action — softer than old #1d4ed8 */
  --c-primary-3: #60a5fa;        /* light accent */
  --c-primary-soft: #eff6ff;     /* subtle blue tint background */
  --c-primary-soft-2: #dbeafe;

  --c-bg: #f6f8fc;               /* breathing background */
  --c-card: #ffffff;
  --c-border: #e6ebf2;           /* softer than #e5e7eb */
  --c-border-2: #eef2f7;
  --c-text: #0f172a;             /* slate-900 */
  --c-text-2: #334155;
  --c-muted: #64748b;

  --c-ok: #10b981;
  --c-warn: #f59e0b;
  --c-err: #ef4444;
  --c-info: #06b6d4;

  /* Sidebar dark slate-blue (softer than #0b1c3a) */
  --c-side-bg-1: #1c2541;
  --c-side-bg-2: #131a32;
  --c-side-text: #c8d3e6;
  --c-side-text-dim: #8a99b5;
  --c-side-section: #6b7a99;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
  --shadow-blue: 0 6px 18px rgba(59, 130, 246, 0.28);

  --radius: 4px;
  --radius-sm: 4px;
  --radius-lg: 4px;

  --t-fast: 120ms ease;
  --t-base: 180ms ease;

  /* Shared control heights — keep inputs, selects and buttons aligned
     so a field and the button beside it never look lopsided (timpang). */
  --control-h: 40px;       /* standard inputs, selects, default buttons */
  --control-h-sm: 32px;    /* compact: btn-sm and inputs inside table rows */
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--c-bg); color: var(--c-text);
  font: 14px/1.55 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--c-primary-2); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--c-primary); text-decoration: none; }

/* Lucide icon defaults */
[data-lucide] { width: 18px; height: 18px; stroke-width: 1.85; flex-shrink: 0; }
.icon-sm [data-lucide], [data-lucide].icon-sm { width: 14px; height: 14px; }
.icon-lg [data-lucide], [data-lucide].icon-lg { width: 22px; height: 22px; }

/* ============ Layout ============ */
.app-shell {
  display: grid; grid-template-columns: 248px 1fr; min-height: 100vh;
}
.sidebar {
  background: linear-gradient(180deg, var(--c-side-bg-1) 0%, var(--c-side-bg-2) 100%);
  color: var(--c-side-text);
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; justify-content: flex-start;
  padding: 4px 6px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 14px;
  text-decoration: none;
}
.sidebar .brand:hover { text-decoration: none; }
.sidebar .brand-logo {
  display: block;
  width: 100%; max-width: 170px; height: auto;
  object-fit: contain;
}
.sidenav { display: flex; flex-direction: column; gap: 2px; }
.sidenav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 4px;
  color: var(--c-side-text);
  font-size: 13.5px;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.sidenav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.sidenav a [data-lucide] { opacity: 0.85; }
.sidenav a.active {
  background: linear-gradient(90deg, var(--c-primary-2), #2563eb);
  color: #fff;
}
.sidenav a.active [data-lucide] { opacity: 1; }
.nav-section {
  padding: 16px 12px 6px;
  color: var(--c-side-section);
  text-transform: uppercase;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
}
.sidenav { flex: 1; }
.nav-section-bottom { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 14px; }

.panduan-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.panduan-content { min-width: 0; }

.panduan-toc {
  position: sticky; top: 16px;
  background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 14px 16px;
  max-height: calc(100vh - 32px); overflow-y: auto;
}
.panduan-toc h4 { margin: 0 0 10px; font-size: 11px; color: var(--c-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.panduan-toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }
.panduan-toc ol li { counter-increment: toc; margin: 0; }
.panduan-toc ol li a {
  display: flex; align-items: baseline; gap: 8px;
  padding: 7px 10px; border-radius: 4px;
  color: var(--c-text); font-size: 13px; line-height: 1.3;
  border-left: 2px solid transparent;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.panduan-toc ol li a::before {
  content: counter(toc, decimal-leading-zero);
  font-size: 10px; font-weight: 700; color: var(--c-muted);
  letter-spacing: 0.05em; flex-shrink: 0;
}
.panduan-toc ol li a:hover { background: var(--c-primary-soft); color: var(--c-primary); }
.panduan-toc ol li a.active {
  background: var(--c-primary-soft); color: var(--c-primary);
  border-left-color: var(--c-primary-2); font-weight: 600;
}
.panduan-toc ol li a.active::before { color: var(--c-primary); }

@media (max-width: 960px) {
  .panduan-layout { grid-template-columns: 1fr; }
  .panduan-toc { position: static; max-height: none; }
}

.panduan-section { scroll-margin-top: 80px; }
.panduan-section h2 { display: flex; align-items: center; gap: 8px; }
.panduan-section h2 .step-no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--c-primary); color: #fff; font-size: 13px; font-weight: 700;
}

.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.role-card { border: 1px solid var(--c-border); border-radius: var(--radius); padding: 12px 14px; background: #fff; }
.role-card h4 { margin: 0 0 6px; display: flex; align-items: center; gap: 6px; }
.role-card .role-tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; background: var(--c-primary-soft); color: var(--c-primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.role-card ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.role-card ul li { margin-bottom: 3px; }

.fr-table th, .fr-table td { vertical-align: top; }
.fr-table code { font-size: 12px; }

.gloss-table td { font-size: 13px; }
.gloss-table td:first-child strong { color: var(--c-primary); }
.gloss-table td:nth-child(2) { color: #475569; }

.app-main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--c-border);
  padding: 14px 28px;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-size: 15px; font-weight: 600; color: var(--c-text); }
.topbar-user { display: flex; gap: 14px; align-items: center; }
.user-block { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 4px; background: var(--c-border-2); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 4px;
  background: var(--c-primary-soft);
  color: var(--c-primary-2);
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px var(--c-primary-soft-2);
}
.user-avatar [data-lucide] { width: 18px; height: 18px; }
.user-meta { line-height: 1.15; }
.user-name { font-weight: 600; font-size: 13px; color: var(--c-text); }
.user-roles { color: var(--c-muted); font-size: 11px; }
.logout-form { margin: 0; }
.btn-icon {
  background: none; border: 0; cursor: pointer;
  padding: 8px 12px; border-radius: 4px;
  color: var(--c-muted); font: inherit;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background var(--t-fast), color var(--t-fast);
}
.btn-icon:hover { background: var(--c-border-2); color: var(--c-text); }
.btn-link {
  background: none; border: 0; color: var(--c-primary-2); cursor: pointer;
  padding: 0; font: inherit;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-link:hover { color: var(--c-primary); }
.app-content { padding: 24px 28px; }

/* ============ Breadcrumb ============ */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: -4px 0 16px; font-size: 13px; }
.breadcrumb a { color: var(--c-muted); text-decoration: none; display: inline-flex; align-items: center; }
.breadcrumb a:hover { color: var(--c-primary-2); text-decoration: underline; }
.breadcrumb .bc-home [data-lucide] { width: 15px; height: 15px; }
.breadcrumb .bc-sep { color: var(--c-muted); display: inline-flex; align-items: center; }
.breadcrumb .bc-sep [data-lucide] { width: 14px; height: 14px; }
.breadcrumb .bc-current { color: var(--c-text); font-weight: 600; max-width: 60ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ Cards & tables ============ */
.card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card h2, .card h3 { margin: 0 0 12px; color: var(--c-text); display: flex; align-items: center; gap: 8px; }
.card h2 > [data-lucide], .card h3 > [data-lucide],
.card-header h2 > [data-lucide], .card-header h3 > [data-lucide] {
  width: 18px; height: 18px; color: var(--c-primary-2); flex-shrink: 0;
}
.app-content > h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; }
.app-content > h2 > [data-lucide] { width: 20px; height: 20px; color: var(--c-primary-2); flex-shrink: 0; }
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
/* Let the title block shrink so a long h2 wraps/ellipsizes instead of pushing the
   action buttons out of the card (overflow). */
.card-header > :first-child { min-width: 0; }
/* Ensure the icon → title gap always applies, even when .card-header is used
   outside a .card (so the icon never touches the title text). */
.card-header h2, .card-header h3 {
  margin: 0; display: flex; align-items: center; gap: 8px;
}
.card-header h2 { font-size: 18px; overflow-wrap: anywhere; }
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-base), box-shadow var(--t-base);
  position: relative; overflow: hidden;
}
.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.kpi::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: linear-gradient(180deg, var(--c-primary-3), var(--c-primary-2));
  opacity: 0.7;
}
.kpi-icon {
  position: absolute; top: 14px; right: 14px;
  width: 38px; height: 38px;
  border-radius: 4px;
  background: var(--c-primary-soft);
  color: var(--c-primary-2);
  display: grid; place-items: center;
}
.kpi-icon [data-lucide] { width: 20px; height: 20px; }
.kpi .label {
  color: var(--c-muted); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
  padding-right: 48px;
}
.kpi .value {
  font-size: 26px; font-weight: 700;
  margin-top: 6px; color: var(--c-text); line-height: 1.15;
}
.kpi .delta { font-size: 11.5px; margin-top: 6px; color: var(--c-muted); }
.kpi .delta .chip {
  display: inline-block; background: var(--c-border-2); color: var(--c-text-2);
  padding: 1px 8px; border-radius: 4px; margin-right: 4px;
  font-weight: 500;
}

.chart-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px; margin-bottom: 16px;
}
.chart-grid .card { margin-bottom: 0; }
@media (max-width: 1280px) { .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .chart-grid { grid-template-columns: 1fr; } }

.chart-legend {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  margin-top: 8px; font-size: 11px; color: var(--c-muted);
}
.chart-legend .lg-item { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .lg-swatch { width: 10px; height: 10px; border-radius: 4px; display: inline-block; }
.chart-legend .lg-value { color: #334155; font-weight: 600; }

table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th, table.tbl td {
  padding: 10px 12px; border-bottom: 1px solid var(--c-border-2);
  text-align: left; vertical-align: top;
}
table.tbl th {
  background: #f7f9fc; font-weight: 600;
  color: var(--c-text-2); font-size: 12.5px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
table.tbl tr:hover td { background: #fafbfd; }
.text-right { text-align: right; }
.text-muted { color: var(--c-muted); }
.nowrap { white-space: nowrap; }

/* ============ Forms ============ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label.full { grid-column: 1 / -1; }
form label { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
form label span { font-weight: 600; font-size: 13px; color: var(--c-text-2); }
form input[type=text], form input[type=email], form input[type=number],
form input[type=password], form input[type=date], form select, form textarea,
.rincian-table input, .rincian-toolbar select {
  padding: 9px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: #fff;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
/* Lock single-line controls to one shared height so they line up with buttons. */
form input[type=text], form input[type=email], form input[type=number],
form input[type=password], form input[type=date], form select,
.rincian-toolbar select {
  height: var(--control-h);
}
form textarea { min-height: 80px; }
/* Inputs inside data-table rows stay compact to match the btn-sm beside them. */
.rincian-table input { height: var(--control-h-sm); padding: 5px 8px; }
form input:focus, form select:focus, form textarea:focus,
.rincian-table input:focus, .rincian-toolbar select:focus {
  outline: none;
  border-color: var(--c-primary-2);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--control-h);
  padding: 0 16px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--c-text);
  cursor: pointer; font: inherit; font-weight: 500; line-height: 1.2;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  box-shadow: none;
}
.btn:hover { background: #f4f6fa; border-color: #d6dde8; box-shadow: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--c-primary-2); color: #fff; border-color: var(--c-primary-2);
  box-shadow: none;
}
.btn-primary:hover { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-danger { background: var(--c-err); color: #fff; border-color: var(--c-err); }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-success { background: var(--c-ok); color: #fff; border-color: var(--c-ok); }
.btn-success:hover { background: #059669; border-color: #059669; color: #fff; }
.btn-block { display: flex; width: 100%; justify-content: center; }
.btn-sm { min-height: var(--control-h-sm); padding: 0 10px; font-size: 12px; }

button, .btn, .btn-primary, .btn-danger, .btn-success, .btn-sm, .btn-block, .btn-icon, .btn-link {
  box-shadow: none !important;
}
button:hover, button:focus, button:active,
.btn:hover, .btn:focus, .btn:active,
.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.btn-danger:hover, .btn-danger:focus, .btn-danger:active,
.btn-success:hover, .btn-success:focus, .btn-success:active,
.btn-icon:hover, .btn-icon:focus, .btn-icon:active,
.btn-link:hover, .btn-link:focus, .btn-link:active {
  box-shadow: none !important;
}

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar input, .toolbar select {
  height: var(--control-h);
  padding: 7px 10px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: #fff; font: inherit;
}
/* Buttons in a filter toolbar match the inputs' height regardless of the
   size class the view used (btn / btn-sm / btn-md), so the row stays level. */
.toolbar .btn { min-height: var(--control-h); padding: 0 14px; font-size: 13.5px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
}
.badge-gray { background: #eef2f7; color: #475569; }
.badge-blue { background: var(--c-primary-soft-2); color: var(--c-primary); }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }

.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 14px; border: 1px solid;
  display: flex; gap: 10px; align-items: flex-start;
}
.alert-info { background: var(--c-primary-soft); color: #1e3a8a; border-color: #bfdbfe; }
.alert-ok, .alert-success { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.alert-warn, .alert-warning { background: #fef3c7; color: #78350f; border-color: #fcd34d; }
.alert-error, .alert-danger { background: #fee2e2; color: #7f1d1d; border-color: #fca5a5; }

.layer-tabs {
  display: flex; gap: 4px; margin-bottom: 14px;
  border-bottom: 1px solid var(--c-border);
}
.layer-tabs a {
  padding: 9px 16px; color: var(--c-muted);
  border-bottom: 2px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
  font-weight: 500;
}
.layer-tabs a:hover { color: var(--c-primary-2); }
.layer-tabs a.active {
  color: var(--c-primary); border-color: var(--c-primary-2);
}

.tree { list-style: none; padding: 0; margin: 0; }
.tree ul { list-style: none; padding-left: 18px; border-left: 1px dashed #cbd5e1; }
.tree li { padding: 4px 0; }

.ai-panel {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border: 1px solid #ddd6fe;
  border-radius: var(--radius);
  padding: 14px 16px; margin-top: 14px;
}
.ai-panel h4 {
  margin: 0 0 10px; color: #5b21b6;
  display: flex; align-items: center; gap: 6px; font-size: 13px;
}

.workflow-bar { display: flex; gap: 6px; margin: 14px 0; flex-wrap: wrap; }
.workflow-bar .step {
  padding: 5px 12px; border-radius: 4px;
  background: #eef2f7; color: var(--c-muted);
  font-size: 12px; font-weight: 500;
}
.workflow-bar .step.done { background: #065f46; color: #fff; }
.workflow-bar .step.current {
  background: var(--c-primary-2); color: #fff;
  font-weight: 700;
}

/* ============ Auth ============ */
.auth-body {
  display: grid; place-items: center; min-height: 100vh;
  background: #fff;
  position: relative; overflow: hidden;
}
.auth-card {
  background: #fff;
  padding: 36px 32px;
  border-radius: 4px;
  width: 100%; max-width: 400px;
  border: 1px solid var(--c-border);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  position: relative; z-index: 1;
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .auth-logo {
  display: block;
  width: 100%; max-width: 240px; height: auto;
  margin: 0 auto 12px;
  object-fit: contain;
}
.auth-brand p { margin: 4px 0 0; color: var(--c-muted); font-size: 13px; }
.auth-form label { margin-bottom: 14px; }
.auth-form .input-icon {
  position: relative;
}
.auth-form .input-icon [data-lucide] {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--c-muted); pointer-events: none;
}
.auth-form .input-icon input { padding-left: 38px !important; width: 100%; }
.auth-form .input-icon.has-toggle input { padding-right: 42px !important; }
.auth-form .pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; margin: 0; border: 0;
  border-radius: 8px; background: transparent; color: var(--c-muted); cursor: pointer;
}
.auth-form .pw-toggle:hover { color: var(--c-text, #111827); background: rgba(15, 23, 42, 0.06); }
.auth-form .pw-toggle:focus-visible { outline: 2px solid var(--c-primary, #4f46e5); outline-offset: 1px; }
.auth-form .pw-toggle [data-lucide] { position: static; left: auto; transform: none; width: 18px; height: 18px; pointer-events: none; }
.auth-form .pw-toggle .icon-hide { display: none; }
.auth-form .pw-toggle.revealed .icon-show { display: none; }
.auth-form .pw-toggle.revealed .icon-hide { display: inline; }
.auth-foot { text-align: center; color: var(--c-muted); font-size: 12px; margin-top: 14px; }

/* ============ Admin decision panel (ACC / Revisi / Tolak) ============ */
.admin-actions { margin-top: 18px; border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; }
.admin-actions .aa-head { padding: 10px 14px; background: #f9fafb; border-bottom: 1px solid var(--c-border); font-weight: 600; font-size: 14px; }
.admin-actions form.aa-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin: 0; }
.admin-actions form.aa-row + form.aa-row { border-top: 1px solid var(--c-border); }
.admin-actions .aa-label { flex: 0 0 132px; font-size: 13.5px; font-weight: 500; color: var(--c-text, #111827); }
.admin-actions .aa-label small { display: block; font-weight: 400; color: var(--c-muted); font-size: 12px; margin-top: 2px; }
.admin-actions .aa-grow { flex: 1 1 auto; min-width: 0; }
.admin-actions input[type="text"].aa-grow { width: 100%; }
.admin-actions form.aa-row > .btn { flex: 0 0 auto; min-width: 132px; justify-content: center; white-space: nowrap; }
@media (max-width: 640px) {
  .admin-actions form.aa-row { flex-wrap: wrap; }
  .admin-actions .aa-label { flex-basis: 100%; }
  .admin-actions .aa-grow { flex-basis: 100%; }
  .admin-actions form.aa-row > .btn { width: 100%; }
}

/* ============ RAB rincian dynamic entry ============ */
.rincian-entry { margin-top: 16px; border: 1px solid var(--c-border); border-radius: var(--radius); padding: 14px; }
.rincian-toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.rincian-toolbar .rincian-kode-label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--c-muted); flex: 1 1 280px; min-width: 240px; }
/* "Tambah baris" sits next to a full-size select — match its height, not btn-sm's. */
.rincian-toolbar .btn { min-height: var(--control-h); padding: 0 14px; }
.rincian-table input { width: 100%; }
.rincian-table td { vertical-align: middle; }
.rincian-table .ta-r { text-align: right; }
.rincian-help { font-size: 12.5px; margin-top: 8px; }
.rincian-status { font-size: 12px; white-space: nowrap; }
.rincian-status.is-idle, .rincian-status.is-typing { color: var(--c-muted); }
.rincian-status.is-saving { color: #b45309; }
.rincian-status.is-saved { color: #15803d; font-weight: 600; }
.rincian-status.is-warn { color: #b45309; }
.rincian-status.is-error { color: #b91c1c; font-weight: 600; }

/* ============ Grouped RAB items (one header per kode akun) ============ */
.rab-items .rab-group-head td {
  background: #f3f6fb;
  border-top: 2px solid var(--c-border);
  padding-top: 8px; padding-bottom: 8px;
}
.rab-items .rab-group-kode {
  font-weight: 700; color: var(--c-primary);
  font-size: 12.5px; letter-spacing: 0.02em;
}
.rab-items .rab-group-head .text-right { font-weight: 600; color: var(--c-text-2); }
/* Indent the rincian so they read as nested under their kode akun. */
.rab-items .rab-group-item td:first-child { padding-left: 24px; }
/* Grand-total row pinned at the bottom of the items table. */
.rab-items tfoot .rab-total-row td {
  background: #f3f6fb;
  border-top: 2px solid var(--c-border);
  font-weight: 700; color: var(--c-text);
  padding-top: 10px; padding-bottom: 10px;
}
.rab-items tfoot .rab-total-row .js-rab-total { color: var(--c-primary); font-size: 14.5px; }

/* Unit "ajukan pembatalan" panel — set apart from the submit action. */
.rab-cancel {
  margin-top: 16px; padding: 14px 16px;
  border: 1px solid #fcd9b6; background: #fff7ed; border-radius: var(--radius);
}
.rab-cancel label { margin-bottom: 10px; }

.chart-grid .chart-holder { min-height: 180px; padding: 8px; }
.chart-holder {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 14px; min-height: 220px;
}
.chart-holder svg { width: 100%; height: auto; }
/* Flowchart diagrams (panduan): tighter padding and hug the diagram height
   (overrides the inline padding/min-height set per holder). */
.chart-holder[data-chart="flow"] {
  padding: 6px !important; min-height: 0 !important;
  width: fit-content; max-width: 100%;   /* frame hugs the diagram, no big empty box */
}

.korelasi-legend { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.korelasi-legend .legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* ============ Modal ============ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 100;
  align-items: center; justify-content: center;
  padding: 24px;
  animation: modalFade 140ms ease;
}
.modal-backdrop.show { display: flex; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: 4px;
  width: 100%; max-width: 560px;
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.3);
  animation: modalPop 180ms ease;
}
@keyframes modalPop { from { transform: translateY(8px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-md { max-width: 720px; }
.modal-lg { max-width: 900px; }
.modal-confirm { max-width: 440px; }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--c-border);
}
.modal-header h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.modal-header h3 [data-lucide] { width: 18px; height: 18px; color: var(--c-primary-2); }
.modal-close {
  background: none; border: 0; cursor: pointer;
  padding: 6px; border-radius: 4px;
  color: var(--c-muted);
  display: inline-flex; align-items: center;
}
.modal-close:hover { background: var(--c-border-2); color: var(--c-text); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-body > form > label:last-child { margin-bottom: 0; }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 18px;
  border-top: 1px solid var(--c-border-2);
  background: #f8fafc;
}

/* Buttons: ensure medium default, icon spacing, sm/lg variants */
.btn-md { min-height: var(--control-h); padding: 0 14px; font-size: 13.5px; }
.btn [data-lucide] { width: 16px; height: 16px; }
.btn-sm [data-lucide] { width: 14px; height: 14px; }
.btn-lg [data-lucide] { width: 18px; height: 18px; }

/* Form error block */
.form-error {
  color: #b91c1c; background: #fee2e2; border: 1px solid #fecaca;
  padding: 9px 12px; border-radius: 4px; margin-bottom: 12px;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}

/* Spinner */
.spin { animation: spin 0.85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar polish (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: padding-box; border: 2px solid transparent; }

/* Responsive */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .form-grid { grid-template-columns: 1fr; }
}
