/* ==========================================================
   Pembukuan Proyek Parkir — tema elegan, font Poppins
   ========================================================== */
:root {
    --bg: #f5f6fa;
    --card: #ffffff;
    --ink: #121826;
    --ink-2: #3b4456;
    --muted: #7a8396;
    --line: #e8eaf0;
    --line-2: #f0f2f6;

    --primary: #0f766e;
    --primary-600: #0b5f58;
    --primary-50: #e8f4f2;
    --gold: #b8892b;
    --gold-50: #faf3e3;

    --green: #15803d;  --green-50: #e9f6ee;
    --blue: #2563eb;   --blue-50: #eaf1fe;
    --amber: #b45309;  --amber-50: #fdf3e5;
    --red: #c0262d;    --red-50: #fcebec;
    --gray: #5b6475;   --gray-50: #f0f2f5;

    --side: #0f1b2b;
    --side-2: #18273c;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: 'Poppins', system-ui, sans-serif;
    font-size: 14px;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.bi { line-height: 1; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 252px; flex-shrink: 0; background: var(--side); color: #c9d2e0;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; color: #fff; }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; object-fit: cover; }
.drawer-close { display: none; margin-left: auto; background: none; border: 0; color: #8494ab; font-size: 18px; cursor: pointer; padding: 6px; }
.brand b { display: block; font-size: 14.5px; font-weight: 600; }
.brand small { color: #8494ab; font-size: 11.5px; }
.nav { padding: 8px 12px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #64748b; padding: 16px 12px 6px; }
.nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
    color: #c9d2e0; font-weight: 500; margin-bottom: 2px; transition: background .15s;
}
.nav a .bi { font-size: 17px; width: 20px; text-align: center; }
.nav a:hover { background: var(--side-2); color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }
.nav .count { margin-left: auto; background: var(--gold); color: #fff; font-size: 11px; padding: 1px 8px; border-radius: 20px; }
.side-user { padding: 14px 16px; border-top: 1px solid #1e2d43; display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: #fff;
    display: grid; place-items: center; font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.side-user .who { flex: 1; min-width: 0; }
.side-user .who b { display: block; color: #fff; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who small { color: #8494ab; font-size: 11.5px; }
.side-user button { background: none; border: 0; color: #8494ab; cursor: pointer; font-size: 18px; padding: 6px; border-radius: 8px; }
.side-user button:hover { color: #fff; background: var(--side-2); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 16px; padding: 22px 32px 6px;
}
.topbar h1 { font-size: 22px; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.content { padding: 18px 32px 40px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }

/* ---------- Kartu & statistik ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 0; }
.card-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-head h3 .bi { color: var(--primary); }
.card-head .right { margin-left: auto; }
.card-body { padding: 16px 20px 20px; }

.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-main { grid-template-columns: 2fr 1fr; }
.mb { margin-bottom: 18px; }

.stat { padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.stat .label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 20px; font-weight: 600; margin-top: 4px; letter-spacing: -.01em; white-space: nowrap; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.hero { background: linear-gradient(135deg, #0f766e 0%, #115e59 60%, #0f1b2b 140%); border: 0; color: #fff; }
.stat.hero .label, .stat.hero .hint { color: rgba(255,255,255,.75); }
.stat.hero .stat-icon { background: rgba(255,255,255,.14); color: #fff; }

.tone-primary { background: var(--primary-50); color: var(--primary); }
.tone-green { background: var(--green-50); color: var(--green); }
.tone-blue { background: var(--blue-50); color: var(--blue); }
.tone-amber { background: var(--amber-50); color: var(--amber); }
.tone-red { background: var(--red-50); color: var(--red); }
.tone-gold { background: var(--gold-50); color: var(--gold); }
.tone-gray { background: var(--gray-50); color: var(--gray); }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-muted { color: var(--muted); }
.text-amber { color: var(--amber); } .text-right { text-align: right; } .fw { font-weight: 600; }
.small { font-size: 12.5px; } .nowrap { white-space: nowrap; }

/* Status pembayaran ringkas */
.status-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.status-tile { border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.status-tile .n { font-size: 24px; font-weight: 600; }
.status-tile .t { font-size: 12.5px; display: flex; align-items: center; gap: 6px; font-weight: 500; }

/* ---------- Badge ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px;
    font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.b-green { background: var(--green-50); color: var(--green); }
.b-blue { background: var(--blue-50); color: var(--blue); }
.b-amber { background: var(--amber-50); color: var(--amber); }
.b-red { background: var(--red-50); color: var(--red); }
.b-gray { background: var(--gray-50); color: var(--gray); }

/* ---------- Tombol ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent;
    padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 500; cursor: pointer;
    transition: all .15s; white-space: nowrap; line-height: 1.2;
}
.btn .bi { font-size: 15px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { filter: brightness(.95); color: #fff; }
.btn-light { background: var(--card); border-color: var(--line); color: var(--ink-2); }
.btn-light:hover { border-color: #cfd5e0; color: var(--ink); }
.btn-danger { background: var(--red-50); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: var(--green-50); color: var(--green); }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btn-block { width: 100%; }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
    font-weight: 500; padding: 12px 16px; background: #fafbfc; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcfc; }
.table .t-title { font-weight: 500; color: var(--ink); }
.table .t-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.table tfoot td { font-weight: 600; background: #fafbfc; border-top: 1px solid var(--line); }
tr.is-void td { opacity: .5; text-decoration: line-through; }
tr.is-void td:last-child { text-decoration: none; }

/* Progress */
.progress { height: 7px; background: var(--line-2); border-radius: 10px; overflow: hidden; min-width: 90px; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 10px; }
.progress.lg { height: 10px; }

/* ---------- Form ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field label {
    display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 7px;
}
.field label .bi { color: var(--primary); font-size: 14px; }
.field label .req { color: var(--red); }
.input, .select, textarea.input {
    width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; font: inherit;
    background: #fff; color: var(--ink); transition: border .15s, box-shadow .15s;
}
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.input-group { display: flex; align-items: stretch; }
.input-group .addon {
    display: grid; place-items: center; padding: 0 12px; background: #f6f7f9; border: 1px solid var(--line);
    color: var(--muted); font-weight: 500; font-size: 13px;
}
.input-group .addon:first-child { border-right: 0; border-radius: 10px 0 0 10px; }
.input-group .addon:last-child { border-left: 0; border-radius: 0 10px 10px 0; }
.input-group .input { border-radius: 0; }
.input-group .input:first-child { border-radius: 10px 0 0 10px; }
.input-group .addon:first-child + .input { border-radius: 0 10px 10px 0; }
.help { font-size: 12px; color: var(--muted); margin-top: 6px; }
.error { font-size: 12px; color: var(--red); margin-top: 6px; display: flex; gap: 5px; align-items: center; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; }

/* Filter bar */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.filters .input, .filters .select { width: auto; min-width: 160px; padding: 8px 12px; }
.search { position: relative; }
.search .bi { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 36px; min-width: 240px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 16px; overflow-x: auto; }
.tabs a, .tabs button {
    display: flex; align-items: center; gap: 7px; padding: 14px 14px 12px; color: var(--muted); font-weight: 500;
    border: 0; background: none; font: inherit; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a.active, .tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Info list */
.info { display: grid; grid-template-columns: 140px 1fr; gap: 10px 12px; font-size: 13.5px; }
.info dt { color: var(--muted); display: flex; align-items: center; gap: 7px; }
.info dt .bi { color: var(--primary); }
.info dd { margin: 0; font-weight: 500; }

/* Alert */
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 500; }
.alert-success { background: var(--green-50); color: var(--green); }
.alert-error { background: var(--red-50); color: var(--red); }
.alert .close { margin-left: auto; background: none; border: 0; cursor: pointer; color: inherit; font-size: 16px; }

/* Empty */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .bi { font-size: 38px; color: #c5ccd8; display: block; margin-bottom: 10px; }
.empty p { margin: 0 0 14px; }

/* List item kecil */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.list-row:last-child { border-bottom: 0; }
.list-row .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; font-size: 16px; }
.list-row .body { flex: 1; min-width: 0; }
.list-row .body b { display: block; font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .body small { color: var(--muted); font-size: 12px; }

/* ---------- Modal (<dialog>) ---------- */
dialog.modal { border: 0; border-radius: 18px; padding: 0; width: min(560px, 94vw); box-shadow: 0 24px 60px rgba(15, 27, 43, .25); }
dialog.modal::backdrop { background: rgba(15, 27, 43, .45); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 0; }
.modal-head .stat-icon { width: 40px; height: 40px; font-size: 18px; }
.modal-head h3 { font-size: 16px; }
.modal-head small { color: var(--muted); font-size: 12.5px; }
.modal-head .x { margin-left: auto; background: none; border: 0; font-size: 20px; color: var(--muted); cursor: pointer; }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 20px; }

/* Pagination */
.pagination { display: flex; gap: 6px; justify-content: flex-end; padding: 14px 16px; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { color: #c0c6d1; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
    background: radial-gradient(circle at 20% 20%, #14a394 0, transparent 45%),
                linear-gradient(150deg, #0f766e 0%, #0f1b2b 75%);
    color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-art h2 { font-size: 34px; line-height: 1.25; max-width: 440px; }
.auth-art p { color: rgba(255,255,255,.75); max-width: 420px; line-height: 1.7; }
.auth-feats { display: grid; gap: 14px; }
.auth-feats div { display: flex; gap: 12px; align-items: center; color: rgba(255,255,255,.88); }
.auth-feats .bi { width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 17px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.auth-form .box { width: min(380px, 100%); }
.auth-form h1 { font-size: 24px; margin-bottom: 6px; }
.auth-form .sub { color: var(--muted); margin-bottom: 28px; }

.auth-mobile-logo { display: none; width: 64px; height: 64px; border-radius: 18px; margin-bottom: 18px; box-shadow: 0 8px 24px rgba(15, 118, 110, .25); }

/* ---------- Status kecil ---------- */
.alert { transition: opacity .3s, transform .3s; }
.alert.fade { opacity: 0; transform: translateY(-6px); pointer-events: none; height: 0; padding: 0; margin: 0; overflow: hidden; }
.btn.loading { opacity: .7; pointer-events: none; }
.btn.loading .bi { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- PWA: banner pasang aplikasi ---------- */
.install-banner {
    position: fixed; z-index: 60; right: 24px; bottom: 24px; width: min(400px, calc(100vw - 24px));
    display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px;
    background: #fff; border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 18px 40px rgba(15, 27, 43, .18);
    opacity: 0; transform: translateY(16px); transition: opacity .25s, transform .25s;
}
.install-banner.show { opacity: 1; transform: none; }
.install-banner img { border-radius: 12px; flex-shrink: 0; }
.install-banner .ib-text { flex: 1; min-width: 0; }
.install-banner .ib-text b { display: block; font-size: 13.5px; font-weight: 600; }
.install-banner .ib-text small { color: var(--muted); font-size: 12px; line-height: 1.4; display: block; }
.install-banner .ib-close { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; padding: 4px; align-self: flex-start; }

/* ---------- Navigasi bawah & aksi cepat (hanya HP) ---------- */
.bottom-nav, .drawer-backdrop { display: none; }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.quick-grid a {
    display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px;
    border: 1px solid var(--line); border-radius: 14px; color: var(--ink); font-weight: 500; font-size: 13.5px;
}
.quick-grid a:active { background: var(--primary-50); }
.sheet-handle { display: none; }

/* ---------- Invoice: form ---------- */
.segmented { display: inline-flex; background: #eceef3; border-radius: 12px; padding: 4px; gap: 4px; }
.segmented a { display: flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.segmented a.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(16,24,40,.1); }
.pick-project { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; margin-bottom: 12px; }
.pick-project .pp-head { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.pick-project .pp-head > div { flex: 1; min-width: 0; }
.pick-project .pp-head b { display: block; font-weight: 600; }
.pick-project .pp-head small { color: var(--muted); font-size: 12px; }
.items-editor td { padding: 8px 6px; vertical-align: top; }
.items-editor td .input { padding: 9px 10px; }
.items-editor .js-amount { padding-top: 18px; }
.sum-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.sum-row span { color: var(--muted); }
.sum-row.grand { border-bottom: 0; padding-top: 14px; font-size: 16px; }
.sum-row.grand span { color: var(--ink); font-weight: 600; }
.sum-row.grand b { color: var(--primary); font-size: 20px; }
.sticky-side { position: sticky; top: 16px; }

/* Riwayat */
.timeline { display: grid; gap: 4px; }
.tl { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; color: var(--muted); }
.tl > .bi { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--gray-50); flex-shrink: 0; }
.tl b { display: block; font-weight: 500; font-size: 13.5px; }
.tl small { font-size: 12px; }
.tl.done { color: var(--ink); }
.tl.done > .bi { background: var(--green-50); color: var(--green); }
.tl.cancel > .bi { background: var(--red-50); color: var(--red); }

/* ---------- Invoice: lembar A4 ---------- */
.inv-preview { overflow-x: auto; }
.inv-paper {
    position: relative; background: #fff; color: #1b2230; border-radius: var(--radius); border: 1px solid var(--line);
    box-shadow: var(--shadow); padding: 44px 48px; font-size: 12.5px; line-height: 1.55; overflow: hidden;
}
.inv-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 22px; border-bottom: 3px solid var(--primary); }
.inv-company { display: flex; gap: 14px; align-items: flex-start; }
.inv-company img { width: 54px; height: 54px; border-radius: 12px; object-fit: contain; }
.inv-company b { display: block; font-size: 16px; font-weight: 600; color: var(--ink); }
.inv-company span { display: block; color: #5b6475; font-size: 11.5px; }
.inv-title { text-align: right; }
.inv-title h2 { font-size: 30px; letter-spacing: .14em; color: var(--primary); font-weight: 600; line-height: 1; }
.inv-no { margin-top: 8px; font-weight: 600; font-size: 13px; }
.inv-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 22px 0; }
.inv-meta small, .inv-words small, .inv-bank small, .inv-notes small { display: block; text-transform: uppercase; letter-spacing: .08em; font-size: 10px; color: #8a93a5; margin-bottom: 4px; }
.inv-meta b { display: block; font-size: 14px; font-weight: 600; }
.inv-meta span { display: block; color: #4a5366; }
.inv-dates { margin-left: auto; border-collapse: collapse; }
.inv-dates td { padding: 3px 0 3px 16px; vertical-align: top; }
.inv-dates td:first-child { color: #8a93a5; white-space: nowrap; }
.inv-dates td:last-child { font-weight: 500; text-align: right; }
.inv-items { width: 100%; border-collapse: collapse; }
.inv-items th { background: var(--primary); color: #fff; font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; text-align: left; }
.inv-items th:first-child { border-radius: 8px 0 0 8px; } .inv-items th:last-child { border-radius: 0 8px 8px 0; }
.inv-items td { padding: 11px 12px; border-bottom: 1px solid #edf0f4; vertical-align: top; }
.inv-items .r { text-align: right; white-space: nowrap; }
.inv-bottom { display: grid; grid-template-columns: 1fr 280px; gap: 28px; padding-top: 18px; }
.inv-words i { display: block; font-style: italic; color: #4a5366; margin-bottom: 16px; }
.inv-bank { background: var(--primary-50); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.inv-bank b { display: block; font-size: 14px; font-weight: 600; color: var(--primary-600); }
.inv-bank span { color: #4a5366; }
.inv-notes span { display: block; color: #4a5366; }
.inv-totals { width: 100%; border-collapse: collapse; align-self: start; }
.inv-totals td { padding: 7px 0; }
.inv-totals td:last-child { text-align: right; font-weight: 500; white-space: nowrap; }
.inv-totals td:first-child { color: #5b6475; }
.inv-totals tr.grand td { border-top: 2px solid var(--ink); padding-top: 12px; font-size: 15px; font-weight: 600; color: var(--ink); }
.inv-sign { display: flex; justify-content: flex-end; padding-top: 34px; }
.inv-sign > div { text-align: center; min-width: 200px; }
.inv-sign span { display: block; color: #4a5366; }
.inv-sign b { display: block; font-weight: 600; border-bottom: 1px solid #1b2230; padding-bottom: 2px; }
.inv-sign-space { height: 70px; }
.inv-stamp {
    position: absolute; top: 150px; right: 28px; transform: rotate(-18deg); font-size: 40px; font-weight: 600; letter-spacing: .2em;
    border: 5px solid; border-radius: 14px; padding: 4px 26px; opacity: .17; pointer-events: none;
}
.inv-stamp.paid { color: var(--green); } .inv-stamp.void { color: var(--red); }

/* ---------- Halaman cetak ---------- */
.print-page { background: #e9ecf1; padding: 24px 16px 40px; }
.print-page .inv-paper { max-width: 210mm; min-height: 297mm; margin: 0 auto; border-radius: 4px; }
.print-toolbar { max-width: 210mm; margin: 0 auto 16px; display: flex; align-items: center; gap: 12px; }
.print-hint { flex: 1; color: var(--muted); font-size: 12.5px; text-align: center; }
@page { size: A4; margin: 12mm; }
@media print {
    .print-page { background: #fff; padding: 0; }
    .print-toolbar { display: none; }
    .print-page .inv-paper { box-shadow: none; border: 0; padding: 0; min-height: 0; max-width: none; }
    .inv-items th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .inv-bank, .inv-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* =========================================================
   RESPONSIF
   ========================================================= */
@media (max-width: 1200px) {
    .g-4 { grid-template-columns: repeat(2, 1fr); }
    .g-main { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
    /* Sidebar jadi drawer */
    .sidebar { position: fixed; left: 0; top: 0; z-index: 80; transform: translateX(-105%); transition: transform .25s ease; height: 100dvh; }
    body.nav-open .sidebar { transform: none; }
    .drawer-close { display: block; }
    .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 75; background: rgba(15, 27, 43, .45); opacity: 0; pointer-events: none; transition: opacity .25s; }
    body.nav-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
    body.nav-open { overflow: hidden; }

    /* Navigasi bawah */
    .bottom-nav {
        display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
        background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px);
        border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    }
    .bottom-nav a, .bottom-nav button {
        position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0;
        color: var(--muted); font: inherit; font-size: 10.5px; font-weight: 500; background: none; border: 0; cursor: pointer;
    }
    .bottom-nav .bi { font-size: 21px; }
    .bottom-nav .active { color: var(--primary); }
    .bottom-nav em {
        position: absolute; top: 0; left: 55%; font-style: normal; background: var(--gold); color: #fff;
        font-size: 10px; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px;
    }
    .bottom-nav .bn-add {
        width: 54px; height: 54px; margin: -22px auto 4px; border-radius: 18px; padding: 0; justify-content: center;
        background: linear-gradient(135deg, #14a394, var(--primary)); color: #fff;
        box-shadow: 0 8px 20px rgba(15, 118, 110, .35);
    }
    .bottom-nav .bn-add .bi { font-size: 24px; }

    .main { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
    .topbar { padding: calc(14px + env(safe-area-inset-top)) 16px 4px; flex-wrap: wrap; gap: 10px; }
    .topbar-title { width: 100%; }
    .topbar h1 { font-size: 19px; }
    .topbar .actions { width: 100%; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .topbar .actions::-webkit-scrollbar { display: none; }
    .topbar .actions > * { flex-shrink: 0; }
    .content { padding: 10px 16px 28px; }

    .install-banner { left: 12px; right: 12px; width: auto; bottom: calc(84px + env(safe-area-inset-bottom)); }
    .auth .install-banner, body:not(:has(.bottom-nav)) .install-banner { bottom: calc(14px + env(safe-area-inset-bottom)); }

    .g-2, .g-3, .form-grid { grid-template-columns: 1fr; }
    .status-tiles { grid-template-columns: repeat(2, 1fr); }
    .auth { grid-template-columns: 1fr; }
    .auth-art { display: none; }
    .auth-mobile-logo { display: block; }
}

@media (max-width: 720px) {
    /* Teks input 16px supaya iPhone tidak zoom otomatis */
    .input, .select, textarea.input { font-size: 16px; padding: 11px 13px; }
    .btn { padding: 11px 16px; }
    .btn-sm { padding: 8px 12px; }
    .btn-icon { width: 36px; height: 36px; }

    /* Kartu angka: 2 kolom ringkas, kartu utama penuh */
    .grid.g-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
    .grid.g-4 .stat { flex-direction: column; gap: 10px; padding: 14px; }
    .grid.g-4 .stat.hero { grid-column: 1 / -1; flex-direction: row; align-items: center; }
    .grid.g-4 > .stat:nth-child(4):last-child { grid-column: 1 / -1; flex-direction: row; align-items: center; }
    .stat .stat-icon { width: 36px; height: 36px; font-size: 17px; border-radius: 10px; }
    .stat .value { font-size: 15.5px; white-space: normal; word-break: break-word; }
    .stat.hero .value { font-size: 21px; }
    .stat .label { font-size: 11.5px; }
    .stat .hint { font-size: 11px; }
    .grid { gap: 12px; }
    .mb { margin-bottom: 12px; }
    .card-head { padding: 16px 16px 0; }
    .card-body { padding: 14px 16px 16px; }

    /* Filter: pencarian penuh, pilihan 2 kolom */
    .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; }
    .filters .search { grid-column: 1 / -1; }
    .filters .input, .filters .select { min-width: 0; width: 100%; }
    .search .input { min-width: 0; width: 100%; }

    /* Tabel berubah jadi kartu */
    .table-wrap { overflow: visible; }
    table.table:not(.keep), table.table:not(.keep) tbody, table.table:not(.keep) tfoot,
    table.table:not(.keep) tr, table.table:not(.keep) td { display: block; width: 100%; }
    table.table:not(.keep) thead { display: none; }
    table.table:not(.keep) tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
    table.table:not(.keep) tbody tr:last-child { border-bottom: 0; }
    table.table:not(.keep) td {
        display: grid; grid-template-columns: minmax(96px, auto) 1fr; column-gap: 12px; row-gap: 2px; align-items: center;
        padding: 6px 0; border: 0; text-align: right;
    }
    table.table:not(.keep) td::before {
        content: attr(data-label); grid-column: 1; grid-row: 1 / span 2; align-self: center;
        color: var(--muted); font-size: 12px; font-weight: 400; text-align: left;
    }
    table.table:not(.keep) td > * { grid-column: 2; justify-self: end; }
    table.table:not(.keep) td > .progress { justify-self: stretch; width: 100%; }
    table.table:not(.keep) td > form { display: inline-block; }
    table.table:not(.keep) td:first-child { display: block; text-align: left; padding-bottom: 8px; }
    table.table:not(.keep) td:first-child::before { display: none; }
    table.table:not(.keep) td:empty { display: none; }
    table.table:not(.keep) td:not([data-label])::before { display: none; }
    table.table:not(.keep) td[colspan] { display: block; text-align: left; }
    table.table:not(.keep) td[colspan]::before { display: none; }
    table.table:not(.keep) tfoot tr { background: #fafbfc; border-radius: 0 0 var(--radius) var(--radius); }
    table.table:not(.keep) tfoot td { background: none; border: 0; }
    table.table:not(.keep) .progress { min-width: 0; }
    table.table:not(.keep) td:first-child > * { justify-self: start; text-align: left; }
    table.table:not(.keep) td:not([data-label]) { display: flex; justify-content: flex-end; gap: 6px; }
    .table .t-sub { font-size: 11.5px; }

    /* Modal jadi bottom sheet */
    dialog.modal {
        width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 22px 22px 0 0;
        max-height: 92dvh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom);
        animation: sheet-up .25s ease;
    }
    .sheet-handle { display: block; width: 40px; height: 4px; border-radius: 4px; background: #d5dae3; margin: 10px auto 0; }
    .modal-head { padding: 16px 18px 0; }
    .modal-body { padding: 16px 18px; }
    .modal-foot { padding: 0 18px 18px; }
    .modal-foot .btn { flex: 1; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; }

    .info { grid-template-columns: 1fr; gap: 2px 0; }
    .info dd { margin-bottom: 10px; }
    .tabs { padding: 0 8px; }
    .tabs a, .tabs button { padding: 13px 10px 11px; font-size: 13px; }
    .list-row .body b { white-space: normal; }
    .alert { font-size: 13px; }

    /* Invoice di HP */
    .segmented { display: flex; } .segmented a { flex: 1; justify-content: center; }
    .pick-project .pp-head { flex-wrap: wrap; }
    .items-editor td { padding: 4px 0; }
    .items-editor td:first-child { padding-bottom: 6px; }
    .items-editor .js-amount { padding-top: 4px; }
    .items-editor tr.item-row { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
    .sticky-side { position: static; }
    .inv-paper { padding: 22px 18px; font-size: 11.5px; }
    .inv-head { flex-direction: column; gap: 14px; }
    .inv-title { text-align: left; }
    .inv-title h2 { font-size: 22px; }
    .inv-meta, .inv-bottom { grid-template-columns: 1fr; gap: 14px; }
    .inv-dates { margin-left: 0; width: 100%; }
    .inv-dates td:first-child { padding-left: 0; }
    .inv-items th, .inv-items td { padding: 8px 6px; }
    .print-toolbar { flex-wrap: wrap; }
    .print-hint { order: 3; width: 100%; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* Saat dibuka sebagai aplikasi (PWA terpasang) */
@media (display-mode: standalone) {
    .install-link { display: none !important; }
}
