/* LUMBUNG app shell — mobile-first, app viewport on desktop */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
    --green: #430461;
    --green-2: #3d0586;
    --green-3: #57048f;
    --green-soft: #e8f3ec;
    --accent: #f59e0b;
    --cream: #f7f5ee;
    --ink: #14231a;
    --muted: #6b7a70;
    --line: #e4e1d6;
    --card: #ffffff;
    --danger: #b91c1c;
    --shadow: 0 12px 30px rgba(20, 35, 26, .08);
}

html, body { height: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background:
        radial-gradient(1200px 700px at 15% 0%, #1d6b3f 0%, transparent 55%),
        radial-gradient(900px 600px at 90% 100%, #0f3d24 0%, transparent 60%),
        #0c2a1a;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; display: block; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
    outline: 3px solid #d97706;
    outline-offset: 2px;
}

/* ── App frame ─────────────────────────────────────────────── */
.app-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100dvh;
    max-width: 480px;
    margin: 0 auto;
    background: var(--cream);
    overflow: hidden;
}

@media (min-width: 760px) {
    body { display: flex; justify-content: center; padding: 22px; }
    .app-shell {
        height: calc(100dvh - 44px);
        border-radius: 30px;
        box-shadow: 0 30px 90px rgba(0, 0, 0, .38);
        outline: 1px solid rgba(255, 255, 255, .14);
    }
}

/* ── Boot / login ──────────────────────────────────────────── */
.boot {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--muted);
    font-size: 12px;
}
.boot-logo { width: 70px; height: 70px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .55; transform: scale(.96); } 50% { opacity: 1; transform: scale(1); } }

.login {
    height: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 34px 24px calc(28px + env(safe-area-inset-bottom));
    background:
        radial-gradient(420px 300px at 85% 8%, rgba(31, 122, 67, .18), transparent 65%),
        radial-gradient(380px 280px at 0% 100%, rgba(245, 158, 11, .14), transparent 70%),
        var(--cream);
    overflow-y: auto;
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-logo {
    width: 92px; height: 92px; margin: 0 auto 16px; padding: 14px;
    background: #fff; border-radius: 26px; box-shadow: var(--shadow);
    object-fit: contain;
}
.login-title { margin: 0; font-size: 27px; font-weight: 900; letter-spacing: .12em; color: var(--green); overflow-wrap: anywhere; }
.login-sub { margin: 7px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.login-card {
    background: #fff; border: 1px solid var(--line); border-radius: 20px;
    padding: 18px; box-shadow: var(--shadow);
}
.login-card h2 { margin: 0 0 4px; font-size: 15px; }
.login-card p { margin: 0 0 16px; font-size: 11.5px; color: var(--muted); }
.login-hint { margin: 18px 0 0; text-align: center; font-size: 10.5px; color: #8b978f; line-height: 1.5; }
.login-foot { margin-top: auto; padding-top: 22px; text-align: center; font-size: 10px; color: #97a29a; }

@media (max-height: 720px) {
    .login { padding: 18px 20px calc(16px + env(safe-area-inset-bottom)); }
    .login-brand { margin-bottom: 14px; }
    .login-logo { width: 64px; height: 64px; margin-bottom: 10px; padding: 9px; border-radius: 18px; }
    .login-title { font-size: 23px; }
    .login-sub { margin-top: 5px; font-size: 11px; }
    .login-card { padding: 15px; border-radius: 18px; }
    .login-card p { margin-bottom: 12px; }
    .login-hint { margin-top: 12px; }
    .login-foot { padding-top: 10px; }
}

/* ── Header ────────────────────────────────────────────────── */
.app-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: linear-gradient(155deg, #6806a8 0%, #6804b9 60%, #3e065f 100%);
    color: #fff;
    position: relative;
    z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; overflow: hidden; }
.brand > div { min-width: 0; }
.brand img { width: 35px; height: 35px; padding: 5px; background: #fff; border-radius: 11px; object-fit: contain; flex: 0 0 auto; }
.brand-name { font-weight: 900; letter-spacing: .1em; font-size: 14px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 10.5px; opacity: .74; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.gudang-chip {
    display: inline-flex; align-items: center; gap: 5px; max-width: 132px;
    border: 0; border-radius: 99px; padding: 6px 9px;
    background: rgba(255, 255, 255, .14); color: #fff;
    font-size: 10.5px; font-weight: 700; cursor: pointer;
}
.gudang-chip .ic { width: 15px; height: 15px; }
.gudang-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gudang-chip.locked { cursor: default; opacity: .92; }
.gudang-chip.warn { background: rgba(245, 158, 11, .3); }
.license-chip {
    display: inline-flex; align-items: center; gap: 4px; max-width: 104px;
    border: 0; border-radius: 99px; padding: 6px 8px;
    background: rgba(255, 255, 255, .14); color: #fff;
    font-size: 9.5px; font-weight: 800; cursor: pointer;
}
.license-chip .ic { width: 14px; height: 14px; }
.license-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.license-chip .license-days { font-weight: 600; opacity: .8; }
@media (max-width: 400px) { .license-chip .license-days { display: none; } }
.license-chip.warn { background: rgba(245, 158, 11, .32); }
.license-chip.danger { background: rgba(220, 38, 38, .4); }
.license-banner {
    flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
    padding: 9px 14px; background: #fff4db; color: #8a5a05;
    border-bottom: 1px solid #f0dfae; font-size: 10.5px; font-weight: 700;
    position: relative; z-index: 4;
}
.license-banner.danger { background: #fdeaea; color: #991b1b; border-bottom-color: #f3c9c9; }
.net-banner {
    position: fixed; top: 0; left: 50%; transform: translateX(-50%);
    width: min(100%, 480px); z-index: 60;
    padding: calc(6px + env(safe-area-inset-top)) 12px 6px;
    background: #b45309; color: #fff; text-align: center;
    font-size: 11px; font-weight: 700;
}
.license-banner .ic { width: 16px; height: 16px; flex: 0 0 auto; }
.license-banner span { flex: 1; min-width: 0; line-height: 1.35; }
.license-banner button {
    border: 0; border-radius: 9px; padding: 6px 9px; background: rgba(0, 0, 0, .08);
    color: inherit; font: inherit; font-size: 10px; font-weight: 900; cursor: pointer; white-space: nowrap;
}
.plan-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 11px 12px; }
.plan-card + .plan-card { margin-top: 8px; }
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-name { font-size: 12.5px; font-weight: 900; }
.plan-limit { font-size: 10px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.plan-options { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.plan-option { flex: 1; min-width: 86px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; background: #f8faf7; }
.plan-option strong { display: block; font-size: 11px; }
.plan-option small { display: block; font-size: 9px; color: var(--muted); margin-top: 1px; }
.icon-btn {
    width: 42px; height: 42px; border: 0; border-radius: 13px;
    background: rgba(255, 255, 255, .13); color: #fff;
    display: grid; place-items: center; position: relative; cursor: pointer;
}
.icon-btn:active { transform: scale(.96); }
.badge {
    position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px;
    padding: 0 4px; border-radius: 10px; background: var(--accent); color: #3b2400;
    font-size: 9.5px; font-weight: 900; display: grid; place-items: center;
    border: 2px solid #14532d;
}

@media (max-width: 440px) {
    .app-header { gap: 6px; padding: calc(9px + env(safe-area-inset-top)) 12px 9px; }
    .brand { gap: 8px; }
    .brand img { width: 30px; height: 30px; padding: 4px; border-radius: 9px; }
    .brand-name { font-size: 13px; letter-spacing: .08em; }
    .brand-sub { display: none; }
    .license-chip { max-width: 88px; padding: 5px 7px; font-size: 9px; flex: 0 1 auto; min-width: 0; }
    .gudang-chip { max-width: 96px; padding: 5px 8px; font-size: 10px; flex: 0 1 auto; min-width: 0; }
    .icon-btn { width: 36px; height: 36px; border-radius: 11px; flex: 0 0 auto; }
}

/* ── View & tabs ───────────────────────────────────────────── */
.view {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 16px 26px;
    scroll-behavior: smooth;
}
.view--login { padding: 0; overflow: hidden; }
.tabbar {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(var(--tab-count, 5), minmax(0, 1fr));
    background: #fff;
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 6;
}
.tab {
    background: none; border: 0; display: flex; flex-direction: column; align-items: center;
    gap: 3px; padding: 5px 2px; min-height: 46px; border-radius: 12px; color: var(--muted);
    font-size: 10.5px; font-weight: 700; cursor: pointer;
}
.tab .ic { width: 23px; height: 23px; transition: transform .15s ease; }
.tab.active { color: var(--green); }
.tab.active .ic { transform: translateY(-1px); }

/* ── Icons (duoline sprite, two-tone) ──────────────────────── */
.ic {
    display: inline-block; flex: 0 0 auto; width: 22px; height: 22px;
    color: inherit; vertical-align: middle;
    --ic-accent: #f97316;
}
.tab .ic { --ic-accent: #94a3b8; }
.tab.active .ic { --ic-accent: #f97316; }
.btn:not(.btn--ghost) .ic { --ic-accent: #fbbf24; }
.menu-icon .ic, .stat-icon .ic, .notif-icon .ic, .icon-btn .ic { --ic-accent: currentColor; }

/* ── Sections & cards ──────────────────────────────────────── */
.section { margin-bottom: 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-title { font-size: 14px; font-weight: 900; margin: 0; letter-spacing: -.01em; }
.section-link { background: none; border: 0; color: var(--green-2); font-size: 11.5px; font-weight: 800; cursor: pointer; padding: 2px; }

.home-slider {
    position: relative; border-radius: 18px; overflow: hidden; margin-bottom: 10px;
    background: var(--green-soft); box-shadow: var(--shadow);
}
.home-slider-track { display: flex; transition: transform .5s cubic-bezier(.4, 0, .2, 1); }
.home-slide { position: relative; flex: 0 0 100%; aspect-ratio: 5 / 2; }
.home-slide img { display: block; width: 100%; height: 100%; object-fit: cover; }
.home-slide-caption {
    position: absolute; left: 12px; bottom: 11px; display: flex; flex-direction: column;
    gap: 1px; max-width: 56%;
}
.home-slide-caption strong { font-size: 12px; font-weight: 900; color: var(--green); line-height: 1.25; }
.home-slide-caption small { font-size: 9.5px; color: #5b6b60; line-height: 1.3; }
.home-slider-dots { position: absolute; right: 10px; bottom: 9px; display: flex; gap: 4px; }
.home-slider-dot { width: 5px; height: 5px; border-radius: 99px; background: rgba(20, 83, 45, .28); transition: width .2s, background .2s; }
.home-slider-dot.is-active { width: 14px; background: var(--green-3); }

.home-welcome {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    padding: 9px 11px; margin-bottom: 12px;
}
.home-welcome-text { min-width: 0; }
.home-welcome h1 { font-size: 14px; margin: 0; line-height: 1.25; }
.home-welcome p { margin: 1px 0 0; font-size: 9.5px; color: var(--muted); }
.home-welcome-date {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px;
    background: var(--green-soft); color: var(--green); border-radius: 99px;
    padding: 4px 8px; font-size: 9.5px; font-weight: 800; white-space: nowrap;
}
.home-welcome-date .ic { width: 12px; height: 12px; }

.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.stat-card {
    background: var(--card); border: 1px solid var(--line); border-radius: 16px;
    padding: 12px; display: flex; gap: 9px; align-items: flex-start; min-height: 74px;
}
.stat-icon { width: 33px; height: 33px; border-radius: 11px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); flex: 0 0 auto; }
.stat-icon .ic { width: 19px; height: 19px; }
.stat-icon.amber { background: #fff4dd; color: #b45309; }
.stat-icon.blue { background: #e8f0fb; color: #1d4ed8; }
.stat-icon.violet { background: #f0e9fb; color: #6d28d9; }
.stat-label { font-size: 10px; color: var(--muted); margin-bottom: 4px; line-height: 1.3; }
.stat-value { font-size: 13.5px; font-weight: 900; letter-spacing: -.015em; line-height: 1.2; }
.stat-card--error { border-color: #f0c7c7; background: #fffafa; }
.stat-card__content { min-width: 0; }
.stat-card__message { color: #9f2525; font-size: 10px; line-height: 1.35; overflow-wrap: anywhere; margin: 3px 0; }

.grid-menu { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grid-menu--3 { grid-template-columns: repeat(3, 1fr); }
.grid-menu--transactions { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.menu-tile {
    background: var(--card); border: 1px solid var(--line); border-radius: 15px;
    padding: 11px 5px; display: flex; flex-direction: column; align-items: center; gap: 7px;
    font-size: 10px; font-weight: 800; color: var(--ink); cursor: pointer;
}
.grid-menu--transactions .menu-tile { min-width: 0; padding: 9px 3px; gap: 5px; text-align: center; line-height: 1.25; }
.grid-menu--transactions .menu-tile small { color: var(--muted); font-size: 8px; font-weight: 600; }
.menu-tile:disabled { cursor: not-allowed; opacity: .58; }
.menu-tile:active { transform: scale(.97); }
.menu-icon { width: 37px; height: 37px; border-radius: 12px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); }
.menu-icon .ic { width: 20px; height: 20px; }
.menu-tile:nth-child(2) .menu-icon { background: #fff3e0; color: #b45309; }
.menu-tile:nth-child(3) .menu-icon { background: #e8f0fb; color: #1d4ed8; }
.menu-tile:nth-child(4) .menu-icon { background: #f0e9fb; color: #6d28d9; }

@media (max-width: 440px) {
    .grid-menu--transactions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ── Notifications ─────────────────────────────────────────── */
.notif {
    display: flex; gap: 10px; padding: 12px; border: 1px solid var(--line);
    background: #fff; border-radius: 14px; cursor: pointer; position: relative; text-align: left;
    width: 100%; min-height: 48px; color: var(--ink); font: inherit; appearance: none;
}
.notif + .notif { margin-top: 8px; }
.notif.unread { border-color: #c9e2d1; background: linear-gradient(180deg, #f2fbf5, #fff); }
.notif-icon { width: 33px; height: 33px; border-radius: 10px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); flex: 0 0 auto; }
.notif-icon .ic { width: 18px; height: 18px; }
.notif-icon.warning { background: #fff4dd; color: #b45309; }
.notif-icon.critical { background: #fdeaea; color: var(--danger); }
.notif-main { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 800; margin: 0 0 2px; line-height: 1.3; }
.notif-text { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.45; }
.notif-time { font-size: 11px; color: #68766d; margin-top: 4px; }
.notif-flag { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); position: absolute; right: 10px; top: 10px; }
.notif-detail { display: none; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 11px; color: var(--muted); line-height: 1.5; }
.notif.open .notif-detail { display: block; }
.notif-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ── Segmented / search / chips ────────────────────────────── */
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: #ece9e0; border-radius: 14px; padding: 4px; margin-bottom: 12px; }
.segmented button { border: 0; background: none; padding: 9px; border-radius: 11px; font-size: 12px; font-weight: 800; color: var(--muted); cursor: pointer; }
.segmented button.active { background: #fff; color: var(--green); box-shadow: 0 2px 8px rgba(20, 35, 26, .08); }

.search { position: relative; margin-bottom: 12px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }
.search input {
    width: 100%; padding: 11px 12px 11px 39px; border: 1px solid var(--line);
    border-radius: 13px; background: #fff; font-size: 12.5px; outline: 0;
}
.search input:focus { border-color: var(--green-3); box-shadow: 0 0 0 3px rgba(22, 101, 52, .11); }

.txn-toolbar { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.txn-toolbar input[type="date"] {
    flex: 1 1 auto; min-width: 0; min-height: 38px; padding: 7px 9px;
    border: 1px solid var(--line); border-radius: 11px; background: #fff;
    font-size: 11.5px; outline: 0;
}
.txn-toolbar input[type="date"]:focus { border-color: var(--green-3); box-shadow: 0 0 0 3px rgba(22, 101, 52, .11); }
.txn-toolbar .chip-btn { flex: 0 0 auto; min-height: 38px; padding: 0 10px; display: inline-flex; align-items: center; }
.txn-clear {
    flex: 0 0 auto; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 11px;
    background: #fff; color: var(--muted); display: grid; place-items: center; cursor: pointer;
}
.txn-clear .ic { width: 15px; height: 15px; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip-btn {
    flex: 0 0 auto; border: 1px solid var(--line); background: #fff; color: var(--muted);
    border-radius: 99px; padding: 7px 11px; min-height: 40px; font-size: 11.5px; font-weight: 800; cursor: pointer;
}
.chip-btn.active { background: var(--green); border-color: var(--green); color: #fff; }

.chip {
    display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 99px;
    font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .035em;
    background: #eef2ee; color: #486052; white-space: nowrap;
}
.chip--ok { background: #e6f6ec; color: #166534; }
.chip--warn { background: #fff4db; color: #a16207; }
.chip--danger { background: #fdeaea; color: #b91c1c; }
.chip--info { background: #e7f0fb; color: #1d4ed8; }
.chip--muted { background: #f0eee7; color: #6b7a70; }

/* ── Notes & lists ─────────────────────────────────────────── */
.note {
    display: flex; align-items: center; gap: 11px; background: #fff;
    border: 1px solid var(--line); border-radius: 15px; padding: 12px;
    cursor: pointer; width: 100%; text-align: left;
}
.note + .note { margin-top: 8px; }
.note:active { background: #fbfaf6; }
.note-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); flex: 0 0 auto; }
.note-icon .ic { width: 20px; height: 20px; }
.note-icon.sale { background: #fff4dd; color: #b45309; }
.note-main { flex: 1; min-width: 0; }
.note-no { font-size: 12px; font-weight: 900; letter-spacing: .01em; }
.note-meta { font-size: 10.5px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-right { text-align: right; flex: 0 0 auto; }
.note-amount { font-size: 12px; font-weight: 900; }
.note-status { margin-top: 4px; display: flex; justify-content: flex-end; }

.date-divider {
    display: flex; align-items: center; gap: 9px; margin: 14px 2px 8px;
    color: var(--muted); font-size: 10px; font-weight: 800;
    letter-spacing: .05em; text-transform: uppercase;
}
.date-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }

.list-card { background: #fff; border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 12px; min-height: 44px; border-bottom: 1px solid #f1efe8; font-size: 12px; }
.list-row:last-child { border-bottom: 0; }
.list-row > .ic { color: var(--muted); width: 18px; height: 18px; }
.grow { min-width: 0; overflow-wrap: anywhere; }
.list-row .grow { flex: 1; }
.list-row small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; line-height: 1.35; }
.list-row strong { font-size: 12px; }

/* ── Reports ───────────────────────────────────────────────── */
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.report-tile {
    display: flex; flex-direction: column; gap: 7px; padding: 10px; background: #fff;
    border: 1px solid var(--line); border-radius: 14px; cursor: pointer; width: 100%; text-align: left;
}
.report-tile.disabled { opacity: .45; cursor: not-allowed; }
.report-tile-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.report-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); flex: 0 0 auto; }
.report-icon .ic { width: 17px; height: 17px; }
.report-tile .report-icon { border-radius: 9px; }
.report-tile-top > .ic { width: 15px; height: 15px; color: var(--muted); flex: 0 0 auto; }
.report-tile-title { font-size: 11.5px; font-weight: 800; line-height: 1.3; }
.report-tile-sub { font-size: 9px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .045em; }

.report-summary { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 10px; -webkit-overflow-scrolling: touch; }
.rs-chip { flex: 0 0 auto; min-width: 104px; max-width: 150px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 7px 9px; }
.rs-label { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .045em; line-height: 1.3; }
.rs-value { font-size: 12px; font-weight: 900; margin-top: 2px; overflow-wrap: anywhere; }

.report-list { border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; }
.report-entry + .report-entry { border-top: 1px solid #f1efe8; }
.report-row { display: flex; align-items: center; gap: 10px; padding: 8px 11px; cursor: pointer; }
.report-row:active { background: #f6faf7; }
.rr-main { flex: 1; min-width: 0; }
.rr-title { display: block; font-size: 12px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.rr-meta { display: block; margin-top: 1px; font-size: 10px; color: var(--muted); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-side { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; }
.rr-amount { text-align: right; font-size: 11.5px; font-weight: 900; font-variant-numeric: tabular-nums; }
.rr-amount small { display: block; font-size: 8px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; margin-top: 1px; }
.rr-caret { width: 15px; height: 15px; color: var(--muted); transition: transform .15s; flex: 0 0 auto; }
.report-row.is-open .rr-caret { transform: rotate(90deg); }
.report-row-detail { padding: 8px 11px 9px; background: #fbfaf6; border-top: 1px dashed #e7e2d6; }
.report-row-detail[hidden] { display: none; }
.rrd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; }
.rrd-label { display: block; font-size: 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 800; }
.rrd-value { display: block; font-size: 10.5px; overflow-wrap: anywhere; }
.rrd-open { margin-top: 7px; }
.report-pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; }
.report-pager .small { min-width: 0; text-align: center; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; max-height: 54vh; }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: 10.5px; white-space: nowrap; }
.table-wrap th {
    position: sticky; top: 0; background: #f2f6f3; font-size: 9px; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted); text-align: left; padding: 9px 10px;
    border-bottom: 1px solid var(--line); z-index: 1;
}
.table-wrap td { padding: 9px 10px; border-bottom: 1px solid #f1efe8; }
.table-wrap td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap tbody tr:nth-child(even) { background: #fbfaf6; }
.report-filter-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 8px; margin-bottom: 12px; }
.report-filter-row .field { min-width: 0; margin-bottom: 0; }
.report-filter-row .btn { min-height: 38px; }
.report-export { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line); }

@media (max-width: 600px) {
    .report-filter-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; }
    .report-filter-row input { min-width: 0; padding: 9px 6px; font-size: 11px; }
    .report-filter-row .btn { padding: 9px 8px; white-space: nowrap; }
}

/* ── Forms ─────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; }
.field label { font-size: 10.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.field input, .field select, .field textarea {
    width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 11px;
    background: #fff; font-size: 12.5px; outline: 0; min-height: 42px;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--green-3); box-shadow: 0 0 0 3px rgba(22, 101, 52, .1);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.items-label { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 7px; }
.items-label span { font-size: 10.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) 62px 86px 32px; gap: 6px; margin-bottom: 7px; align-items: center; }
.item-row select, .item-row input {
    min-height: 40px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px;
    font-size: 11.5px; background: #fff; width: 100%; min-width: 0;
}
.item-row [aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(185, 28, 28, .12); }
.item-row .del {
    border: 0; background: #fdeaea; color: var(--danger); border-radius: 9px;
    width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer;
}
.item-row .del .ic { width: 15px; height: 15px; }
.stock-row { display: grid; grid-template-columns: minmax(0, 1fr) 82px 32px; gap: 6px; margin-bottom: 7px; align-items: start; }
.stock-row select, .stock-row input {
    min-height: 40px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px;
    font-size: 11.5px; background: #fff; width: 100%; min-width: 0;
}
.stock-row .del {
    border: 0; background: #fdeaea; color: var(--danger); border-radius: 9px;
    width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer;
}
.stock-row .del .ic { width: 15px; height: 15px; }
.stock-row .stock-hint { grid-column: 1 / span 2; font-size: 9.5px; color: var(--muted); margin-top: -2px; }
.item-head { display: grid; grid-template-columns: minmax(0, 1fr) 62px 86px 32px; gap: 6px; font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.fin-summary { background: linear-gradient(150deg, #f0f7f2, #fff); border: 1px dashed #bcd6c4; border-radius: 14px; padding: 12px; margin: 10px 0; }
.fin-row { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; padding: 3px 0; color: var(--muted); }
.fin-row strong { color: var(--ink); }
.fin-row.total { font-size: 13.5px; font-weight: 900; color: var(--ink); border-top: 1px solid #d7e7db; margin-top: 6px; padding-top: 8px; }
.btn {
    width: 100%; border: 0; border-radius: 13px; padding: 13px; font-weight: 900;
    font-size: 13px; background: var(--green); color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn--danger { background: #b91c1c; }
.btn--sm { padding: 9px 12px; font-size: 11.5px; width: auto; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row .btn { flex: 1 1 0; width: 0; min-width: 0; overflow-wrap: anywhere; }

/* ── Profile / settings ────────────────────────────────────── */
.profile-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; gap: 12px; align-items: center; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(145deg, #14532d, #1f7a43); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 16px; flex: 0 0 auto; }
.profile-name { font-size: 13.5px; font-weight: 900; }
.profile-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; }
.pill-note { background: #fff8e6; border: 1px solid #f0dfae; color: #7a5a06; border-radius: 12px; padding: 10px 12px; font-size: 11px; line-height: 1.5; }
.pill-note.info { background: #eef5ff; border-color: #c8dcf5; color: #1e4b82; }

/* ── FAB ───────────────────────────────────────────────────── */
.fab {
    position: absolute; right: 16px; bottom: calc(78px + env(safe-area-inset-bottom));
    width: 54px; height: 54px; border-radius: 18px; border: 0;
    background: var(--green); color: #fff; display: grid; place-items: center;
    box-shadow: 0 10px 26px rgba(20, 83, 45, .38); z-index: 7; cursor: pointer;
}
.fab .ic { width: 24px; height: 24px; }
.fab:active { transform: scale(.95); }

/* ── Sheet ─────────────────────────────────────────────────── */
.sheet { position: absolute; inset: 0; z-index: 60; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(9, 23, 15, .48); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.sheet-panel {
    position: relative; background: var(--cream); border-radius: 24px 24px 0 0;
    max-height: 94%; display: flex; flex-direction: column;
    box-shadow: 0 -20px 50px rgba(9, 23, 15, .3);
    animation: sheetUp .22s ease both;
}
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); background: #fff; border-radius: 24px 24px 0 0; flex: 0 0 auto; }
.sheet-title { font-size: 13.5px; font-weight: 900; flex: 1; margin: 0; }
.sheet-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }
.sheet-close { width: 36px; height: 36px; border-radius: 11px; border: 0; background: #f1efe8; color: var(--ink); display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; }
.sheet-close .ic { width: 17px; height: 17px; }
.sheet-back { width: 36px; height: 36px; border-radius: 11px; border: 0; background: #fff; color: var(--ink); display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; }
.sheet-back .ic { width: 17px; height: 17px; transform: rotate(180deg); }
.sheet-close, .sheet-back { width: 44px; height: 44px; }
.note-actions { display: grid; gap: 8px; margin: 4px 0 10px; }
.note-doc-actions { margin: 4px 0 2px; }
.note-doc-actions .btn { gap: 6px; padding: 10px 8px; font-size: 11.5px; white-space: nowrap; }
.note-doc-actions .ic { width: 15px; height: 15px; }

/* ── Riwayat pembayaran & bukti ────────────────────────────── */
.pay-stack { display: grid; gap: 8px; }
.pay-card { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 10px 12px; display: grid; gap: 8px; }
.pay-card .row-between { align-items: flex-start; }
.proof-area { display: grid; gap: 7px; border-top: 1px dashed var(--line); padding-top: 8px; }
.proof-list { display: flex; flex-wrap: wrap; gap: 6px; }
.proof-chip {
    display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
    padding: 6px 9px; border: 1px solid var(--line); background: #f7f5ef;
    border-radius: 9px; font-size: 10.5px; color: var(--ink); cursor: pointer;
}
.proof-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.proof-chip .ic { width: 13px; height: 13px; color: var(--muted); flex: 0 0 auto; }
.proof-actions { display: flex; gap: 6px; }
.proof-actions .btn { flex: 0 0 auto; }
.proof-pick-row { display: flex; gap: 6px; }
.proof-pick-row .btn { flex: 0 0 auto; cursor: pointer; }
.proof-pick-row .ic, .proof-actions .ic { width: 17px; height: 17px; }
.proof-preview { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: block; }
.proof-frame { width: 100%; height: min(64vh, 600px); border: 1px solid var(--line); border-radius: 12px; background: #fff; display: block; }

/* ── Pratinjau PDF in-app ──────────────────────────────────── */
.pdf-preview {
    background: #f1efe8; border: 1px solid var(--line); border-radius: 14px;
    overflow: hidden; display: flex; flex-direction: column; min-height: 320px;
    align-items: stretch; justify-content: center;
}
.pdf-preview iframe { width: 100%; height: min(64vh, 600px); border: 0; background: #fff; display: block; }
.pdf-hint { text-align: center; padding: 8px 10px; background: #f1efe8; }

/* ── Struk thermal 58 mm ───────────────────────────────────── */
.thermal-preview {
    width: 58mm; max-width: 100%; margin: 0 auto; padding: 3mm 2.5mm;
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
    font: 10px/1.35 "Courier New", Consolas, monospace; color: #000;
}
.thermal-preview .center { text-align: center; }
.thermal-preview h1 { font-size: 13px; margin: 0 0 1mm; letter-spacing: .5px; }
.thermal-preview .type { font-size: 10px; font-weight: bold; }
.thermal-preview .muted { font-size: 9px; color: #444; }
.thermal-preview .sep { border-top: 1px dashed #000; margin: 2mm 0; }
.thermal-preview .row { display: flex; justify-content: space-between; gap: 2mm; }
.thermal-preview .row span:last-child { text-align: right; white-space: nowrap; }
.thermal-preview .item { margin-bottom: 1.4mm; }
.thermal-preview .item-name { font-weight: bold; }
.thermal-preview .bold { font-weight: bold; }
.thermal-preview .totals .row { margin: .6mm 0; }
.thermal-preview .footer { text-align: center; margin-top: 1mm; }
#thermalPrintArea { display: none; }

@media print {
    @page { size: 58mm auto; margin: 0; }
    body.printing-thermal > *:not(#thermalPrintArea) { display: none !important; }
    body.printing-thermal #thermalPrintArea { display: block; }
    #thermalPrintArea .thermal-preview {
        width: 58mm; margin: 0; padding: 3mm 2.5mm;
        border: 0; border-radius: 0;
    }
}
.retur-row { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.retur-row input { width: 82px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 9px; padding: 8px; font-size: 12px; text-align: right; }
.sheet-body { padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
@keyframes sheetUp { from { transform: translateY(34px); opacity: .65; } to { transform: none; opacity: 1; } }

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
    position: absolute; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom));
    transform: translate(-50%, 14px); background: #14231a; color: #fff;
    padding: 11px 14px; border-radius: 12px; font-size: 11.5px; font-weight: 700;
    max-width: calc(100% - 32px); box-shadow: 0 12px 28px rgba(0, 0, 0, .3);
    opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
    z-index: 90; display: flex; gap: 8px; align-items: center; line-height: 1.4;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .ic { width: 17px; height: 17px; }
.toast--error { background: #7f1d1d; }
.toast--info { background: #1e3a5f; }
.toast--success { background: #14532d; }

/* ── Empty / loading ──────────────────────────────────────── */
.empty { text-align: center; padding: 28px 16px; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.empty .ic { width: 36px; height: 36px; margin: 0 auto 9px; opacity: .38; display: block; }
.skeleton {
    height: 78px; border-radius: 15px; margin-bottom: 10px;
    background: linear-gradient(90deg, #eeece4 25%, #f8f6f0 50%, #eeece4 75%);
    background-size: 200% 100%; animation: shimmer 1.2s infinite;
}
.skeleton.short { height: 52px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading-inline { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px; color: var(--muted); font-size: 11.5px; }
.spinner { width: 24px; height: 24px; border: 3px solid #d9e3dc; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utility ───────────────────────────────────────────────── */
.muted { color: var(--muted); }
.small { font-size: 11.5px; line-height: 1.45; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; }
}
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-0 { margin-bottom: 0; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
