:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-light: #EEF2FF;
    --bg-main: #F8FAFC;
    --card-bg: #FFFFFF;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --glass-border: #E2E8F0;
    
    --sidebar-width: 180px;
    --input-bg: #FFFFFF;
    
    /* Mapping existing variables to new system for compatibility */
    --accent: var(--primary);
    --accent-hover: var(--primary-hover);
    --accent-gradient: var(--primary);
    
    --success: #15803D;
    --danger: #DC2626;
    --warning: #B45309;
    --info: #2563EB;
    
    --stat-bg: #F8FAFC;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    position: relative;
    font-size: 15px;
    font-weight: 400;
}

/* Layout */
.app-container {
    display: flex;
    width: 100%;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.brand {
    height: 88px;
    padding: 0 1.2rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
    overflow: hidden;
}

.nav-links {
    padding: 1rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    height: 42px;
    padding: 0 0.9rem;
    border-radius: 8px;
    color: #475569;
    background: transparent;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 500;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item i { font-size: 20px; width: 22px; text-align: center; flex-shrink: 0; }

.nav-item:hover {
    color: #3730A3;
    background: #F1F5F9;
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    border-left: 3px solid var(--primary);
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Header */
.top-header {
    height: 88px;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    border-bottom: 1px solid var(--glass-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex; justify-content: center; align-items: center;
    font-weight: 600;
}

main {
    padding: 1rem 1.5rem 2rem;
    flex: 1;
}

/* Page Headers */
.page-header {
    margin-bottom: 2rem;
}
.page-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

h3 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
}

h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    height: 32px;
    padding: 0 16px;
    border-radius: 4px;
    border: 1px solid transparent;
    font-family: Arial, sans-serif;
    font-weight: 400;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.btn i { font-size: 15px; }

.btn-primary {
    background: var(--primary);
    color: #FFFFFF;
}
.btn-primary:hover { 
    background: var(--primary-hover); 
}

.btn-default, .btn-secondary {
    background: #FFFFFF;
    color: #334155;
    border: 1px solid #CBD5E1;
}
.btn-default:hover, .btn-secondary:hover { background: #F8FAFC; }

.btn-danger {
    background: #FFFFFF;
    color: #DC2626;
    border: 1px solid #FCA5A5;
}

.btn-warning {
    background: #FFFFFF;
    color: #B45309;
    border: 1px solid #FCD34D;
}

/* Glass Cards -> Solid Cards */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow); overflow-x: auto;
    margin-bottom: 24px;
}

/* Dashboard Specifics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow); overflow-x: auto;
}
.stat-icon {
    width: 50px; height: 50px;
    border-radius: 4px;
    display: flex; justify-content: center; align-items: center;
    font-size: 24px;
}
.stat-info h4 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}
.stat-info .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}
.chart-container {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow); overflow-x: auto;
}
.chart-container h3 {
    margin-bottom: 24px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 0;
    overflow: visible;
}
th {
    padding: 8px 12px;
    height: 36px;
    background: var(--bg-main);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}
th:first-child { border-top-left-radius: 0; }
th:last-child { border-top-right-radius: 0; }
td {
    padding: 4px 12px;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid #F1F5F9;
    height: 36px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}
td:last-child { overflow: visible; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-main); }

/* Barcode cell — must NOT be clipped */
.barcode-cell {
    height: auto !important;
    min-height: 70px !important;
    overflow: visible !important;
    white-space: normal !important;
    text-overflow: unset !important;
    padding: 10px 9px 16px 9px !important;
    vertical-align: middle !important;
}
/* Detail table wrapper — rounded corners with safe bottom padding */
.detail-table-wrap {
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: #fff;
    overflow: hidden;
}
.detail-table-wrap table {
    border: none !important;
    border-radius: 8px !important;
    margin-bottom: 0;
    border-collapse: collapse !important;
}
.detail-table-wrap table td {
    border-bottom: 1px solid var(--glass-border) !important;
    border-top: none !important;
    border-right: none !important;
    border-left: none !important;
}
.detail-table-wrap table tr:last-child td {
    border-bottom: none !important;
}

/* Right-align the Actions column in all lists */
.glass-card table th:last-child,
.glass-card table td:last-child {
    text-align: right;
    padding-right: 24px;
}

/* 3-dot action menu */
.action-menu-wrap {
    position: relative;
    display: inline-block;
}
.action-menu-btn {
    background: transparent;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 18px;
    transition: background 0.2s, color 0.2s;
}
.action-menu-btn:hover { background: rgba(0,0,0,0.05); color: var(--text-primary); }
.action-menu-popup {
    display: none;
    position: absolute;
    right: 0;
    bottom: calc(100% + 2px);
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 9999;
    padding: 3px;
    gap: 2px;
    flex-direction: row;
}
.action-menu-wrap.open .action-menu-popup { display: flex; }
.action-menu-popup button {
    background: none;
    border: none;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: background 0.15s;
}
.action-menu-popup .am-view  { color: #10b981; }
.action-menu-popup .am-view:hover  { background: rgba(16,185,129,0.15); }
.action-menu-popup .am-edit  { color: var(--primary); }
.action-menu-popup .am-edit:hover  { background: rgba(79,70,229,0.12); }
.action-menu-popup .am-del   { color: #ef4444; }
.action-menu-popup .am-del:hover   { background: rgba(239,68,68,0.12); }

/* Forms */
.form-group { margin-bottom: 24px; }
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #334155;
}

.form-horizontal .form-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}
.form-horizontal .form-group label {
    margin-bottom: 0;
    width: 150px;
    min-width: 150px;
    text-transform: uppercase;
    font-size: 13px;
    font-weight: 500;
    white-space: normal;
    line-height: 1.2;
}
.form-horizontal .form-group input, 
.form-horizontal .form-group select, 
.form-horizontal .form-group textarea,
.form-horizontal .form-group .ts-wrapper {
    flex: 1;
    width: auto !important;
}

/* ── Universal 44px height for ALL form controls everywhere ── */
input, select, textarea,
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    height: 44px;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    padding: 0 16px;
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s ease;
    box-sizing: border-box;
}
input[type="file"], .form-group input[type="file"] {
    padding: 9px 16px;
    line-height: normal;
    cursor: pointer;
}
select, .form-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%2364748b" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px !important;
}
textarea, .form-group textarea {
    height: auto;
    min-height: 100px;
    padding: 12px 16px;
    resize: vertical;
}
/* Date inputs need special padding to show the calendar icon properly */
input[type="date"] {
    padding: 0 16px;
    cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator {
    background-image: url('data:image/svg+xml;utf8,<svg fill="%2364748b" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><path d="M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V72H48V48ZM208,208H48V88H208V208Z"/></svg>');
    cursor: pointer;
    background-size: 16px 16px;
    background-repeat: no-repeat;
    background-position: center;
}
input::placeholder, .form-group input::placeholder {
    color: var(--text-muted);
}
input:focus, select:focus, textarea:focus,
.form-group input:focus, .form-group select:focus, .form-group textarea:focus,
.ts-wrapper.focus .ts-control {
    outline: none !important;
    border-color: #94A3B8 !important;
    box-shadow: none !important;
}
/* Required field asterisk */
.form-group label[data-required]::after,
.form-group label.required::after {
    content: ' *';
    color: #DC2626;
    font-weight: 700;
}
input:invalid, select:invalid {
    border-color: #CBD5E1; /* keep neutral until submitted */
}

/* Action Buttons */
.action-btn {
    width: 36px; height: 36px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    display: inline-flex; justify-content: center; align-items: center;
    transition: background 0.2s;
}
.action-btn i { font-size: 18px; }
.action-btn.view { background: #EFF6FF; color: #2563EB; }
.action-btn.edit { background: #EEF2FF; color: #4F46E5; }
.action-btn.delete { background: #FEF2F2; color: #DC2626; }
.action-btn.archive { background: #FFF7ED; color: #EA580C; }

/* Print copies count select */
.copies-select {
    width: 72px !important;
    height: 32px !important;
    padding: 0 28px 0 10px !important;
    border: 1px solid #CBD5E1 !important;
    border-radius: 4px !important;
    background-color: #fff !important;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%2364748b" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    background-size: 14px !important;
    font-size: 13px !important;
    cursor: pointer !important;
    color: #333 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

/* Submenu */
.submenu { display: none; padding-left: 48px; padding-top: 8px; padding-bottom: 4px; }
.submenu.active { display: flex; flex-direction: column; gap: 4px; }
.submenu a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 10px;
    cursor: pointer;
    font-weight: 500;
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}
.submenu a:hover {
    color: var(--text-primary);
    background: #F1F5F9;
}
.submenu a.active {
    color: var(--primary);
    font-weight: 600;
    background: var(--primary-light);
    border-left: 3px solid var(--primary);
}

/* Popups (Notifications, User Profile, Search) */
.popup-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    min-width: 250px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    flex-direction: column;
}
.popup-menu.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}
.popup-header {
    padding: 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 15px;
}
.popup-item {
    padding: 12px 16px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}
.popup-item:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

/* ── Notification Panel ───────────────────────────────────── */
.notif-popup-panel {
    min-width: 360px !important;
    max-width: 380px !important;
    border-radius: 16px !important;
    padding: 0 !important;
    overflow: hidden;
}
.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--glass-border);
    background: var(--card-bg);
    position: sticky;
    top: 0;
    z-index: 2;
}
.notif-count-badge {
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}
.notif-action-btn {
    background: var(--bg-main);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}
.notif-action-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.notif-clear-btn:hover  { background: rgba(220,38,38,0.08); color: #DC2626; border-color: #DC2626; }
.notif-items-wrap {
    max-height: 360px;
    overflow-y: auto;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.15s;
    position: relative;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-main); }
.notif-unread { background: var(--primary-light) !important; }
.notif-unread:hover { background: #e0e7ff !important; }
.notif-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}
.notif-body { flex: 1; min-width: 0; }
.notif-message {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
}
.notif-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}
.notif-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

/* Footer */
footer {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 14px;
    border-top: 1px solid var(--glass-border);
}

.flex-between { display: flex; justify-content: space-between; align-items: center; }
.toolbar { margin-bottom: 24px; display:flex; gap:16px; }

/* Select2 Light Theme Overrides */
.select2-container--default .select2-selection--single {
    background-color: var(--input-bg) !important;
    border: 1px solid #CBD5E1 !important;
    border-radius: 4px !important;
    height: 44px !important;
    display: flex;
    align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-primary) !important;
    padding-left: 16px !important;
    line-height: 44px !important;
    font-size: 13px !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    display: none !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    background-image: url('data:image/svg+xml;utf8,<svg fill="%2364748b" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px;
    height: 44px !important;
    right: 12px !important;
    width: 20px !important;
}
.select2-dropdown {
    background-color: var(--card-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 4px !important;
    box-shadow: var(--shadow) !important;
    color: var(--text-primary) !important;
    font-size: 13px !important;
}
.select2-search--dropdown .select2-search__field {
    background-color: var(--input-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid #CBD5E1 !important;
    border-radius: 4px !important;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%2364748b" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><path d="M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"/></svg>');
    background-repeat: no-repeat;
    background-position: 10px center;
    background-size: 16px;
    padding-left: 32px !important;
}
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--primary) !important;
    color: white !important;
}
.select2-container--default .select2-results__option--selected {
    background-color: var(--primary-light) !important;
    color: var(--primary) !important;
}

/* SweetAlert2 Light Theme */
div:where(.swal2-container) div:where(.swal2-popup) {
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 18px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}
div:where(.swal2-container) h2:where(.swal2-title) {
    color: var(--text-primary) !important;
}
div:where(.swal2-container) div:where(.swal2-html-container) {
    color: var(--text-secondary) !important;
}
div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm {
    background-color: var(--primary) !important;
    border-radius: 10px !important;
}
div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel {
    background-color: #FFFFFF !important;
    color: #334155 !important;
    border: 1px solid #CBD5E1 !important;
    border-radius: 10px !important;
}

/* Hide spin buttons on number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* Status Badges */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Missing btn-success */
.btn-success {
    background: #16a34a;
    color: #FFFFFF;
}
.btn-success:hover { background: #15803d; }

/* Missing btn-info */
.btn-info {
    background: #0ea5e9;
    color: #FFFFFF;
}
.btn-info:hover { background: #0284c7; }

/* Smooth Sidebar Scrollbar */
.nav-links::-webkit-scrollbar { width: 4px; }
.nav-links::-webkit-scrollbar-track { background: transparent; }
.nav-links::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 4px; }

/* Fade-in animation for page transitions */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
main > * { animation: fadeIn 0.2s ease; }

/* Search bar active state */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-main);
    border: 1.5px solid var(--glass-border);
    border-radius: 12px;
    padding: 0 1rem;
    height: 44px;
    width: 320px;
    position: relative;
    transition: border-color 0.2s;
}
.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.search-bar i { color: var(--text-muted); font-size: 18px; flex-shrink: 0; }
.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    flex: 1;
    color: var(--text-primary);
    font-size: 14px;
}
.search-bar input:focus {
    border: none !important;
    box-shadow: none !important;
}
.search-bar input::placeholder { color: var(--text-muted); }

/* Responsive: collapse stats grid on small screens */
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
    .stats-grid { grid-template-columns: 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    main { padding: 1rem; }
}

/* ── PRINT STYLES ──────────────────────────────────────────────────── */
@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    /* Hide everything that is NOT the actual book/member detail tables */
    .sidebar,
    .top-header,
    footer,
    .page-header,
    .print-actions,
    .brand,
    .nav-links {
        display: none !important;
    }

    /* Remove the sidebar offset and make the content full width */
    .main-wrapper {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    #app-content {
        padding: 0 !important;
        margin: 0 !important;
    }

    body, .app-container {
        background: white !important;
    }

    /* Make sure the two-column flex layout prints correctly */
    #app-content > div {
        display: flex !important;
    }
}
