:root {
    --primary: #7B1818;
    --primary-dark: #5a1212;
    --primary-light: #a02020;
    --secondary: #1a1a1a;
    --bg-body: #f4f5f7;
    --bg-card: #ffffff;
    --bg-sidebar: #1a1a1a;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-light: #ffffff;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 12px;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --topbar-height: 64px;
    --touch-min: 48px;
}

[data-theme="dark"] {
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --bg-sidebar: #0d0d0d;
    --text-primary: #f0f0f0;
    --text-secondary: #aaaaaa;
    --border-color: #333333;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    min-height: 100vh;
}

/* Auth */
.auth-page {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-container { width: 100%; max-width: 420px; text-align: center; }
.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.auth-logo img { width: 100px; height: 100px; object-fit: contain; }
.auth-title { color: var(--primary); font-size: 2rem; font-weight: 700; margin: 12px 0 4px; }
.auth-title.brand-wordmark { margin-top: 0; }
.brand-wordmark {
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.1;
    white-space: nowrap;
}
.auth-subtitle { color: var(--text-secondary); margin-bottom: 28px; }
.auth-footer { color: rgba(255,255,255,0.6); margin-top: 24px; font-size: 0.85rem; }
.auth-footer a { color: rgba(255,255,255,0.85); text-decoration: none; }
.auth-footer a:hover { color: #fff; text-decoration: underline; }

/* Layout */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-light);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    overflow-x: hidden;
    overflow-y: auto;
    transition: width 0.3s ease, transform 0.3s ease;
}

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

.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 12px 8px;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px 8px;
    gap: 0;
}

.sidebar.collapsed .nav-item i {
    width: auto;
    font-size: 1rem;
}

.sidebar.collapsed .nav-pos {
    margin: 4px 6px;
    padding: 10px 8px;
}

.sidebar-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.sidebar-brand { font-size: 1.15rem; font-weight: 700; color: #fff; }
.sidebar-brand.brand-wordmark {
    font-size: 1.2rem;
    color: #fff;
}

.sidebar-nav { padding: 4px 0 8px; }

.nav-section {
    padding: 8px 16px 2px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.4);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.875rem;
    min-height: 0;
    line-height: 1.3;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item i { width: 18px; text-align: center; font-size: 0.9rem; }

.nav-pos {
    background: var(--primary);
    color: #fff !important;
    margin: 4px 10px;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-weight: 600;
}
.nav-pos:hover { background: var(--primary-light) !important; }
.nav-pos.active { background: var(--primary-light); }

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.app-wrapper.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.topbar-branch {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 600;
}

.sidebar-collapse-toggle {
    color: var(--text-secondary);
    flex-shrink: 0;
}

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

.topbar-center { flex: 1; text-align: center; }
.session-timer { font-size: 0.85rem; color: var(--text-secondary); }

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.btn-icon {
    width: 44px; height: 44px;
    border: none; background: transparent;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s;
}
.btn-icon:hover { background: var(--bg-body); color: var(--primary); }

.notification-bell {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e74c3c;
    border: 2px solid var(--bg-card);
    pointer-events: none;
    animation: notification-blink 1.2s ease-in-out infinite;
}

@keyframes notification-blink {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.6);
    }
    50% {
        opacity: 0.35;
        transform: scale(0.85);
        box-shadow: 0 0 0 4px rgba(231, 76, 60, 0);
    }
}

.btn-user {
    border: none; background: transparent;
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: var(--radius);
    color: var(--text-primary); cursor: pointer;
}

.page-content { padding: 24px; flex: 1; }

/* Cards & Stats */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 { font-size: 1.5rem; font-weight: 700; margin: 0; color: var(--text-primary); }

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card .stat-label { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 4px; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
}

.stat-card.primary .stat-icon { background: rgba(123,24,24,0.1); color: var(--primary); }
.stat-card.success .stat-icon { background: rgba(39,174,96,0.1); color: #27ae60; }
.stat-card.warning .stat-icon { background: rgba(243,156,18,0.1); color: #f39c12; }
.stat-card.info .stat-icon { background: rgba(52,152,219,0.1); color: #3498db; }
.stat-card.danger .stat-icon { background: rgba(231,76,60,0.1); color: #e74c3c; }

.card-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-panel .card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    display: flex; align-items: center; justify-content: space-between;
}
.card-panel .card-body { padding: 20px; }

/* Buttons */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    min-height: var(--touch-min);
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-lg { padding: 12px 24px; font-size: 1rem; border-radius: var(--radius); }
.btn-touch { min-height: 56px; min-width: 56px; font-size: 1.1rem; border-radius: var(--radius); }

/* Tables */
.table { color: var(--text-primary); }
.table thead th {
    background: var(--bg-body);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Forms */
.form-control, .form-select {
    min-height: var(--touch-min);
    border-radius: 8px;
    border-color: var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(123,24,24,0.15);
}

/* POS Layout */
.pos-fullscreen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-body);
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

/* POS tam ekran katmanının üstünde modal ve uyarılar */
.swal2-container { z-index: 10050 !important; }
.modal { z-index: 10050 !important; }
.modal-backdrop { z-index: 10040 !important; }

/* Roller — yetki düzenleme modalı kaydırma */
.permissions-modal-dialog {
    max-height: calc(100vh - 2rem);
    margin-top: 1rem;
    margin-bottom: 1rem;
}
.permissions-modal-dialog .modal-content {
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
}
.permissions-modal-dialog .modal-header,
.permissions-modal-dialog .modal-footer {
    flex-shrink: 0;
}
.permissions-modal-dialog .modal-body {
    flex: 1 1 auto;
    max-height: calc(100vh - 11rem);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.permissions-modal-dialog .modal-body::-webkit-scrollbar {
    width: 10px;
}
.permissions-modal-dialog .modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.06);
    border-radius: 5px;
}
.permissions-modal-dialog .modal-body::-webkit-scrollbar-thumb {
    background: rgba(123, 24, 24, 0.45);
    border-radius: 5px;
}
.permissions-modal-dialog .modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(123, 24, 24, 0.65);
}

.pos-toast {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10060;
    min-width: 280px;
    max-width: 90vw;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: posToastIn 0.25s ease;
}
.pos-toast-success { background: #27ae60; color: #fff; }
.pos-toast-error { background: #c0392b; color: #fff; }
.pos-toast-warning { background: #f39c12; color: #fff; }
@keyframes posToastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.pos-topbar {
    height: 60px;
    background: var(--secondary);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
}

.pos-topbar .pos-logo { height: 36px; }
.pos-topbar .pos-logo.brand-wordmark {
    height: auto;
    font-size: 1.25rem;
    color: #fff;
    margin: 0;
}
.pos-topbar .pos-branch { font-weight: 600; flex: 1; }
.pos-topbar .pos-actions { display: flex; gap: 8px; }

.pos-main { flex: 1; display: flex; overflow: hidden; }

.pos-categories {
    width: 160px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 8px;
}

.pos-category-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px 8px;
    margin-bottom: 8px;
    border: 2px solid transparent;
    border-radius: var(--radius);
    background: var(--bg-body);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 80px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}
.pos-category-btn i { font-size: 1.5rem; margin-bottom: 6px; }
.pos-category-btn.active, .pos-category-btn:hover {
    border-color: var(--primary);
    background: rgba(123,24,24,0.08);
    color: var(--primary);
}

.pos-category-quick {
    border-color: #f39c12 !important;
    background: rgba(243,156,18,0.12);
}
.pos-category-quick.active, .pos-category-quick:hover {
    border-color: #e67e22 !important;
    background: rgba(243,156,18,0.25) !important;
    color: #d35400 !important;
}
.pos-category-quick i { color: #f39c12; }

/* Quick products admin */
.quick-sort-item { transition: background 0.15s; user-select: none; }
.quick-sort-item.dragging { opacity: 0.55; background: rgba(123,24,24,0.08); }
.quick-drag-handle {
    cursor: grab;
    padding: 8px 10px;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}
.quick-drag-handle:active { cursor: grabbing; }
.quick-drag-handle i { font-size: 1.1rem; pointer-events: none; }
.quick-add-item:hover { background: var(--bg-body); }
#selectedProducts { min-height: 80px; }


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

.pos-product-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: all 0.15s;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.pos-product-card:active { transform: scale(0.96); border-color: var(--primary); background: rgba(123,24,24,0.05); }
.pos-products--readonly .pos-product-card {
    cursor: not-allowed;
    opacity: 0.75;
}
.pos-products--readonly .pos-product-card:active {
    transform: none;
    border-color: var(--border-color);
    background: var(--bg-card);
}
.pos-product-card .product-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.pos-product-card .product-price { color: var(--primary); font-weight: 700; font-size: 1rem; }
.pos-product-card .product-img {
    width: 48px; height: 48px;
    border-radius: 8px;
    object-fit: cover;
    margin: 0 auto 8px;
    background: var(--bg-body);
}

.pos-cart {
    width: 360px;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.pos-cart-header {
    padding: 16px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pos-cart-items { padding: 8px; }

.pos-cart-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.pos-cart-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.pos-cart--partial-open .pos-cart-scroll {
    scroll-behavior: smooth;
}

.pos-cart-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    gap: 8px;
}
.pos-cart-item .item-name { flex: 1; font-weight: 600; font-size: 0.9rem; }
.pos-cart-item .item-price { font-weight: 700; color: var(--primary); min-width: 70px; text-align: right; }

.qty-control {
    display: flex;
    align-items: center;
    gap: 4px;
}
.qty-btn {
    width: 40px; height: 40px;
    border: none;
    border-radius: 8px;
    background: var(--bg-body);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-primary);
}
.qty-btn:active { background: var(--primary); color: #fff; }
.qty-value { min-width: 30px; text-align: center; font-weight: 700; }

.pos-cart-summary {
    padding: 16px;
    border-top: 2px solid var(--border-color);
    background: var(--bg-body);
}
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.95rem;
}
.summary-row.total {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
    margin-top: 4px;
}

.pos-cart-actions { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.pos-cart-actions .btn { font-size: 1.1rem; font-weight: 600; padding: 14px; }

.pos-discount-field {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-body);
}
.pos-discount-field .form-label { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 4px; }

.pos-pay-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}
.pos-pay-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 72px;
    padding: 12px 8px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-body);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-primary);
}
.pos-pay-btn i { font-size: 1.4rem; }
.pos-pay-btn:active:not(:disabled) { transform: scale(0.97); }
.pos-pay-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pos-pay-btn.is-processing { opacity: 0.7; pointer-events: none; }
.pos-pay-pos { border-color: #3498db; color: #2980b9; }
.pos-pay-pos:hover:not(:disabled) { background: rgba(52,152,219,0.12); }
.pos-pay-nakit { border-color: #27ae60; color: #1e8449; }
.pos-pay-nakit:hover:not(:disabled) { background: rgba(39,174,96,0.12); }
.pos-pay-patron { border-color: #8e44ad; color: #7d3c98; }
.pos-pay-patron:hover:not(:disabled) { background: rgba(142,68,173,0.12); }
.pos-pay-banka { border-color: #e67e22; color: #d35400; }
.pos-pay-banka:hover:not(:disabled) { background: rgba(230,126,34,0.12); }

.pos-pay-btn.is-original-payment {
    opacity: 1;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.pos-pay-pos.is-original-payment {
    background: rgba(52, 152, 219, 0.22);
    border-color: rgba(52, 152, 219, 0.55);
    color: rgba(41, 128, 185, 0.85);
}

.pos-pay-nakit.is-original-payment {
    background: rgba(39, 174, 96, 0.22);
    border-color: rgba(39, 174, 96, 0.55);
    color: rgba(30, 132, 73, 0.85);
}

.pos-pay-patron.is-original-payment {
    background: rgba(142, 68, 173, 0.22);
    border-color: rgba(142, 68, 173, 0.55);
    color: rgba(125, 60, 152, 0.85);
}

.pos-pay-banka.is-original-payment {
    background: rgba(230, 126, 34, 0.22);
    border-color: rgba(230, 126, 34, 0.55);
    color: rgba(211, 84, 0, 0.85);
}

.pos-partial-toggle.is-original-payment {
    opacity: 1;
    background: rgba(123, 24, 24, 0.14);
    border-color: rgba(123, 24, 24, 0.45);
    color: rgba(123, 24, 24, 0.75);
    font-weight: 700;
}

.pos-partial-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(100% - 24px);
    margin: 0 12px 12px;
    min-height: 52px;
    padding: 12px 16px;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    background: rgba(123,24,24,0.06);
    color: var(--primary);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s;
}
.pos-partial-toggle:hover:not(:disabled) { background: rgba(123,24,24,0.12); }
.pos-partial-toggle.active {
    background: var(--primary);
    color: #fff;
}
.pos-partial-toggle:disabled { opacity: 0.45; cursor: not-allowed; }

.pos-partial-panel {
    padding: 12px 16px 16px;
    border-top: 2px dashed var(--primary);
    background: rgba(123,24,24,0.05);
}
.pos-partial-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary);
    margin-bottom: 12px;
}
.pos-partial-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.pos-partial-row label {
    min-width: 52px;
    font-weight: 700;
    font-size: 0.9rem;
    margin: 0;
}
.pos-partial-row .input-group { flex: 1; }
.pos-partial-row .form-control { text-align: right; font-weight: 600; }
.pos-partial-summary {
    text-align: center;
    font-size: 0.85rem;
    margin: 12px 0;
    padding: 8px;
    border-radius: var(--radius);
    background: var(--bg-body);
}
.pos-partial-summary.is-valid {
    color: #1e8449;
    background: rgba(39,174,96,0.12);
}
.pos-partial-summary.is-invalid {
    color: #922b21;
    background: rgba(192,57,43,0.08);
}
#btnPartialComplete { font-weight: 700; }

/* Payment Modal (legacy) */
.payment-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.payment-method-btn {
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-card);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 80px;
}
.payment-method-btn i { font-size: 1.8rem; display: block; margin-bottom: 8px; }
.payment-method-btn.active { border-color: var(--primary); background: rgba(123,24,24,0.08); color: var(--primary); }

.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.numpad-btn {
    padding: 16px;
    font-size: 1.3rem;
    font-weight: 700;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-card);
    cursor: pointer;
    min-height: 56px;
}
.numpad-btn:active { background: var(--primary); color: #fff; }

/* Receipt Print */
@media print {
    body:not(.receipt-print-body) * { visibility: hidden; }
    #receiptPrint, #receiptPrint * { visibility: visible; }
    #receiptPrint { position: absolute; left: 0; top: 0; width: 100mm; }
}

.receipt-print-body {
    margin: 0;
    padding: 0;
    background: #fff;
    font-family: 'Aller', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
}

@font-face {
    font-family: 'Aller';
    src: url('../fonts/Aller_Lt.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Aller';
    src: url('../fonts/Aller_Rg.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Aller';
    src: url('../fonts/Aller_Bd.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

.receipt {
    font-family: 'Aller', sans-serif;
    font-weight: 400;
    font-size: 16.2px;
    line-height: 1.25;
    text-transform: uppercase;
    width: 100mm;
    max-width: 100mm;
    padding: 2mm;
    color: #000;
    background: #fff;
    box-sizing: border-box;
}
.receipt-logo { text-align: center; margin-bottom: 8px; }
.receipt-logo img { height: 88px; width: auto; }
.receipt-logo.brand-wordmark {
    font-size: 22px;
    font-weight: 700;
    color: #111;
    margin-bottom: 6px;
}
.receipt-header { text-align: center; margin-bottom: 6px; }
.receipt-brand { font-size: 19.8px; font-weight: 700; letter-spacing: 0.5px; }
.receipt-branch { font-size: 14.4px; font-weight: 300; margin-top: 2px; }
.receipt-meta div,
.receipt-line,
.receipt-items-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 2px 0;
}
.receipt-items-head { font-weight: 700; font-size: 14.4px; margin-bottom: 4px; }
.receipt-item { margin-bottom: 6px; }
.receipt-item-name { font-weight: 700; font-size: 16.2px; }
.receipt-item-detail {
    display: flex;
    justify-content: space-between;
    font-size: 14.4px;
    color: #333;
}
.receipt--design-2 { overflow: visible; }
.receipt--design-2 .receipt-items-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(72px, auto);
    column-gap: 6px;
    align-items: end;
}
.receipt--design-2 .receipt-items-head span:last-child { text-align: right; }
.receipt--design-2 .receipt-item-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(72px, auto);
    column-gap: 6px;
    align-items: start;
}
.receipt--design-2 .receipt-item-name { min-width: 0; }
.receipt--design-2 .receipt-item-qty {
    font-weight: 400;
    font-size: 16.2px;
    line-height: 1.25;
    white-space: nowrap;
    text-align: right;
}
.receipt--design-2 .receipt-item-amount {
    font-weight: 700;
    font-size: 16.2px;
    line-height: 1.25;
    white-space: nowrap;
    text-align: right;
}
.receipt-divider { border-top: 2px dashed #000; margin: 8px 0; }
.receipt-discount { color: #c0392b; }
.receipt-total { font-size: 19.8px; font-weight: 700; margin-top: 4px; }
.receipt-payment { font-weight: 700; font-size: 16.2px; }
.receipt-footer { text-align: center; margin-top: 8px; font-size: 14.4px; font-weight: 400; }
.receipt-footer-note { text-align: center; font-size: 12.6px; font-weight: 300; color: #000; margin-top: 4px; }
.receipt-footer-site { text-transform: none; }

/* Responsive */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .pos-cart { width: 300px; }
}

@media (max-width: 768px) {
    .pos-main { flex-direction: column; }
    .pos-categories {
        width: 100%;
        display: flex;
        overflow-x: auto;
        padding: 8px;
        flex-direction: row;
        gap: 8px;
    }
    .pos-category-btn { min-width: 100px; min-height: 60px; margin-bottom: 0; }
    .pos-cart { width: 100%; max-height: 40vh; }
    .pos-products { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* Badge */
.badge-primary { background: var(--primary); }

/* DataTables dark mode fix */
[data-theme="dark"] .dataTables_wrapper .dataTables_filter input,
[data-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Reports chart */
.reports-chart-wrap {
    position: relative;
    height: 360px;
}

.reports-chart-wrap-branch {
    height: 300px;
}

.reports-chart-legend {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
}

.reports-chart-legend-sales { background: rgba(39, 174, 96, 0.85); }
.reports-chart-legend-expenses { background: rgba(231, 76, 60, 0.85); }
.reports-chart-legend-profit { background: rgba(52, 152, 219, 0.85); }

.expense-lines-table td {
    vertical-align: middle;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.expense-lines-table .form-control-sm,
.expense-lines-table .form-select-sm {
    min-height: calc(1.5em + 0.5rem + 2px);
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
}

.expense-lines-table .badge {
    font-size: 0.75rem;
}

.expense-lines-table .line-num-input {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.expense-lines-table .line-num-input::placeholder {
    text-align: right;
    color: #adb5bd;
    opacity: 1;
}
