:root {
    --ink: #17212b;
    --muted: #6b7785;
    --line: #d9e1e8;
    --bg: #f4f7f9;
    --panel: #ffffff;
    --brand: #ee4d2d;
    --brand-dark: #d73217;
    --accent: #ff8a00;
    --danger: #b91c1c;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: var(--bg);
}
a { color: inherit; text-decoration: none; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 250px;
    background: #5a1f12;
    color: #fff7ed;
    padding: 18px 14px;
    overflow-y: auto;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 6px 8px 18px; }
.brand img { width: 42px; height: 42px; object-fit: contain; background: white; border-radius: 6px; }
.brand strong { display: block; line-height: 1.2; }
.brand span { display: block; margin-top: 4px; font-size: 12px; color: #ffd0bf; text-transform: uppercase; }
nav a {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 6px;
    color: #ffe6dd;
    margin-bottom: 3px;
}
nav a.active, nav a:hover { background: #ee4d2d; color: #fff; }
.nav-group {
    margin: 18px 10px 7px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.16);
    color: #ffd0bf;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.nav-group:first-child {
    margin-top: 4px;
    padding-top: 0;
    border-top: 0;
}
.main { margin-left: 250px; padding: 24px; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 16px;
}
.topbar-title { display: flex; align-items: center; gap: 12px; }
.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 6px;
    background: var(--brand);
    color: white;
    font-size: 22px;
    cursor: pointer;
}
.sidebar-backdrop { display: none; }
h1 { margin: 0; font-size: 26px; }
.topbar p { margin: 5px 0 0; color: var(--muted); }
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 18px;
}
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { border-left: 4px solid var(--brand); }
.stat b { display: block; font-size: 24px; margin-top: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
}
textarea { min-height: 76px; resize: vertical; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 9px 13px;
    border: 0;
    border-radius: 6px;
    background: var(--brand);
    color: white;
    cursor: pointer;
    font-weight: 700;
}
.btn:hover { background: var(--brand-dark); }
.btn.ghost { background: #fff1ec; color: var(--brand-dark); }
.btn.danger { background: var(--danger); }
.btn.wa { background: #16a34a; }
.btn.wa:hover { background: #15803d; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.report-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.report-tabs .btn.active {
    background: var(--brand);
    color: #fff;
}
.report-action-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}
.report-output-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.report-action-bar .btn { min-width: 145px; padding-left: 18px; padding-right: 18px; }
.report-filter-button { min-width: 180px !important; }
.print-report-header { display: none; }
.search-bar {
    max-width: 520px;
    margin-bottom: 14px;
}
.combo-search-field {
    display: grid;
    gap: 6px;
}
.combo-search {
    padding: 8px 10px;
    background: #fffaf7;
}
.customer-combobox {
    position: relative;
}
.combo-suggestions {
    display: none;
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: 100%;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 12px 24px rgba(23,33,43,.14);
    margin-top: 4px;
}
.combo-suggestions.open { display: block; }
.combo-suggestion {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    background: #fff;
    text-align: left;
    cursor: pointer;
    color: var(--ink);
}
.combo-suggestion:hover {
    background: #fff1ec;
}
.pos-panel { overflow-x: auto; }
.pos-table { margin-top: 14px; overflow-x: auto; }
.pos-table table { min-width: 760px; }
.pos-table th:last-child, .pos-table td:last-child { width: 90px; }
.pos-subtotal, #posTotal, #posKurang, #posKembali, #posBranchHpp { background: #f8fafc; font-weight: 700; }
.pos-price { font-weight: 700; }
.pos-actions { margin: 12px 0; }
.pos-summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 13px; color: var(--muted); background: #fff1ec; }
tbody tr:nth-child(odd) { background: #ffffff; }
tbody tr:nth-child(even) { background: #f1f3f5; }
.right { text-align: right; }
.muted { color: var(--muted); }
.alert { padding: 12px 14px; border-radius: 6px; margin-bottom: 16px; background: #dff4e7; color: #14532d; }
.alert.error { background: #fee2e2; color: #7f1d1d; }
.badge { display: inline-block; padding: 4px 8px; border-radius: 999px; background: #eef2f4; font-size: 12px; }
.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #ee4d2d, #6b2a16);
    padding: 20px;
}
.login-card { width: min(420px, 100%); background: white; padding: 28px; border-radius: 8px; }
.login-card h1 { margin-bottom: 8px; }
.login-card p { color: var(--muted); margin-bottom: 20px; }
.print-page {
    background: #fff;
    padding: 24px;
}
.receipt {
    width: min(760px, 100%);
    margin: 0 auto;
    color: #111827;
}
.receipt h1, .receipt h2, .receipt h3 {
    margin: 0 0 10px;
}
.receipt h2 {
    padding-bottom: 12px;
    border-bottom: 2px solid #111827;
}
@media print {
    @page { size: A4 portrait; margin: 10mm; }
    .print-page { padding: 0; }
    .receipt { width: 100%; }
    .btn, .sidebar, .topbar, .sidebar-backdrop, .report-controls { display: none !important; }
    .print-report-header {
        display: block;
        margin: 0 0 8px;
        padding: 0 0 5px;
        border-bottom: 1px solid #777;
        color: #111;
        line-height: 1.15;
    }
    .print-report-header h1 { margin: 0 0 2px; font-size: 15px; line-height: 1.15; }
    .print-report-header h2 { margin: 0 0 2px; font-size: 12px; line-height: 1.15; }
    .print-report-header p { margin: 0; font-size: 9px; line-height: 1.15; }
    .main { margin: 0; padding: 0; }
    .panel { box-shadow: none; border: 0; padding: 0; margin: 0 0 9px; break-inside: auto; }
    .panel h2 { margin: 0 0 4px; font-size: 11px; line-height: 1.15; }
    .panel p { margin: 0 0 4px; font-size: 9px; line-height: 1.2; }
    table { width: 100%; font-size: 8.5px; page-break-inside: auto; }
    thead { display: table-header-group; }
    tr { page-break-inside: avoid; page-break-after: auto; }
    th, td { padding: 3px 4px; line-height: 1.15; }
}
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        z-index: 50;
        width: 280px;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 12px 0 24px rgba(23,33,43,.22);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 40;
        background: rgba(23,33,43,.45);
    }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .main { margin-left: 0; padding: 16px; }
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
    .grid.two, .grid.three, .grid.four, .form-grid, .pos-summary { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .topbar-title { align-items: flex-start; }
    .report-action-bar { align-items: stretch; flex-direction: column; gap: 12px; }
    .report-output-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .report-action-bar .btn { width: 100%; }
}
@media (max-width: 520px) {
    .report-output-actions { grid-template-columns: 1fr; }
}
