/* ===== Buku Kas Gudang Mie — tampilan terang ala Frozen Food Manager ===== */
:root {
    --primary-color: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #f0fdfa;
    --primary-border: #ccfbf1;
    --primary-rgb: 13, 148, 136;
}
body.theme-blue   { --primary-color: #0284c7; --primary-dark: #0369a1; --primary-light: #f0f9ff; --primary-border: #bae6fd; --primary-rgb: 2, 132, 199; }
body.theme-maroon { --primary-color: #be123c; --primary-dark: #9f1239; --primary-light: #fff1f2; --primary-border: #fecdd3; --primary-rgb: 190, 18, 60; }
body.theme-dark   { --primary-color: #334155; --primary-dark: #1e293b; --primary-light: #f1f5f9; --primary-border: #cbd5e1; --primary-rgb: 51, 65, 85; }

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Plus Jakarta Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { background: #f1f5f9; color: #1e293b; padding-bottom: 84px; line-height: 1.45; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.01em; }
table, .text-right, input[type="number"] { font-variant-numeric: tabular-nums; }

.app-container { max-width: 600px; margin: 0 auto; background: #f8fafc; min-height: 100vh; box-shadow: 0 0 24px rgba(15, 23, 42, .06); position: relative; }

/* ----- Header ----- */
.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #fff; padding: 18px 18px 22px;
    display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
    border-bottom-left-radius: 22px; border-bottom-right-radius: 22px;
    box-shadow: 0 6px 16px -6px rgba(15, 23, 42, .35);
}
.header-title h2 { font-size: 18px; font-weight: 800; margin-bottom: 3px; }
.header-title p { font-size: 11px; opacity: .95; font-variant-numeric: tabular-nums; }
.header-badge button { background: rgba(255,255,255,.2); border: none; color: #fff; padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 11.5px; font-weight: 700; }
.header-badge button:active { transform: scale(.96); }

.content-body { padding: 16px; }

/* ----- Banner & statistik ----- */
.welcome-banner { background: var(--primary-light); border: 1px solid var(--primary-border); padding: 16px; border-radius: 14px; margin-bottom: 16px; }
.welcome-banner h3 { font-size: 15px; color: var(--primary-dark); margin-bottom: 4px; }
.welcome-banner p { font-size: 12.5px; color: var(--primary-color); line-height: 1.5; }

.stats-grid-compact { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-card { padding: 12px 10px; border-radius: 12px; display: flex; flex-direction: column; gap: 10px; color: #fff; min-width: 0; }
.stat-card.blue { background: linear-gradient(145deg, #0ea5e9, #0369a1); }
.stat-card.orange { background: linear-gradient(145deg, #fb923c, #ea580c); }
.stat-card.green { background: linear-gradient(145deg, #4ade80, #16a34a); }
.stat-icon { font-size: 15px; background: rgba(255,255,255,.22); width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.stat-info h4 { font-size: 10px; font-weight: 600; opacity: .92; }
.stat-info h3 { font-size: 13px; font-weight: 800; margin-top: 3px; word-break: break-word; }

/* ----- Kartu ----- */
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.card h3 { font-size: 14px; color: #0f172a; margin-bottom: 12px; }
.floating-card { box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 16px -10px rgba(15,23,42,.08); }
.grid-section .card:nth-child(1) { box-shadow: inset 4px 0 0 #fbbf24, 0 8px 16px -10px rgba(15,23,42,.08); }
.grid-section .card:nth-child(2) { box-shadow: inset 4px 0 0 #22c55e, 0 8px 16px -10px rgba(15,23,42,.08); }
.grid-section .card:nth-child(3) { box-shadow: inset 4px 0 0 #fb923c, 0 8px 16px -10px rgba(15,23,42,.08); }
.card:has(#hutang-container) { box-shadow: inset 4px 0 0 #ef4444, 0 8px 16px -10px rgba(15,23,42,.08); }
.card:has(#keluar-container) { box-shadow: inset 4px 0 0 #fb7185, 0 8px 16px -10px rgba(15,23,42,.08); }
.card.sisa-card { box-shadow: inset 4px 0 0 #f59e0b, 0 8px 16px -10px rgba(15,23,42,.08); }

.info-baris { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; font-size: 13px; border-bottom: 1px dashed #e2e8f0; }
.info-baris:last-child { border-bottom: none; }
.info-baris span { color: #64748b; }
.info-baris b { font-variant-numeric: tabular-nums; color: #0f172a; }

/* ----- Akses cepat ----- */
.quick-actions-3-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px; }
.action-btn-modern { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px 8px; text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: all .15s; }
.action-btn-modern:active { background: var(--primary-light); border-color: var(--primary-border); transform: scale(.97); }
.abm-icon { font-size: 18px; margin-bottom: 3px; }
.action-btn-modern strong { font-size: 11.5px; font-weight: 700; color: #1e293b; display: block; }
.action-btn-modern small { font-size: 9.5px; color: #64748b; }

/* ----- Bar bawah ----- */
.tabs.bottom-tabs { position: fixed; bottom: 0; left: 0; right: 0; max-width: 600px; margin: 0 auto; background: rgba(255,255,255,.97); backdrop-filter: blur(8px); border-top: 1px solid #e2e8f0; display: flex; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 1000; }
.tab-btn { flex: 1; background: none; border: none; color: #94a3b8; cursor: pointer; padding: 6px 2px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 700; transition: all .15s; }
.tab-ico { font-size: 19px; line-height: 1; }
.tab-btn.active { color: var(--primary-dark); background: var(--primary-light); }

/* ----- Input baris (catat) ----- */
.row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; width: 100%; }
.row input, .price-inputs input, #cari-tanggal, .field {
    min-width: 0; width: 100%; background: #f8fafc; border: 1.5px solid #e2e8f0; color: #1e293b;
    padding: 11px 12px; border-radius: 10px; font-size: 14px; font-weight: 500; outline: none;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.row input { flex: 1; width: auto; }
.row input:focus, .price-inputs input:focus, #cari-tanggal:focus, .field:focus { border-color: var(--primary-color); background: #fff; box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .12); }
::placeholder { color: #94a3b8; }
.price-inputs { display: flex; gap: 10px; }
.price-inputs > div { flex: 1; min-width: 0; }
.price-inputs label, .field-label { font-size: 11px; font-weight: 600; color: #475569; display: block; margin-bottom: 5px; }
input[type="date"].field { font-weight: 700; }

.btn-add { width: 100%; background: transparent; color: var(--primary-dark); border: 1.5px dashed var(--primary-color); padding: 11px; border-radius: 10px; font-size: 13px; font-weight: 700; cursor: pointer; margin-top: 4px; transition: background .15s; }
.btn-add:hover, .btn-add:active { background: var(--primary-light); }
.btn-delete { flex-shrink: 0; width: 40px; height: 40px; display: grid; place-items: center; background: #fef2f2; color: #ef4444; border: none; border-radius: 10px; cursor: pointer; font-size: 13px; }
.btn-delete:active { background: #fee2e2; }

.subtotal-box { margin-top: 12px; padding-top: 12px; border-top: 1px solid #f1f5f9; font-size: 14.5px; font-weight: 800; color: var(--primary-dark); text-align: right; font-variant-numeric: tabular-nums; }
.text-danger { color: #ef4444 !important; }
.text-success { color: #16a34a !important; }

/* ----- Rekapitulasi harian ----- */
.summary-card { padding: 18px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.summary-row > span { color: #475569; }
.summary-row b { color: #0f172a; }
.summary-row:has(#rp-kas) { flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 14px 12px; margin-top: 4px; background: var(--primary-light); border: 1px solid var(--primary-border); border-radius: 14px; }
.summary-row:has(#rp-kas) > span { font-size: 12px; font-weight: 700; color: var(--primary-dark); }
#rp-kas { font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; color: var(--primary-dark) !important; }
.summary-card hr { border: none; border-top: 1px solid #f1f5f9; margin: 8px 0; }

.action-buttons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 4px; }
.action-buttons button { padding: 14px; border: none; border-radius: 12px; font-size: 13.5px; font-weight: 700; cursor: pointer; color: #fff; transition: transform .1s; }
.action-buttons button:active { transform: scale(.98); }
.btn-whatsapp { background: #16a34a; }
.btn-export { background: #fff !important; color: var(--primary-dark) !important; box-shadow: inset 0 0 0 1.5px var(--primary-color); }
.btn-reset { grid-column: span 2; background: #fef2f2 !important; color: #ef4444 !important; }

/* ----- Chip periode ----- */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; padding: 8px 16px; border-radius: 999px; border: 1.5px solid #e2e8f0; background: #f8fafc; color: #475569; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.chip.active { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }

/* ----- Rekap & arsip ----- */
.rekap-item { background: #fff; border: 1px solid #e2e8f0; padding: 12px 14px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rekap-info h4 { font-size: 13.5px; font-weight: 700; color: var(--primary-dark); }
.rekap-info p { font-size: 11.5px; color: #64748b; margin-top: 3px; font-variant-numeric: tabular-nums; }
.btn-buka-rekap { background: var(--primary-light); color: var(--primary-dark); border: 1px solid var(--primary-border); padding: 8px 16px; border-radius: 999px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.kosong-info { text-align: center; color: #94a3b8; padding: 18px 0; font-size: 13px; }
.readonly-section { background: #f8fafc; border-left: 4px solid var(--primary-color); padding: 12px; margin-bottom: 10px; border-radius: 12px; }
.readonly-section h4 { font-size: 13px; font-weight: 700; color: var(--primary-dark); margin-bottom: 8px; }
.readonly-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: #475569; margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.detail-kas { margin-top: 14px; background: var(--primary-light); border: 1px solid var(--primary-border); color: #0f172a; padding: 14px; border-radius: 14px; font-size: 13px; }

/* ----- Buku hutang ----- */
.hutang-card { background: #fff; border: 1px solid #e2e8f0; border-left: 5px solid #ef4444; border-radius: 14px; margin-bottom: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(15,23,42,.05); }
.hutang-card.lunas { border-left-color: #16a34a; }
.hutang-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #f8fafc; list-style: none; cursor: pointer; user-select: none; }
.hutang-head::-webkit-details-marker { display: none; }
.hutang-nama { flex: 1; min-width: 0; }
.hutang-card[open] > .hutang-head { border-bottom: 1px solid #f1f5f9; }
.hutang-card[open] > .hutang-head .accordion-arrow { background: var(--primary-dark); color: #fff; transform: rotate(180deg); }
.hutang-card[open] .hutang-body { animation: accOpen .25s ease; }
.hutang-nama { font-size: 14.5px; font-weight: 800; color: #1e293b; word-break: break-word; }
.hutang-status { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: #fee2e2; color: #b91c1c; }
.hutang-card.lunas .hutang-status { background: #dcfce7; color: #166534; }
.hutang-body { padding: 10px 14px 14px; }
.hutang-sub { font-size: 11px; font-weight: 700; margin: 6px 0 4px; }
.hutang-sub.plus { color: #0369a1; }
.hutang-sub.minus { color: #16a34a; margin-top: 12px; }
.hutang-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: #475569; border-bottom: 1px dashed #e2e8f0; padding: 6px 0; }
.hutang-row .plus { color: #ef4444; font-weight: 700; white-space: nowrap; }
.hutang-row .minus { color: #16a34a; font-weight: 700; white-space: nowrap; margin-right: 8px; }
.btn-batal { background: #fef2f2; color: #ef4444; border: 1px solid #fecaca; border-radius: 8px; padding: 3px 10px; font-size: 11px; font-weight: 700; cursor: pointer; }
.hutang-aksi { display: flex; gap: 8px; margin-top: 14px; }
.btn-bayar { flex: 1; border: none; border-radius: 10px; padding: 11px 8px; font-size: 13px; font-weight: 700; cursor: pointer; color: #fff; }
.btn-bayar.penuh { background: var(--primary-dark); }
.btn-bayar.sebagian { background: #f59e0b; }
.btn-bayar:active { transform: scale(.97); }

/* ----- Menu & accordion ----- */
.menu-item { width: 100%; display: flex; align-items: center; gap: 12px; background: #fff; border: 1.5px solid #e2e8f0; border-radius: 20px; padding: 16px 18px; margin-bottom: 12px; cursor: pointer; text-align: left; box-shadow: 0 2px 10px rgba(15,23,42,.05); }
.menu-item:active { transform: scale(.99); }
.menu-item .settings-card-text { flex: 1; min-width: 0; }
.menu-item h3 { font-size: 13.5px; color: #0f172a; margin-bottom: 2px; }
.menu-item p { font-size: 11.5px; color: #64748b; line-height: 1.4; }
.menu-item.keluar { border-color: #fecaca; }
.menu-item.keluar h3 { color: #ef4444; }
.settings-icon { flex-shrink: 0; width: 38px; height: 38px; border-radius: 14px; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 17px; }
.settings-accordion { background: #fff; border: 1.5px solid #e2e8f0; border-radius: 20px; margin-bottom: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(15,23,42,.05); }
.settings-accordion[open] { border-color: var(--primary-dark); box-shadow: 0 8px 22px rgba(var(--primary-rgb), .15); }
.settings-accordion.warning { background: #fffbeb; border-color: #fde68a; }
.settings-accordion.warning[open] { border-color: #f59e0b; box-shadow: 0 8px 22px rgba(245,158,11,.18); }
.settings-accordion.warning .settings-icon { background: #fef3c7; }
.settings-accordion summary { list-style: none; cursor: pointer; padding: 16px 18px; display: flex; align-items: center; gap: 12px; user-select: none; }
.settings-accordion summary::-webkit-details-marker { display: none; }
.settings-accordion summary .settings-card-text { flex: 1; min-width: 0; }
.settings-accordion summary h3 { font-size: 13.5px; color: #0f172a; margin-bottom: 2px; }
.settings-accordion summary p { font-size: 11.5px; color: #64748b; line-height: 1.4; }
.settings-accordion.warning summary p { color: #92400e; }
.accordion-arrow { flex-shrink: 0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; background: #f1f5f9; border-radius: 50%; color: #64748b; font-size: 12px; transition: transform .3s ease, background .2s, color .2s; }
.settings-accordion[open] > summary .accordion-arrow { background: var(--primary-dark); color: #fff; transform: rotate(180deg); }
.settings-accordion.warning[open] > summary .accordion-arrow { background: #f59e0b; }
.settings-accordion[open] > summary { border-bottom: 1px solid #f1f5f9; }
.accordion-body { padding: 14px 18px 18px; animation: accOpen .28s ease; }
@keyframes accOpen { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.settings-stack { display: flex; flex-direction: column; gap: 10px; }
.select-pill { width: 100%; appearance: none; -webkit-appearance: none; padding: 13px 44px 13px 18px; border: 2px solid #e2e8f0; border-radius: 999px; background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 18px center; font-size: 14px; font-weight: 600; color: #1e293b; outline: none; }
.select-pill:focus { border-color: var(--primary-dark); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .12); }

.btn-success { background: var(--primary-color); color: #fff; border: none; padding: 13px 16px; font-size: 13px; font-weight: 700; border-radius: 999px; cursor: pointer; width: 100%; transition: background .15s, transform .1s; }
.btn-success:hover { background: var(--primary-dark); }
.btn-success:active { transform: scale(.98); }
.btn-success.biru { background: #0284c7; }
.btn-halaman { background: #fff; color: var(--primary-dark); border: 1.5px solid var(--primary-color); border-radius: 999px; padding: 8px 16px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.sub-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sub-header h3 { margin: 0; font-size: 15px; }
.catatan-kecil { font-size: 12px; color: #64748b; line-height: 1.5; margin-bottom: 14px; }

/* ----- Form bertumpuk, modal bahan, neraca ----- */
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-item { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 12px 12px 8px; margin-bottom: 10px; }
.modal-item .row input { background: #fff; }
.modal-sub { text-align: right; font-size: 12.5px; color: #64748b; padding-top: 2px; }
.modal-sub b { color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.neraca-sec { font-size: 11px; font-weight: 800; letter-spacing: .06em; color: var(--primary-dark); margin: 16px 0 4px; }
.neraca-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 9px 0; border-bottom: 1px dashed #e2e8f0; font-size: 13.5px; }
.neraca-row > span { flex: 1; min-width: 0; color: #334155; font-weight: 600; }
.neraca-row small { display: block; color: #94a3b8; font-size: 11px; font-weight: 500; margin-top: 2px; line-height: 1.4; }
.neraca-row b { font-variant-numeric: tabular-nums; white-space: nowrap; color: #0f172a; }
.neraca-total { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; padding: 11px 14px; background: var(--primary-light); border: 1px solid var(--primary-border); border-radius: 12px; font-weight: 800; font-size: 14px; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.neraca-cek { margin-top: 16px; font-size: 11.5px; color: #16a34a; background: #f0fdf4; border-radius: 10px; padding: 9px 12px; line-height: 1.5; }

/* ----- Pilihan segmen (di dalam tab) ----- */
.seg-tabs { display: flex; gap: 4px; background: #e2e8f0; padding: 4px; border-radius: 14px; margin-bottom: 14px; }
.seg-btn { flex: 1; border: none; background: transparent; padding: 10px 6px; border-radius: 11px; font-size: 13px; font-weight: 700; color: #64748b; cursor: pointer; transition: all .15s; }
.seg-btn.active { background: #fff; color: var(--primary-dark); box-shadow: 0 1px 3px rgba(15,23,42,.14); }

/* ----- Splash ----- */
.splash-screen { position: fixed; inset: 0; background: #0f172a; z-index: 99999; display: flex; align-items: center; justify-content: center; color: #fff; transition: opacity .4s ease; }
.splash-screen.hilang { opacity: 0; pointer-events: none; }
.splash-content { text-align: center; }
.splash-content img { width: 96px; height: 96px; border-radius: 22px; margin-bottom: 14px; animation: bounce 1s infinite; }
.splash-content p { font-size: 13px; opacity: .8; margin-top: 4px; }
.splash-spinner { width: 30px; height: 30px; border: 3px solid rgba(255,255,255,.3); border-radius: 50%; border-top-color: #fff; animation: spin .8s linear infinite; margin: 16px auto 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .bottom-tabs, .splash-screen, .header-badge { display: none !important; } body { padding-bottom: 0; } .app-container { box-shadow: none; max-width: 100%; } }
