:root {
    /* Palette: Dark Mode OLED + Amber Accent */
    --bg-app: #0a0a0f;
    --bg-surface: #111114;
    --bg-surface-hover: #1a1a1f;
    
    --border-hairline: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    
    --accent: #FF6B35;
    --accent-hover: #e85a25;
    --accent-glow: rgba(255, 107, 53, 0.15);
    
    --success: #10B981;
    --danger: #F43F5E;
    
    --text-primary: #e8e8ed;
    --text-secondary: #A1A1AA;
    --text-muted: #71717A;

    /* Typography */
    --font-ui: 'Satoshi', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

/* Utilities */
.num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* Layout */
.app-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 14px 14px 96px;
}

/* Topbar — compact POS chrome */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-hairline);
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9375rem;
}
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--accent-glow);
    border: 1px solid rgba(255, 107, 53, 0.28);
    color: var(--accent);
    flex-shrink: 0;
}
.brand-mark i {
    font-size: 0.95rem;
    line-height: 1;
}
.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}
.brand h1 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.15;
    color: var(--text-primary);
}
.brand-sub {
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.2;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.btn-close {
    padding: 6px 10px !important;
    font-size: 0.75rem !important;
    gap: 4px !important;
}
.btn-close i {
    font-size: 0.875rem;
}

/* Cards */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    border-radius: 12px;
    padding: 14px 16px;
}

/* Wallet Grid */
.wallet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.wallet-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wallet-card.primary-glow {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}
.wallet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}
.wallet-balance {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}
.wallet-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Workspace */
.workspace {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
}
@media (min-width: 768px) {
    .workspace {
        grid-template-columns: 300px 1fr;
    }
}
.section-title {
    font-size: 0.875rem;
    text-transform: capitalize;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 150ms ease;
}
.btn i { font-size: 1.125rem; }

.btn-primary {
    background-color: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
}
.btn-outline:hover {
    background-color: var(--bg-surface-hover);
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface-hover);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 150ms;
}
.btn-icon:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface-hover);
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* Ledger (List) */
.ledger-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.ledger-header .section-title { margin-bottom: 0; }
.ledger-list {
    display: flex;
    flex-direction: column;
}
.ledger-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-hairline);
}
.ledger-item:last-child {
    border-bottom: none;
}
.ledger-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ledger-title {
    font-weight: 500;
    font-size: 0.875rem;
}
.ledger-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.ledger-amount {
    font-size: 0.875rem;
    font-weight: 700;
}

/* Modal system — fixed stacking, no white-screen trap */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.72);
    /* light blur only; heavy blur looked broken on some mobile browsers */
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.modal-overlay.hidden {
    display: none !important;
}

.modal {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    z-index: 950 !important;
    width: min(400px, calc(100vw - 32px));
    max-height: min(85vh, 640px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-surface) !important;
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg, 16px);
    padding: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    display: block;
}

.modal.hidden {
    display: none !important;
    pointer-events: none;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

[data-theme="light"] .modal-overlay {
    background: rgba(15, 15, 20, 0.45);
}

[data-theme="light"] .modal {
    background: #ffffff !important;
    box-shadow: 0 20px 50px rgba(15, 15, 20, 0.18);
}


/* === MODAL FORM CONTROLS (match HTML classes) === */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.form-group label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.form-group input,
.input-money,
.modal input[type="text"],
.modal input[type="password"],
.modal input[type="number"],
.modal input[type="search"],
.modal input:not([type="file"]) {
    width: 100%;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-elevated, var(--bg-app, #0f0f14));
    border: 1px solid var(--border-strong, #2a2a33);
    color: var(--text-primary, #e8e8ed);
    border-radius: 10px;
    padding: 12px 14px;
    font-family: var(--font-ui, inherit);
    font-size: 1rem;
    line-height: 1.3;
    outline: none;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.input-money {
    font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace) !important;
    font-weight: 700;
    font-size: 1.25rem !important;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
}

.form-group input::placeholder,
.input-money::placeholder,
.modal input::placeholder {
    color: var(--text-muted, #6b6b76);
    opacity: 1;
    font-weight: 400;
}

.form-group input:focus,
.input-money:focus,
.modal input:focus {
    border-color: var(--accent, #ff6b35);
    box-shadow: 0 0 0 3px var(--accent-glow, rgba(255, 107, 53, 0.18));
    background: var(--bg-surface, #111114);
}

/* Chips */
.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.chip {
    border: 1px solid var(--border-strong, #2a2a33);
    background: var(--bg-elevated, #0f0f14);
    color: var(--text-secondary, #a1a1aa);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: var(--font-ui, inherit);
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.chip:hover {
    border-color: var(--accent, #ff6b35);
    color: var(--text-primary, #e8e8ed);
}

.chip.active {
    background: var(--accent, #ff6b35);
    border-color: var(--accent, #ff6b35);
    color: #0a0a0f;
}

/* Modal primary button spacing */
.modal > .btn.w-full,
.modal .btn.w-full {
    margin-top: 4px;
    min-height: 46px;
}

.modal .grid-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 4px;
}

/* Light theme inputs */
[data-theme="light"] .form-group input,
[data-theme="light"] .input-money,
[data-theme="light"] .modal input:not([type="file"]) {
    background: #f4f4f1;
    border-color: #d6d6cf;
    color: #1a1a1f;
}

[data-theme="light"] .form-group input:focus,
[data-theme="light"] .input-money:focus,
[data-theme="light"] .modal input:focus {
    background: #ffffff;
    border-color: var(--accent, #ff6b35);
}

[data-theme="light"] .chip {
    background: #f4f4f1;
    border-color: #d6d6cf;
    color: #5c5c66;
}

[data-theme="light"] .chip.active {
    background: var(--accent, #ff6b35);
    border-color: var(--accent, #ff6b35);
    color: #fff;
}

/* Ensure native autofill doesn't go white-on-white */
.modal input:-webkit-autofill {
    -webkit-text-fill-color: var(--text-primary, #e8e8ed) !important;
    transition: background-color 9999s ease-in-out 0s;
}


.input-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.input-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: capitalize;
    letter-spacing: 0.05em;
}
.input-flat {
    background-color: var(--bg-app);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 1rem;
    width: 100%;
    outline: none;
    transition: border-color 150ms;
}
.input-flat:focus {
    border-color: var(--accent);
}

/* --- LIGHT MODE DISCIPLINE --- */
[data-theme="light"] {
    --bg-app: #fafaf7;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f1ec;
    
    --border-hairline: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.15);
    
    --accent: #d94d1a; /* Darker amber for contrast on light */
    --accent-hover: #b83d12;
    --accent-glow: rgba(217, 77, 26, 0.15);
    
    --text-primary: #1a1a1f;
    --text-secondary: #5c5c66;
    --text-muted: #8a8a92;

    color-scheme: light;
}

body, .card, .btn, .input-flat, .modal, .ledger-item {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

[data-theme="light"] .modal-overlay {
    background-color: rgba(250, 250, 247, 0.8);
}
[data-theme="light"] .card.primary-glow {
    box-shadow: 0 4px 20px var(--accent-glow);
}

/* Category Buttons */
.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.btn-category {
    background-color: var(--bg-app);
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 150ms ease;
}
.btn-category:hover, .btn-category.active {
    border-color: var(--accent);
    color: var(--text-primary);
    background-color: var(--bg-surface-hover);
}
.btn-category .price {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 700;
}

/* --- VIEWS AND NAVIGATION --- */
.view-section {
    display: none;
    animation: fadeIn 0.2s ease;
}
.view-section.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.app-container {
    padding-bottom: 96px;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-hairline);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 100;
    pointer-events: auto;
}
.bottom-nav .nav-item {
    pointer-events: auto;
    position: relative;
    z-index: 101;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 80px;
    height: 100%;
    cursor: pointer;
    transition: color 150ms ease;
}
.nav-item i {
    font-size: 1.5rem;
}
.nav-item span {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.05em;
}
.nav-item.active {
    color: var(--accent);
}

.grid-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.btn-lg {
    padding: 14px;
    font-size: 0.9375rem;
}
.btn-lg i {
    font-size: 1.25rem;
}

/* --- CSS CHART --- */
.css-chart-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 200px;
    padding: 20px 0 0 0;
    border-bottom: 1px solid var(--border-hairline);
    margin-bottom: 16px;
}
.chart-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40%;
    height: 100%;
    justify-content: flex-end;
}
.chart-bar {
    width: 100%;
    max-width: 60px;
    border-radius: 8px 8px 0 0;
    transition: height 0.5s ease;
    min-height: 4px;
}
.bg-success { background-color: var(--success); }
.bg-danger { background-color: var(--danger); }
.chart-label {
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: capitalize;
    letter-spacing: 0.05em;
}
.chart-val {
    font-size: 0.875rem;
    font-weight: 700;
    margin-top: 4px;
}


/* --- FILTERS --- */
.filter-group {
    display: flex;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 16px;
}
.btn-filter {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    border-radius: 4px;
    cursor: pointer;
    transition: all 150ms ease;
}
.btn-filter.active {
    background-color: var(--bg-app);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
[data-theme="light"] .btn-filter.active {
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* --- BREAKDOWN BAR --- */
.breakdown-item {
    margin-bottom: 12px;
}
.breakdown-item:last-child {
    margin-bottom: 0;
}
.bd-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 6px;
}
.bd-title { font-weight: 500; }
.bd-track {
    width: 100%;
    height: 8px;
    background-color: var(--bg-app);
    border-radius: 4px;
    overflow: hidden;
}
.bd-fill {
    height: 100%;
    background-color: var(--danger);
    border-radius: 4px;
    transition: width 0.5s ease;
}
/* --- REDESIGN FILTERS (Ala iOS / Vercel Segmented Control) --- */
.filter-group {
    display: flex;
    background-color: var(--bg-app);
    border: 1px solid var(--border-hairline);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 24px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
[data-theme="light"] .filter-group {
    background-color: #f1f1ec;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}
.btn-filter {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 0;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: capitalize;
    border-radius: 6px;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-filter:hover:not(.active) {
    color: var(--text-primary);
}
.btn-filter.active {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3), 0 1px 1px rgba(0,0,0,0.2);
    border: 1px solid var(--border-hairline);
}
[data-theme="light"] .btn-filter.active {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05), 0 1px 1px rgba(0,0,0,0.02);
}

/* === CONNECTION BADGE === */
.conn-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 4px;
    transition: all 150ms ease;
}
.conn-badge.online {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.conn-badge.offline {
    background-color: rgba(244, 63, 94, 0.15);
    color: var(--danger);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

/* === BREAKDOWN === */
.breakdown-item {
    margin-bottom: 12px;
}
.breakdown-item:last-child {
    margin-bottom: 0;
}
.bd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.bd-title {
    font-size: 0.8125rem;
    font-weight: 500;
}
.bd-amount {
    font-size: 0.8125rem;
    font-weight: 700;
}
.bd-track {
    height: 6px;
    background-color: var(--bg-app);
    border-radius: 3px;
    overflow: hidden;
}
.bd-fill {
    height: 100%;
    background-color: var(--danger);
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* === TOAST === */
.toast {
    position: fixed;
    left: 50%;
    bottom: 88px;
    transform: translateX(-50%);
    z-index: 1100;
    min-width: 180px;
    max-width: calc(100vw - 32px);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    backdrop-filter: blur(8px);
    transition: opacity 150ms ease, transform 150ms ease;
}
.toast.hidden {
    display: none;
}
.toast-ok {
    background: rgba(16, 185, 129, 0.18);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.toast-err {
    background: rgba(244, 63, 94, 0.18);
    color: var(--danger);
    border: 1px solid rgba(244, 63, 94, 0.35);
}


/* Compact brand — light theme */
[data-theme="light"] .brand-mark {
    background: rgba(255, 107, 53, 0.08);
    border-color: rgba(255, 107, 53, 0.2);
}
@media (max-width: 380px) {
    .btn-close span { display: none; }
    .brand-sub { display: none; }
}


/* Export actions */
.export-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.btn-export {
    padding: 6px 10px !important;
    font-size: 0.75rem !important;
    gap: 4px !important;
    white-space: nowrap;
}
.btn-export i {
    font-size: 0.9rem !important;
}

/* Print / PDF recap */
@media print {
    body {
        background: #fff !important;
        color: #111 !important;
    }
    .bottom-nav,
    .topbar-actions,
    .filter-group,
    .export-actions,
    .actions-panel,
    #viewKasir {
        display: none !important;
    }
    .app-container {
        max-width: none;
        padding: 0;
    }
    .card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

@page {
    margin: 12mm;
}


/* === SEARCH / CUSTOM RANGE / SETTINGS === */
.search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 12px;
    padding: 8px 12px;
    border: 1px solid var(--border-hairline);
    border-radius: 10px;
    background: var(--bg-elevated);
}
.search-wrap i {
    color: var(--text-muted);
    font-size: 1rem;
}
.search-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 0.875rem;
    outline: none;
}
.custom-range {
    margin-bottom: 12px;
    padding: 12px;
}
.custom-range.hidden { display: none; }
.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.field input[type="date"] {
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 8px 10px;
    font-family: var(--font-ui);
    font-size: 0.875rem;
}
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* === TOP LISTS === */
.top-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.top-item {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    gap: 10px;
    align-items: center;
}
.top-rank {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.top-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.top-bar {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 99px;
    overflow: hidden;
}
.top-bar span {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 99px;
}
.top-amt {
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

/* === EMPTY STATE === */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 28px 16px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 1.75rem;
    opacity: 0.55;
    color: var(--accent);
}
.empty-state strong {
    color: var(--text-secondary);
    font-size: 0.875rem;
}
.empty-state span {
    font-size: 0.75rem;
    max-width: 240px;
    line-height: 1.4;
}

/* === LEDGER DELETE / RIGHT === */
.ledger-right {
    display: flex;
    align-items: center;
    gap: 4px;
}
.btn-del-tx {
    opacity: 0.45;
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
}
.btn-del-tx:hover { opacity: 1; color: var(--danger); }
#btnUndo:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* === TUTUP PREVIEW === */
.preview-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-hairline);
}
.preview-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
.preview-row strong {
    color: var(--text-primary);
    font-weight: 700;
}
.preview-note {
    margin: 4px 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* === PIN LOCK === */
body.locked .app-container,
body.locked .bottom-nav,
body.locked .modal-overlay,
body.locked .modal {
    visibility: hidden !important;
}
.pin-lock {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    padding: 24px;
}
.pin-lock.hidden { display: none; }
.pin-card {
    width: min(320px, 100%);
    text-align: center;
}
.pin-logo {
    margin: 0 auto 12px;
    width: 40px;
    height: 40px;
}
.pin-card h2 {
    margin: 0 0 4px;
    font-size: 1.1rem;
}
.pin-sub {
    margin: 0 0 18px;
    color: var(--text-muted);
    font-size: 0.8125rem;
}
.pin-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}
.pin-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    transition: all 120ms ease;
}
.pin-dots span.filled {
    background: var(--accent);
    border-color: var(--accent);
}
.pin-dots.shake {
    animation: pinshake 0.35s ease;
}
@keyframes pinshake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.pin-pad button {
    height: 56px;
    border-radius: 12px;
    border: 1px solid var(--border-hairline);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 600;
    font-family: var(--font-ui);
    cursor: pointer;
}
.pin-pad button:active {
    background: var(--bg-elevated);
}
.pin-muted { color: var(--text-muted) !important; }
.pin-skip { margin-top: 14px; width: 100%; }

.hidden { display: none !important; }

/* Tarik Profit helpers */
.saldo-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--bg-elevated, #0f0f14);
    border: 1px solid var(--border-hairline, #222);
}
.saldo-info-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.saldo-info-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--success, #34d399);
}
.pct-chips {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.pct-chips .chip {
    text-align: center;
    padding: 10px 6px;
}
.pct-chips .chip.active {
    background: var(--accent, #ff6b35) !important;
    border-color: var(--accent, #ff6b35) !important;
    color: #0a0a0f !important;
}
.tarik-hint {
    margin: -6px 0 14px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.tarik-hint.is-warn {
    color: var(--danger, #f43f5e);
    font-weight: 600;
}
[data-theme="light"] .saldo-info {
    background: #f4f4f1;
    border-color: #e4e4dc;
}

/* === JUAL MENU fixed price + qty === */
.modal-jual {
    max-height: min(90vh, 720px) !important;
}
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-height: 42vh;
    overflow-y: auto;
    margin-bottom: 12px;
    padding-right: 2px;
}
.menu-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-strong, #2a2a33);
    background: var(--bg-elevated, #0f0f14);
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}
.menu-item:hover {
    border-color: var(--accent, #ff6b35);
}
.menu-item.active {
    border-color: var(--accent, #ff6b35);
    background: color-mix(in srgb, var(--accent, #ff6b35) 14%, var(--bg-elevated, #0f0f14));
    box-shadow: inset 0 0 0 1px var(--accent, #ff6b35);
}
.menu-item-name {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.25;
}
.menu-item-price {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}
.menu-item.active .menu-item-price {
    color: var(--accent, #ff6b35);
}
.jual-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: var(--bg-elevated, #0f0f14);
    border: 1px solid var(--border-hairline, #222);
}
.jual-selected-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.jual-selected-name {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.jual-selected-price {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.qty-stepper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.qty-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-strong, #2a2a33);
    background: var(--bg-surface, #111114);
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-family: inherit;
}
.qty-btn:active {
    transform: scale(0.96);
    border-color: var(--accent, #ff6b35);
}
.qty-val {
    min-width: 1.5rem;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
}
.jual-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 4px 0 12px;
    padding: 0 2px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.jual-total-row strong {
    font-size: 1.15rem;
    color: var(--success, #34d399);
}
#jualFreeWrap.hidden { display: none !important; }
[data-theme="light"] .menu-item,
[data-theme="light"] .jual-selected {
    background: #f4f4f1;
    border-color: #d6d6cf;
}
[data-theme="light"] .menu-item.active {
    background: color-mix(in srgb, var(--accent, #ff6b35) 12%, #fff);
}
[data-theme="light"] .qty-btn {
    background: #fff;
    border-color: #d6d6cf;
}

/* Recent txs on Kasir */
.recent-panel {
    margin-top: 8px;
}
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.section-head .section-title {
    margin: 0;
}
.link-btn {
    border: 0;
    background: transparent;
    color: var(--accent, #ff6b35);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 4px 0;
}
.ledger-item.compact {
    padding: 10px 12px;
}
.recent-panel .ledger-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.recent-panel .empty-state {
    padding: 18px 12px;
}

/* Ledger pagination */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 4px;
}
.pager.hidden { display: none !important; }
.pager-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-strong, #2a2a33);
    background: var(--bg-elevated, #0f0f14);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.pager-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.pager-btn:not(:disabled):active {
    border-color: var(--accent, #ff6b35);
    transform: scale(0.97);
}
.pager-info {
    min-width: 9.5rem;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
[data-theme="light"] .pager-btn {
    background: #f4f4f1;
    border-color: #d6d6cf;
}
