/* StockPulse POS - Modern Killer UI CSS */
:root {
    --primary-color: #4F46E5;
    --secondary-color: #7C3AED;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --info-color: #3B82F6;
    --dark-color: #1F2937;
    --light-color: #F9FAFB;
    --sidebar-width: 260px;
    --base-font-size: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-color);
    color: var(--dark-color);
    font-size: 1rem;
    line-height: 1.5;
}

html {
    font-size: var(--base-font-size);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 0;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-brand i {
    font-size: 2rem;
}

.sidebar-menu {
    padding: 1rem 0;
}

.sidebar-menu .menu-item {
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar-menu .menu-item:hover,
.sidebar-menu .menu-item.active {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left-color: white;
}

.sidebar-menu .menu-item i {
    width: 20px;
    font-size: 1.1rem;
}

.sidebar-menu .menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 1rem 1.5rem;
}

.sidebar-menu .menu-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    padding: 0.5rem 1.5rem;
}

.sidebar-menu .menu-tree-group .tree-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.sidebar-menu .menu-tree-group .tree-caret {
    transition: transform 0.2s ease;
}

.sidebar-menu .menu-tree-group .tree-children {
    display: none;
}

.sidebar-menu .menu-tree-group.open .tree-children {
    display: block;
}

.sidebar-menu .menu-tree-group.open .tree-caret {
    transform: rotate(90deg);
}

.sidebar-menu .menu-tree-group .tree-link {
    padding-left: 2.75rem;
    font-size: 0.95rem;
}

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 0;
}

.topbar {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-search {
    flex: 1 1 560px;
    max-width: 760px;
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
}

.topbar-search-form {
    flex: 1 1 360px;
    min-width: 260px;
}

.sidebar-toggle-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #E5E7EB;
    background: white;
    color: var(--dark-color);
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.sidebar-backdrop {
    display: none;
}

.topbar-search .input-group {
    position: relative;
    align-items: center;
    flex: 1;
    min-width: 220px;
}

.topbar-search .topbar-search-icon {
    background: transparent;
    border: none;
    position: absolute;
    left: 12px;
    z-index: 2;
    padding: 0;
    height: 100%;
    display: flex;
    align-items: center;
}

.topbar-search input {
    border-radius: 50px;
    border: 1px solid #E5E7EB;
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    background: var(--light-color);
}

.topbar .branch-selector {
    flex: 0 0 220px;
}

.topbar .branch-selector .dropdown {
    width: 100%;
}

.topbar .branch-selector .dropdown-toggle {
    width: 100%;
    min-width: 0;
    height: 40px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    padding-left: 0.9rem;
    padding-right: 0.9rem;
    white-space: nowrap;
}

.topbar-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-left: auto;
    flex-wrap: wrap;
}

body.pwa-standalone .topbar-quick-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 999px;
    padding: 0.2rem 0.3rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

body.pwa-standalone .topbar-account-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

body.pwa-standalone .topbar-user-trigger {
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    border-radius: 999px;
    padding: 0.24rem 0.6rem 0.24rem 0.28rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-align: left;
    box-shadow: none;
    min-height: 40px;
    line-height: 1;
}

body.pwa-standalone .topbar-user-trigger .user-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
    flex: 0 0 34px;
}

body.pwa-standalone .topbar-user-trigger .topbar-user-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.08rem;
    min-width: 0;
}

body.pwa-standalone .topbar-user-trigger:hover,
body.pwa-standalone .topbar-user-trigger:focus-visible {
    border-color: #CBD5E1;
    background: #F8FAFC;
}

.topbar-user-meta {
    line-height: 1.15;
}

body.pwa-standalone .topbar-user-name {
    font-weight: 600;
    font-size: 0.88rem;
    line-height: 1.15;
    color: #111827;
    margin: 0;
}

body.pwa-standalone .topbar-user-role {
    font-size: 0.72rem;
    line-height: 1.1;
    color: #6B7280;
    margin: 0;
}

body.pwa-standalone .topbar-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    border-radius: 999px;
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: 0;
    border-color: #FECACA;
    background: #FFFFFF;
    color: #DC2626;
}

body.pwa-standalone .topbar-logout-btn:hover,
body.pwa-standalone .topbar-logout-btn:focus-visible {
    border-color: #FCA5A5;
    background: #FFF1F2;
    color: #991B1B;
    box-shadow: none;
}

body.pwa-standalone .topbar-logout-text {
    display: none;
}

/* Keep web view header classic while PWA has enhanced controls */
body:not(.pwa-standalone) .topbar-quick-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    background: transparent;
    border: 0;
    padding: 0;
    box-shadow: none;
}

body:not(.pwa-standalone) .topbar-account-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

body:not(.pwa-standalone) .topbar-user-trigger {
    border: 0;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

body:not(.pwa-standalone) .topbar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #111827;
}

body:not(.pwa-standalone) .topbar-user-role {
    font-size: 0.75rem;
    color: #6B7280;
}

body:not(.pwa-standalone) .topbar-logout-btn {
    display: none;
    min-height: auto;
    border-radius: 0.375rem;
}

.invoice-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
}

.invoice-action-form {
    margin: 0;
}

.invoice-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 40px;
    white-space: nowrap;
}

.pwa-install-btn {
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.18);
}

.pwa-install-fab {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1085;
    border-radius: 999px;
    padding: 0.85rem 1.2rem;
    box-shadow: 0 16px 32px rgba(31, 41, 55, 0.22);
}

.offline-status-banner {
    position: fixed;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    z-index: 1080;
    min-width: min(92vw, 360px);
    padding: 0.85rem 1rem;
    border-radius: 16px;
    color: white;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.2);
    text-align: center;
}

.offline-status-banner.is-offline {
    background: linear-gradient(135deg, #F97316, #EA580C);
}

.offline-status-banner.is-online {
    background: linear-gradient(135deg, #059669, #10B981);
}

.system-clock {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4B5563;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    white-space: nowrap;
    min-width: 136px;
    text-align: center;
}

.notification-btn {
    position: relative;
    background: #F8FAFC;
    border: 1px solid #E5E7EB;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    color: var(--dark-color);
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
}

body:not(.pwa-standalone) .notification-btn {
    background: none;
    border: none;
    width: auto;
    height: auto;
    border-radius: 0;
    font-size: 1.3rem;
}

.notification-btn:hover,
.notification-btn:focus-visible {
    background: #EFF6FF;
    border-color: #BFDBFE;
    color: #1D4ED8;
}

body:not(.pwa-standalone) .notification-btn:hover,
body:not(.pwa-standalone) .notification-btn:focus-visible {
    background: transparent;
    border-color: transparent;
    color: var(--dark-color);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Content Area */
.content-area {
    padding: 2rem;
}

.main-content-fullscreen {
    margin-left: 0 !important;
    width: 100vw;
    max-width: 100vw;
    min-height: 100vh;
}

.content-area-fullscreen {
    padding: 0;
    min-height: 100vh;
    overflow: hidden;
}

.content-area-fullscreen .pos-container {
    min-height: 100vh;
    height: 100vh;
    margin: 0;
}

body.pos-fullpage-mode .sidebar,
body.pos-fullpage-mode .topbar {
    display: none !important;
}

body.pos-fullpage-mode .main-content {
    margin-left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
}

body.pos-fullpage-mode {
    overflow: hidden;
}

body.pos-fullpage-mode .main-content,
body.pos-fullpage-mode .content-area {
    position: relative;
    left: 0 !important;
    padding-left: 0 !important;
}

body.pos-fullpage-mode .content-area-fullscreen {
    height: 100vh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

body.pos-fullpage-mode .content-area-fullscreen .pos-top-actions {
    flex: 0 0 auto;
}

body.pos-fullpage-mode .content-area-fullscreen .pos-container {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
}

body.pos-fullpage-mode .content-area-fullscreen .pos-cart {
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}

body.pos-fullpage-mode .content-area-fullscreen .cart-total {
    position: sticky;
    bottom: 0;
    background: #fff;
    z-index: 2;
}

body.pos-fullpage-mode .content-area {
    width: 100vw !important;
    min-width: 100vw !important;
}

body.pos-fullpage-mode .pos-container {
    width: 100vw !important;
    min-width: 100vw !important;
    margin: 0 !important;
    padding: 0.75rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: #6B7280;
    font-size: 0.95rem;
}

/* Cards */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #E5E7EB;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-card-title {
    font-size: 0.875rem;
    color: #6B7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.stat-card-change {
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-card-change.positive {
    color: var(--success-color);
}

.stat-card-change.negative {
    color: var(--danger-color);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

/* Tables */
.data-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.data-table table {
    width: 100%;
    margin: 0;
}

.data-table thead {
    background: var(--light-color);
}

.data-table th {
    padding: 1rem;
    font-weight: 600;
    color: var(--dark-color);
    text-align: left;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #E5E7EB;
}

.data-table tbody tr:hover {
    background: var(--light-color);
}

/* Badges */
.badge-custom {
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: #D1FAE5;
    color: #065F46;
}

.badge-danger {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-info {
    background: #DBEAFE;
    color: #1E40AF;
}

/* Charts */
.chart-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: relative;
    height: auto;
}

.chart-container canvas {
    max-height: 100%;
}

/* POS Interface */
.pos-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(320px, 34vw, 430px);
    gap: 1.5rem;
    height: calc(100vh - 120px);
    transition: all 0.3s ease;
    align-items: stretch;
}

.pos-products {
    min-width: 0;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.pos-cart {
    width: 100%;
    min-width: 320px;
    min-height: 300px;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

.pos-filter-controls {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pos-scan-hint {
    max-width: 360px;
}

.pos-search-input {
    width: clamp(180px, 28vw, 320px);
}

.pos-category-filter {
    width: clamp(150px, 20vw, 220px);
}

.pos-top-actions {
    padding: 0.75rem 0.75rem 0 0.75rem;
    gap: 0.55rem;
}

.pos-top-actions .btn {
    border-radius: 10px;
    font-weight: 600;
}

.pos-queue-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #ef4444;
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.3rem;
}

.pos-sync-banner {
    margin: 0 0.75rem 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 18px;
    background: linear-gradient(135deg, #0f766e, #4f46e5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.pos-sync-banner strong,
.pos-sync-banner span {
    display: block;
}

.pos-sync-banner span {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.pos-mobile-workspace {
    display: none;
}

.pos-mobile-summary-card {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.75rem;
    align-items: center;
    background: linear-gradient(135deg, #111827 0%, #312e81 60%, #0f766e 100%);
    color: white;
    border-radius: 20px;
    padding: 0.95rem 1rem;
    margin: 0 0.75rem 0.85rem;
    box-shadow: 0 18px 42px rgba(17, 24, 39, 0.18);
}

.pos-mobile-summary-card small {
    display: block;
    color: rgba(255, 255, 255, 0.72);
    margin-bottom: 0.18rem;
}

.pos-mobile-summary-card strong {
    display: block;
    font-size: 1rem;
}

.pos-mobile-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    margin: 0 0.75rem 0.85rem;
}

.pos-mobile-tab {
    border: 1px solid #dbe3f1;
    background: white;
    color: #334155;
    border-radius: 16px;
    min-height: 48px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.pos-mobile-tab.active {
    background: linear-gradient(135deg, #4F46E5, #0f766e);
    color: white;
    border-color: transparent;
}

.pos-mobile-tab-badge {
    min-width: 24px;
    padding: 0.1rem 0.42rem;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.12);
    color: #4F46E5;
    font-size: 0.75rem;
}

.pos-mobile-tab.active .pos-mobile-tab-badge {
    background: rgba(255, 255, 255, 0.18);
    color: white;
}

.pos-mobile-bottom-nav {
    display: none;
}

.pos-mobile-bottom-item {
    border: 0;
    background: transparent;
    color: #64748b;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 12px;
    min-height: 52px;
    padding: 0.45rem 0.25rem;
    transition: all 0.2s ease;
    position: relative;
}

.pos-mobile-bottom-item i {
    font-size: 1.06rem;
    transition: all 0.2s ease;
}

.pos-mobile-bottom-item.active {
    color: #0f766e;
    background: rgba(15, 118, 110, 0.08);
}

.pos-mobile-bottom-item.active i {
    color: #0f766e;
    transform: translateY(-1px);
}

.pos-mobile-bottom-item.active::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(135deg, #0f766e, #0284c7);
}

.pos-mobile-bottom-item-scan {
    color: #0f172a;
    transform: translateY(-6px);
    font-weight: 800;
}

.pos-mobile-bottom-item-scan i {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(145deg, #0f172a, #1e293b);
    color: white;
    font-size: 1.12rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.36);
}

.pos-mobile-bottom-item-scan:active {
    transform: translateY(-6px) scale(0.97);
}

.barcode-scanner-frame {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    background: #111827;
    min-height: 320px;
}

.barcode-scanner-video {
    width: 100%;
    min-height: 320px;
    object-fit: cover;
    display: block;
}

.barcode-scanner-overlay {
    position: absolute;
    inset: 18% 12%;
    border: 3px solid rgba(255, 255, 255, 0.82);
    border-radius: 18px;
    box-shadow: 0 0 0 999px rgba(15, 23, 42, 0.28);
}

.barcode-scanner-status {
    margin-top: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 16px;
    background: #f8fafc;
    color: #334155;
}

.barcode-scanner-status[data-tone='success'] {
    background: #dcfce7;
    color: #166534;
}

.barcode-scanner-status[data-tone='warning'] {
    background: #ffedd5;
    color: #c2410c;
}

.keypad-display {
    background: #0f172a;
    color: white;
    border-radius: 18px;
    padding: 0.95rem 1rem;
    font-size: 1.9rem;
    text-align: right;
    letter-spacing: 0.04em;
    margin-bottom: 0.85rem;
}

.keypad-mode-switcher {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.keypad-mode-btn.active {
    background: linear-gradient(135deg, #4f46e5, #0f766e);
    color: white;
    border-color: transparent;
}

.numeric-keypad-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
}

.numeric-key {
    border: 1px solid #dbe3f1;
    background: white;
    border-radius: 16px;
    min-height: 54px;
    font-weight: 700;
    font-size: 1rem;
}

.numeric-key-muted {
    background: #f8fafc;
}

.numeric-key-accent {
    background: linear-gradient(135deg, #4f46e5, #0f766e);
    color: white;
    border-color: transparent;
}

.sale-draft-list {
    display: grid;
    gap: 0.75rem;
}

.sale-draft-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 1rem;
}

.sale-draft-header,
.sale-draft-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sale-draft-header span,
.sale-draft-meta span {
    color: #64748b;
    font-size: 0.85rem;
}

.sale-draft-meta {
    margin-top: 0.45rem;
}

.sale-draft-error {
    margin-top: 0.65rem;
    color: #b91c1c;
    font-size: 0.84rem;
}

.sale-draft-empty {
    border-radius: 18px;
    background: #f8fafc;
    padding: 1.25rem;
    text-align: center;
    color: #64748b;
}

.cart-view-items-btn {
    white-space: nowrap;
    min-width: auto;
}

@media (max-width: 768px) {
    .cart-view-items-btn {
        width: auto;
        flex: 0 0 auto;
        min-width: 0;
        padding: 0.375rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* Hide "Open Full POS" button in PWA mode */
@media (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
    #pos-fullscreen-btn {
        display: none !important;
    }
}

.cart-qty-display {
    min-width: 36px;
    min-height: 34px;
    padding: 0.3rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #f8fafc;
    color: #111827;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.pos-fullpage-mode .pos-top-actions {
    padding: 0.75rem 1rem 0 1rem;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.25rem;
    padding-bottom: 0.5rem;
    align-content: start;
}

.product-card {
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.product-card:active {
    transform: scale(0.98);
}

.cart-items {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    margin: 1rem 0;
    padding-right: 0.25rem;
    padding-bottom: 0.5rem;
}

.cart-items-preview {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #ffffff;
    padding: 0.45rem;
    max-height: none;
    overflow: visible;
    margin-bottom: 0.95rem;
    padding-bottom: 0.7rem;
    box-shadow: inset 0 -1px 0 rgba(229, 231, 235, 0.9);
}

.cart-items-preview .cart-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.cart-items-modal {
    max-height: min(62vh, 520px);
    overflow-y: auto;
    padding-right: 0.25rem;
}

body.pos-fullpage-mode .product-grid,
body.pos-fullpage-mode .cart-items {
    padding-bottom: 1.5rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #E5E7EB;
    gap: 0.75rem;
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.25;
    word-break: break-word;
}

.cart-item-price {
    font-size: 0.86rem;
    color: #6B7280;
    margin-top: 0.15rem;
}

.cart-item-note {
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

.cart-item-note-warning {
    color: #B45309;
}

.cart-item-note-success {
    color: #10B981;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cart-control-btn {
    min-width: 34px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.5rem;
}

#cartItemsModal .modal-content {
    border-radius: 16px;
    box-shadow: 0 24px 46px rgba(15, 23, 42, 0.2);
}

#cartItemsModal .modal-header,
#cartItemsModal .modal-footer {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
}

#cartItemsModal .modal-body {
    padding: 0.75rem 1.1rem 1rem 1.1rem;
}

.cart-total {
    margin-top: auto;
    margin-top: 0.25rem;
    padding-top: 1rem;
    border-top: 2px solid var(--primary-color);
    background: #fff;
}

.cart-total-heading {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin-bottom: 0.45rem;
}

.cart-summary-grid {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    padding: 0.7rem 0.75rem;
}

#promo-discount {
    color: #10B981;
    font-weight: 700;
}

.cart-inline-input {
    width: 118px;
    text-align: right;
}

.cart-grand-total {
    font-size: 1.18rem;
    border-top: 2px solid var(--primary-color);
    padding-top: 0.75rem;
}

.cart-grand-total #total {
    color: var(--primary-color);
}

.cart-checkout-actions .btn {
    min-height: 46px;
    border-radius: 10px;
}

/* Fullscreen POS Mode */
.pos-fullscreen {
    height: 100vh;
    border-radius: 0;
    margin: 0;
    padding: 1.5rem;
}

.sidebar.pos-fullscreen-hidden {
    transform: translateX(-100%);
}

.topbar.pos-fullscreen-hidden {
    display: none;
}

.main-content.pos-fullscreen-mode {
    margin-left: 0;
}

.main-content.pos-fullscreen-mode .pos-container {
    min-height: calc(100vh - 30px);
    height: calc(100vh - 30px);
}

.main-content.pos-fullscreen-mode .pos-container.pos-fullscreen {
    min-height: 100vh;
    height: 100vh;
}

/* Normal POS Mode (with sidebar/topbar visible) */
.main-content:not(.main-content-fullscreen) .pos-container {
    height: calc(100vh - 170px);
}

.main-content:not(.main-content-fullscreen) .pos-products {
    overflow-y: auto;
}

.main-content:not(.main-content-fullscreen) .pos-cart {
    overflow-y: auto;
}

/* Desktop modal styles - normal size */
@media (min-width: 769px) {
    #cartItemsModal .modal-dialog {
        margin: var(--bs-modal-margin);
        width: auto;
        height: auto;
        max-width: var(--bs-modal-width);
        display: block;
    }

    #cartItemsModal .modal-content {
        height: auto;
        max-height: 90vh;
        width: 100%;
        border-radius: var(--bs-modal-border-radius);
    }

    #cartItemsModal .modal-body {
        flex: initial;
        padding: var(--bs-modal-padding);
    }

    #cartItemsModal .modal-header {
        background: transparent;
        color: inherit;
        padding: var(--bs-modal-header-padding);
    }

    #cartItemsModal .modal-header .btn-close {
        filter: none;
    }

    #cartItemsModal .modal-title {
        color: inherit;
    }

    #cartItemsModal .modal-footer {
        padding: var(--bs-modal-footer-padding);
    }

    #cartItemsModal .modal-footer .btn {
        flex: initial;
    }
}

@media (max-width: 1200px) {
    :root {
        --base-font-size: 15px;
    }

    .topbar {
        padding: 0.9rem 1rem;
    }

    .topbar-search {
        flex: 1 1 100%;
        max-width: none;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    body.pwa-standalone .topbar-user-meta {
        max-width: 170px;
    }

    .pos-container {
        grid-template-columns: minmax(0, 1fr) clamp(300px, 38vw, 390px);
        gap: 1rem;
    }

    .pos-cart {
        min-width: 300px;
        padding: 1rem;
        position: sticky;
        top: 86px;
        max-height: calc(100vh - 112px);
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    }
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --base-font-size: 14px;
    }

    .topbar {
        padding: 0.8rem;
        gap: 0.75rem;
    }

    .topbar-search {
        width: 100%;
        max-width: none;
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-areas:
            'toggle search'
            'branch branch';
        align-items: center;
        gap: 0.6rem;
    }

    .sidebar-toggle-btn {
        flex: 0 0 auto;
        grid-area: toggle;
        display: inline-flex;
    }

    .topbar-search-form {
        grid-area: search;
        min-width: 0;
    }

    .topbar .branch-selector {
        grid-area: branch;
        width: 100%;
        flex: 1 1 auto;
    }

    .topbar .branch-selector .dropdown,
    .topbar .branch-selector .dropdown-toggle {
        width: 100%;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
        gap: 0.55rem;
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .topbar-quick-controls,
    .topbar-account-actions {
        width: 100%;
    }

    .topbar-quick-controls {
        display: grid;
        grid-template-columns: minmax(110px, 1fr) auto auto;
        justify-content: stretch;
        align-items: center;
        gap: 0.45rem;
        padding: 0.3rem 0.35rem;
        order: 1;
    }

    .topbar-account-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        justify-content: stretch;
        gap: 0.5rem;
        order: 2;
    }

    .topbar-account-actions .user-info {
        flex: 1 1 auto;
        min-width: 0;
    }

    .topbar-user-trigger {
        width: 100%;
        justify-content: flex-start;
    }

    .topbar-user-meta {
        max-width: calc(100vw - 210px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar-logout-btn {
        flex: 0 0 auto;
        margin-left: 0;
    }

    .pwa-install-btn {
        display: none !important;
    }

    .sidebar {
        left: 0;
        top: 0;
        max-width: 85vw;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(17, 24, 39, 0.45);
        opacity: 0;
        visibility: hidden;
        z-index: 1040;
        transition: opacity 0.2s ease;
    }

    .sidebar-backdrop.active {
        display: block;
        opacity: 1;
        visibility: visible;
    }

    .main-content {
        margin-left: 0;
    }

    .content-area {
        padding: 1rem;
    }

    .pos-mobile-workspace {
        display: block;
    }

    .pos-mobile-bottom-nav {
        display: none !important;
    }

    .page-title {
        font-size: 1.35rem;
    }

    .pos-sync-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .pos-top-actions {
        justify-content: flex-start !important;
    }

    .pos-top-actions .btn {
        flex: 1 1 calc(50% - 0.4rem);
        min-width: 0;
    }

    .stat-card {
        padding: 1rem;
    }

    .table thead th,
    .table tbody td {
        font-size: 0.88rem;
    }

    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
        padding-bottom: 1rem;
    }

    .pos-container:not([data-mobile-panel]) .pos-cart,
    .pos-container[data-mobile-panel='products'] .pos-cart {
        display: none;
    }

    .pos-container[data-mobile-panel='cart'] .pos-products {
        display: none;
    }

    .pos-container[data-mobile-panel='products'] .pos-products,
    .pos-container[data-mobile-panel='cart'] .pos-cart {
        display: flex;
    }

    /* PWA-only mobile cart behavior */
    body.pwa-standalone .cart-items-preview {
        display: none;
    }

    body.pwa-standalone .pos-cart > .d-flex h4 {
        display: none;
    }

    body.pwa-standalone #cart-customer-wrap,
    body.pwa-standalone #customer-loyalty-card,
    body.pwa-standalone #cart-total-panel {
        display: none !important;
    }

    body.pwa-standalone #cartItemsModal #cart-customer-wrap,
    body.pwa-standalone #cartItemsModal #customer-loyalty-card,
    body.pwa-standalone #cartItemsModal #cart-total-panel {
        display: block !important;
        width: 100%;
    }

    body.pwa-standalone #cartItemsModal .cart-mobile-details-host {
        display: flex;
        flex-direction: column;
        gap: 0.85rem;
        margin-top: 0.75rem;
    }

    body.pwa-standalone .cart-view-items-btn {
        width: 100% !important;
        padding: 1rem 0.75rem;
        font-size: 1rem;
        height: auto;
    }

    body.pwa-standalone .pos-cart {
        min-width: 0;
        position: static;
        height: auto;
        max-height: none;
        overflow-y: auto;
        padding-bottom: 1.25rem;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2rem;
    }

    body:not(.pwa-standalone) .pos-cart {
        min-width: 0;
        position: static;
        height: auto;
        max-height: none;
        overflow-y: visible;
        padding-bottom: 1.25rem;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
    }

    body:not(.pwa-standalone) .pos-cart > div:first-child {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.6rem;
        align-items: stretch;
    }

    body:not(.pwa-standalone) .pos-cart h4 {
        display: none;
    }

    body:not(.pwa-standalone) .cart-view-items-btn {
        width: 100%;
        min-width: 0;
        flex: 1 1 auto;
        padding: 0.8rem 0.95rem;
        font-size: 0.95rem;
        border-radius: 14px;
    }

    body:not(.pwa-standalone) .cart-items-preview {
        display: none;
    }

    body:not(.pwa-standalone) #customer-loyalty-card {
        display: none !important;
    }

    body:not(.pwa-standalone) #cart-customer-wrap {
        margin-bottom: 0;
        padding: 0.85rem;
        border: 1px solid #E5E7EB;
        border-radius: 14px;
        background: #FFFFFF;
    }

    body:not(.pwa-standalone) #cart-customer-wrap .form-select {
        min-height: 46px;
        border-radius: 12px;
        background-color: #F8FAFC;
    }

    body:not(.pwa-standalone) .cart-total {
        margin-top: 0;
        padding: 1rem;
        border: 1px solid #E5E7EB;
        border-radius: 16px;
        background: #FFFFFF;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
    }

    body:not(.pwa-standalone) .cart-total-heading {
        font-size: 0.95rem;
        margin-bottom: 0.85rem;
    }

    body:not(.pwa-standalone) .cart-summary-grid {
        gap: 0.3rem;
        font-size: 0.92rem;
    }

    body:not(.pwa-standalone) .cart-grand-total {
        padding-top: 0.2rem;
        font-size: 1.05rem;
    }

    body:not(.pwa-standalone) .cart-inline-input {
        width: 96px;
    }

    body:not(.pwa-standalone) .cart-checkout-actions {
        margin-top: 0.85rem;
    }

    .pos-filter-controls {
        width: 100%;
        justify-content: stretch;
    }

    .pos-scan-hint {
        max-width: none;
    }

    .pos-search-input,
    .pos-category-filter {
        width: 100%;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
    }

    .cart-total {
        position: static;
        margin-top: 0.75rem;
        margin-bottom: 0;
        background: #f8fafc;
        border: 1px solid #e5e7eb;
        border-radius: 14px;
        padding: 0.85rem;
    }

    .cart-summary-grid {
        font-size: 0.95rem;
    }

    #promo-discount {
        font-size: 1rem;
    }

    .cart-checkout-actions {
        margin-bottom: 0.15rem;
    }

    .cart-inline-input {
        width: 112px;
    }

    body.pwa-standalone .cart-items {
        max-height: calc(100vh - 350px);
        overflow-y: auto;
    }

    body.pwa-standalone .cart-items-preview {
        max-height: none;
        margin-bottom: 1rem;
        padding-bottom: 0.9rem;
    }

    .cart-item {
        align-items: stretch;
        flex-direction: column;
        padding: 0.8rem 0.7rem;
        gap: 0.55rem;
    }

    .cart-item-controls {
        justify-content: flex-start;
    }

    .cart-control-btn {
        min-width: 40px;
        min-height: 40px;
    }

    .cart-qty-display {
        min-width: 42px;
        min-height: 40px;
    }

    .barcode-scanner-frame,
    .barcode-scanner-video {
        min-height: 260px;
    }

    /* Full-screen cart modal on mobile */
    body.pwa-standalone #cartItemsModal .modal-dialog {
        margin: 0;
        width: 100% !important;
        height: 100vh;
        max-width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body.pwa-standalone #cartItemsModal .modal-content {
        height: 100vh;
        max-height: 100vh;
        width: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    body.pwa-standalone #cartItemsModal .modal-body {
        flex: 1 1 auto;
        overflow-y: auto;
        padding: 1rem;
    }

    body.pwa-standalone #cartItemsModal .modal-header {
        padding: 1rem;
        background: var(--primary-color);
        color: white;
    }

    body.pwa-standalone #cartItemsModal .modal-header .btn-close {
        filter: brightness(0) invert(1);
    }

    body.pwa-standalone #cartItemsModal .modal-title {
        color: white;
        font-weight: 600;
    }

    body.pwa-standalone #cartItemsModal .modal-header .text-muted {
        color: rgba(255, 255, 255, 0.8) !important;
    }

    body.pwa-standalone #cartItemsModal .modal-footer {
        padding: 1rem;
        border-top: 1px solid #e5e7eb;
        gap: 0.5rem;
    }

    body.pwa-standalone #cartItemsModal .modal-footer .btn {
        flex: 1;
    }
}

@media (max-width: 576px) {
    :root {
        --base-font-size: 13px;
    }

    .topbar {
        padding: 0.7rem;
    }

    .topbar-search {
        gap: 0.45rem;
    }

    body.pwa-standalone .topbar-actions {
        justify-content: flex-start;
    }

    body.pwa-standalone .topbar-quick-controls {
        gap: 0.4rem;
    }

    body.pwa-standalone .topbar-account-actions {
        align-items: center;
    }

    body.pwa-standalone .topbar-logout-btn {
        width: 36px;
        min-width: 36px;
        height: 36px;
        min-height: 36px;
        font-size: 0.86rem;
    }

    body.pwa-standalone .topbar-user-meta {
        max-width: calc(100vw - 180px);
        font-size: 0.82rem;
    }

    body.pwa-standalone .topbar-user-trigger {
        padding: 0.2rem 0.5rem 0.2rem 0.24rem;
        min-height: 38px;
    }

    body.pwa-standalone .topbar-user-trigger .user-avatar {
        width: 32px;
        height: 32px;
        flex: 0 0 32px;
        font-size: 0.85rem;
    }

    body.pwa-standalone .system-clock {
        min-width: 104px;
        font-size: 0.78rem;
        padding: 0.3rem 0.55rem;
    }

    body.pwa-standalone .topbar-user-meta > div:last-child {
        display: none;
    }

    .pwa-install-fab {
        right: 0.75rem;
        left: 0.75rem;
        bottom: 0.75rem;
        width: auto;
        justify-content: center;
    }

    .offline-status-banner {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 6.35rem;
        min-width: 0;
        transform: none;
    }

    .system-clock {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }

    .user-avatar {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }

    .content-area {
        padding: 0.85rem;
    }

    .pos-top-actions .btn {
        flex: 1 1 100%;
        width: 100%;
    }

    .pos-mobile-summary-card {
        grid-template-columns: 1fr 1fr;
        padding: 0.9rem;
    }

    .invoice-action-bar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.55rem;
    }

    .invoice-action-form {
        width: 100%;
    }

    .invoice-action-btn {
        width: 100%;
    }

    .pos-mobile-summary-card .btn {
        grid-column: 1 / -1;
        width: 100%;
    }

    .page-title {
        font-size: 1.2rem;
    }

    .page-subtitle,
    .stat-card-title,
    .table thead th,
    .table tbody td {
        font-size: 0.82rem;
    }

    .pos-products,
    .pos-cart {
        padding: 1rem;
        border-radius: 16px;
    }

    .pos-cart {
        padding-bottom: calc(7rem + env(safe-area-inset-bottom));
    }

    .pos-cart > div:first-child {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: space-between;
        align-items: center;
    }

    .pos-cart h4 {
        flex: 0 0 auto;
        margin-bottom: 0;
    }

    .cart-view-items-btn {
        flex: 1 1 auto;
        min-width: 120px;
    }

    .pos-scan-hint {
        font-size: 0.76rem;
    }

    .pos-mobile-bottom-nav {
        display: none !important;
    }

    .pos-mobile-bottom-item {
        min-height: 50px;
        font-size: 0.7rem;
        padding: 0.32rem 0.16rem;
    }

    .pos-mobile-bottom-item i {
        font-size: 0.98rem;
    }

    .pos-mobile-bottom-item-scan i {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .numeric-keypad-grid {
        gap: 0.4rem;
    }

    .numeric-key {
        min-height: 48px;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .product-card {
        padding: 0.85rem;
    }

    .cart-item {
        border-radius: 12px;
        background: #f9fafb;
        border: 1px solid #e5e7eb;
        margin-bottom: 0.55rem;
    }

    .cart-items {
        padding-right: 0;
    }

    #cartItemsModal .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100dvh;
    }

    #cartItemsModal .modal-content {
        min-height: 100dvh;
        border-radius: 0;
    }

    #cartItemsModal .modal-body {
        padding-left: 0.8rem;
        padding-right: 0.8rem;
        padding-bottom: 1rem;
    }

    .cart-item-name {
        font-size: 0.9rem;
    }

    .cart-item-controls {
        gap: 0.4rem;
    }

    .cart-control-btn {
        min-width: 44px;
        min-height: 42px;
    }

    .cart-qty-display {
        min-width: 44px;
        min-height: 42px;
        border-radius: 12px;
    }

    .cart-total {
        padding: 0.9rem;
    }

    .cart-inline-input {
        width: 100px;
    }

    .cart-grand-total {
        font-size: 1.08rem;
    }
}

@media (max-width: 420px) {
    body.pwa-standalone .topbar-user-meta {
        max-width: calc(100vw - 168px);
    }

    body.pwa-standalone .topbar-logout-btn {
        width: 34px;
        min-width: 34px;
        height: 34px;
        min-height: 34px;
        font-size: 0.82rem;
    }
}

@media (min-width: 1400px) {
    :root {
        --base-font-size: 16px;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #F3F4F6;
}

::-webkit-scrollbar-thumb {
    background: #9CA3AF;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6B7280;
}
/* ====== MESSAGE & FEEDBACK SYSTEM ====== */

/* Success Messages */
.alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.05) 100%);
    border-left: 4px solid #10B981;
    border-right: 0;
    border-top: 0;
    border-bottom: 0;
    color: #047857;
    border-radius: 8px;
    animation: slideInDown 0.3s ease-out;
}

.alert-success strong {
    color: #059669;
}

/* Error Messages */
.alert-error,
.alert-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.05) 100%);
    border-left: 4px solid #EF4444;
    border-right: 0;
    border-top: 0;
    border-bottom: 0;
    color: #991B1B;
    border-radius: 8px;
    animation: slideInDown 0.3s ease-out;
}

.alert-error strong,
.alert-danger strong {
    color: #DC2626;
}

/* Warning Messages */
.alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.05) 100%);
    border-left: 4px solid #F59E0B;
    border-right: 0;
    border-top: 0;
    border-bottom: 0;
    color: #92400E;
    border-radius: 8px;
    animation: slideInDown 0.3s ease-out;
}

.alert-warning strong {
    color: #B45309;
}

/* Info Messages */
.alert-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(29, 78, 216, 0.05) 100%);
    border-left: 4px solid #3B82F6;
    border-right: 0;
    border-top: 0;
    border-bottom: 0;
    color: #1E40AF;
    border-radius: 8px;
    animation: slideInDown 0.3s ease-out;
}

.alert-info strong {
    color: #1E3A8A;
}

/* Close Button Styling */
.btn-close {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.btn-close:hover {
    opacity: 0.8;
}

.alert .btn-close {
    padding: 0.5rem;
}

/* ====== FORM FIELD FEEDBACK ====== */

/* Form Validation Styling */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #EF4444;
    border-width: 2px;
    padding-left: calc(1.5em + 0.75rem);
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: #10B981;
    border-width: 2px;
}

/* Invalid Feedback */
.invalid-feedback {
    display: block;
    color: #DC2626;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    animation: fadeIn 0.2s ease-out;
}

.invalid-feedback::before {
    content: "✗ ";
    font-weight: 700;
    margin-right: 0.25rem;
}

/* Valid Feedback */
.valid-feedback {
    display: block;
    color: #10B981;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    animation: fadeIn 0.2s ease-out;
}

.valid-feedback::before {
    content: "✓ ";
    font-weight: 700;
    margin-right: 0.25rem;
}

/* Form Group Styling */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    display: block;
}

.form-group label.required::after {
    content: " *";
    color: var(--danger-color);
    font-weight: 700;
}

/* Form Control Focus State */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Disabled Form Elements */
.form-control:disabled,
.form-select:disabled {
    background-color: #F3F4F6;
    color: #9CA3AF;
    cursor: not-allowed;
}

/* ====== FORM SUBMISSION FEEDBACK ====== */

/* Submit Button Loading State */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-loading::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 0.5rem;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

/* Field Error State */
.form-group.has-error .form-control,
.form-group.has-error .form-select {
    border-color: var(--danger-color);
}

/* Help Text */
.form-text {
    font-size: 0.875rem;
    color: #6B7280;
    margin-top: 0.25rem;
    display: block;
}

.form-text.text-danger {
    color: var(--danger-color);
}

.form-text.text-success {
    color: var(--success-color);
}

/* ====== ANIMATIONS ====== */

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ====== MODAL FEEDBACK ====== */

.modal-header {
    border-bottom: 1px solid #E5E7EB;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* Success Modal */
.modal.success .modal-header {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

/* Error Modal */
.modal.error .modal-header {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
}

/* ====== TOAST/NOTIFICATION STYLING ====== */

.toast {
    min-width: 300px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-success {
    background-color: #10B981;
    color: white;
}

.toast-error {
    background-color: #EF4444;
    color: white;
}

.toast-warning {
    background-color: #F59E0B;
    color: white;
}

.toast-info {
    background-color: #3B82F6;
    color: white;
}

/* DataTables minimal spacing only (keep default Bootstrap/DataTables look) */
.dataTables_wrapper {
    margin: 0;
}

.dataTables_wrapper .row {
    margin: 0.5rem 0;
}

/* Card Body with Tables */
.card-body .table {
    margin-bottom: 0;
}

/* Lock Screen Styles */
.locked-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.locked-screen-content {
    background: white;
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 90%;
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.locked-screen #unlockPassword {
    border: 2px solid #E5E7EB;
    transition: border-color 0.3s ease;
}

.locked-screen #unlockPassword:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.locked-screen .btn {
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.locked-screen .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Prevent interaction with locked page */
.screen-locked-mode {
    pointer-events: none;
    opacity: 0.5;
}

/* Lock button styling */
#lock-screen-btn {
    transition: all 0.3s ease;
}

#lock-screen-btn:hover {
    color: #667eea;
}

#lock-screen-btn:active {
    transform: scale(0.95);
}