/* =========================================================
 * assets/css/mobile.css — Pendamping mobile-first untuk Kasir POS.
 *
 * Dimuat SETELAH assets/app.css (Tailwind hasil build lokal).
 * Berisi: shell aplikasi, sidebar responsif, top bar 56px,
 * bottom navigation + safe-area, bottom sheet, toast, layar auth,
 * dan aturan cetak thermal. Tidak menghapus Bootstrap/Tailwind.
 * ========================================================= */

:root {
    --mf-orange: #ea580c;
    --mf-orange-dark: #c2410c;
    --mf-orange-soft: #fff7ed;
    --mf-stone-50: #fafaf9;
    --mf-stone-100: #f5f5f4;
    --mf-stone-200: #e7e5e4;
    --mf-stone-300: #d6d3d1;
    --mf-stone-400: #a8a29e;
    --mf-stone-500: #78716c;
    --mf-stone-600: #57534e;
    --mf-stone-700: #44403c;
    --mf-stone-800: #292524;
    --mf-stone-900: #1c1917;
    --mf-safe-top: env(safe-area-inset-top, 0px);
    --mf-safe-bottom: env(safe-area-inset-bottom, 0px);
    --mf-safe-left: env(safe-area-inset-left, 0px);
    --mf-safe-right: env(safe-area-inset-right, 0px);
    --mf-bottom-nav-height: 64px;
    --mf-topbar-height: 56px;
}

/* ---------- Dasar ---------- */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.app-body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    background: var(--mf-stone-50);
    color: var(--mf-stone-900);
    font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body.no-scroll {
    overflow: hidden;
}

.app-shell {
    display: flex;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--mf-stone-50);
}

.app-main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* ---------- Sidebar desktop (disembunyikan di HP) ---------- */
.app-sidebar {
    display: none;
    flex-direction: column;
    flex-shrink: 0;
    width: 256px;
    background: var(--mf-stone-900);
    color: var(--mf-stone-200);
    border-right: 1px solid var(--mf-stone-800);
    z-index: 30;
}

.app-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--mf-topbar-height);
    padding: 0 20px;
    border-bottom: 1px solid var(--mf-stone-800);
}

.app-sidebar__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--mf-orange);
    color: #fff;
    font-size: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.app-sidebar__brand h1 {
    margin: 0;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.app-sidebar__brand p {
    margin: 0;
    color: #fb923c;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    overscroll-behavior: contain;
}

.app-sidebar__group {
    margin-bottom: 16px;
}

.app-sidebar__group-title {
    padding: 0 12px 8px;
    color: var(--mf-stone-400);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.app-sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 12px;
    color: var(--mf-stone-400);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.app-sidebar__link i {
    width: 18px;
    font-size: 14px;
    text-align: center;
}

.app-sidebar__link:hover {
    background: var(--mf-stone-800);
    color: #f5f5f4;
}

.app-sidebar__link.is-active {
    background: var(--mf-orange);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.app-sidebar__link.is-active i {
    color: #fff;
}

.app-sidebar__user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid var(--mf-stone-800);
    background: rgba(12, 10, 9, 0.4);
}

.app-sidebar__user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.app-sidebar__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: 1px solid var(--mf-stone-700);
    border-radius: 999px;
    background: var(--mf-stone-800);
    color: var(--mf-stone-200);
    font-size: 12px;
}

.app-sidebar__user-name {
    margin: 0;
    color: var(--mf-stone-200);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar__user-role {
    margin: 0;
    color: var(--mf-stone-400);
    font-size: 10px;
    text-transform: capitalize;
}

.app-sidebar__logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--mf-stone-400);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.app-sidebar__logout:hover {
    background: rgba(244, 63, 94, 0.12);
    color: #fb7185;
}

/* ---------- Top bar 56px ---------- */
.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: calc(var(--mf-topbar-height) + var(--mf-safe-top));
    padding: var(--mf-safe-top) calc(16px + var(--mf-safe-right)) 0 calc(16px + var(--mf-safe-left));
    background: #fff;
    border-bottom: 1px solid var(--mf-stone-200);
    box-shadow: 0 1px 2px rgba(28, 25, 23, 0.04);
    flex-shrink: 0;
    z-index: 20;
}

.app-topbar__left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.app-topbar__title {
    min-width: 0;
}

.app-topbar__page {
    margin: 0;
    color: var(--mf-stone-900);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-topbar__store {
    margin: 0;
    color: var(--mf-stone-500);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-topbar__right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.app-topbar__date {
    display: none;
    color: var(--mf-stone-500);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--mf-stone-500);
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
    background: var(--mf-stone-100);
    color: var(--mf-stone-900);
}

.icon-btn:active {
    background: var(--mf-stone-200);
}

/* Badge status laci di top bar */
.laci-badge {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: filter 0.15s ease;
}

.laci-badge:hover {
    filter: brightness(0.97);
}

.laci-badge__dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
}

/* Perluas area sentuh badge laci tanpa mengubah ukuran visual pill. */
.laci-badge::after {
    content: "";
    position: absolute;
    inset: -8px -6px;
    border-radius: 999px;
}

.laci-badge.is-buka {
    border-color: #a7f3d0;
    background: #ecfdf5;
    color: #047857;
}

.laci-badge.is-tutup {
    border-color: #fde68a;
    background: #fffbeb;
    color: #b45309;
}

/* ---------- Area konten ---------- */
.app-content {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 16px calc(16px + var(--mf-safe-right)) calc(var(--mf-bottom-nav-height) + var(--mf-safe-bottom) + 20px) calc(16px + var(--mf-safe-left));
    background: var(--mf-stone-50);
}

/* ---------- Bottom navigation (HP) ---------- */
.bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    height: calc(var(--mf-bottom-nav-height) + var(--mf-safe-bottom));
    padding: 0 calc(4px + var(--mf-safe-right)) var(--mf-safe-bottom) calc(4px + var(--mf-safe-left));
    border-top: 1px solid var(--mf-stone-200);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 24px rgba(28, 25, 23, 0.07);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
}

.bottom-nav__item {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 48px;
    padding: 4px 2px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--mf-stone-500);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.bottom-nav__item i {
    font-size: 19px;
    line-height: 1;
}

.bottom-nav__item span {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bottom-nav__item.is-active {
    color: var(--mf-orange-dark);
}

.bottom-nav__item.is-active::before {
    content: "";
    position: absolute;
    top: 5px;
    width: 28px;
    height: 4px;
    border-radius: 999px;
    background: var(--mf-orange);
}

.bottom-nav__item:active {
    background: var(--mf-stone-100);
}

/* ---------- Bottom sheet ---------- */
.sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(12, 10, 9, 0.5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.sheet-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sheet {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    max-height: 88dvh;
    overflow: hidden;
    padding-bottom: var(--mf-safe-bottom);
    border-radius: 20px 20px 0 0;
    background: #fff;
    box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.25);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet-overlay.is-open .sheet {
    transform: translateY(0);
}

.sheet__handle {
    width: 44px;
    height: 5px;
    margin: 10px auto 4px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--mf-stone-300);
}

.sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 20px 12px;
    border-bottom: 1px solid var(--mf-stone-200);
    flex-shrink: 0;
}

.sheet__title {
    margin: 0;
    color: var(--mf-stone-900);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.sheet__body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 12px 20px 20px;
}

.sheet__group-title {
    margin: 16px 0 6px;
    color: var(--mf-stone-500);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sheet__group-title:first-child {
    margin-top: 4px;
}

.sheet__link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--mf-stone-700);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sheet__link i {
    width: 20px;
    color: var(--mf-stone-500);
    font-size: 15px;
    text-align: center;
}

.sheet__link:hover,
.sheet__link:focus-visible {
    background: var(--mf-stone-100);
    color: var(--mf-stone-900);
}

.sheet__link.is-active {
    background: var(--mf-orange-soft);
    color: var(--mf-orange-dark);
    font-weight: 800;
}

.sheet__link.is-active i {
    color: var(--mf-orange);
}

.sheet__divider {
    height: 1px;
    margin: 12px 0;
    background: var(--mf-stone-200);
}

.sheet__logout {
    color: #be123c;
}

.sheet__logout i {
    color: #be123c;
}

/* ---------- Toast ---------- */
.toast-container {
    position: fixed;
    bottom: calc(var(--mf-bottom-nav-height) + var(--mf-safe-bottom) + 12px);
    left: 50%;
    z-index: 70;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: calc(100% - 32px);
    max-width: 420px;
    pointer-events: none;
    transform: translateX(-50%);
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--mf-stone-900);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast i {
    margin-top: 2px;
    flex-shrink: 0;
}

.toast--sukses {
    background: #047857;
}

.toast--peringatan {
    background: #b45309;
}

.toast--gagal {
    background: #be123c;
}

.toast--info {
    background: var(--mf-stone-900);
}

/* Toast bawaan layar POS (di atas bottom navigation) */
.pos-toast {
    position: fixed;
    bottom: calc(var(--mf-bottom-nav-height) + var(--mf-safe-bottom) + 12px);
    left: 50%;
    z-index: 60;
    max-width: calc(100% - 32px);
    padding: 10px 16px;
    border-radius: 12px;
    background: var(--mf-stone-900);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transform: translateX(-50%);
}

.pos-toast--error {
    background: #e11d48;
}

@media (min-width: 768px) {
    .pos-toast {
        bottom: 20px;
    }
}

/* ---------- Layar auth (login & setup) ---------- */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: calc(16px + var(--mf-safe-top)) calc(16px + var(--mf-safe-right)) calc(16px + var(--mf-safe-bottom)) calc(16px + var(--mf-safe-left));
    background: radial-gradient(circle at 20% 0%, #fff7ed 0, #fafaf9 45%, #f5f5f4 100%);
}

.auth-shell {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    width: 100%;
    max-width: 960px;
}

.auth-brand {
    display: none;
}

.auth-brand h2 {
    margin: 20px 0 10px;
    color: #fff;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.auth-brand p {
    max-width: 340px;
    margin: 0;
    color: #d6d3d1;
    font-size: 14px;
    line-height: 1.6;
}

.auth-brand__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--mf-orange);
    color: #fff;
    font-size: 24px;
    box-shadow: 0 12px 24px rgba(234, 88, 12, 0.28);
}

.auth-brand__list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
}

.auth-brand__list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: #e7e5e4;
    font-size: 13px;
    line-height: 1.5;
}

.auth-brand__list i {
    width: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    color: #fb923c;
    text-align: center;
}

.auth-brand__footer {
    margin: 28px 0 0;
    color: #a8a29e;
    font-size: 11px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 24px;
    border: 1px solid var(--mf-stone-200);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 20px 50px rgba(28, 25, 23, 0.12);
}

.auth-card__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    text-align: center;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--mf-orange);
    color: #fff;
    font-size: 24px;
    box-shadow: 0 8px 20px rgba(234, 88, 12, 0.25);
}

.auth-card__brand h1 {
    margin: 12px 0 4px;
    color: var(--mf-stone-900);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.auth-card__brand p {
    margin: 0;
    color: var(--mf-stone-500);
    font-size: 13px;
}

.auth-title {
    display: none;
    margin: 0 0 4px;
    color: var(--mf-stone-900);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.auth-sub {
    display: none;
    margin: 0 0 20px;
    color: var(--mf-stone-500);
    font-size: 13px;
    line-height: 1.5;
}

.auth-error {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #fecaca;
    border-radius: 12px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-label {
    color: var(--mf-stone-700);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.auth-input {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--mf-stone-300);
    border-radius: 12px;
    background: var(--mf-stone-50);
    color: var(--mf-stone-900);
    font-size: 16px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.auth-input:focus {
    border-color: var(--mf-orange);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    border: 0;
    border-radius: 14px;
    background: var(--mf-orange);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(234, 88, 12, 0.22);
    transition: background-color 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
}

.auth-btn:hover {
    background: var(--mf-orange-dark);
}

.auth-btn:active {
    transform: scale(0.99);
}

.auth-btn:disabled {
    cursor: wait;
    opacity: 0.7;
}

.auth-hint {
    margin: 20px 0 0;
    color: var(--mf-stone-500);
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

.auth-hint strong {
    color: var(--mf-stone-600);
}

/* ---------- Tablet & desktop ---------- */
@media (min-width: 768px) {
    .app-sidebar {
        display: flex;
    }

    .app-topbar {
        padding-right: 24px;
        padding-left: 24px;
    }

    .app-topbar__date {
        display: inline;
    }

    .app-content {
        padding: 24px 32px 32px;
    }

    .bottom-nav {
        display: none;
    }

    .toast-container {
        bottom: 24px;
    }

    .auth-shell {
        overflow: hidden;
        border: 1px solid var(--mf-stone-200);
        border-radius: 28px;
        background: #fff;
        box-shadow: 0 24px 60px rgba(28, 25, 23, 0.16);
        grid-template-columns: 1fr 460px;
    }

    .auth-brand {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 40px;
        background: linear-gradient(135deg, #1c1917 0%, #292524 55%, #431407 100%);
        color: #fff;
    }

    .auth-card {
        max-width: none;
        margin: 0;
        padding: 40px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .auth-card__brand {
        display: none;
    }

    .auth-title,
    .auth-sub {
        display: block;
    }
}

/* ---------- Layar sangat kecil (≤360px) ---------- */
@media (max-width: 360px) {
    .app-topbar {
        padding-right: 12px;
        padding-left: 12px;
    }

    .app-content {
        padding-right: 12px;
        padding-left: 12px;
    }

    .bottom-nav__item {
        font-size: 10px;
    }

    .bottom-nav__item i {
        font-size: 18px;
    }

    .auth-card {
        padding: 20px;
    }
}

/* ---------- Cetak thermal / kertas ---------- */
@media print {
    .app-sidebar,
    .app-topbar,
    .bottom-nav,
    .sheet-overlay,
    .toast-container {
        display: none !important;
    }

    .app-shell {
        display: block;
        height: auto;
        overflow: visible;
    }

    .app-main {
        display: block;
        overflow: visible;
    }

    .app-content {
        overflow: visible;
        padding: 0;
    }

    body.app-body {
        background: #fff;
    }
}

/* ---------- Kurangi animasi bila diminta pengguna ---------- */
@media (prefers-reduced-motion: reduce) {
    .sheet-overlay,
    .sheet,
    .toast,
    .bottom-nav__item,
    .app-sidebar__link,
    .auth-btn,
    .icon-btn {
        transition: none !important;
    }
}
