/* Multi-Store POS & Service Center Modern Styling */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary: #475569;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --header-height: 61px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Top Bar */
.top-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
    height: var(--header-height);
    box-sizing: border-box;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    background: #000;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.brand-info h1 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.3px;
}

.brand-info p {
    font-size: 11px;
    color: var(--text-muted);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 14px;
}

.warehouse-pill {
    background: var(--primary-light);
    border: 1px solid #bfdbfe;
    color: var(--primary);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.sync-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.sync-badge.online {
    background: var(--success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.sync-badge.offline {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid #fde68a;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.status-dot.online { background: #10b981; box-shadow: 0 0 6px #10b981; }
.status-dot.offline { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: white;
    cursor: pointer;
}

.role-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
}
.role-tag.admin { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.role-tag.manager { background: #e0e7ff; color: #3730a3; }
.role-tag.manager-pusat, .role-tag.manager.pusat { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }
.role-tag.manager-cabang, .role-tag.manager.cabang { background: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; }
.role-tag.sales { background: #dcfce7; color: #166534; }
.role-tag.sales-pusat, .role-tag.sales.pusat { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.role-tag.sales-cabang, .role-tag.sales.cabang { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.role-tag.danger { background: #fee2e2; color: #b91c1c; }

/* Kolom transaksi/nilai belanja pembeli & faktur/total pembelian supplier telah dipindahkan ke menu Total Penjualan & Total Pembelian */
.col-cust-stat,
.col-supp-stat {
    display: none !important;
}

.inv-filter-btn {
    font-size: 11px !important;
    padding: 4px 10px !important;
    border-radius: 20px !important;
    transition: all 0.2s ease;
}
.inv-filter-btn.active {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

/* App Wrapper for Left Sidebar + Main Content */
.app-layout {
    display: flex;
    flex: 1;
    min-height: calc(100vh - var(--header-height));
}

/* Vertical Left Sidebar (Sticky & Independen: Menu tetap diam tidak ikut terscroll saat scroll sisi kanan) */
.sidebar-nav {
    width: 250px;
    background: #0f172a;
    border-right: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    gap: 4px;
    flex-shrink: 0;
    position: sticky;
    top: var(--header-height);
    align-self: flex-start;
    height: calc(100vh - var(--header-height));
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    z-index: 40;
    scrollbar-width: thin;
    scrollbar-color: #334155 #0f172a;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: #0f172a;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Sidebar DateTime Box (WITA) */
.sidebar-datetime-box {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.75), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-date-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: #94a3b8;
    white-space: nowrap;
}

.sidebar-time-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 800;
    color: #38bdf8;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.sidebar-datetime-icon {
    font-size: 12px;
    opacity: 0.85;
}

.sidebar-tz-badge {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
    font-size: 9.5px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    margin-left: auto;
}

.sidebar-section-title {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 10px 12px 4px 12px;
}

.sidebar-divider {
    height: 1px;
    background: #1e293b;
    margin: 8px 0;
}

.sidebar-nav .nav-item {
    color: #94a3b8;
    text-decoration: none;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    border: 1px solid transparent;
}

.sidebar-nav .nav-item:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-nav .nav-item.active {
    color: #ffffff;
    background: #2563eb;
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.nav-item-icon {
    font-size: 16px;
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.nav-item-label {
    flex: 1;
}

.sidebar-nav .shortcut-badge {
    background: rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.sidebar-nav .nav-item.active .shortcut-badge {
    background: #ffffff;
    color: #1e40af;
    border: none;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 14px;
}

.sidebar-hint {
    background: #1e293b;
    border-radius: var(--radius-md);
    padding: 10px;
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* App Container (Right Side Content Area) */
.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    min-width: 0;
}

/* Views */
.view-section {
    display: none;
    flex: 1;
}
.view-section.active {
    display: flex;
    flex-direction: column;
}

/* POS Cashier Layout: Sisi Kiri = Input Invoice & Keranjang, Sisi Kanan = Katalog Produk */
.pos-layout {
    display: grid;
    grid-template-columns: 480px 1fr;
    gap: 16px;
    height: calc(100vh - 140px);
}

@media (max-width: 1100px) {
    .pos-layout {
        grid-template-columns: 420px 1fr;
    }
}

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

/* Pure Input Page Layout (Pembelian, Penjualan, Transfer, Servisan, Retur) */
.pure-input-layout {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.pos-cart-row {
    display: flex;
    gap: 12px;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.pos-cart-row:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-sm);
}

.pure-input-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.pure-input-header {
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pure-input-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pure-input-body {
    padding: 22px 24px;
}

.pure-input-footer {
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* History Tabs in view-invoices */
.invoice-history-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 18px;
    padding-bottom: 10px;
    flex-wrap: wrap;
}

.inv-subtab-btn,
.login-tab-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.catalog-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.catalog-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
    background: #fafbfc;
}

.search-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrap input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.search-input-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 15px;
}

.category-chips {
    display: flex;
    gap: 8px;
    padding: 10px 18px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    background: #ffffff;
}

.chip {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border);
    background: #f8fafc;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.chip:hover, .chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.products-grid {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    align-content: start;
}

.product-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.product-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.product-card.out-of-stock {
    cursor: pointer;
}

.product-badge-stock {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}
.product-badge-stock.in { background: #dcfce7; color: #166534; }
.product-badge-stock.low { background: #fef3c7; color: #b45309; }
.product-badge-stock.zero { background: #f1f5f9; color: #64748b; }
.product-badge-stock.negative { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; font-weight: 800; }

.product-card h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-top: 14px;
    margin-bottom: 4px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .sku-tag {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
}

.product-card .price-tag {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 10px;
}

/* POS Cart Panel */
.cart-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.cart-header {
    padding: 14px 18px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h3 {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.customer-bar {
    padding: 10px 18px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 10px;
}

.customer-bar input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.cart-items-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.empty-cart-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    gap: 10px;
}

.item-details {
    flex: 1;
}

.item-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
}

.item-price-unit {
    font-size: 11px;
    color: var(--text-muted);
}

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

.qty-btn {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: #e2e8f0;
}

.qty-input {
    width: 38px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    padding: 2px;
    font-weight: 600;
}

.item-subtotal {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-main);
    min-width: 80px;
    text-align: right;
}

.remove-item-btn {
    color: #ef4444;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

/* Cart Summary & Pay Section */
.cart-summary {
    background: #ffffff;
    border-top: 1px solid var(--border);
    padding: 16px 18px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.summary-row.grand-total {
    border-top: 2px dashed var(--border);
    padding-top: 10px;
    margin-top: 10px;
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
}

.pay-btn-checkout {
    width: 100%;
    margin-top: 12px;
    padding: 14px;
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
    transition: all 0.2s;
}

.pay-btn-checkout:hover {
    background: linear-gradient(135deg, #15803d, #166534);
    transform: translateY(-1px);
}

/* Common Card & Tables */
.content-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.card-header-flex h2 {
    font-size: 18px;
    font-weight: 700;
}

.data-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.data-table th {
    background: #f8fafc;
    padding: 12px 14px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

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

/* Buttons & Inputs */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13px;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

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

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }

.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }

.btn-outline {
    background: white;
    border-color: var(--border);
    color: var(--text-main);
}
.btn-outline:hover {
    background: #f1f5f9;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 5px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-toggle-password {
    transition: color 0.15s ease, transform 0.1s ease;
}
.btn-toggle-password:hover {
    color: var(--primary, #2563eb) !important;
}
.btn-toggle-password:active {
    transform: scale(0.92);
}

/* Hilangkan tombol panah scroll (spinner atas-bawah) pada semua input number */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button,
.no-spinner::-webkit-outer-spin-button,
.no-spinner::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

input[type="number"],
.no-spinner {
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
}

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

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 20px;
    flex: 1;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #fafbfc;
}

/* Payment Quick Cash Buttons */
.quick-cash-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.quick-cash-btn {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #f8fafc;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    text-align: center;
}
.quick-cash-btn:hover {
    background: #e2e8f0;
}

/* Service Kanban / Status Badges */
.badge-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-status.ANTRIAN { background: #f1f5f9; color: #475569; }
.badge-status.PENGECEKAN { background: #e0f2fe; color: #0369a1; }
.badge-status.MENUNGGU_PART { background: #fef3c7; color: #b45309; }
.badge-status.PROSES_SERVIS { background: #f3e8ff; color: #7e22ce; }
.badge-status.SELESAI { background: #dcfce7; color: #15803d; }
.badge-status.DIAMBIL { background: #d1fae5; color: #065f46; }
.badge-status.DIBATALKAN { background: #fee2e2; color: #b91c1c; }

.badge-status.DRAFT { background: #f1f5f9; color: #475569; }
.badge-status.IN_TRANSIT { background: #fef3c7; color: #b45309; }
.badge-status.RECEIVED { background: #dcfce7; color: #15803d; }
.badge-status.CANCELLED, .badge-status.VOID { background: #fee2e2; color: #b91c1c; }

/* Thermal / NCR Receipt Preview Styling (75mm x 65mm x 12mm NCR 2Ply & 80mm) */
.receipt-preview {
    font-family: 'Courier New', Courier, monospace;
    background: #fff;
    padding: 10px 12px;
    border: 1px dashed #cbd5e1;
    margin: 0 auto;
    width: 270px; /* Standar tampilan rol 75mm */
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
    line-height: 1.3;
    font-size: 11px;
    text-align: left !important;
}

.receipt-header {
    text-align: center;
    border-bottom: 1px dashed #000;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.receipt-store-title {
    font-size: 15px;
    font-weight: bold;
}

.receipt-preview table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.receipt-preview table td {
    text-align: left;
}

.receipt-items-table {
    width: 100%;
    margin: 8px 0;
    border-collapse: collapse;
    text-align: left;
}

.receipt-items-table td {
    padding: 2px 0;
    text-align: left;
}

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

.receipt-footer {
    text-align: center;
    margin-top: 10px;
    font-size: 11px;
    white-space: pre-line;
}

/* Faktur Penjualan A4 Styling */
.faktur-a4-preview {
    font-family: Arial, Helvetica, sans-serif;
    background: #fff;
    padding: 24px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    margin: 0 auto;
    width: 100%;
    max-width: 800px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    line-height: 1.35;
    font-size: 11px;
    color: #000000;
    text-align: left;
}

/* Print Only Styles */
@media print {
    @page {
        size: auto;
        margin: 0 !important;
    }

    /* Completely remove the app interface from layout to prevent multi-page spill */
    header,
    aside,
    nav,
    .app-header,
    .app-layout,
    .sidebar-nav,
    .main-content,
    .no-print,
    .modal-header,
    .modal-footer,
    .modal-close-btn,
    .modal-overlay:not(.active),
    #toast-container {
        display: none !important;
    }

    html, body {
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        overflow: visible !important;
    }
    body * {
        visibility: hidden;
    }
    .modal-overlay.active,
    .modal-overlay.active .modal-content,
    .modal-overlay.active .modal-body {
        position: static !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        display: block !important;
    }
    .modal-overlay.active .modal-header,
    .modal-overlay.active .modal-footer {
        display: none !important;
    }
    .modal-overlay.active #printable-area,
    .modal-overlay.active #printable-area *,
    .modal-overlay.active #purchase-detail-content,
    .modal-overlay.active #purchase-detail-content *,
    .modal-overlay.active #surat-jalan-content,
    .modal-overlay.active #surat-jalan-content *,
    .modal-overlay.active #service-invoice-content,
    .modal-overlay.active #service-invoice-content *,
    .modal-overlay.active #return-detail-content,
    .modal-overlay.active #return-detail-content *,
    .modal-overlay.active #report-print-content,
    .modal-overlay.active #report-print-content * {
        visibility: visible !important;
    }
    .modal-overlay.active #printable-area,
    .modal-overlay.active #purchase-detail-content,
    .modal-overlay.active #service-invoice-content,
    .modal-overlay.active #return-detail-content {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 auto !important;
        padding: 0 !important;
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
        border: none !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    /* Batas aman cetak dokumen Surat Jalan Transfer Antar Gudang agar tulisan tidak keluar halaman kertas */
    .modal-overlay.active #surat-jalan-content {
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 8mm 10mm !important; /* Batas aman fisik printer agar tulisan dan tabel tidak terpotong */
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
        border: none !important;
        box-sizing: border-box !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        overflow: visible !important;
        font-family: Arial, Helvetica, sans-serif !important;
    }
    .modal-overlay.active #surat-jalan-content * {
        box-sizing: border-box !important;
    }
    .modal-overlay.active #surat-jalan-content table {
        width: 100% !important;
        max-width: 100% !important;
        border-collapse: collapse !important;
        table-layout: fixed !important;
        box-sizing: border-box !important;
        color: #000 !important;
        background: #fff !important;
        margin-bottom: 14px !important;
    }
    .modal-overlay.active #surat-jalan-content th,
    .modal-overlay.active #surat-jalan-content td {
        box-sizing: border-box !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        border: 1px solid #475569 !important;
        color: #000 !important;
        padding: 5px 6px !important;
        font-size: 8.5pt !important;
        line-height: 1.25 !important;
    }
    .modal-overlay.active #surat-jalan-content th {
        background: #f1f5f9 !important;
        font-weight: 700 !important;
        text-align: center !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .modal-overlay.active #surat-jalan-content .badge-status {
        border: 1px solid #475569 !important;
        color: #000 !important;
        background: transparent !important;
        padding: 1px 5px !important;
        font-size: 8pt !important;
    }
    .modal-overlay.active #surat-jalan-content .surat-jalan-header-box {
        background: #f8fafc !important;
        border: 1px solid #94a3b8 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        box-sizing: border-box !important;
    }
    .modal-overlay.active #report-print-content {
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 6mm 8mm !important; /* Batas aman printer fisik agar tulisan tidak kepotong keluar kertas */
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
        border: none !important;
        box-sizing: border-box !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        overflow: visible !important;
    }
    .report-print-preview {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        font-family: Arial, Helvetica, sans-serif !important;
    }
    #report-print-content div {
        overflow: visible !important;
        box-sizing: border-box !important;
    }
    #report-print-content table {
        width: 100% !important;
        max-width: 100% !important;
        border-collapse: collapse !important;
        color: #000 !important;
        background: #fff !important;
        font-size: 8pt !important;
        line-height: 1.25 !important;
        table-layout: auto !important;
        box-sizing: border-box !important;
    }
    #report-print-content th,
    #report-print-content td {
        border: 1px solid #475569 !important;
        padding: 3px 4px !important;
        color: #000 !important;
        background: #fff !important;
        font-size: 8pt !important;
        box-sizing: border-box !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
    }
    #report-print-content th {
        background: #f1f5f9 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        font-weight: 700 !important;
        font-size: 8pt !important;
        text-align: center !important;
    }
    #report-print-content .role-tag,
    #report-print-content .badge-status {
        background: transparent !important;
        border: 1px solid #666 !important;
        color: #000 !important;
        padding: 1px 3px !important;
        font-size: 7.5pt !important;
    }
    @page {
        margin: 0 !important;
        size: auto;
    }
    .receipt-preview {
        box-shadow: none !important;
        border: none !important;
        width: 100% !important;
        max-width: 63mm !important; /* Presisi area cetak 40 kolom TM-U220 / rol 75mm agar huruf tidak keluar kertas */
        padding: 0 1mm !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        font-size: 10px !important;
        line-height: 1.25 !important;
        word-break: break-word !important;
        overflow: hidden !important;
        text-align: left !important;
    }
    .receipt-preview table {
        font-size: 10px !important;
        width: 100% !important;
        text-align: left !important;
    }
    .receipt-preview table td {
        text-align: left !important;
    }
    .receipt-preview table td[style*="text-align:right"],
    .receipt-preview table td[style*="text-align: right"] {
        text-align: right !important;
    }
    .receipt-preview .receipt-store-title {
        font-size: 12.5px !important;
    }
    .faktur-a4-preview {
        box-shadow: none !important;
        border: none !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 8mm 10mm !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
}

/* Serial Number Scanner in Purchases */
.sn-box {
    background: #f0fdf4;
    border: 1px dashed #86efac;
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-top: 6px;
}

.sn-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.sn-tag {
    background: #ffffff;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sn-tag-remove {
    cursor: pointer;
    color: #ef4444;
    font-weight: bold;
}

/* ========================================================
   KARTU STOK PRODUK & MUTASI PERSEDIAAN
   ======================================================== */
#inventory-matrix-table {
    min-width: 1100px;
}

#inventory-matrix-table th,
#inventory-matrix-table td {
    vertical-align: middle;
}

#inventory-matrix-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

#inventory-matrix-table tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.08) !important;
}

.stock-card-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.stock-card-metric {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stock-card-metric:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.stock-card-metric .metric-title {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
    white-space: nowrap;
}

.stock-card-metric .metric-value {
    font-size: 19px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 3px;
}

.stock-card-metric .metric-subtext {
    font-size: 10.5px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Color accents for the 7 requested metrics */
.metric-stok-awal {
    border-left: 4px solid #3b82f6;
    background: #f8fafc;
}
.metric-stok-awal .metric-value { color: #1e40af; }

.metric-input {
    border-left: 4px solid #10b981;
    background: #f0fdf4;
}
.metric-input .metric-value { color: #15803d; }

.metric-output {
    border-left: 4px solid #ef4444;
    background: #fef2f2;
}
.metric-output .metric-value { color: #b91c1c; }

.metric-transfer {
    border-left: 4px solid #6366f1;
    background: #f5f3ff;
}
.metric-transfer .metric-value { color: #4338ca; }

.metric-retur {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
}
.metric-retur .metric-value { color: #b45309; }

.metric-servis {
    border-left: 4px solid #06b6d4;
    background: #ecfeff;
}
.metric-servis .metric-value { color: #0e7490; }

.metric-stok-akhir {
    border: 2px solid #059669;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.15);
}
.metric-stok-akhir .metric-title { color: #065f46; font-weight: 800; }
.metric-stok-akhir .metric-value { color: #047857; font-size: 22px; }

/* Filter Tabs inside Stock Card */
.stock-card-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.stock-card-tab-btn {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.stock-card-tab-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.stock-card-tab-btn.active {
    background: #1e40af;
    color: #ffffff;
    border-color: #1e40af;
    box-shadow: 0 1px 4px rgba(30, 64, 175, 0.3);
}

/* Category Badges in Table */
.badge-stok-awal { background: #dbeafe; color: #1e40af; }
.badge-pembelian { background: #dcfce7; color: #166534; }
.badge-penjualan { background: #fee2e2; color: #991b1b; }
.badge-transfer-in { background: #e0e7ff; color: #3730a3; }
.badge-transfer-out { background: #ede9fe; color: #5b21b6; }
.badge-retur { background: #fef3c7; color: #92400e; }
.badge-servis { background: #cffafe; color: #155e75; }
.badge-opname { background: #f1f5f9; color: #334155; }

