/* ============================================================
   Sistem Invoice & SPJ Pengadaan — App UI
   Design tokens & layout
   ============================================================ */
:root {
  --slate-900: #0F172A;
  --slate-850: #131C31;
  --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;

  --primary: #2563EB;
  --primary-600: #1D4ED8;
  --primary-700: #1E40AF;
  --primary-50: #EFF6FF;

  --green: #16A34A;
  --green-600: #15803D;
  --green-50: #ECFDF5;
  --amber: #F59E0B;
  --amber-50: #FFFBEB;
  --red: #DC2626;
  --red-50: #FEF2F2;

  --bg: #F1F5F9;
  --panel: #FFFFFF;
  --line: #E2E8F0;
  --text: #0F172A;
  --muted: #64748B;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.05);
  --shadow: 0 6px 20px -6px rgba(15,23,42,.14), 0 2px 6px rgba(15,23,42,.06);
  --shadow-lg: 0 24px 60px -18px rgba(15,23,42,.35);
  --sidebar-w: 264px;
  --topbar-h: 68px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.muted { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.ta-right { text-align: right !important; }
.ta-center { text-align: center !important; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }

/* ============================ LAYOUT ============================ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--slate-900);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 14px;
  gap: 14px;
  transition: width .22s ease;
  z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 4px 6px; }
.brand-logo {
  width: 38px; height: 38px; object-fit: contain;
  background: #fff; border-radius: 10px; padding: 4px; flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { color: #fff; font-size: 14.5px; line-height: 1.2; white-space: nowrap; }
.brand-text span { color: #64748b; font-size: 11px; white-space: nowrap; }
.sidebar-collapse {
  margin-left: auto; background: transparent; border: 0; color: #64748b;
  width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center;
}
.sidebar-collapse:hover { background: rgba(255,255,255,.06); color: #cbd5e1; }

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; padding-right: 2px; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: #475569; font-weight: 700; padding: 12px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px; border-radius: 10px; color: #94a3b8;
  font-size: 13.5px; font-weight: 500; position: relative;
  transition: background .15s, color .15s;
}
.nav-item svg { flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.055); color: #e2e8f0; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -6px rgba(37,99,235,.75); }
.nav-item.active svg { opacity: 1; }

.sidebar-card {
  background: linear-gradient(160deg, #1e293b, #131c31);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius); padding: 14px; position: relative; overflow: hidden;
}
.sidebar-card::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px;
  background: radial-gradient(circle, rgba(37,99,235,.35), transparent 70%);
}
.sidebar-card-icon {
  width: 34px; height: 34px; border-radius: 9px; background: rgba(37,99,235,.2);
  color: #60a5fa; display: grid; place-items: center; margin-bottom: 9px;
}
.sidebar-card strong { color: #fff; font-size: 12.5px; display: block; }
.sidebar-card p { color: #64748b; font-size: 11px; margin-top: 4px; line-height: 1.5; }

.sidebar-footer { display: flex; align-items: center; gap: 10px; padding: 10px 6px 2px; border-top: 1px solid rgba(255,255,255,.06); }
.sf-text { display: flex; flex-direction: column; min-width: 0; }
.sf-text strong { color: #e2e8f0; font-size: 12.5px; white-space: nowrap; }
.sf-text span { color: #64748b; font-size: 11px; }

/* collapsed sidebar */
.app-shell.sidebar-collapsed .sidebar { width: 86px; }
.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-item span,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .sidebar-card,
.app-shell.sidebar-collapsed .sf-text { display: none; }
.app-shell.sidebar-collapsed .nav-item { justify-content: center; }
.app-shell.sidebar-collapsed .sidebar-brand { flex-direction: column; justify-content: center; gap: 9px; padding-bottom: 12px; }
.app-shell.sidebar-collapsed .sidebar-collapse { margin: 0; transform: rotate(180deg); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ============================ TOPBAR ============================ */
.topbar {
  height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  position: sticky; top: 0; z-index: 30;
}
.menu-toggle { display: none; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  border: 1px solid transparent; background: transparent; color: var(--slate-600);
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; position: relative;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--slate-100); color: var(--slate-900); }
.badge-dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; background: var(--red); border-radius: 50%; box-shadow: 0 0 0 2px #fff; }

/* company switcher */
.company-switcher { position: relative; }
.cs-btn {
  display: flex; align-items: center; gap: 11px; background: var(--slate-50);
  border: 1px solid var(--line); padding: 7px 12px 7px 8px; border-radius: 12px; min-width: 240px;
  transition: border-color .15s, background .15s;
}
.cs-btn:hover { background: #fff; border-color: var(--slate-300); }
.cs-avatar {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(140deg, var(--primary), #60a5fa); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.cs-info { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; flex: 1; }
.cs-info small { color: var(--muted); font-size: 10.5px; }
.cs-info strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.cs-caret { color: var(--slate-400); transition: transform .2s; }
.company-switcher.open .cs-caret { transform: rotate(180deg); }

.cs-menu {
  position: absolute; top: calc(100% + 8px); left: 0; width: 320px; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 8px; display: none; z-index: 60;
}
.company-switcher.open .cs-menu { display: block; animation: pop .14s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.cs-menu-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--slate-400); font-weight: 700; padding: 8px 10px 6px; }
.cs-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: transparent; border: 0; padding: 9px 10px; border-radius: 10px;
}
.cs-item:hover { background: var(--slate-50); }
.cs-item.active { background: var(--primary-50); }
.cs-item .cs-avatar { width: 32px; height: 32px; font-size: 12px; }
.cs-item-info { flex: 1; min-width: 0; }
.cs-item-info strong { display: block; font-size: 13px; }
.cs-item-info small { color: var(--muted); font-size: 11px; }
.cs-item-check { color: var(--primary); opacity: 0; }
.cs-item.active .cs-item-check { opacity: 1; }
.cs-item-role { font-size: 10px; color: var(--slate-400); border: 1px solid var(--line); padding: 1px 6px; border-radius: 20px; }

/* user menu */
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; background: transparent; border: 1px solid transparent; padding: 5px 8px; border-radius: 12px; }
.user-btn:hover { background: var(--slate-100); }
.user-text { display: flex; flex-direction: column; align-items: flex-start; }
.user-text strong { font-size: 12.5px; }
.user-text small { color: var(--muted); font-size: 10.5px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(140deg, var(--slate-700), var(--slate-900)); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px;
}
.avatar-sm { width: 34px; height: 34px; font-size: 11.5px; }

.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; width: 250px; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 8px; display: none; z-index: 60;
}
.user-menu.open .user-dropdown { display: block; animation: pop .14s ease; }
.ud-head { display: flex; align-items: center; gap: 10px; padding: 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.ud-head strong { font-size: 13px; display: block; }
.ud-head small { color: var(--muted); font-size: 11px; }
.user-dropdown a { display: block; padding: 9px 10px; border-radius: 9px; font-size: 13px; color: var(--slate-600); }
.user-dropdown a:hover { background: var(--slate-50); color: var(--slate-900); }
.ud-logout { width: 100%; text-align: left; border: 0; background: transparent; color: var(--red); padding: 9px 10px; border-radius: 9px; font-size: 13px; margin-top: 4px; }
.ud-logout:hover { background: var(--red-50); }

/* ============================ CONTENT ============================ */
.content { padding: 24px; flex: 1; }
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head-actions { display: flex; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent;
  padding: 10px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: transform .06s, background .15s, box-shadow .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px -8px rgba(37,99,235,.8); }
.btn-primary:hover { background: var(--primary-600); }
.btn-green { background: var(--green); color: #fff; box-shadow: 0 8px 18px -8px rgba(22,163,74,.8); }
.btn-green:hover { background: var(--green-600); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--slate-600); }
.btn-ghost:hover { background: var(--slate-50); color: var(--slate-900); }
.btn-soft { background: var(--primary-50); color: var(--primary-700); border-color: #dbeafe; }
.btn-soft:hover { background: #dbeafe; }
.btn-block { width: 100%; justify-content: center; margin-top: 14px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700;
  padding: 4px 10px; border-radius: 20px; white-space: nowrap;
}
.pill-blue { background: var(--primary-50); color: var(--primary-700); }
.pill-green { background: var(--green-50); color: var(--green-600); }
.pill-slate { background: var(--slate-100); color: var(--slate-600); }

/* panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h2 { font-size: 15.5px; }

/* metrics */
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.metric-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--primary); }
.metric-card.g-green::before { background: var(--green); }
.metric-card.g-amber::before { background: var(--amber); }
.metric-card.g-slate::before { background: var(--slate-700); }
.metric-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.metric-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.metric-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; }
.metric-icon.i-blue { background: var(--primary-50); color: var(--primary); }
.metric-icon.i-green { background: var(--green-50); color: var(--green); }
.metric-icon.i-amber { background: var(--amber-50); color: var(--amber); }
.metric-icon.i-slate { background: var(--slate-100); color: var(--slate-700); }
.metric-value { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.metric-foot { margin-top: 8px; font-size: 11.5px; display: flex; align-items: center; gap: 6px; }
.trend-up { color: var(--green-600); font-weight: 700; }
.trend-down { color: var(--red); font-weight: 700; }

/* dashboard split */
.dashboard-split { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.side-stack { display: flex; flex-direction: column; gap: 20px; }

/* table */
.table-wrap { overflow-x: auto; margin: 0 -18px -18px; padding: 0 18px 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--slate-500); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: var(--slate-50); white-space: nowrap;
}
.table th:first-child { border-top-left-radius: 8px; }
.table th:last-child { border-top-right-radius: 8px; }
.table td { padding: 12px; border-bottom: 1px solid var(--slate-100); vertical-align: middle; }
.table tbody tr:hover { background: var(--slate-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.doc-no { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12px; font-weight: 600; color: var(--slate-700); }
.school-cell { display: flex; flex-direction: column; }
.school-cell strong { font-size: 13px; }
.school-cell small { color: var(--muted); font-size: 11px; }
.nominal { font-weight: 700; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 20px; }
.badge-lunas { background: var(--green-50); color: var(--green-600); }
.badge-pending { background: var(--amber-50); color: #B45309; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.row-actions { display: flex; gap: 6px; justify-content: center; }
.mini-btn {
  border: 1px solid var(--line); background: #fff; color: var(--slate-600);
  padding: 6px 10px; border-radius: 8px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.mini-btn:hover { background: var(--slate-50); color: var(--slate-900); border-color: var(--slate-300); }
.mini-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.mini-btn.primary:hover { background: var(--primary-600); }
.mini-btn.danger { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.mini-btn.danger:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.import-reset { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--slate-600); white-space: nowrap; }
.import-reset input { accent-color: var(--primary); }

/* bar chart */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar-track { width: 100%; display: flex; align-items: flex-end; height: 100%; }
.bar {
  width: 100%; border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #60a5fa, var(--primary));
  transition: height .5s cubic-bezier(.2,.8,.2,1); position: relative; min-height: 6px;
}
.bar:hover { filter: brightness(1.06); }
.bar-col span { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.bar-val { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 9.5px; color: var(--slate-500); white-space: nowrap; opacity: 0; transition: opacity .15s; }
.bar:hover .bar-val { opacity: 1; }

/* receivable list */
.receivable-list { display: flex; flex-direction: column; gap: 12px; }
.rec-item { display: flex; align-items: center; gap: 12px; }
.rec-avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--slate-100); color: var(--slate-600); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.rec-info { flex: 1; min-width: 0; }
.rec-info strong { font-size: 12.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-info small { color: var(--muted); font-size: 11px; }
.rec-amt { font-weight: 700; font-size: 12.5px; color: #B45309; white-space: nowrap; }
.progress { height: 6px; background: var(--slate-100); border-radius: 10px; overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; background: var(--amber); border-radius: 10px; }

/* ============================ FORM ============================ */
.form-layout { display: grid; grid-template-columns: minmax(0,1fr) 380px; gap: 20px; align-items: start; }
.form-main { display: flex; flex-direction: column; gap: 18px; }
.form-calc { position: sticky; top: calc(var(--topbar-h) + 24px); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; position: relative; }
.field > span { font-size: 12px; font-weight: 600; color: var(--slate-600); }
.field-span2 { grid-column: span 2; }
.field-span3 { grid-column: span 3; }
input, select, textarea {
  font-family: inherit; font-size: 13.5px; color: var(--text);
  border: 1px solid var(--slate-200); background: #fff; border-radius: 10px;
  padding: 10px 12px; width: 100%; transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
input[readonly] { background: var(--slate-50); color: var(--slate-500); box-shadow: none; }
input[readonly]:focus { border-color: var(--slate-200); box-shadow: none; }
textarea { resize: vertical; }

/* autocomplete */
.autocomplete input { padding-right: 36px; }
.ac-clear { position: absolute; right: 8px; bottom: 8px; width: 26px; height: 26px; border: 0; background: transparent; color: var(--slate-400); border-radius: 7px; display: none; place-items: center; }
.autocomplete.has-value .ac-clear { display: grid; }
.ac-clear:hover { background: var(--slate-100); color: var(--slate-700); }
.ac-list {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  max-height: 260px; overflow-y: auto; z-index: 25; display: none; padding: 6px;
}
.ac-list.open { display: block; animation: pop .12s ease; }
.ac-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.ac-item:hover, .ac-item.active { background: var(--primary-50); }
.ac-item-ic { width: 32px; height: 32px; border-radius: 8px; background: var(--slate-100); color: var(--slate-600); display: grid; place-items: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.ac-item.active .ac-item-ic { background: var(--primary); color: #fff; }
.ac-item strong { font-size: 13px; display: block; }
.ac-item small { color: var(--muted); font-size: 11px; }
.ac-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* form table */
.table-form th { background: #fff; border-bottom: 1px solid var(--line); }
.table-form td { padding: 8px 8px; }
.table-form input, .table-form select { padding: 8px 10px; font-size: 13px; }
.table-form .row-no { color: var(--slate-400); font-weight: 700; font-size: 13px; }
.item-jumlah { font-weight: 700; font-size: 13.5px; color: var(--slate-800); }
.row-del {
  border: 1px solid var(--red-50); background: var(--red-50); color: var(--red);
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; margin: 0 auto;
}
.row-del:hover { background: #fee2e2; border-color: #fecaca; }
.item-name-wrap { display: flex; flex-direction: column; gap: 4px; }
.item-cat-hint { font-size: 10.5px; color: var(--slate-400); }
.currency-input { position: relative; }
.currency-input input { padding-left: 26px; }
.currency-input::before { content: "Rp"; position: absolute; left: 9px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--slate-400); font-weight: 600; z-index: 1; }

/* calc panel */
.calc-panel { background: linear-gradient(180deg, #ffffff, var(--slate-50)); }
.calc-toggle {
  display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none;
  padding: 10px 12px; margin: 4px 0 10px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; font-size: 12.5px; font-weight: 600; color: var(--slate-700);
}
.calc-toggle:hover { border-color: var(--primary); }
.calc-toggle input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.calc-note { font-size: 11.5px; color: var(--amber-700, #b45309); background: #fffbeb; border: 1px dashed #fcd34d; border-radius: 10px; padding: 8px 12px; margin-top: 10px; }
.calc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--slate-200); font-size: 13px; }
.calc-row span { color: var(--slate-600); }
.calc-row em { font-style: normal; color: var(--slate-400); font-size: 11px; }
.calc-row strong { font-variant-numeric: tabular-nums; font-weight: 700; }
.calc-grand {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding: 16px; border-radius: 12px;
  background: linear-gradient(135deg, var(--slate-900), #1e293b); color: #fff;
}
.calc-grand span { font-size: 12px; color: var(--slate-300); }
.calc-grand strong { font-size: 19px; font-variant-numeric: tabular-nums; }
.terbilang-box { margin-top: 14px; background: var(--primary-50); border: 1px dashed #bfdbfe; border-radius: 12px; padding: 12px 14px; }
.terbilang-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--primary-700); }
.terbilang-box p { margin-top: 5px; font-size: 13.5px; font-weight: 600; color: var(--slate-800); line-height: 1.5; font-style: italic; }
.calc-hint { font-size: 11px; color: var(--muted); text-align: center; margin-top: 10px; }

/* empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 80px 20px; }
.empty-state img { width: 78px; height: 78px; object-fit: contain; opacity: .9; margin-bottom: 18px; }
.empty-state h2 { font-size: 18px; }
.empty-state p { color: var(--muted); margin-top: 8px; max-width: 420px; }

/* ============================ MODAL ============================ */
.modal {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
  background: rgba(15,23,42,.78); backdrop-filter: blur(3px);
}
.modal[hidden] { display: none; }
.modal-chrome { background: var(--slate-900); color: #fff; flex-shrink: 0; }
.modal-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; flex-wrap: wrap; }
.modal-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; color: #fff; }
.modal-title .pill { margin-left: 4px; }
.modal-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.paper-picker { display: flex; gap: 6px; background: rgba(255,255,255,.06); padding: 4px; border-radius: 11px; }
.pp-opt { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 8px; cursor: pointer; transition: background .15s; }
.pp-opt:hover { background: rgba(255,255,255,.06); }
.pp-opt input { display: none; }
.pp-opt span { display: flex; flex-direction: column; line-height: 1.2; }
.pp-opt strong { font-size: 12.5px; color: #cbd5e1; }
.pp-opt small { font-size: 10.5px; color: #64748b; }
.pp-opt:has(input:checked) { background: var(--primary); }
.pp-opt:has(input:checked) strong, .pp-opt:has(input:checked) small { color: #fff; }

.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch-track { width: 44px; height: 24px; border-radius: 20px; background: #334155; position: relative; transition: background .18s; flex-shrink: 0; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .18s; }
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); }
.switch-text { font-size: 12.5px; color: #cbd5e1; font-weight: 600; }
.modal-close { color: #94a3b8; }
.modal-close:hover { background: rgba(255,255,255,.08); color: #fff; }

.modal-tabs { display: flex; gap: 4px; padding: 0 16px; border-top: 1px solid rgba(255,255,255,.07); }
.tab {
  border: 0; background: transparent; color: #94a3b8; font-size: 13px; font-weight: 600;
  padding: 12px 16px; border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 8px;
}
.tab i { width: 20px; height: 20px; border-radius: 6px; background: rgba(255,255,255,.08); display: grid; place-items: center; font-style: normal; font-size: 11px; }
.tab:hover { color: #e2e8f0; }
.tab.active { color: #fff; border-bottom-color: var(--primary); }
.tab.active i { background: var(--primary); }

.paper-viewport { flex: 1; overflow: auto; padding: 28px 20px 40px; display: flex; justify-content: center; align-items: flex-start; }
.paper-stage { transform-origin: top center; }
#printArea { display: flex; flex-direction: column; align-items: center; gap: 26px; }

.modal-footer { flex-shrink: 0; background: #fff; border-top: 1px solid var(--line); padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.mf-info { display: flex; align-items: center; gap: 12px; }
.mf-actions { display: flex; gap: 10px; }

/* toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--slate-900); color: #fff; padding: 13px 20px; border-radius: 12px; font-size: 13.5px;
  box-shadow: var(--shadow-lg); z-index: 200; opacity: 0; transition: opacity .2s, transform .2s;
  display: flex; align-items: center; gap: 10px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

/* scrim */
.sidebar-scrim { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 39; }
.sidebar-scrim.show { display: block; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 1180px) {
  .dashboard-split { grid-template-columns: 1fr; }
  .side-stack { flex-direction: row; }
  .side-stack .panel { flex: 1; }
  .form-layout { grid-template-columns: 1fr; }
  .form-calc { position: static; }
}
@media (max-width: 900px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .25s ease; box-shadow: var(--shadow-lg);
  }
  .app-shell.nav-open .sidebar { transform: none; }
  .app-shell.sidebar-collapsed .sidebar { width: var(--sidebar-w); }
  .app-shell.sidebar-collapsed .brand-text,
  .app-shell.sidebar-collapsed .nav-item span,
  .app-shell.sidebar-collapsed .nav-label,
  .app-shell.sidebar-collapsed .sidebar-card,
  .app-shell.sidebar-collapsed .sf-text { display: block; }
  .app-shell.sidebar-collapsed .nav-item { justify-content: flex-start; }
  .app-shell.sidebar-collapsed .sidebar-brand { flex-direction: row; gap: 11px; }
  .menu-toggle { display: grid; }
  .sidebar-collapse { display: none; }
  .cs-btn { min-width: 0; }
  .cs-info { display: none; }
  .cs-btn { padding: 7px 8px; }
  .user-text { display: none; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .field-span3 { grid-column: span 2; }
}
@media (max-width: 620px) {
  .content { padding: 16px; }
  .metric-grid { grid-template-columns: 1fr; }
  .side-stack { flex-direction: column; }
  .grid-3 { grid-template-columns: 1fr; }
  .field-span2, .field-span3 { grid-column: span 1; }
  .page-head-actions { width: 100%; }
  .page-head-actions .btn { flex: 1; justify-content: center; }
  .modal-topbar { padding: 10px 12px; }
  .modal-title { font-size: 13px; }
  .tab { padding: 11px 10px; font-size: 12px; }
  .tab i { display: none; }
  .modal-footer { padding: 10px 12px; }
  .mf-actions { width: 100%; }
  .mf-actions .btn { flex: 1; justify-content: center; }
}

/* ============================================================
   FASE 4 — Login, Pengaturan, Pengguna, Audit
   ============================================================ */
.login-screen {
  position: fixed; inset: 0; z-index: 500; display: grid;
  grid-template-columns: 1.05fr 1fr; background: #fff;
}
.login-brand {
  background: radial-gradient(1200px 600px at 15% 15%, #1e293b 0%, #0F172A 55%);
  color: #fff; padding: 56px 60px; display: flex; flex-direction: column; justify-content: center;
  gap: 20px; position: relative; overflow: hidden;
}
.login-brand::after {
  content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(37,99,235,.45), transparent 65%);
}
.login-brand::before {
  content: ""; position: absolute; left: -80px; top: -80px; width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(220,38,38,.25), transparent 65%);
}
.lb-top { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.lb-logo { width: 54px; height: 54px; background: #fff; border-radius: 14px; padding: 7px; object-fit: contain; }
.lb-top strong { font-size: 16px; display: block; }
.lb-top span { color: #94a3b8; font-size: 12px; }
.login-brand h1 { font-size: 34px; line-height: 1.14; max-width: 14ch; position: relative; z-index: 1; }
.login-brand > p { color: #cbd5e1; max-width: 46ch; line-height: 1.65; position: relative; z-index: 1; font-size: 14px; }
.lb-points { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 11px; position: relative; z-index: 1; }
.lb-points li { display: flex; gap: 11px; color: #e2e8f0; font-size: 13.5px; align-items: center; }
.lb-points li::before {
  content: "✓"; flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(74,222,128,.16); color: #4ade80; font-weight: 700; font-size: 11px;
  display: grid; place-items: center;
}
.lb-badge {
  align-self: flex-start; margin-top: 10px; border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.06); padding: 9px 16px; border-radius: 20px; font-size: 12px;
  color: #cbd5e1; position: relative; z-index: 1;
}
.login-panel { display: grid; place-items: center; padding: 40px; background: var(--slate-50); overflow-y: auto; }
.login-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 34px; box-shadow: var(--shadow-lg); }
.login-card h2 { font-size: 22px; }
.login-card form { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.pw-field { position: relative; }
.pw-toggle { position: absolute; right: 6px; bottom: 5px; border: 0; background: var(--slate-100); color: var(--slate-600); font-size: 11.5px; font-weight: 600; padding: 6px 11px; border-radius: 8px; }
.pw-toggle:hover { background: var(--slate-200); }
.remember { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--slate-600); }
.remember input, .check-inline input { width: auto; }
.login-error { background: var(--red-50); color: #b91c1c; border: 1px solid #fecaca; border-radius: 10px; padding: 10px 12px; font-size: 12.5px; }
.login-demo { margin-top: 22px; border-top: 1px dashed var(--line); padding-top: 16px; }
.demo-btns { display: grid; gap: 8px; margin-top: 10px; }
.demo-btns button { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 13px; display: flex; flex-direction: column; transition: background .15s, border-color .15s; }
.demo-btns button:hover { background: var(--primary-50); border-color: #bfdbfe; }
.demo-btns strong { font-size: 12.5px; }
.demo-btns small { color: var(--muted); font-size: 11px; }
.login-offline { width: 100%; margin-top: 14px; border: 0; background: transparent; color: var(--slate-500); font-size: 12px; text-decoration: underline; }
.login-offline:hover { color: var(--slate-800); }

/* generik */
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.search-input { max-width: 300px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filter-bar input, .filter-bar select { width: auto; min-width: 140px; }
.filter-bar .search-input { flex: 1 1 240px; min-width: 200px; max-width: none; }
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; gap: 10px; flex-wrap: wrap; }
.pagination-actions { display: flex; gap: 8px; }

.settings-layout { display: grid; grid-template-columns: 1.45fr 1fr; gap: 20px; align-items: start; margin-bottom: 20px; }
.asset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.asset-box { border: 1px dashed var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.asset-box > span { font-size: 12px; font-weight: 700; color: var(--slate-600); }
.asset-preview { height: 116px; border-radius: 10px; background: var(--slate-50); display: grid; place-items: center; overflow: hidden; border: 1px solid var(--slate-100); }
.asset-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.asset-preview.empty::after { content: "belum ada"; color: var(--slate-400); font-size: 11px; }
.asset-box input[type=file] { font-size: 11.5px; }
.check-inline { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--slate-600); padding-top: 26px; }

.role-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.role-super_admin { background: #ede9fe; color: #6d28d9; }
.role-owner { background: var(--primary-50); color: var(--primary-700); }
.role-operator { background: var(--slate-100); color: var(--slate-600); }
.act-badge { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; font-family: 'SFMono-Regular', Consolas, monospace; white-space: nowrap; }
.act-create { background: var(--green-50); color: var(--green-600); }
.act-print { background: var(--primary-50); color: var(--primary-700); }
.act-update { background: var(--amber-50); color: #B45309; }
.act-delete { background: var(--red-50); color: var(--red); }
.act-auth { background: var(--slate-100); color: var(--slate-600); }
.ip-cell { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 11.5px; color: var(--slate-500); }
.log-time { white-space: nowrap; font-size: 12px; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.status-dot .d { width: 7px; height: 7px; border-radius: 50%; }
.status-on { color: var(--green-600); } .status-on .d { background: var(--green); }
.status-off { color: var(--slate-400); } .status-off .d { background: var(--slate-400); }

@media (max-width: 1180px) {
  .settings-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { padding: 22px; }
  .asset-grid { grid-template-columns: 1fr; }
}

/* status koneksi server di layar login */
.login-status { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; padding: 8px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--slate-50); color: var(--slate-600); line-height: 1.45; }
.login-status code { background: var(--slate-200); padding: 1px 5px; border-radius: 4px; font-size: 11px; font-family: 'SFMono-Regular', Consolas, monospace; }
.login-status .ls-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--slate-400); }
.login-status.checking .ls-dot { background: var(--amber); animation: ls-pulse 1s ease-in-out infinite; }
.login-status.ok { background: var(--green-50); border-color: #bbf7d0; color: var(--green-600); }
.login-status.ok .ls-dot { background: var(--green); }
.login-status.fail { background: var(--red-50); border-color: #fecaca; color: #b91c1c; }
.login-status.fail .ls-dot { background: var(--red); }
.login-help { margin-top: 12px; font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.5; }
.login-help code { background: var(--slate-100); padding: 1px 5px; border-radius: 4px; font-family: 'SFMono-Regular', Consolas, monospace; }
.login-about { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); text-align: center; line-height: 1.55; }
.login-about strong { color: var(--slate-700); }
.sidebar-about { margin: 10px 14px 0; font-size: 10.5px; color: var(--slate-400); line-height: 1.5; text-align: center; }
.sidebar-about strong { color: var(--slate-300); }
@keyframes ls-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* Pemilih bagian cetak di modal pratinjau */
.print-scope { display: flex; flex-direction: column; gap: 3px; }
.print-scope span { font-size: 10.5px; color: var(--slate-500); font-weight: 600; }
.print-scope select { padding: 7px 10px; font-size: 13px; min-width: 210px; }

/* Pemilih dokumen (checkbox) di modal pratinjau */
.doc-picker { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.06); padding: 5px 12px; border-radius: 11px; }
.doc-picker .dp-title { font-size: 11.5px; color: #94a3b8; font-weight: 700; }
.dp-opt { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12.5px; color: #cbd5e1; font-weight: 600; padding: 5px 9px; border-radius: 8px; transition: background .15s; }
.dp-opt:hover { background: rgba(255,255,255,.08); }
.dp-opt input { width: 15px; height: 15px; accent-color: #16A34A; cursor: pointer; }
.dp-opt span { white-space: nowrap; }

/* Overlay proses (import/upload) */
.busy-overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(15,23,42,.55); backdrop-filter: blur(2px); }
.busy-box { background: #fff; border-radius: 16px; padding: 26px 34px; display: flex; flex-direction: column; align-items: center; gap: 14px; box-shadow: var(--shadow-lg); min-width: 240px; }
.busy-box p { font-size: 13px; font-weight: 600; color: var(--slate-700); text-align: center; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--slate-200); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
