:root {
  --bg: #f8f9fb;
  --surface: #ffffff;
  --ink: #191c1f;
  --ink-2: #505a63;
  --muted: #8d969e;
  --line: #e4e6ea;
  --green: #28a745;
  --red: #dc3545;
  --radius: 12px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; min-height: 100vh; }

/* shell + sidebar */
.lara { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.lara-side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.lara-brand { background: linear-gradient(135deg, #e84393, #a55eea); color: #fff; border-radius: 10px; padding: 14px; display: flex; gap: 10px; align-items: center; }
.lara-brand .logo { width: 38px; height: 38px; border-radius: 50%; background: rgba(0,0,0,.45); display: grid; place-items: center; font-weight: 800; font-size: 20px; flex: none; }
.lara-brand b { display: block; font-size: 16px; letter-spacing: 1px; }
.lara-brand small { font-size: 11px; opacity: .85; }
.lara-user { display: flex; gap: 10px; align-items: center; padding: 0 6px; }
.lara-user .ava { width: 40px; height: 40px; border-radius: 8px; background: #e9ecef; display: grid; place-items: center; font-weight: 700; color: var(--ink-2); flex: none; }
.lara-user b { display: block; font-size: 14px; }
.lara-user small { color: var(--muted); font-size: 12px; }
.lara-sec { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--muted); padding: 0 10px; margin: 0; }
.lara-nav { display: grid; gap: 2px; }
.lara-nav a { color: var(--ink-2); text-decoration: none; font-size: 14px; padding: 10px 12px; border-radius: 8px; display: flex; gap: 10px; align-items: center; }
.lara-nav a .ico { width: 20px; text-align: center; }
.lara-nav a:hover { background: #f1f3f5; color: var(--ink); }
.lara-nav a.active { background: #e9ecef; color: var(--ink); font-weight: 600; }
.lara-sub { display: none; padding-left: 42px; }
.lara-sub.open { display: grid; gap: 2px; }
.lara-sub a { font-size: 13px; padding: 8px 12px; }
.lara-foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 10px; }
.lara-foot a { color: var(--red); font-weight: 600; text-decoration: none; }

/* topbar + main */
.lara-main { min-width: 0; }
.lara-top { background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 5; }
.lara-top .burger { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--ink-2); }
.lara-top .me { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.lara-top .me .ava { width: 34px; height: 34px; border-radius: 50%; background: #e9ecef; display: grid; place-items: center; font-weight: 700; font-size: 13px; position: relative; }
.lara-top .me .ava::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: #fd7e14; border: 2px solid #fff; }
.lara-body { padding: 24px clamp(16px, 3vw, 32px) 60px; max-width: 1280px; }
.lara-title { font-size: 24px; margin: 0 0 18px; font-weight: 700; }
.inline-period { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.inline-period select { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: inherit; background: #fff; }

/* 8 gradient cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.stat { color: #fff; border-radius: 10px; padding: 18px; min-height: 118px; display: grid; gap: 4px; align-content: center; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.stat .t { font-size: 14px; font-weight: 600; }
.stat .v { font-size: 21px; font-weight: 800; letter-spacing: -.3px; }
.stat .s { font-size: 12px; opacity: .9; }
.g1 { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.g2 { background: linear-gradient(135deg, #ff6a88, #ff99ac); }
.g3 { background: linear-gradient(135deg, #f6a723, #f7ce46); }
.g4 { background: linear-gradient(135deg, #3a7bd5, #6d9ff5); }
.g5 { background: linear-gradient(135deg, #8e44ad, #b06ab3); }
.g6 { background: linear-gradient(135deg, #9b2c8f, #e84393); }
.g7 { background: linear-gradient(135deg, #5b6ee1, #8e9bff); }
.g8 { background: linear-gradient(135deg, #b06ab3, #e0aaff); }

/* chart panels */
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.chart-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.chart-panel h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.chart-box svg, .chart svg { width: 100%; height: auto; display: block; }
.chart-box .grid, .chart .grid { stroke: var(--line); stroke-width: 1; }
.chart-box .ylab, .chart-box .xlab, .chart .ylab, .chart .xlab { font-size: 11px; fill: var(--muted); }
.chart-box .b-in, .chart .b-in { fill: #2563eb; }
.chart-box .b-out, .chart .b-out { fill: var(--red); }
.chart-box .b-in2, .chart .b-in2 { fill: #2563eb; }
.chart-box .b-out2, .chart .b-out2 { fill: var(--red); }
.chart-box .dot-sisa, .chart .dot-sisa { fill: var(--green); }
.chart-box .legend text, .chart .legend text { font-size: 11px; fill: var(--muted); }

/* generic: panels, forms, tables */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel h2 { margin: 0 0 14px; font-size: 18px; }
.page-head { margin-bottom: 18px; }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #a55eea; margin: 0 0 4px; }
h1 { font-size: 26px; margin: 0; }
.sub { color: var(--ink-2); margin: 6px 0 0; font-size: 14px; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
input, select { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; min-height: 46px; width: 100%; }
button, .btn { font: inherit; font-weight: 600; font-size: 14px; background: var(--ink); color: #fff; border: 0; border-radius: 8px; padding: 12px 24px; min-height: 46px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
button:hover, .btn:hover { opacity: .85; }
.btn.light { background: #e9ecef; color: var(--ink); }
.btn.ghost, button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-height: 38px; font-size: 12px; }
.btn.danger, button.danger { background: transparent; color: var(--red); border: 1px solid #f3c2c7; border-radius: 8px; padding: 8px 12px; min-height: 38px; font-size: 12px; }
.req { color: var(--red); }
.hint, .muted { color: var(--muted); font-size: 13px; }
.banner { padding: 12px 14px; border-radius: 8px; margin: 0 0 16px; font-size: 14px; }
.banner.err { background: #fdeef0; color: #8b0000; }
.banner.ok { background: #e6f6f0; color: #006400; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; background: #fff; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-2); background: #f4f5f7; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; font-family: var(--mono); font-size: 12.5px; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 3px 10px; }
.tag.in { background: #e6f6f0; color: #006400; }
.tag.out { background: #fdeef0; color: #8b0000; }
.tag.save { background: #eee9ff; color: #6c3ce0; }
.ok { color: #006400; font-weight: 600; }
.todo { color: var(--red); font-weight: 600; }
table.kv td.bar { width: 32%; }
table.kv td.bar span { display: block; height: 8px; border-radius: 999px; background: #a55eea; }
form.inline { display: inline-flex; gap: 8px; align-items: center; margin: 4px 0 0; }
form.inline.row { display: flex; }
form.inline input { min-height: 38px; padding: 8px 10px; }
.narrow { max-width: 440px; }
.cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 6px; }
.card span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-2); }
.card strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.card small { color: var(--muted); font-size: 12px; }
.card.sisa.neg strong { color: var(--red); }
.picker { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 18px; }
.picker .fld { min-width: 170px; }
.chart { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow-x: auto; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); }
.login-hero { background: linear-gradient(135deg, #e84393, #a55eea); color: #fff; padding: clamp(28px, 5vw, 72px); display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.login-hero .mark { width: 48px; height: 48px; border-radius: 50%; background: rgba(0,0,0,.45); display: grid; place-items: center; font-weight: 800; font-size: 24px; }
.login-hero h1 { color: #fff; font-size: clamp(30px, 4vw, 48px); }
.login-hero p { color: rgba(255,255,255,.9); font-size: 16px; max-width: 42ch; }
.hero-stats { display: flex; gap: 28px; margin-top: 12px; }
.hero-stats div b { display: block; font-size: 24px; }
.hero-stats div span { font-size: 12px; opacity: .85; text-transform: uppercase; }
.login-pane { display: grid; place-items: center; padding: 32px; background: var(--bg); }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 32px 30px; }
.login-card h2 { margin: 0 0 4px; font-size: 24px; }
.login-card .lede { color: var(--ink-2); font-size: 14px; margin: 0 0 20px; }
.role-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border: 0; padding: 0; margin: 0 0 4px; }
.role-switch .pill { display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface-2); border-radius: 999px; padding: 12px; cursor: pointer; font-weight: 600; font-size: 14px; border: 2px solid transparent; margin: 0; }
.role-switch .pill:has(input:checked) { border-color: var(--ink); background: #fff; }

@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .charts { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .lara { grid-template-columns: 1fr; }
  .lara-side { position: static; height: auto; }
  .login-wrap { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}
