/* Inventory System - tampilan */
:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --border: #e3e7ef;
    --text: #1d2433;
    --muted: #6b7489;
    --primary: #2457d6;
    --primary-dark: #1b44ab;
    --primary-soft: #e8eefc;
    --danger: #d23b3b;
    --danger-soft: #fdeaea;
    --ok: #198754;
    --ok-soft: #e4f4ec;
    --warn: #b7791f;
    --warn-soft: #fdf3e1;
    --sidebar: #141b2d;
    --sidebar-text: #aab3c7;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(20, 27, 45, .06), 0 4px 16px rgba(20, 27, 45, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.muted { color: var(--muted); }
.ico { width: 18px; height: 18px; flex: none; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 284px; flex: none; background: var(--sidebar); color: var(--sidebar-text);
    position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 16px 16px; color: #fff; }
.brand > div { min-width: 0; }
/* Nama perusahaan selalu satu baris */
.brand strong { display: block; font-size: 12px; line-height: 1.3; letter-spacing: 0; white-space: nowrap; }
.brand small { display: block; margin-top: 3px; color: var(--sidebar-text); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff;
}
.brand .brand-mark { flex: none; }
/* Logo stempel SBK */
.brand-logo { display: inline-flex; flex: none; color: #fff; }
.brand-logo svg, .brand-logo img { display: block; }
.brand-logo img { background: #fff; border-radius: 50%; }
.login-logo { display: inline-flex; color: var(--primary-dark); }
.login-logo svg, .login-logo img { display: block; }
.brand-mark.lg { width: 52px; height: 52px; border-radius: 14px; }
.brand-mark.lg .ico { width: 26px; height: 26px; }
.sidebar nav { padding: 8px 12px 24px; }
.sidebar nav a {
    display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 2px 0;
    border-radius: 8px; color: var(--sidebar-text); font-weight: 500;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.nav-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    padding: 18px 12px 6px; color: #6f7a93;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 12px; padding: 14px 28px;
    background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 18px; flex: 1; }
.menu-toggle { display: none; background: none; border: 0; padding: 6px; cursor: pointer; color: var(--text); }
/* Grup menu samping (dropdown) */
.nav-group { margin: 2px 0; }
.nav-group-toggle {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px;
    background: none; color: var(--sidebar-text); font: inherit; font-weight: 500; text-align: left; cursor: pointer;
}
.nav-group-toggle span { flex: 1; }
.nav-group-toggle:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-group-toggle .ico:last-child { width: 16px; height: 16px; transition: transform .15s; opacity: .7; }
.nav-group.open .nav-group-toggle .ico:last-child { transform: rotate(180deg); }
.nav-group.has-active .nav-group-toggle { color: #fff; }
.nav-sub { display: none; padding: 2px 0 6px; }
.nav-group.open .nav-sub { display: block; }
.sidebar nav .nav-sub a {
    position: relative; padding: 7px 12px 7px 42px; margin: 1px 0; font-size: 13.5px; font-weight: 400;
}
.sidebar nav .nav-sub a::before {
    content: ''; position: absolute; left: 21px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px;
    border-radius: 50%; background: currentColor; opacity: .45;
}
.sidebar nav .nav-sub a.active { background: var(--primary); color: #fff; }
.sidebar nav .nav-sub a.active::before { opacity: 1; }

/* Menu user + pengaturan (pojok kanan atas) */
.user-menu { position: relative; }
.user-chip {
    display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border: 1px solid transparent; border-radius: 999px;
    background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer;
}
.user-chip:hover, .user-menu.open .user-chip { border-color: var(--border); background: #f8f9fc; }
.user-chip > .ico { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.user-menu.open .user-chip > .ico { transform: rotate(180deg); }
.user-dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(20, 27, 45, .14); z-index: 40;
}
.user-menu.open .user-dropdown { display: block; }
.user-dropdown-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-dropdown-head strong { display: block; font-size: 14px; }
.user-dropdown-head small { color: var(--muted); font-size: 12px; }
.user-dropdown-label { padding: 8px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.user-dropdown a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text); }
.user-dropdown a .ico { width: 16px; height: 16px; color: var(--muted); }
.user-dropdown a:hover { background: var(--primary-soft); color: var(--primary-dark); }
.user-dropdown a.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.user-dropdown a.logout { border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; margin-top: 4px; color: var(--danger); }
.user-dropdown a.logout .ico { color: var(--danger); }
.user-dropdown a.logout:hover { background: var(--danger-soft); color: var(--danger); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.user-meta strong { display: block; font-size: 13px; }
.user-meta small { color: var(--muted); font-size: 12px; }
.content { padding: 24px 28px; flex: 1; }
.footer { padding: 16px 28px; color: var(--muted); font-size: 12px; }
.sidebar-backdrop { display: none; }

/* ---------- Kartu & toolbar ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 20px;
}
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 15px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card-body { padding: 20px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 170px; }
.toolbar input[type=search] { min-width: 230px; }
td .badge-unit, td.nowrap { white-space: nowrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
    display: flex; align-items: center; gap: 14px; padding: 18px 20px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text);
}
.stat:hover { border-color: var(--primary); }
.stat-ico {
    width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-soft); color: var(--primary);
}
.stat-ico .ico { width: 22px; height: 22px; }
.stat strong { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 13px; }

/* ---------- Tombol ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #c9d0de; background: #f8f9fc; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-block { width: 100%; padding: 11px; margin-top: 8px; }
.btn .ico { width: 16px; height: 16px; }
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
    border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer;
}
.btn-icon .ico { width: 16px; height: 16px; }
.btn-icon:hover { color: var(--primary); border-color: var(--primary); }
.btn-icon.danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
form.inline { display: inline; margin: 0; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th {
    font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
    background: #f9fafc; font-weight: 600; white-space: nowrap;
}
tbody tr:hover { background: #fafbfe; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.empty { text-align: center; color: var(--muted); padding: 36px; }
.code { font-family: Consolas, "Courier New", monospace; font-size: 13px; white-space: nowrap; }
.sub { display: block; color: var(--muted); font-size: 12px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-off { background: #eef0f4; color: var(--muted); }
.badge-admin { background: var(--primary-soft); color: var(--primary); }
.badge-unit { background: #f1f3f8; color: var(--text); font-family: Consolas, monospace; }

.pager {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px 20px; border-top: 1px solid var(--border); font-size: 13px;
}
.pager-links { display: flex; gap: 4px; flex-wrap: wrap; }
.pager-links a {
    min-width: 32px; height: 32px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 8px; color: var(--text);
}
.pager-links a.current { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Form ---------- */
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
    width: 100%; padding: 9px 12px; border: 1px solid #ccd3e0; border-radius: 8px; background: #fff;
    font: inherit; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { min-height: 76px; resize: vertical; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.field .req { color: var(--danger); }
.field small { display: block; color: var(--muted); margin-top: 5px; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section {
    grid-column: 1 / -1; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
    font-weight: 700; padding: 6px 0 10px; border-bottom: 1px dashed var(--border); margin-bottom: 16px;
}
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }
.input-group, .field > .input-group { display: flex; align-items: stretch; margin: 0; font-weight: normal; }
.input-group input { border-radius: 8px 0 0 8px; }
.input-group .addon {
    display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid #ccd3e0; border-left: 0;
    border-radius: 0 8px 8px 0; background: #f4f6fa; color: var(--muted); font-weight: 600; white-space: nowrap;
}
.preview {
    grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; padding: 12px 14px; margin-bottom: 16px;
    border-radius: 8px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 600;
}

/* ---------- Alert ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border: 1px solid transparent; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert-success { background: var(--ok-soft); color: #11603c; border-color: #c4e6d4; }
.alert-error { background: var(--danger-soft); color: #9b2323; border-color: #f4c9c9; }
.alert-info { background: var(--primary-soft); color: var(--primary-dark); border-color: #cddaf8; }

/* ---------- Tab ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs a { padding: 10px 16px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Login ---------- */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
    background: linear-gradient(135deg, #141b2d 0%, #1f3a8a 100%);
}
.login-card {
    width: 100%; max-width: 420px; background: var(--surface); border-radius: 14px; padding: 32px 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.login-brand { text-align: center; margin-bottom: 24px; }
/* Nama perusahaan selalu satu baris; huruf mengecil otomatis di layar sempit */
.login-brand h1 { font-size: clamp(12px, 3.8vw, 17px); margin-top: 12px; white-space: nowrap; letter-spacing: 0; }
.login-brand p { margin: 4px 0 0; }
.login-app { margin-top: 2px; font-size: 13px; font-weight: 700; letter-spacing: .12em; color: var(--primary); }
.report-company { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }

/* ---------- Transaksi, stok & laporan ---------- */
input[type=date] {
    padding: 8px 10px; border: 1px solid #ccd3e0; border-radius: 8px; background: #fff; font: inherit; color: var(--text);
}
.field input[type=date] { width: 100%; }
.toolbar input[type=date] { min-width: 0; width: auto; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
input:disabled { background: #f4f6fa; color: var(--muted); }
.input-group.sm { width: 124px; }
.input-group.sm input { padding: 7px 8px; text-align: right; }
.input-group.sm .addon { padding: 0 8px; font-size: 12px; min-width: 44px; justify-content: center; }
.search-msg { display: none; margin: 12px 20px 0; padding: 8px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.trx-table td { vertical-align: top; }
.trx-table th, .trx-table td { padding-left: 10px; padding-right: 10px; }
.trx-table .input-group.sm { width: 112px; }
.trx-table td:nth-child(2) { min-width: 190px; }
.trx-table .sisa { color: var(--warn); font-weight: 600; }
.trx-table .input-group.sm-price { width: 152px; margin-left: auto; }
.trx-table .input-group.sm-price input { padding: 7px 8px; text-align: right; }
.trx-table .input-group.sm-price .addon { padding: 0 7px; font-size: 12px; }
.trx-table .harga-info { white-space: nowrap; }
tr.row-warn { background: var(--danger-soft) !important; }
.sub.warn, .text-danger { color: var(--danger); font-weight: 600; }
.text-ok { color: var(--ok); }
.badge-in { background: var(--ok-soft); color: var(--ok); }
.badge-out { background: var(--warn-soft); color: var(--warn); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px; margin: 0; }
.info-grid dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.info-grid dd { margin: 2px 0 0; font-weight: 600; }
.info-grid .span-2 { grid-column: span 2; }
.saldo-row td { background: #f9fafc; font-weight: 700; }
tfoot td { background: #f9fafc; font-weight: 700; border-top: 2px solid var(--border); }
.report-head { display: none; }
.print-only { display: none; }
.signatures { grid-template-columns: 1fr 1fr; gap: 40px; padding: 32px 20px 20px; text-align: center; }
.signatures b { display: block; margin: 64px auto 0; width: 70%; border-top: 1px solid #333; }
.input-group.price { width: 230px; }
.input-group.price input { border-radius: 0; text-align: right; }
.input-group .addon.pre { border-left: 1px solid #ccd3e0; border-right: 0; border-radius: 8px 0 0 8px; }
.grand-total { font-size: 15px; }
.grand-total strong { font-size: 18px; color: var(--primary-dark); margin-left: 6px; }
.mini-stats { display: flex; gap: 24px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.mini-stats div span { display: block; font-size: 12px; color: var(--muted); }
.mini-stats div strong { font-size: 16px; }

/* ---------- Dashboard penjualan ---------- */
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.section-title h2 { font-size: 16px; }
.section-title .muted { font-size: 12.5px; }
.section-title .toolbar select { min-width: 220px; }
/* 4 kotak ringkasan dalam 1 baris */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { min-width: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { margin-top: 4px; font-size: 20px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.kpi-value small { font-size: 12px; font-weight: 600; color: var(--muted); }
.kpi-hero { border-color: #c9d6f6; }
.kpi-hero .kpi-value { font-size: 24px; color: var(--primary-dark); }
.kpi-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.kpi-delta { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.kpi-delta.up { background: var(--ok-soft); color: var(--ok); }
.kpi-delta.down { background: var(--danger-soft); color: var(--danger); }
.kpi-delta.flat { background: #eef0f4; color: var(--muted); }
.kpi-note { display: block; font-size: 11px; line-height: 1.4; color: var(--muted); }
.kpi-foot .kpi-note { display: inline; }
.kpi > .kpi-note { margin-top: 4px; }

/* Grafik kolom riwayat revenue (satu seri, bulan berjalan ditegaskan) */
.chart-col { display: flex; gap: 10px; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; width: 70px; height: 180px; text-align: right; }
.chart-axis span { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1; }
.chart-axis span:first-child { transform: translateY(-50%); }
.chart-axis span:last-child { transform: translateY(50%); }
.chart-plot { position: relative; flex: 1; display: flex; }
.chart-grid { position: absolute; left: 0; right: 0; top: 0; height: 180px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart-grid i { display: block; border-top: 1px solid #e3e7ef; }
.chart-slot { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; outline: none; cursor: default; }
.chart-bar-wrap { position: relative; width: 100%; height: 180px; display: flex; align-items: flex-end; justify-content: center; }
.chart-slot:hover .chart-bar-wrap, .chart-slot:focus .chart-bar-wrap { background: rgba(36, 87, 214, .05); }
.chart-bar { display: block; width: 24px; max-width: 60%; min-height: 1px; background: #a9bcef; border-radius: 4px 4px 0 0; }
.chart-slot.kini .chart-bar { background: var(--primary); }
.chart-cap { position: absolute; left: 0; right: 0; margin-bottom: 4px; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--text); }
.chart-x { margin-top: 6px; font-size: 12px; color: var(--muted); }
.chart-slot.kini .chart-x { color: var(--text); font-weight: 700; }
.chart-tip {
    display: none; position: absolute; bottom: calc(100% - 40px); left: 50%; transform: translateX(-50%); z-index: 5;
    min-width: 140px; padding: 8px 10px; background: #141b2d; color: #fff; border-radius: 8px; font-size: 12px; text-align: center;
    box-shadow: 0 6px 18px rgba(20, 27, 45, .25); pointer-events: none;
}
.chart-tip strong { display: block; font-size: 12px; }
.chart-tip small { display: block; color: #aab3c7; }
.chart-slot:hover .chart-tip, .chart-slot:focus .chart-tip { display: block; }
.chart-table { margin-top: 14px; }
.chart-table summary { cursor: pointer; font-size: 13px; color: var(--primary); font-weight: 600; }
.chart-table table { margin-top: 8px; }

/* Tabel peringkat top 10 */
/* 3 kotak peringkat dalam 1 baris */
.rank-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.rank-grid .card { margin-bottom: 0; min-width: 0; }
.rank-grid .card-head { padding: 12px 14px; }
.rank-grid .card-head h2 { font-size: 14px; }
.rank-grid .card-head p { font-size: 11.5px; }
.rank { font-size: 13px; }
.rank th { font-size: 11px; }
.rank th, .rank td { padding: 8px 10px; }
.rank td { vertical-align: top; }
.rank td strong { font-size: 13px; }
.rank .sub { font-size: 11px; }
.rank td.num { white-space: nowrap; }
.rank-no { width: 22px; color: var(--muted); font-weight: 700; }
.rank-bar { display: block; height: 4px; margin-top: 6px; background: #eef2fb; border-radius: 2px; }
.rank-bar i { display: block; height: 100%; min-width: 2px; background: var(--primary); border-radius: 2px; }

/* Kotak operasional (6 kotak) dalam 1 baris */
.stats.ops { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stats.ops .stat { min-width: 0; gap: 10px; padding: 12px 14px; }
.stats.ops .stat-ico { width: 34px; height: 34px; border-radius: 10px; flex: none; }
.stats.ops .stat-ico .ico { width: 18px; height: 18px; }
.stats.ops .stat > div { min-width: 0; }
.stats.ops .stat strong { font-size: 18px; line-height: 1.2; }
.stats.ops .stat span { display: block; font-size: 11.5px; line-height: 1.3; }

/* Layar sedang & kecil: kotak turun ke baris berikutnya agar tulisan tidak berdesakan */
@media screen and (max-width: 1100px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rank-grid { grid-template-columns: 1fr; }
    .stats.ops { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media screen and (max-width: 600px) {
    .kpi-grid, .stats.ops { grid-template-columns: 1fr; }
}

/* ---------- Wizard status pengeluaran ---------- */
.badge-info { background: var(--primary-soft); color: var(--primary-dark); }

/* Analisa harga vendor */
.toolbar .check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; cursor: pointer; }
.toolbar .check input { min-width: 0; width: auto; margin: 0; }
.vendor-compare tbody + tbody { border-top: 0; }
.vendor-compare .group-row td { background: #f6f8fc; border-top: 2px solid var(--border); padding-top: 10px; padding-bottom: 10px; }
.vendor-compare .group-row .group-meta { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.vendor-compare tr.row-focus td { background: var(--primary-soft); }
.vendor-compare td { vertical-align: top; }
.vendor-compare td.num { white-space: nowrap; }
.vendor-profile { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 24px; padding: 16px 20px; }
.vendor-profile span { display: block; font-size: 12px; color: var(--muted); }
.wizard { max-width: 840px; margin-bottom: 16px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.wizard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.wizard-head h2 { font-size: 15px; }
.wizard-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 18px 0 16px; padding: 0; counter-reset: step; }
.step { position: relative; text-align: center; padding: 0 4px; }
.step::before { content: ''; position: absolute; top: 15px; left: -50%; width: 100%; height: 3px; background: var(--border); z-index: 0; }
.step:first-child::before { display: none; }
.step.done::before, .step.current::before { background: var(--primary); }
.step-dot {
    position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
    border-radius: 50%; background: #fff; border: 2px solid var(--border); color: var(--muted); font-weight: 700; font-size: 13px;
}
.step.done .step-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.current .step-dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.step.done.current .step-dot { background: var(--ok); border-color: var(--ok); color: #fff; box-shadow: 0 0 0 4px var(--ok-soft); }
.step-label { display: block; margin-top: 6px; font-weight: 700; font-size: 13px; }
.step.current .step-label { color: var(--primary-dark); }
.step-info { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.35; color: var(--muted); }
.wizard-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.wizard-panel { min-width: 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: #fbfcfe; }
.wizard-panel h3 { font-size: 14px; margin-bottom: 10px; }
.wizard-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin-top: 8px; }
.wizard-form .field { margin-bottom: 10px; }
.wizard-form .full { grid-column: 1 / -1; }
.wizard-form .form-actions { padding-top: 0; }
.wizard-note { margin: 8px 0 0; font-size: 12px; }
.bayar-ringkas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bayar-ringkas span { display: block; font-size: 11.5px; color: var(--muted); }
.bayar-ringkas strong { font-size: 15px; white-space: nowrap; }
.bayar-bar { height: 6px; margin: 10px 0; background: #e9edf5; border-radius: 3px; overflow: hidden; }
.bayar-bar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.bayar-list { margin-bottom: 6px; }
.bayar-list td { padding: 6px 4px; font-size: 13px; }
.wizard-log { margin-top: 14px; }
.wizard-log summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--primary); }
.wizard-log table { margin-top: 8px; font-size: 13px; }
.wizard-log th, .wizard-log td { padding: 7px 10px; }
/* Pilih dokumen: Delivery Order / Invoice */
.doc-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.doc-switch a, .doc-switch .disabled { padding: 8px 14px; font-weight: 600; color: var(--text); border-right: 1px solid var(--border); }
.doc-switch > :last-child { border-right: 0; }
.doc-switch a.active { background: var(--primary); color: #fff; }
.doc-switch .disabled { color: #aab0bd; cursor: not-allowed; }
/* Delivery Order */
.inv-sign.do-sign { grid-template-columns: repeat(3, 1fr); gap: 24px; }
.inv-sign.do-sign small { width: 85%; }
.do-cek { width: 48px; text-align: center; }
.do-kotak { display: inline-block; width: 14px; height: 14px; border: 1.5px solid #4b5468; border-radius: 3px; vertical-align: middle; }
/* Cap LUNAS pada invoice */
.invoice { position: relative; }
.cap-lunas {
    position: absolute; top: 150px; right: 40px; z-index: 2; padding: 4px 18px; border: 4px double var(--ok); border-radius: 10px;
    color: var(--ok); font-size: 30px; font-weight: 900; letter-spacing: .2em; transform: rotate(-12deg); opacity: .85; pointer-events: none;
}
@media screen and (max-width: 900px) {
    .wizard-panels, .wizard-form, .bayar-ringkas { grid-template-columns: 1fr; }
    .step-info { display: none; }
}

/* ---------- Invoice pengeluaran ---------- */
.invoice {
    max-width: 840px; padding: 32px 36px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); font-size: 13px; color: #1d2433;
}
/* Kop surat (sesuai kertas kop UD. Sukses Bersama Keluarga) */
.kop { display: flex; align-items: center; gap: 20px; padding: 0 4px 10px; border-bottom: 4px double #2b2f38; color: #2b2f38; }
.kop-logo { flex: none; color: #3a3f4b; }
.kop-logo svg, .kop-logo img { display: block; }
.kop-teks { min-width: 0; font-family: "Times New Roman", Times, Georgia, serif; }
.kop-nama { font-size: 22px; font-weight: 700; letter-spacing: .01em; line-height: 1.2; }
.kop-alamat { font-size: 14px; line-height: 1.35; margin-top: 2px; }
.kop-kontak { border-collapse: collapse; margin-top: 1px; }
.kop-kontak td { padding: 0; border: 0; font-size: 14px; line-height: 1.35; }
.kop-kontak td:first-child { width: 64px; }
.kop-kontak tr:hover, .kop-kontak tr:hover td { background: transparent; }
.kop-cetak { display: none; }              /* bukti penerimaan: kop hanya saat dicetak */
.kop-laporan { margin-bottom: 10px; }
.kop-laporan .kop-nama { font-size: 18px; }
.kop-laporan .kop-alamat, .kop-laporan .kop-kontak td { font-size: 12px; }
.inv-judul { margin: 12px 0 2px; text-align: center; font-size: 17px; font-weight: 800; letter-spacing: .14em; }
.inv-meta { flex: none; width: auto; border-collapse: collapse; }
.inv-meta td { padding: 1px 0 1px 10px; border: 0; font-size: 12.5px; white-space: nowrap; }
.inv-meta td:first-child { color: #4b5468; padding-left: 0; }
.inv-meta td:last-child { font-weight: 700; }
.inv-parties { display: flex; gap: 32px; justify-content: space-between; align-items: flex-start; padding: 10px 0 12px; }
.inv-parties > div { flex: 1; min-width: 0; }
.kop-kontak { width: auto; }
.inv-parties strong { font-size: 14px; }
.inv-ket { margin-top: 2px; color: #4b5468; }
.inv-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6b7489; margin-bottom: 2px; }
.inv-items { width: 100%; border-collapse: collapse; }
.inv-items th { background: #eef2fb; color: #1d2433; font-size: 11.5px; padding: 7px 8px; border-top: 1px solid #c9d0de; border-bottom: 1px solid #c9d0de; }
.inv-items td { padding: 6px 8px; border-bottom: 1px solid #e3e7ef; vertical-align: top; }
.inv-items tbody tr:hover { background: transparent; }
.inv-items .sub { font-size: 11px; }
.inv-items tfoot td { font-size: 14px; font-weight: 800; background: #eef2fb; border-top: 2px solid #1d2433; border-bottom: 2px solid #1d2433; }
.inv-terbilang { margin-top: 8px; font-size: 12.5px; }
.inv-terbilang span { color: #6b7489; }
.inv-terbilang em { font-weight: 600; }
.inv-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 22px; text-align: center; font-size: 12.5px; }
.inv-sign b { display: block; height: 56px; }
.inv-sign small { display: block; width: 70%; margin: 0 auto; padding-top: 4px; border-top: 1px solid #1d2433; font-size: 12px; }
.inv-foot { margin-top: 18px; padding-top: 8px; border-top: 1px dashed #c9d0de; font-size: 10.5px; color: #6b7489; text-align: center; }

@media print {
    .invoice { max-width: none; padding: 0; border: 0; border-radius: 0; box-shadow: none; font-size: 12px; }
    .inv-items th, .inv-items tfoot td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .kop-cetak { display: flex; margin-bottom: 12px; }
    @page { size: A4; margin: 12mm; }
    body { background: #fff; font-size: 11px; }
    .sidebar, .sidebar-backdrop, .topbar, .footer, .no-print, .toolbar, .pager-links, .actions, .alert { display: none !important; }
    .layout, .main { display: block; }
    .content { padding: 0; }
    .card { border: 0; box-shadow: none; margin: 0; }
    .card-head { padding: 0 0 8px; }
    .table-wrap { overflow: visible; }
    th, td { padding: 5px 6px; }
    th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .report-head { display: block; margin-bottom: 12px; }
    .report-head h2 { font-size: 16px; }
    .print-only { display: grid; }
    a { color: inherit; }
}

/* ---------- Responsif ---------- */
/* Hanya untuk layar kecil; tidak berlaku saat mencetak (kertas A4 lebih sempit dari 900px) */
@media screen and (max-width: 900px) {
    .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 25; }
    .menu-toggle { display: inline-flex; }
    .topbar, .content, .footer { padding-left: 16px; padding-right: 16px; }
    .user-meta { display: none; }
    .form-grid, .form-grid.cols-3, .info-grid { grid-template-columns: 1fr; }
    .form-grid .span-2, .info-grid .span-2 { grid-column: auto; }
    .toolbar input, .toolbar select { min-width: 0; flex: 1 1 160px; }
}

/* Laporan laba */
.alert-warn { background: var(--warn-soft); color: #7a4a00; border-color: #f1d7a6; }
.alert-warn a { color: inherit; font-weight: 600; text-decoration: underline; }
.mode-switch { display: flex; flex-wrap: wrap; margin: 0 20px 16px; width: fit-content; max-width: calc(100% - 40px); }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); font-size: 12px; }
.laba-kpi .kpi-hero .kpi-value .text-ok { color: var(--ok); }
.laba-bar-col { width: 120px; }
.laba-bar { display: block; height: 6px; background: #eef2fb; border-radius: 3px; }
.laba-bar i { display: block; height: 100%; min-width: 2px; background: var(--ok); border-radius: 3px; }
.laba-bar.rugi i { background: var(--danger); }
.laba-matriks td.num, .laba-matriks th.num { white-space: nowrap; }
@media print { .laba-bar-col { display: none; } }

/* Cap & tanda tangan owner di invoice (menimpa garis nama seperti cap basah) */
.inv-sign .ttd-owner { position: relative; }
.inv-sign .ttd-owner small { position: relative; z-index: 0; }
.inv-sign b { height: 104px; }   /* ruang cap & tanda tangan (invoice & DO) */
.ttd-cap { position: absolute; left: 50%; bottom: 10px; z-index: 1; width: 140px; height: auto; transform: translateX(-45%) rotate(-3deg); pointer-events: none; }
@media print { .ttd-cap { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
