/* Sistem PKU - base styles, mobile-first */

:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-bg: #f3f4f6;
    --color-surface: #ffffff;
    --color-text: #1f2937;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-error-bg: #fee2e2;
    --color-error-text: #b91c1c;
    --radius: 10px;
    --sidebar-width: 240px;
    --sidebar-width-collapsed: 76px;
    --ease: cubic-bezier(.4, 0, .2, 1);
    --transition-fast: .18s var(--ease);
    --transition-med: .32s var(--ease);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
}

a {
    color: inherit;
    text-decoration: none;
}

/* ---------- Login page ---------- */

.login-page {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
    overflow: hidden;
    background: linear-gradient(160deg, #0f1117 0%, #1a1d27 45%, #12141c 100%);
}

/* Bola gradient mengambang pelan-pelan di belakang kartu login */
.login-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .55;
    pointer-events: none;
    z-index: 0;
}

.login-orb-1 {
    width: 360px;
    height: 360px;
    top: -80px;
    left: -100px;
    background: radial-gradient(circle, rgba(37, 99, 235, .55), transparent 70%);
    animation: orb-float-1 14s ease-in-out infinite;
}

.login-orb-2 {
    width: 320px;
    height: 320px;
    bottom: -100px;
    right: -80px;
    background: radial-gradient(circle, rgba(244, 63, 94, .4), transparent 70%);
    animation: orb-float-2 17s ease-in-out infinite;
}

.login-orb-3 {
    width: 240px;
    height: 240px;
    top: 40%;
    right: 15%;
    background: radial-gradient(circle, rgba(168, 85, 247, .3), transparent 70%);
    animation: orb-float-3 20s ease-in-out infinite;
}

@keyframes orb-float-1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, 50px) scale(1.1); }
}

@keyframes orb-float-2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-50px, -30px) scale(1.15); }
}

@keyframes orb-float-3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-30px, 40px) scale(.9); }
}

.login-box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 360px;
    background: rgba(30, 33, 43, .75);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 32px 24px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 25px 60px -20px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .02);
    animation: login-box-in .6s var(--ease) both;
}

@keyframes login-box-in {
    from {
        opacity: 0;
        transform: translateY(18px) scale(.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.login-logo-plate {
    background: #fff;
    padding: 12px 18px;
    border-radius: 14px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5);
    animation: logo-pop .6s var(--ease) both;
    animation-delay: .1s;
}

@keyframes logo-pop {
    from {
        opacity: 0;
        transform: scale(.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.login-logo img {
    display: block;
    width: 100%;
    max-width: 160px;
    height: auto;
    object-fit: contain;
}

.login-box .subtitle {
    margin: 0 0 20px;
    text-align: center;
    color: #9095a5;
    font-size: 14px;
}

.login-box form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-box label {
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
    color: #cbd0dc;
}

.login-box input {
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 8px;
    font-size: 16px; /* cegah zoom otomatis di iOS */
    background: rgba(255, 255, 255, .04);
    color: #f1f2f6;
    transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.login-box input::placeholder {
    color: #6b7180;
}

.login-box input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, .07);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .25);
}

.login-box button {
    margin-top: 20px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--color-primary), #4f46e5);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
    box-shadow: 0 10px 24px -8px rgba(37, 99, 235, .55);
}

.login-box button:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 14px 28px -8px rgba(37, 99, 235, .65);
}

.login-box .alert-error {
    background: rgba(239, 68, 68, .12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, .3);
}

.login-credit {
    position: relative;
    z-index: 1;
    margin-top: 24px;
    text-align: center;
    font-size: 12px;
    color: #6b7180;
    animation: login-box-in .7s var(--ease) both;
    animation-delay: .15s;
}

.login-credit a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #9095a5;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.login-credit a:hover {
    color: #fff;
}

.login-credit svg {
    flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
    .login-orb,
    .login-box,
    .login-logo-plate,
    .login-credit {
        animation: none !important;
    }
}

.alert {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
}

.alert-error {
    background: var(--color-error-bg);
    color: var(--color-error-text);
}

.alert-success {
    background: #dcfce7;
    color: #15803d;
}

/* ---------- App shell (dashboard pages) ---------- */

.app-shell {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}

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

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 16px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.topbar-title {
    font-weight: 700;
    font-size: 16px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.topbar-user a {
    color: var(--color-primary);
    font-weight: 600;
}

.content {
    padding: 20px 16px 40px;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
    animation: content-fade-in .4s var(--ease) both;
}

@keyframes content-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content h2 {
    margin-top: 0;
}

.placeholder-note {
    color: var(--color-muted);
    font-size: 14px;
    font-style: italic;
}

.section-spacer {
    margin-top: 28px;
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 20px;
}

.menu-card {
    display: block;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.menu-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(37, 99, 235, .12);
    border-color: var(--color-primary);
}

.menu-card h3 {
    margin: 0 0 6px;
    font-size: 16px;
    color: var(--color-primary);
}

.menu-card p {
    margin: 0;
    font-size: 13px;
    color: var(--color-muted);
}

.menu-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #eef2ff;
    color: var(--color-primary);
    margin-bottom: 10px;
}

/* =========================================================
   Sidebar (gaya app desktop/tablet)
   Default: disembunyikan (mode HP pakai bottom-nav).
   Dimunculkan lewat media query "MODE TABLET/LAPTOP" di bawah.
   ========================================================= */
.sidebar {
    display: none;
    flex-direction: column;
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    overflow: hidden;
    transition: width var(--transition-med), flex-basis var(--transition-med);
    animation: sidebar-slide-in .45s var(--ease) both;
}

.sidebar.no-anim,
.sidebar.no-anim * {
    animation: none !important;
    transition: none !important;
}

.sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
    flex-basis: var(--sidebar-width-collapsed);
}

@keyframes sidebar-slide-in {
    from {
        opacity: 0;
        transform: translateX(-14px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    white-space: nowrap;
}

.sidebar-brand-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.sidebar-brand-text {
    font-weight: 700;
    font-size: 15px;
    transition: opacity var(--transition-fast);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-muted);
    white-space: nowrap;
    transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.sidebar-nav-item:hover {
    background: #eef2ff;
    color: var(--color-primary);
    transform: translateX(3px);
}

.sidebar-nav-item.active {
    background: var(--color-primary);
    color: #fff;
}

.sidebar-nav-item.active:hover {
    transform: none;
}

.sidebar-nav-icon {
    display: flex;
    flex-shrink: 0;
}

.sidebar-nav-label {
    transition: opacity var(--transition-fast);
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 12px;
    border-top: 1px solid var(--color-border);
}

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

.sidebar-user-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #eef2ff;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.sidebar-user-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    font-size: 12px;
    line-height: 1.3;
    transition: opacity var(--transition-fast);
}

.sidebar-user-text strong {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-text small {
    color: var(--color-muted);
}

.sidebar-logout {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--color-muted);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.sidebar-logout:hover {
    background: var(--color-error-bg);
    color: var(--color-error-text);
}

.sidebar-toggle {
    position: absolute;
    top: 20px;
    right: -12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
    transition: transform var(--transition-med), color var(--transition-fast), background-color var(--transition-fast);
}

.sidebar-toggle:hover {
    color: var(--color-primary);
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
    transition: transform var(--transition-med);
}

.sidebar-toggle svg {
    transition: transform var(--transition-med);
}

.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .sidebar-nav-item,
.sidebar.collapsed .sidebar-footer {
    justify-content: center;
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-nav-label,
.sidebar.collapsed .sidebar-user-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-user {
    gap: 0;
}

/* Karena topbar sudah diwakili sidebar (brand+keluar), sembunyikan
   elemen yang jadi duplikat di mode tablet/desktop maupun HP. */
.topbar-user a {
    display: none;
}

/* =========================================================
   Bottom navigation (gaya app mobile)
   Default: disembunyikan. Hanya dimunculkan di layar HP
   lewat media query "Mode HP" di bawah.
   ========================================================= */
.bottom-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-inner {
    display: flex;
    justify-content: space-around;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    min-height: 52px;
    font-size: 11px;
    color: var(--color-muted);
}

.bottom-nav-item.active {
    color: var(--color-primary);
}

/* =========================================================
   MODE TABLET (>= 600px): sidebar muncul dengan animasi slide-in,
   grid menu 2 kolom, judul "Sistem PKU" di topbar disembunyikan
   karena sudah diwakili brand sidebar.
   ========================================================= */
@media (min-width: 600px) {
    .sidebar {
        display: flex;
    }

    .topbar-title {
        display: none;
    }

    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================================
   MODE LAPTOP/DESKTOP (>= 1024px): sidebar lebih lega, grid
   menu 3 kolom.
   ========================================================= */
@media (min-width: 1024px) {
    .menu-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .content {
        padding-top: 32px;
    }
}

/* =========================================================
   MODE HP (< 600px): tampilan ala aplikasi mobile.
   Bottom nav muncul, sidebar tetap disembunyikan, konten diberi
   ruang bawah agar tidak ketutup bottom nav.
   ========================================================= */
@media (max-width: 599.98px) {
    .bottom-nav {
        display: block;
    }

    .content {
        padding-bottom: 88px;
    }

    .menu-card {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px;
    }

    .menu-card-icon {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .menu-card-text h3 {
        margin: 0 0 2px;
    }

    .menu-card-text p {
        margin: 0;
    }
}

/* =========================================================
   Halaman data (daftar & form) - dipakai di modul Inventaris
   dan modul lain ke depannya.
   ========================================================= */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.page-head h2 {
    margin: 0 0 4px;
}

.page-head p {
    margin: 0;
    color: var(--color-muted);
    font-size: 14px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

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

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-secondary {
    background: #eef2ff;
    color: var(--color-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--color-muted);
    border-color: var(--color-border);
}

.btn-ghost:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-small {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
    background: #eef2ff;
    color: var(--color-primary);
}

.stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 18px;
    min-width: 130px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
}

.stat-label {
    font-size: 12px;
    color: var(--color-muted);
}

.stat-card-warn {
    border-color: #f59e0b;
    background: #fffbeb;
}

.stat-card-warn .stat-value {
    color: #b45309;
}

.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-bar input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
}

.table-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 640px;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.data-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-muted);
    background: var(--color-bg);
}

.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tr.row-warn {
    background: #fffbeb;
}

.cell-sub {
    font-size: 11px;
    color: var(--color-muted);
    margin-top: 2px;
}

.cell-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
}

.badge-warn {
    background: #fef3c7;
    color: #b45309;
}

.form-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    max-width: 640px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-group-checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.field-hint {
    font-size: 12px;
    color: var(--color-muted);
}

.form-static {
    font-size: 13px;
    color: var(--color-muted);
    margin-bottom: 16px;
}

.form-static a {
    color: var(--color-primary);
    font-weight: 600;
}

@media (min-width: 600px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

.form-row-3 {
    grid-template-columns: 1fr;
}

@media (min-width: 900px) {
    .form-row-3 {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.form-section-label {
    font-size: 13px;
    color: var(--color-muted);
    margin: 4px 0 12px;
}

.badge-success {
    background: #dcfce7;
    color: #15803d;
}

.badge-muted {
    background: #f1f5f9;
    color: var(--color-muted);
}

.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
}

/* =========================================================
   Halaman Kasir / POS
   ========================================================= */
.content-pos {
    max-width: 1100px;
}

.pos-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: start;
}

@media (min-width: 900px) {
    .pos-layout {
        grid-template-columns: 1fr 320px;
    }
}

.pos-scan {
    position: relative;
    margin-bottom: 16px;
}

.pos-scan-row {
    display: flex;
    gap: 8px;
}

.pos-scan input {
    flex: 1;
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid var(--color-primary);
    border-radius: 10px;
}

.pos-scan-camera-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .pos-scan-camera-label {
        display: none;
    }
}

/* =========================================================
   Modal scan kamera (barcode & QR code lewat kamera HP)
   ========================================================= */
.scanner-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .7);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.scanner-overlay.active {
    display: flex;
}

.scanner-box {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    animation: login-box-in .3s var(--ease) both;
}

.scanner-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    font-weight: 700;
    font-size: 14px;
    border-bottom: 1px solid var(--color-border);
}

.scanner-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: var(--color-muted);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.scanner-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

#qrReader {
    width: 100%;
    background: #000;
}

.scanner-hint {
    margin: 0;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--color-muted);
    text-align: center;
}

.scan-results {
    position: relative;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.scan-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.scan-result-item:hover {
    border-color: var(--color-primary);
    background: #eef2ff;
}

.scan-result-item span {
    color: var(--color-muted);
    font-size: 12px;
}

.scan-result-empty {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--color-muted);
}

.cart-price-input {
    width: 100px;
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 13px;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 4px;
}

.qty-input {
    width: 46px;
    padding: 6px 4px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    text-align: center;
    font-size: 13px;
}

.pos-summary .form-card {
    max-width: none;
    position: sticky;
    top: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    padding: 6px 0;
    color: var(--color-muted);
}

.summary-row-total {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    border-top: 1px dashed var(--color-border);
    border-bottom: 1px dashed var(--color-border);
    margin: 10px 0;
    padding: 10px 0;
}

.voucher-input-row {
    display: flex;
    gap: 6px;
}

.voucher-input-row input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.field-hint-error {
    color: var(--color-error-text);
}

/* Tanda hijau saat barang berhasil discan/ditemukan */
.pos-scan input.scan-flash-success {
    border-color: #16a34a !important;
    background: #f0fdf4;
}

.scan-success-toast {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #15803d;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    animation: scan-success-pulse .5s var(--ease);
}

@keyframes scan-success-pulse {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scanner-box.scan-flash-success {
    animation: scanner-flash-success .6s ease-out;
}

@keyframes scanner-flash-success {
    0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .65); }
    100% { box-shadow: 0 0 0 18px rgba(22, 163, 74, 0); }
}

.scanner-hint.success {
    color: #15803d;
    font-weight: 700;
}

/* Toggle jenis diskon manual: Rupiah / Persen */
.discount-input-row {
    display: flex;
    gap: 6px;
}

.discount-input-row input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.discount-type-switch {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    background: var(--color-bg);
    padding: 3px;
    border-radius: 8px;
}

/* Kartu keranjang ala aplikasi mobile (< 600px): tabel diubah jadi
   daftar kartu bertumpuk supaya tidak perlu geser ke samping. */
@media (max-width: 599.98px) {
    .cart-table-wrap {
        background: transparent;
        border: none;
        overflow: visible;
    }

    #cartTable {
        min-width: 0;
        width: 100%;
        font-size: 13px;
    }

    #cartTable thead {
        display: none;
    }

    #cartTable,
    #cartTable tbody,
    #cartTable tr,
    #cartTable td {
        display: block;
        width: 100%;
    }

    #cartTable tbody tr {
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius);
        margin-bottom: 10px;
        padding: 12px 14px;
    }

    #cartTable tbody tr#cartEmptyRow {
        background: transparent;
        border: none;
        padding: 0;
    }

    #cartTable td {
        border-bottom: none;
        padding: 6px 0;
    }

    #cartTable td.cart-name-cell {
        padding-top: 0;
        font-size: 14px;
    }

    #cartTable td[data-label] {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    #cartTable td[data-label]::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .03em;
        color: var(--color-muted);
        flex-shrink: 0;
    }

    #cartTable td[data-label] select,
    #cartTable td[data-label] .cart-price-input {
        max-width: 150px;
    }

    #cartTable .qty-control {
        justify-content: flex-end;
    }

    #cartTable td.cart-remove-cell {
        display: flex;
        justify-content: flex-end;
        padding-top: 10px;
        margin-top: 4px;
        border-top: 1px dashed var(--color-border);
    }

    #cartTable td.cart-remove-cell .btn {
        width: 100%;
        justify-content: center;
    }
}

/* =========================================================
   Resi (struk) - halaman bersih siap print
   ========================================================= */
.receipt-page {
    background: #e5e7eb;
    min-height: 100vh;
    padding: 24px 0;
}

.receipt-toolbar {
    max-width: 320px;
    margin: 0 auto 12px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 0 8px;
}

.receipt {
    background: #fff;
    max-width: 320px;
    margin: 0 auto;
    padding: 20px 16px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}

.receipt-header {
    text-align: center;
}

.receipt-store {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}

.receipt-meta {
    line-height: 1.5;
}

.receipt-divider {
    border-top: 1px dashed #999;
    margin: 10px 0;
}

.receipt-items,
.receipt-summary {
    width: 100%;
    border-collapse: collapse;
}

.receipt-items td,
.receipt-summary td {
    padding: 2px 0;
    vertical-align: top;
}

.receipt-amount {
    text-align: right;
    white-space: nowrap;
}

.receipt-tier {
    color: #666;
}

.receipt-total-row td {
    font-weight: 700;
    font-size: 13px;
    padding-top: 6px;
    padding-bottom: 6px;
}

.receipt-footer {
    text-align: center;
    margin-top: 4px;
}

/* Printer thermal 58mm (mis. X-58BTII, kertas roll 57mm) - kalau nanti
   ganti ke printer 80mm, ubah angka di @page dan .receipt di bawah ini. */
@media print {
    @page {
        size: 58mm auto;
        margin: 0;
    }

    .no-print {
        display: none !important;
    }

    html, body {
        width: 58mm;
    }

    .receipt-page {
        background: #fff;
        padding: 0;
        min-height: 0;
    }

    .receipt {
        box-shadow: none;
        margin: 0;
        width: 58mm;
        max-width: 58mm;
        padding: 2mm 3mm;
        font-size: 11px;
    }

    .bottom-nav,
    .sidebar {
        display: none !important;
    }
}

/* =========================================================
   Label barcode - halaman cetak stiker
   ========================================================= */
.label-page {
    background: #e5e7eb;
    min-height: 100vh;
    padding: 20px;
}

.label-toolbar {
    max-width: 700px;
    margin: 0 auto 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.label-format-switch {
    display: flex;
    gap: 4px;
    background: var(--color-bg);
    padding: 3px;
    border-radius: 8px;
}

.label-copy-form {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.label-copy-form input {
    width: 64px;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

.label-sheet {
    max-width: 700px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.label-item {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 10px;
    text-align: center;
}

.label-name {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.label-barcode {
    width: 100%;
    height: auto;
}

.label-qr {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60px;
}

.label-qr img,
.label-qr canvas {
    max-width: 100px;
    height: auto;
}

.label-price {
    font-size: 12px;
    font-weight: 700;
    margin-top: 2px;
}

@media print {
    .label-page {
        background: #fff;
        padding: 0;
    }

    .label-sheet {
        max-width: 100%;
    }

    .label-item {
        border: 1px dashed #999;
        break-inside: avoid;
    }
}
