:root {
    --primary: #1a56db;
    --primary-dark: #1243af;
    --primary-light: #e8f0fe;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --dark: #0f172a;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --sidebar-width: 260px;
    --sidebar-width-tablet: 220px;
    --header-height: 64px;
    --header-height-mobile: 56px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xl: 16px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --transition: all 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; letter-spacing: -0.01em; color: var(--gray-900); }
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

.text-gradient {
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Buttons ===== */
.btn {
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.25rem;
    transition: var(--transition);
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid transparent;
}

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,86,219,0.3); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #059669; border-color: #059669; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,185,129,0.3); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(239,68,68,0.3); }
.btn-outline-secondary { color: var(--gray-600); border-color: var(--gray-300); }
.btn-outline-secondary:hover { background: var(--gray-100); border-color: var(--gray-400); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; border-radius: 6px; }
.btn-header-link { color: var(--primary); background: var(--primary-light); font-size: 0.8125rem; padding: 0.375rem 0.75rem; border-radius: 6px; }
.btn-header-link:hover { background: #d0e1fd; color: var(--primary-dark); }

/* ===== Cards ===== */
.card { border: none; border-radius: var(--radius); box-shadow: var(--shadow); transition: var(--transition); background: #fff; }
.card:hover { box-shadow: var(--shadow-md); }
.card-header { background: transparent; border-bottom: 1px solid var(--gray-200); padding: 1rem 1.25rem; font-weight: 600; }
.card-header h5, .card-header h4 { margin-bottom: 0; font-size: 1rem; color: var(--gray-800); }
.card-body { padding: 1.25rem; }

/* ===== Stat Cards ===== */
.stat-card {
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.stat-card-inner {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255,255,255,0.15);
}

.stat-info { flex: 1; }
.stat-label { font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.75; margin-bottom: 0.125rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }

.stat-trend {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.12);
    flex-shrink: 0;
}

.stat-card-primary { background: linear-gradient(135deg, #1a56db 0%, #1e40af 100%); color: #fff; }
.stat-card-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: #fff; }
.stat-card-info { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); color: #fff; }
.stat-card-warning { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: #fff; }
.stat-card-purple { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); color: #fff; }
.stat-card-rose { background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%); color: #fff; }

/* ===== Modern Table ===== */
.table-modern { margin-bottom: 0; }
.table-modern thead { position: sticky; top: 0; z-index: 2; }
.table-modern thead th {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    color: var(--gray-600);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}
.table-modern tbody td { padding: 0.75rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--gray-100); font-size: 0.875rem; color: var(--gray-700); }
.table-modern tbody tr { transition: var(--transition); }
.table-modern tbody tr:hover { background: var(--gray-50); }
.table-modern tbody tr:last-child td { border-bottom: none; }
.table-modern tbody tr:nth-child(even) { background: rgba(0,0,0,0.02); }

/* ===== Status Badges ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.2rem 0.625rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-active { background: #dcfce7; color: #166534; }
.status-active .status-dot { background: #16a34a; box-shadow: 0 0 4px rgba(22,163,74,0.4); }

.status-unassigned { background: #fef2f2; color: #991b1b; }
.status-unassigned .status-dot { background: #ef4444; box-shadow: 0 0 4px rgba(239,68,68,0.4); }

.status-inactive { background: var(--gray-100); color: var(--gray-600); }
.status-inactive .status-dot { background: var(--gray-400); }

/* Legacy badge styles */
.badge { font-weight: 500; padding: 0.25em 0.65em; border-radius: 6px; font-size: 0.75rem; }
.bg-success { background: #dcfce7 !important; color: #166534 !important; }
.bg-secondary { background: var(--gray-100) !important; color: var(--gray-600) !important; }
.bg-warning { background: #fef3c7 !important; color: #92400e !important; }
.bg-danger { background: #fef2f2 !important; color: #991b1b !important; }
.bg-info { background: #eff6ff !important; color: #1e40af !important; }
.bg-primary { background: #eff6ff !important; color: #1e40af !important; }

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 0.5rem;
    border-radius: 6px;
    background: var(--gray-100);
    color: var(--gray-600);
    font-size: 0.75rem;
    font-weight: 600;
}

.pages-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0.1rem 0.5rem;
    border-radius: 6px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.board-tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.ip-badge {
    background: var(--gray-100);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--gray-600);
}

/* ===== Action Buttons ===== */
.action-btns { display: inline-flex; gap: 0.25rem; }

.btn-icon {
    width: 32px; height: 32px;
    border: none; border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition);
    background: transparent;
}

.btn-icon-edit:hover { background: var(--primary-light); color: var(--primary); }
.btn-icon-toggle:hover { background: #fef3c7; color: var(--warning); }
.btn-icon-danger:hover { background: #fef2f2; color: var(--danger); }
.btn-icon-reset:hover { background: #fef3c7; color: #d97706; }
.btn-icon-receipt:hover { background: #ecfdf5; color: var(--success); }
.btn-icon-key:hover { background: #f3e8ff; color: #7c3aed; }
.btn-icon-eye:hover { background: #dbeafe; color: #2563eb; }
.cred-box {
    font-family: "Cascadia Mono", Consolas, monospace;
    font-size: 0.85rem;
    background: var(--gray-50);
    border: 1px dashed var(--gray-300) !important;
    word-break: break-all;
}

/* ===== Activity Timeline ===== */
.activity-timeline { padding: 0.5rem 0; }

.timeline-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    position: relative;
    transition: var(--transition);
}

.timeline-item:hover { background: var(--gray-50); }

.timeline-item::before {
    content: '';
    position: absolute;
    left: 26px;
    top: 36px;
    bottom: 0;
    width: 1.5px;
    background: var(--gray-200);
}

.timeline-item:last-child::before { display: none; }

.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    margin-top: 5px;
    box-shadow: 0 0 0 3px var(--primary-light);
    z-index: 1;
    position: relative;
}

.timeline-content { flex: 1; min-width: 0; }

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.125rem;
}

.timeline-shop { font-weight: 600; font-size: 0.875rem; color: var(--gray-800); }
.timeline-time { font-size: 0.75rem; color: var(--gray-400); }

.timeline-body { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.125rem; }
.timeline-book { font-size: 0.8125rem; color: var(--gray-600); }
.timeline-badge { font-size: 0.75rem; color: var(--gray-500); background: var(--gray-100); padding: 0.0625rem 0.5rem; border-radius: 4px; }

.timeline-footer { font-size: 0.75rem; color: var(--gray-400); }
.timeline-user { color: var(--gray-400); }

/* ===== Quick Actions ===== */
.quick-actions { display: flex; flex-direction: column; gap: 0.5rem; }

.quick-action-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 10px;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

.quick-action-item:hover { background: var(--gray-50); }

.quick-action-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.quick-action-label { font-weight: 600; font-size: 0.8125rem; color: var(--gray-800); }
.quick-action-desc { font-size: 0.75rem; color: var(--gray-500); }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.show { opacity: 1; visibility: visible; }

.modal-container {
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}

.modal-sm { max-width: 400px; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 0; }
.modal-close { background: none; border: none; color: var(--gray-400); cursor: pointer; padding: 0.25rem; border-radius: 6px; }
.modal-close:hover { background: var(--gray-100); color: var(--gray-600); }

.modal-body { padding: 1.5rem; }

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.delete-icon { display: flex; justify-content: center; }

/* ===== Forms ===== */
.form-label { font-weight: 500; font-size: 0.875rem; color: var(--gray-700); margin-bottom: 0.375rem; }
.form-hint { margin-top: 0.375rem; font-size: 0.78rem; color: var(--gray-400); }

.form-control-modern {
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: var(--transition);
    background: #fff;
    color: var(--gray-800);
}

.form-control-modern:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
    outline: none;
}

.form-control-modern::placeholder { color: var(--gray-400); }

/* Legacy form control (Bootstrap compat) */
.form-control, .form-select {
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: var(--transition);
    background: #fff;
    color: var(--gray-800);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
    outline: none;
}

.form-control::placeholder { color: var(--gray-400); }

.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,0.12); }

/* ===== File Upload ===== */
.file-input-hidden { display: none; }

.file-drop-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 2px;
    transition: var(--transition);
}

.file-drop-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    cursor: pointer;
    border-radius: 10px;
    transition: var(--transition);
    color: var(--gray-500);
    font-size: 0.875rem;
    text-align: center;
}

.file-drop-label:hover { background: var(--gray-50); color: var(--gray-700); }

.file-drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(26, 86, 219, 0.05);
}

.file-drop-zone.dragover .file-drop-label { color: var(--primary); }

/* ===== Upload Progress ===== */
.upload-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0 1rem;
}
.upload-progress-bar {
    flex: 1;
    height: 8px;
    border-radius: 999px;
    background: var(--gray-100);
    overflow: hidden;
}
.upload-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: var(--primary);
    transition: width 0.2s ease;
}
.upload-progress-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    min-width: 3rem;
    text-align: right;
}

/* ===== Shop Credentials ===== */
.login-email {
    font-size: 0.85rem;
    color: var(--gray-700);
    word-break: break-all;
}
.password-mask {
    letter-spacing: 2px;
    color: var(--gray-500);
    font-size: 0.85rem;
}
.new-password-box {
    margin: 0.5rem 0 0.25rem;
    padding: 0.625rem 0.875rem;
    border: 1px dashed var(--success);
    border-radius: var(--radius);
    background: #ecfdf5;
    font-family: "Consolas", "Courier New", monospace;
    font-weight: 700;
    font-size: 1rem;
    color: var(--success);
    word-break: break-all;
}

/* ===== Shop List (Dashboard) ===== */
.shop-list { padding: 0.25rem 0; }
.shop-row {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: none;
    border-bottom: 1px solid var(--gray-100);
    background: none;
    text-align: start;
    cursor: pointer;
    transition: var(--transition);
}
.shop-row:hover { background: var(--gray-50); }
.shop-row:last-child { border-bottom: none; }
.shop-row-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #ecfdf5;
    color: var(--success);
    flex-shrink: 0;
}
.shop-row-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.shop-row-name { font-weight: 600; color: var(--gray-800); }
.shop-row-address {
    font-size: 0.8rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.shop-row-prints { font-size: 0.8rem; font-weight: 600; color: var(--primary); white-space: nowrap; }
.shop-row-arrow { color: var(--gray-400); display: grid; place-items: center; }

/* ===== Shop Detail Grid (Dashboard) ===== */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}
.detail-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; color: var(--gray-500); }
.detail-value { font-size: 0.95rem; color: var(--gray-800); }

/* ===== Upload Card ===== */
.upload-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: slideDown 0.25s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); max-height: 0; }
    to { opacity: 1; transform: translateY(0); max-height: 500px; }
}

.upload-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.upload-card-body { padding: 1.5rem; }

.book-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--primary-light);
    display: flex; align-items: center; justify-content: center;
}

.shop-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: #ecfdf5;
    display: flex; align-items: center; justify-content: center;
}

/* ===== Assign Card ===== */
.assign-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.assign-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    user-select: none;
}
.assign-card-header:hover { background: var(--gray-50); }

.expand-arrow {
    transition: transform 0.2s ease;
    color: var(--gray-400);
}
.expand-arrow.expanded {
    transform: rotate(90deg);
}

.assign-shop-icon {
    width: 34px; height: 34px;
    border-radius: 8px;
    background: #ecfdf5;
    color: var(--success);
    display: flex; align-items: center; justify-content: center;
}

.assign-count { font-size: 0.75rem; color: var(--gray-500); background: var(--gray-100); padding: 0.25rem 0.625rem; border-radius: 6px; }

.assign-card-body { padding: 0.5rem 0; }

.assign-row {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    cursor: pointer;
    transition: var(--transition);
}

.assign-row:hover { background: var(--gray-50); }
.assign-row.assigned { background: rgba(16,185,129,0.04); }
.assign-row.unassigned { background: rgba(239,68,68,0.04); }
.assign-row.inactive { opacity: 0.55; cursor: not-allowed; }
.assign-row.inactive:hover { background: inherit; }

.assign-info { flex: 1; display: flex; flex-direction: column; }
.assign-book-title { font-size: 0.875rem; font-weight: 500; color: var(--gray-800); }
.assign-book-board { font-size: 0.75rem; color: var(--gray-400); }
.assign-pages { font-size: 0.75rem; color: var(--gray-400); }

/* ===== Toggle Switch ===== */
.toggle-switch {
    width: 40px; height: 22px;
    border-radius: 11px;
    position: relative;
    cursor: pointer;
    transition: all 0.25s ease;
}

.toggle-switch.off { background: var(--gray-300); }
.toggle-switch.on { background: var(--success); }
.toggle-switch.unassigned { background: #f87171; }
.toggle-switch.disabled { background: var(--gray-200); cursor: not-allowed; }

.toggle-knob {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.25s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch.on .toggle-knob { transform: translateX(18px); }

/* ===== Board Section (Shop) ===== */


.board-section-header {
    display: flex; align-items: center; gap: 0.625rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.board-section-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
}

.board-section-title { font-size: 1rem; font-weight: 600; margin-bottom: 0; flex: 1; }
.board-section-count { font-size: 0.75rem; color: var(--gray-500); background: var(--gray-100); padding: 0.125rem 0.5rem; border-radius: 6px; }

/* ===== Book Card ===== */
.book-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.book-card-top { margin-bottom: 0.75rem; }

.book-card-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 0.75rem;
}

.book-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0;
    line-height: 1.3;
}

.book-card-meta { display: flex; gap: 1rem; margin-bottom: 1rem; }

.book-meta-item {
    display: flex; align-items: center; gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* ===== Skeleton Loading ===== */
.book-card-skeleton {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
}

.skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.skeleton-title { width: 70%; height: 18px; }
.skeleton-text { width: 50%; }
.skeleton-btn { width: 100%; height: 36px; border-radius: 6px; margin-bottom: 0; }

@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ===== Alerts ===== */
.alert-modern {
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.alert-modern.alert-success { background: #ecfdf5; color: #065f46; }
.alert-modern.alert-danger { background: #fef2f2; color: #991b1b; }
.alert-modern.alert-info { background: #eff6ff; color: #1e40af; }

/* ===== Summary Chip ===== */
.summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--gray-100);
    border-radius: 10px;
    font-size: 0.8125rem;
    color: var(--gray-600);
}

/* ===== Trend Bar ===== */
.trend-bar-track {
    height: 8px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}

.trend-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--info));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.bar-mini {
    height: 6px;
    background: linear-gradient(90deg, var(--success), #34d399);
    border-radius: 3px;
    transition: width 0.5s ease;
    flex-shrink: 0;
}

.bar-purple { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

.trend-summary { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; color: var(--gray-500); }
.trend-sep { color: var(--gray-300); }

/* ===== Page Header ===== */
.page-header {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); margin-bottom: 0.25rem; }
.page-header .page-subtitle { color: var(--gray-500); font-size: 0.875rem; margin-bottom: 0; }
.page-header-actions { display: flex; gap: 0.5rem; align-items: center; }

/* ===== Content Area ===== */
.content-area { padding: clamp(0.75rem, 3vw, 1.5rem); max-width: 1400px; margin: 0 auto; }

.content-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.content-card .card-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--gray-200); background: #fff; }
.content-card .card-body { padding: 0; }

.table-container { overflow-x: auto; }

/* ===== Loading ===== */
.loading-placeholder { color: var(--gray-400); font-size: 0.875rem; padding: 2rem; text-align: center; }
.loading-spinner { display: inline-block; width: 1.5rem; height: 1.5rem; border: 2px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Empty States ===== */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gray-400); }
.empty-state .empty-icon { margin-bottom: 0.75rem; }
.empty-state h5 { color: var(--gray-500); margin-bottom: 0.25rem; }
.empty-state p { font-size: 0.9375rem; margin-bottom: 0; color: var(--gray-400); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ===== Public Layout ===== */
.public-layout { min-height: 100vh; display: flex; flex-direction: column; }
.public-header { background: rgba(255,255,255,0.95); backdrop-filter: blur(10px); border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 100; }
.brand-text { font-size: 1.25rem; font-weight: 700; color: var(--gray-900); letter-spacing: -0.02em; line-height: 1.2; }
.brand-subtitle { font-size: 0.7rem; color: var(--gray-400); letter-spacing: 0.03em; text-transform: uppercase; }
.public-main { flex: 1; }
.public-footer { background: var(--gray-900); color: var(--gray-400); padding: 1.5rem 0; font-size: 0.8125rem; }

/* ===== Hero Section ===== */
.hero-section { position: relative; overflow: hidden; padding: 4rem 0 2rem; }
.hero-bg { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1a56db 100%); z-index: 0; }
.hero-bg::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/svg%3E"); background-size: 60px 60px; opacity: 0.5; }
.hero-particles { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 1; pointer-events: none; }
.particle { position: absolute; width: 5px; height: 5px; background: rgba(255,255,255,0.3); border-radius: 50%; animation: particleFloat 8s infinite linear; }
.hero-content { position: relative; z-index: 2; padding: 3rem 0; }
.hero-badge { display: inline-block; background: rgba(255,255,255,0.1); color: #93c5fd; padding: 0.375rem 1rem; border-radius: 20px; font-size: 0.8125rem; font-weight: 500; margin-bottom: 1.5rem; backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.1); }
.hero-title { font-size: 3rem; font-weight: 800; color: #fff; line-height: 1.15; margin-bottom: 1.25rem; letter-spacing: -0.02em; }
.hero-description { font-size: 1.125rem; color: rgba(255,255,255,0.7); max-width: 560px; line-height: 1.7; margin-bottom: 2rem; }
.hero-actions .btn-primary { padding: 0.875rem 2.5rem; font-size: 1rem; border-radius: 12px; background: #fff; color: var(--primary); border: none; font-weight: 600; box-shadow: 0 4px 20px rgba(0,0,0,0.15); display: inline-flex; align-items: center; }
.hero-actions .btn-primary:hover { background: var(--gray-100); transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,0.2); }
.hero-stats { display: flex; gap: 2.5rem; }
.hero-stat { display: flex; flex-direction: column; }
.hero-stat-value { font-size: 1.5rem; font-weight: 700; color: #fff; }
.hero-stat-label { font-size: 0.8125rem; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.05em; }

.hero-visual { position: relative; height: 400px; }
.hero-card-float { position: absolute; background: rgba(255,255,255,0.95); backdrop-filter: blur(10px); padding: 1rem 1.5rem; border-radius: var(--radius); box-shadow: var(--shadow-xl); display: flex; align-items: center; gap: 0.75rem; font-weight: 600; font-size: 0.875rem; color: var(--gray-800); animation: float 3s ease-in-out infinite; }
.card-1 { top: 20%; right: 10%; animation-delay: 0s; }
.card-2 { top: 45%; right: 5%; animation-delay: 0.5s; }
.card-3 { top: 70%; right: 15%; animation-delay: 1s; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes particleFloat { 0% { transform: translateY(0) rotate(0deg); opacity: 0; } 10% { opacity: 0.6; } 90% { opacity: 0.6; } 100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; } }

/* ===== Section Common ===== */
.section-badge { display: inline-block; background: var(--primary-light); color: var(--primary); padding: 0.25rem 1rem; border-radius: 20px; font-size: 0.8125rem; font-weight: 600; margin-bottom: 1rem; }
.section-title { font-size: 2rem; font-weight: 700; color: var(--gray-900); margin-bottom: 0.5rem; }
.section-subtitle { font-size: 1rem; color: var(--gray-500); max-width: 500px; margin: 0 auto; }

.features-section { padding: 5rem 0; background: #fff; }
.feature-card { text-align: center; padding: 2.5rem 1.5rem; border-radius: var(--radius-xl); transition: var(--transition); border: 1px solid var(--gray-100); }
.feature-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--gray-200); }
.feature-icon { width: 56px; height: 56px; border-radius: 14px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; margin: 0 auto 1.25rem; }
.feature-card h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.75rem; color: var(--gray-900); }
.feature-card p { font-size: 0.875rem; color: var(--gray-500); line-height: 1.6; margin-bottom: 1rem; }
.feature-link { font-size: 0.8125rem; font-weight: 500; color: var(--primary); }

.cta-section { padding: 4rem 0; background: var(--gray-50); }
.cta-card { background: linear-gradient(135deg, #1a56db 0%, #7c3aed 100%); border-radius: var(--radius-xl); padding: 3.5rem 4rem; box-shadow: var(--shadow-xl); }
.cta-title { font-size: 1.75rem; font-weight: 700; color: #fff; margin-bottom: 0.5rem; }
.cta-text { font-size: 1rem; color: rgba(255,255,255,0.8); margin-bottom: 0; }
.cta-card .btn-light { border-radius: 12px; font-weight: 600; display: inline-flex; align-items: center; }
.cta-card .btn-light:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.2); }

/* ===== Login Page ===== */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%); padding: 2rem 1rem; position: relative; }
.login-bg-pattern { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%231a56db' fill-opacity='0.03'%3E%3Cpath d='M20 0v40M0 20h40'/%3E%3C/g%3E%3C/svg%3E"); pointer-events: none; }
.login-card { background: #fff; border-radius: var(--radius-xl); box-shadow: 0 4px 24px rgba(0,0,0,0.08); padding: 2.5rem; width: 100%; max-width: 420px; animation: fadeIn 0.4s ease; position: relative; }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-logo { width: 56px; height: 56px; border-radius: 14px; background: var(--primary-light); display: flex; align-items: center; justify-content: center; margin: 0 auto 1.25rem; }
.login-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); margin-bottom: 0.375rem; }
.login-header p { color: var(--gray-500); font-size: 0.875rem; margin-bottom: 0; }
.input-wrapper { position: relative; }
.input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-400); pointer-events: none; }
.input-wrapper .form-control-modern { padding-left: 2.25rem; }
.btn-login { padding: 0.75rem; font-weight: 600; font-size: 0.9375rem; border-radius: 10px; background: var(--primary); border: none; display: inline-flex; align-items: center; justify-content: center; }
.btn-login:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(26,86,219,0.35); }

/* ===== Error Pages ===== */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gray-50); }
.error-code { font-size: 6rem; font-weight: 800; line-height: 1; margin-bottom: 0.5rem; letter-spacing: -0.03em; }
.error-title { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); margin-bottom: 0.5rem; }
.error-description { color: var(--gray-500); font-size: 1rem; margin-bottom: 1.5rem; }

/* ===== Viewer Layout ===== */
.viewer-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #2a2d3a;
    position: fixed;
    inset: 0;
    z-index: 1030;
}

.viewer-header {
    background: linear-gradient(180deg, #1f2230 0%, #1a1d2a 100%);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.viewer-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    flex-wrap: wrap;
}

.viewer-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.viewer-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}
.viewer-back:hover {
    color: #fff;
    background: rgba(255,255,255,0.12);
    transform: translateX(-2px);
}

.viewer-book-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, #1243af 100%);
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(26,86,219,0.35);
}

.viewer-title-block {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.viewer-eyebrow {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
}

.viewer-title {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    margin: 2px 0 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

.viewer-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.copies-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.copies-control > label {
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(255,255,255,0.6);
    margin: 0;
}

.copies-input-wrap {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
}

.copies-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 36px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 200ms ease;
}
.copies-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}
.copies-btn:first-child { border-right: 1px solid rgba(255,255,255,0.1); }
.copies-btn:last-child { border-left: 1px solid rgba(255,255,255,0.1); }

.copies-input {
    width: 48px;
    height: 36px;
    border: none;
    background: transparent;
    color: #fff;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    outline: none;
    -moz-appearance: textfield; appearance: textfield;
}
.copies-input::-webkit-outer-spin-button,
.copies-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.print-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.25rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(220,38,38,0.35);
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.print-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(220,38,38,0.45);
}
.print-btn:active { transform: translateY(0); }

/* ===== Print Settings Widget ===== */
.settings-group { position: relative; display: flex; align-items: center; }

.settings-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 200ms ease;
}
.settings-toggle:hover { background: rgba(255,255,255,0.12); color: #fff; }

.settings-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    background: #1e2232;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 6px 0;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6);
    z-index: 1100;
}
.settings-panel.open { display: block; }

.settings-panel::-webkit-scrollbar { width: 5px; }
.settings-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.settings-section { padding: 12px 16px; }

.settings-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.settings-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 0 12px;
}

/* ─── Printer Section ─── */
.printer-select-wrap { display: flex; flex-direction: column; gap: 6px; }
.printer-select-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.printer-select {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 0.78rem;
    outline: none;
    cursor: pointer;
    transition: border-color 200ms ease;
}
.printer-select:hover { border-color: rgba(255,255,255,0.2); }
.printer-select:focus { border-color: var(--primary); }
.printer-select option {
    background: #1e2232;
    color: #fff;
    padding: 4px 8px;
}

.printer-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 200ms ease;
    flex-shrink: 0;
}
.printer-refresh:hover { background: rgba(255,255,255,0.1); color: #fff; }
.printer-refresh svg.spinning { animation: spin 0.8s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.printer-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
}
.printer-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    flex-shrink: 0;
}
.printer-status-online { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.printer-status-stale { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.5); }
.printer-status-offline { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.printer-status-text.online { color: rgba(16,185,129,0.8); }
.printer-status-text.stale { color: rgba(245,158,11,0.9); }
.printer-status-text.offline { color: rgba(239,68,68,0.8); }

/* ─── Page Setup ─── */
.page-setup-row {
    display: flex;
    gap: 8px;
}
.page-setup-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.page-setup-field-label {
    font-size: 0.62rem;
    color: rgba(255,255,255,0.35);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.page-setup-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 0.75rem;
    outline: none;
    cursor: pointer;
    transition: border-color 200ms ease;
}
.page-setup-select:hover { border-color: rgba(255,255,255,0.2); }
.page-setup-select:focus { border-color: var(--primary); }
.page-setup-select option { background: #1e2232; color: #fff; }

/* ─── Scaling ─── */
.scaling-options { display: flex; flex-direction: column; gap: 3px; }
.scaling-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 150ms ease;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.7);
}
.scaling-radio:hover { background: rgba(255,255,255,0.04); }
.scaling-radio input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.25);
    border-radius: 50%;
    outline: none;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}
.scaling-radio input[type="radio"]:checked {
    border-color: var(--primary);
    background: var(--primary);
}
.scaling-radio input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: #fff;
}

.custom-scale-row {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding: 6px 8px 6px 22px;
}
.custom-scale-row input[type="range"] {
    flex: 1;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.custom-scale-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.custom-scale-input {
    width: 52px;
    padding: 4px 6px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 5px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 0.75rem;
    text-align: center;
    outline: none;
}
.custom-scale-input:focus { border-color: var(--primary); }
.custom-scale-unit {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
}

/* ─── Margins ─── */
.margin-options-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.margin-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    width: 100%;
}
.margin-btn {
    padding: 6px 2px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    background: transparent;
    color: rgba(255,255,255,0.55);
    font-size: 0.68rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    transition: all 150ms ease;
    min-width: 0;
}
.margin-btn:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.8); }
.margin-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.custom-margin-grid {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 5px 10px;
    margin-top: 8px;
}
.margin-field {
    display: flex;
    align-items: center;
    gap: 4px;
}
.margin-field-label {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.4);
    font-weight: 500;
    min-width: 38px;
}
.margin-input {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 5px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 0.72rem;
    text-align: center;
    outline: none;
    min-width: 0;
}
.margin-input:focus { border-color: var(--primary); }
.margin-unit-field { grid-column: span 2; }
.margin-unit-select {
    padding: 4px 6px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 5px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 0.72rem;
    outline: none;
    cursor: pointer;
}
.margin-unit-select option { background: #1e2232; color: #fff; }

/* ─── Zoom/Display ─── */
.zoom-control { display: flex; align-items: center; gap: 10px; }
.zoom-control input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.zoom-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.zoom-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    min-width: 38px;
    text-align: right;
}

/* ─── Pages range ─── */
.page-range-input {
    width: 100%;
    padding: 6px 10px;
    margin-top: 6px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 0.78rem;
    outline: none;
    box-sizing: border-box;
}
.page-range-input:focus { border-color: var(--primary); }
.page-range-input:disabled {
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.3);
    cursor: not-allowed;
}
.page-range-input.invalid { border-color: #e5533d; }
.page-range-input::placeholder { color: rgba(255,255,255,0.35); }
.page-range-error {
    min-height: 1em;
    font-size: 0.7rem;
    color: #e5533d;
    margin-top: 4px;
    line-height: 1.3;
}
.pages-summary {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.45);
    margin-top: 4px;
    line-height: 1.3;
}
/* ===== End Settings Widget ===== */

.pdf-container {
    position: relative;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 50% 0%, #3a3e50 0%, #2a2d3a 60%);
    scroll-behavior: smooth;
}
.pdf-container::-webkit-scrollbar { width: 10px; }
.pdf-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 5px; }
.pdf-container::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

.pdf-canvas-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    gap: 16px;
    min-height: 100%;
}

.pdf-page-canvas {
    display: block;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    background: #fff;
    max-width: 100%;
    height: auto !important;
    border-radius: 4px;
}

/* Loading state */
.pdf-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    padding: 2rem;
}

.pdf-loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2.5rem 3rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.pdf-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255,255,255,0.12);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.pdf-loading-text {
    color: rgba(255,255,255,0.8);
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 160px;
    text-align: center;
}

.pdf-loading-bar {
    width: 180px;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}
.pdf-loading-bar span {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    border-radius: 2px;
    transition: width 200ms ease;
}

/* Unauthorized state */
.viewer-unauthorized {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--gray-50);
    padding: 2rem;
}
.unauthorized-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    padding: 3rem;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 420px;
}
.unauthorized-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #fef2f2;
    color: #dc2626;
    margin-bottom: 0.5rem;
}
.unauthorized-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}
.unauthorized-card p {
    color: var(--gray-500);
    margin: 0;
}
.unauthorized-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.6rem 1.25rem;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    transition: all 200ms ease;
}
.unauthorized-back:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* Print modal */
.print-modal .modal-content {
    border: none;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.print-modal-body {
    padding: 2.5rem 2rem;
    text-align: center;
}
.print-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    margin: 0 auto 1.25rem;
}
.print-modal-icon-success {
    background: #dcfce7;
    color: #16a34a;
}
.print-modal-icon-error {
    background: #fee2e2;
    color: #dc2626;
}
.print-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.5rem;
}
.print-modal-message {
    color: var(--gray-600);
    margin: 0 0 1.5rem;
    font-size: 0.95rem;
}
.print-modal-close {
    padding: 0.6rem 2.5rem;
    border: none;
    border-radius: 10px;
    background: var(--gray-100);
    color: var(--gray-700);
    font-weight: 600;
    cursor: pointer;
    transition: all 200ms ease;
}
.print-modal-close:hover {
    background: var(--gray-200);
}

/* Viewer responsive */
@media (max-width: 768px) {
    .viewer-header-inner { padding: 0.625rem 0.875rem; gap: 0.5rem; }
    .viewer-title { max-width: 180px; font-size: 0.9rem; }
    .viewer-eyebrow { display: none; }
    .copies-control > label { display: none; }
    .print-btn span { display: none; }
    .print-btn { padding: 0.55rem 0.75rem; }
}

/* ===== Animations ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.fade-in { animation: fadeIn 0.3s ease forwards; }
.slide-in { animation: slideIn 0.3s ease forwards; }

/* ===== Print Styles ===== */
@media print {
    body * { visibility: hidden; }
    #pdfViewer, #pdfViewer * { visibility: visible; }
    #pdfViewer { position: absolute; left: 0; top: 0; width: 100%; }
    .viewer-header, .viewer-unauthorized, #printBtn, #copiesInput, .copies-input-wrap, .print-modal { display: none !important; }
    .pdf-container { background: #fff !important; overflow: visible !important; height: auto !important; }
    .pdf-page-canvas { box-shadow: none !important; page-break-after: always; max-width: 100% !important; height: auto !important; }
    .pdf-loading { display: none !important; }
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .hero-title { font-size: 2.25rem; }
    .hero-stats { gap: 1.5rem; }
    .cta-card { padding: 2.5rem 1.5rem; }
}

@media (max-width: 768px) {
    .content-area { padding: 1rem; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header-actions { width: 100%; }
    .page-header-actions .btn { flex: 1; }
    .hero-title { font-size: 1.75rem; }
    .section-title { font-size: 1.5rem; }
    .cta-title { font-size: 1.25rem; }
    .cta-card { text-align: center; }
    .cta-card .text-lg-end { text-align: center !important; }
    .hero-stat-value { font-size: 1.25rem; }
    .hero-stats { gap: 1.5rem; }
}



/* =============================================================================
   SIDEBAR NAVIGATION  (global – NOT scoped – see NavMenu.razor.css note)
   ============================================================================= */

/* ── Variables ─────────────────────────────────────────────────────────────── */
.sidebar {
    --sb-bg:          linear-gradient(180deg, #1e3a8a 0%, #1e40af 55%, #1d4ed8 100%);
    --sb-text:        rgba(255,255,255,0.72);
    --sb-text-active: #ffffff;
    --sb-hover-bg:    rgba(255,255,255,0.08);
    --sb-active-bg:   rgba(255,255,255,0.16);
    --sb-border:      rgba(255,255,255,0.10);
    --sb-ease:        cubic-bezier(0.4,0,0.2,1);
}

/* ── Shell ─────────────────────────────────────────────────────────────────── */
.sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 260px;
    background: var(--sb-bg);
    position: relative;
    overflow: hidden;
}

/* subtle dot-grid overlay */
.sidebar::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 22px 22px;
    pointer-events: none;
    z-index: 0;
}

/* keep real content above the overlay */
.sidebar > * { position: relative; z-index: 1; }

/* ── Brand ─────────────────────────────────────────────────────────────────── */
.sidebar .navbar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid var(--sb-border);
    flex-shrink: 0;
}

.sidebar .brand-icon {
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.18);
}

.sidebar .brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    letter-spacing: -0.01em;
    display: block;
}

.sidebar .brand-subtitle {
    font-size: 0.62rem;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-weight: 500;
    display: block;
    margin-top: 2px;
}

/* ── Nav scroll area ────────────────────────────────────────────────────────── */
.sidebar .sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 14px 8px;
}

.sidebar .sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.18);
    border-radius: 2px;
}

/* ── Base nav link ──────────────────────────────────────────────────────────── */
/*
  Override Bootstrap's global `a { color: var(--primary) }` which would paint
  every sidebar link blue.  We must be explicit with color AND text-decoration
  here so Bootstrap can't win the specificity race.
*/
.sidebar .nav-link,
.sidebar .sidebar-footer .nav-link {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 11px 14px !important;
    margin-bottom: 3px !important;
    border-radius: 11px !important;
    text-decoration: none !important;
    color: var(--sb-text) !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    font-size: 0.895rem !important;
    font-weight: 500 !important;
    position: relative !important;
    transition: all 0.22s var(--sb-ease) !important;
    cursor: pointer !important;
    -webkit-font-smoothing: antialiased;
}

/* ── Hover ──────────────────────────────────────────────────────────────────── */
.sidebar .nav-link:hover,
.sidebar .sidebar-footer .nav-link:hover {
    background: var(--sb-hover-bg) !important;
    color: var(--sb-text-active) !important;
    border-color: rgba(255,255,255,0.10) !important;
    transform: translateX(3px) !important;
    text-decoration: none !important;
}

/* ── ACTIVE STATE ───────────────────────────────────────────────────────────── */
.sidebar .nav-link.active,
.sidebar .sidebar-footer .nav-link.active {
    background: var(--sb-active-bg) !important;
    color: var(--sb-text-active) !important;
    font-weight: 600 !important;
    border-color: rgba(255,255,255,0.22) !important;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.12),
        0 3px 10px rgba(0,0,0,0.20) !important;
    transform: translateX(4px) !important;
    text-decoration: none !important;
}

/* left-edge accent bar */
.sidebar .nav-link.active::before,
.sidebar .sidebar-footer .nav-link.active::before {
    content: '';
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 22px;
    background: #ffffff;
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 10px rgba(255,255,255,0.50);
}

/* hover on already-active link */
.sidebar .nav-link.active:hover,
.sidebar .sidebar-footer .nav-link.active:hover {
    background: rgba(255,255,255,0.22) !important;
    transform: translateX(6px) !important;
}

/* ── Icon wrapper ───────────────────────────────────────────────────────────── */
.sidebar .nav-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 9px !important;
    flex-shrink: 0 !important;
    transition: all 0.22s var(--sb-ease) !important;
    background: transparent !important;
}

.sidebar .nav-icon svg {
    opacity: 0.75;
    transition: opacity 0.2s ease;
    display: block;
}

.sidebar .nav-link:hover   .nav-icon { background: rgba(255,255,255,0.10) !important; }
.sidebar .nav-link:hover   .nav-icon svg { opacity: 1; }
.sidebar .nav-link.active  .nav-icon {
    background: rgba(255,255,255,0.20) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    transform: scale(1.06);
}
.sidebar .nav-link.active  .nav-icon svg { opacity: 1; }
.sidebar .nav-link.active:hover .nav-icon { transform: scale(1.12) !important; }

/* ── Label ──────────────────────────────────────────────────────────────────── */
.sidebar .nav-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Active indicator dot (rendered from Blazor when active) ─────────────────── */
.sidebar .nav-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.20), 0 0 8px rgba(255,255,255,0.45);
    animation: sb-pulse 2.4s ease-in-out infinite;
}

@keyframes sb-pulse {
    0%,100% { opacity:1; transform:scale(1); }
    50%      { opacity:.75; transform:scale(1.25); }
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.sidebar .sidebar-footer {
    border-top: 1px solid var(--sb-border);
    padding: 14px;
    flex-shrink: 0;
}

.sidebar .sidebar-footer .nav-link {
    margin-bottom: 0 !important;
    background: rgba(255,255,255,0.05) !important;
    border-color: rgba(255,255,255,0.08) !important;
}

/* ── Focus ring ─────────────────────────────────────────────────────────────── */
.sidebar .nav-link:focus-visible {
    outline: 2px solid rgba(255,255,255,0.65) !important;
    outline-offset: 2px !important;
}

/* ── Reduced motion ─────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .sidebar .nav-link,
    .sidebar .nav-icon,
    .sidebar .nav-indicator {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
}



/* =============================================================================
   LOGIN PAGE  — split panel with dedicated LoginLayout (no header/footer)
   ============================================================================= */

/* ── Full-viewport shell ────────────────────────────────────────────────────── */
.lp-shell {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── LEFT: branding panel ───────────────────────────────────────────────────── */
.lp-brand-panel {
    display: none;
    position: relative;
    flex: 0 0 46%;
    background: linear-gradient(155deg, #0a1f5e 0%, #1a3a8f 40%, #1e4fd8 100%);
    overflow: hidden;
}

@media (min-width: 960px) {
    .lp-brand-panel { display: flex; align-items: center; }
}

/* dot-grid texture */
.lp-bp-grid {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.08) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}

/* ambient glow orbs */
.lp-bp-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
}
.lp-bp-glow-1 {
    width: 400px; height: 400px;
    top: -100px; left: -100px;
    background: rgba(96,165,250,0.20);
}
.lp-bp-glow-2 {
    width: 320px; height: 320px;
    bottom: -80px; right: -60px;
    background: rgba(167,139,250,0.20);
}

/* inner content */
.lp-bp-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 2.75rem;
    padding: 3rem 3.5rem;
    width: 100%;
}

/* logo row */
.lp-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.lp-logo-icon {
    width: 48px; height: 48px;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 18px rgba(0,0,0,0.22);
}

.lp-logo-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.lp-logo-sub {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.10em;
    margin-top: 3px;
}

/* tagline */
.lp-tagline h1 {
    font-size: clamp(1.8rem, 2.8vw, 2.5rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.22;
    letter-spacing: -0.025em;
    margin: 0 0 1rem;
}

.lp-gradient-text {
    background: linear-gradient(90deg, #93c5fd 0%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lp-tagline p {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.62);
    line-height: 1.72;
    max-width: 300px;
    margin: 0;
}

/* feature list */
.lp-features {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.lp-feat {
    display: flex;
    align-items: flex-start;
    gap: 13px;
}

.lp-feat-icon {
    width: 36px; height: 36px;
    border-radius: 9px;
    background: rgba(255,255,255,0.11);
    border: 1px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #93c5fd;
}

.lp-feat-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255,255,255,0.92);
    line-height: 1.3;
}

.lp-feat-desc {
    font-size: 0.76rem;
    color: rgba(255,255,255,0.48);
    margin-top: 2px;
}

.lp-bp-credit {
    margin: 0;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.28);
}

/* ── RIGHT: form panel ──────────────────────────────────────────────────────── */
.lp-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    padding: 2.5rem 1.5rem;
    overflow: hidden;
}

.lp-form-wrap {
    width: 100%;
    max-width: 400px;
}

/* mobile logo */
.lp-mobile-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2.5rem;
}

@media (min-width: 960px) { .lp-mobile-logo { display: none !important; } }

/* form header */
.lp-form-head {
    margin-bottom: 2rem;
}

.lp-form-head h2 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gray-900);
    margin: 0 0 0.3rem;
    letter-spacing: -0.025em;
}

.lp-form-head p {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0;
}

/* error banner */
.lp-error-banner {
    display: flex;
    align-items: center;
    gap: 9px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.845rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.2s ease;
}

/* fields */
.lp-field {
    margin-bottom: 1.2rem;
}

.lp-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.45rem;
    letter-spacing: 0.015em;
}

.lp-input-group {
    position: relative;
}

.lp-input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    display: flex;
    align-items: center;
    pointer-events: none;
}

.lp-input {
    width: 100%;
    padding: 0.72rem 1rem 0.72rem 2.5rem;
    border: 1.5px solid var(--gray-300);
    border-radius: 10px;
    font-size: 0.895rem;
    color: var(--gray-800);
    background: #ffffff;
    outline: none;
    transition: border-color 0.17s ease, box-shadow 0.17s ease;
    font-family: inherit;
    -webkit-appearance: none; appearance: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.lp-input::placeholder { color: var(--gray-400); }

.lp-input:hover:not(:focus) { border-color: var(--gray-400); }

.lp-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.13), 0 1px 2px rgba(0,0,0,0.04);
}

/* extras row */
.lp-extras {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0.5rem 0 1.6rem;
}

.lp-remember {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.83rem;
    color: var(--gray-600);
    cursor: pointer;
    user-select: none;
}

.lp-remember input[type="checkbox"] {
    width: 15px; height: 15px;
    border-radius: 4px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* submit */
.lp-submit {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0.82rem 1.5rem;
    background: linear-gradient(135deg, #1a56db 0%, #1e44cc 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 8px rgba(26,86,219,0.30);
}

.lp-submit:hover {
    background: linear-gradient(135deg, #1243af 0%, #1535a8 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26,86,219,0.38);
}

.lp-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(26,86,219,0.25);
}


/* =============================================================================
   GLOBAL UI ENHANCEMENTS  (no functionality change)
   ============================================================================= */

/* ── Top Header ──────────────────────────────────────────────────────────── */
.app-header {
    background: rgba(255,255,255,0.98) !important;
    border-bottom: 1px solid var(--gray-200) !important;
    box-shadow: 0 1px 0 var(--gray-100), 0 2px 8px rgba(0,0,0,0.04) !important;
}

/* breadcrumb gets a subtle "/" separator colour */
.header-breadcrumb { display: flex; align-items: center; gap: 6px; }
.breadcrumb-item { color: var(--gray-700); font-weight: 600; font-size: 0.8125rem; }

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 1.75rem;
}

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 0.2rem;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin: 0;
}

/* ── Content area ────────────────────────────────────────────────────────── */
.app-content {
    background: #f1f5f9;
    min-height: calc(100vh - var(--header-height));
}

.content-area {
    padding: 1.75rem 1.75rem 3rem;
    max-width: 1380px;
}

/* ── Stat cards — modern elevated glass & gradient aesthetic ─────────────── */
.stat-card {
    border-radius: 16px !important;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px -2px rgba(0,0,0,0.08), 0 0 0 1px rgba(255,255,255,0.18) inset !important;
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease !important;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    z-index: 2;
}

.stat-card:hover {
    transform: translateY(-5px) scale(1.015) !important;
    box-shadow: 0 20px 35px -6px rgba(0,0,0,0.18), 0 0 0 1px rgba(255,255,255,0.3) inset !important;
}

.stat-card-bg {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.15) 1.2px, transparent 1.2px);
    background-size: 16px 16px;
    pointer-events: none;
    border-radius: inherit;
    opacity: 0.8;
}

.stat-card-inner {
    position: relative;
    z-index: 1;
    padding: 1.35rem 1.5rem;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(-3deg);
}

.stat-value {
    font-size: 2.1rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em;
}

/* ── Cards & Content Cards — clean, modern, multi-layered depth ──────────── */
.card, .content-card {
    border-radius: 16px !important;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 6px 18px -4px rgba(15, 23, 42, 0.05) !important;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.card:hover, .content-card:hover {
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 12px 24px -4px rgba(15, 23, 42, 0.08) !important;
    border-color: rgba(203, 213, 225, 0.9) !important;
}

.card-header, .content-card .card-header {
    padding: 1.15rem 1.5rem !important;
    background: #ffffff !important;
    border-bottom: 1px solid rgba(241, 245, 249, 1) !important;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.01em;
    border-top-left-radius: 16px !important;
    border-top-right-radius: 16px !important;
}

/* ── Buttons — slightly rounder, more polished ───────────────────────────── */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #1e44cc 100%) !important;
    border-color: transparent !important;
    box-shadow: 0 1px 3px rgba(26,86,219,0.25) !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1243af 0%, #1535a8 100%) !important;
    box-shadow: 0 4px 14px rgba(26,86,219,0.35) !important;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-modern thead th {
    background: var(--gray-50) !important;
    font-size: 0.72rem !important;
    letter-spacing: 0.06em !important;
    color: var(--gray-500) !important;
    border-bottom: 2px solid var(--gray-200) !important;
}

.table-modern tbody tr:hover { background: #f0f4ff !important; }

/* ── Modal overlay ───────────────────────────────────────────────────────── */
.modal-container {
    border-radius: 16px !important;
    box-shadow: 0 25px 60px rgba(0,0,0,0.22) !important;
}

.modal-header {
    padding: 1.25rem 1.5rem !important;
    background: var(--gray-50) !important;
    border-bottom: 1px solid var(--gray-200) !important;
}

/* ── Form inputs ─────────────────────────────────────────────────────────── */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(26,86,219,0.12) !important;
}

/* ── User dropdown in header ─────────────────────────────────────────────── */
.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    min-width: 220px;
    padding: 0.5rem;
    background: #fff;
    border-radius: 14px !important;
    border: 1px solid var(--gray-100) !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12) !important;
    z-index: 1050;
}

.user-dropdown.show {
    display: block;
    animation: dropdownFade 0.15s ease;
}

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

.dropdown-item {
    border-radius: 8px;
    margin: 2px 8px;
    width: calc(100% - 16px) !important;
    padding: 0.55rem 0.875rem !important;
}

.dropdown-item:hover { background: var(--gray-50) !important; }

/* ── Status badges ───────────────────────────────────────────────────────── */
.status-active {
    background: #dcfce7 !important;
    color: #15803d !important;
    font-weight: 600 !important;
}

.status-inactive {
    background: var(--gray-100) !important;
    color: var(--gray-500) !important;
}

/* ── Assign card in Assignments page ─────────────────────────────────────── */
.assign-card {
    border-radius: 14px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ── Quick-action items ──────────────────────────────────────────────────── */
.quick-action-item {
    border-radius: 12px;
    border: 1px solid transparent;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.quick-action-item:hover {
    background: #f0f4ff !important;
    border-color: #dbeafe;
    transform: translateX(3px);
}

/* ── Timeline ────────────────────────────────────────────────────────────── */
.timeline-item:hover { background: #f8fafc !important; border-radius: 10px; }

/* ── Empty states ────────────────────────────────────────────────────────── */
.empty-state {
    background: #fff;
    border-radius: 14px;
    border: 1.5px dashed var(--gray-300);
    padding: 3.5rem 1rem;
}

/* ── Book cards — modern interactive showcase design ─────────────────────── */
.book-card {
    border-radius: 16px !important;
    border: 1px solid rgba(226, 232, 240, 0.85) !important;
    background: #ffffff;
    box-shadow: 0 2px 6px -1px rgba(15, 23, 42, 0.04), 0 8px 20px -4px rgba(15, 23, 42, 0.06) !important;
    padding: 1.35rem !important;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease, border-color 0.28s ease !important;
}

.book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary) 0%, #3b82f6 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.book-card:hover {
    transform: translateY(-6px) !important;
    box-shadow: 0 16px 36px -6px rgba(37, 99, 235, 0.16), 0 4px 12px -2px rgba(15, 23, 42, 0.05) !important;
    border-color: rgba(147, 197, 253, 0.8) !important;
}

.book-card:hover::before {
    opacity: 1;
}

.book-card-top {
    margin-bottom: 0.85rem;
}

.book-card-icon {
    width: 44px !important;
    height: 44px !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
    border: 1px solid rgba(191, 219, 254, 0.8) !important;
    color: var(--primary) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.85rem;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.08);
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.book-card:hover .book-card-icon {
    transform: scale(1.1) rotate(-3deg);
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%) !important;
}

.book-card-title {
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: var(--gray-900) !important;
    line-height: 1.35;
    margin-bottom: 0;
}

.book-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.15rem;
}

.book-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
}

.book-card .btn {
    border-radius: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.book-card:hover .btn-primary {
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

/* ── Modern Skeleton for Cards ───────────────────────────────────────────── */
.book-card-skeleton {
    border-radius: 16px !important;
    border: 1px solid rgba(226, 232, 240, 0.85) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03) !important;
    padding: 1.35rem !important;
    background: #ffffff;
}

.skeleton-line {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%) !important;
    background-size: 200% 100% !important;
    animation: skeletonShimmer 1.6s infinite ease-in-out !important;
    border-radius: 8px !important;
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Page-level fade-in is already defined — just make it a touch longer ─── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.app-content { animation: fadeIn 0.25s ease both; }

/* ===== Settings Page ===== */
.setting-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.setting-card-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem 1.5rem 0.75rem;
}

.setting-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
    transition: all 200ms ease;
}
.setting-icon-on {
    background: #dcfce7;
    color: #16a34a;
}
.setting-icon-off {
    background: var(--gray-100);
    color: var(--gray-400);
}

.setting-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.2rem;
}

.setting-subtitle {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin: 0;
    line-height: 1.4;
}

.setting-card-body {
    padding: 0.5rem 1.5rem 1.5rem;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.75rem 0;
    cursor: pointer;
}

.toggle-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.toggle-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
}

.toggle-hint {
    font-size: 0.78rem;
    color: var(--gray-500);
    line-height: 1.4;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--gray-300);
    border-radius: 14px;
    transition: background 200ms ease;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch.is-on .toggle-slider {
    background: var(--primary);
}

.toggle-switch.is-on .toggle-slider::after {
    transform: translateX(20px);
}

.setting-saving {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--gray-500);
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-100);
}

.setting-saving .loading-spinner {
    width: 14px;
    height: 14px;
    border-width: 2px;
}

.setting-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-100);
    font-size: 0.75rem;
}

.meta-label {
    color: var(--gray-400);
}

.meta-value {
    color: var(--gray-600);
    font-weight: 500;
}

/* ===== Print Modal Enhanced ===== */
.print-modal-state { display: flex; flex-direction: column; align-items: center; padding: 0.5rem 0; }

.print-modal-spinner {
    width: 52px;
    height: 52px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 1.25rem;
}

.print-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.5rem;
    text-align: center;
}

.print-modal-message {
    color: var(--gray-600);
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
    text-align: center;
    line-height: 1.5;
    max-width: 380px;
}

.print-job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    background: var(--gray-100);
    color: var(--gray-700);
    font-size: 0.78rem;
    font-weight: 500;
}

.meta-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.meta-dot-progress {
    background: var(--primary);
    animation: pulse 1.2s ease-in-out infinite;
}

.meta-dot-success {
    background: #16a34a;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.print-error-box {
    width: 100%;
    max-width: 380px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.print-error-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.print-error-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #991b1b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.print-error-value {
    font-size: 0.85rem;
    color: #7f1d1d;
    line-height: 1.4;
    word-break: break-word;
}

.print-help-box {
    width: 100%;
    max-width: 380px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    text-align: left;
}

.print-help-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 0.25rem;
}

.print-help-list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.8rem;
    color: var(--gray-600);
    line-height: 1.6;
}

.print-modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.print-modal-close {
    padding: 0.6rem 2rem;
    border: none;
    border-radius: 10px;
    background: var(--gray-100);
    color: var(--gray-700);
    font-weight: 600;
    cursor: pointer;
    transition: all 200ms ease;
}

.print-modal-close:hover {
    background: var(--gray-200);
}

.print-modal-close-primary {
    background: var(--primary);
    color: #fff;
}

.print-modal-close-primary:hover {
    background: var(--primary-dark);
}

/* ===== Watermark Text Editor ===== */
.watermark-placeholders {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}
.placeholder-label {
    font-size: 0.78rem;
    color: var(--gray-500);
    font-weight: 600;
}
.placeholder-tag {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.75rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
}
.watermark-editor {
    margin-bottom: 0.75rem;
}
.watermark-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--gray-300);
    border-radius: 10px;
    font-size: 0.85rem;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    color: var(--gray-800);
    background: #f8fafc;
    resize: vertical;
    outline: none;
    transition: border-color 0.17s ease, box-shadow 0.17s ease;
    line-height: 1.6;
}
.watermark-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}
.watermark-preview {
    margin-bottom: 1rem;
}
.preview-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 0.4rem;
}
.preview-box {
    padding: 0.75rem 1rem;
    background: #1e293b;
    border-radius: 10px;
    min-height: 60px;
}
.preview-line {
    font-size: 0.78rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: rgba(255,255,255,0.85);
    line-height: 1.6;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.watermark-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
/* ===== Analytics Dashboard ===== */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 900px) { .analytics-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .analytics-grid { grid-template-columns: 1fr; } }

.analytics-grid .stat-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}
.analytics-grid .stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
}
.analytics-grid .stat-card-primary .stat-icon { background: #e8f0fe; color: var(--primary); }
.analytics-grid .stat-card-success .stat-icon { background: #dcfce7; color: #16a34a; }
.analytics-grid .stat-card-purple .stat-icon  { background: #ede9fe; color: #7c3aed; }
.analytics-grid .stat-card-rose .stat-icon     { background: #fce7f3; color: #db2777; }
.analytics-grid .stat-body { min-width: 0; }
.analytics-grid .stat-label {
    font-size: 0.78rem;
    color: var(--gray-500);
    font-weight: 600;
    margin-bottom: 0.15rem;
}
.analytics-grid .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.analytics-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 768px) { .analytics-row { grid-template-columns: 1fr; } }

.analytics-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.analytics-card.full-width {
    margin-bottom: 1.5rem;
}
.analytics-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
}
.analytics-card .card-header h5 {
    font-size: 0.925rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
}

.chart-list {
    padding: 0.5rem 1.25rem 0.75rem;
}
.chart-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}
.chart-row-btn {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    border-radius: 8px;
    transition: background 0.15s ease;
}
.chart-row-btn:hover {
    background: var(--gray-50);
}
.chart-row-btn:hover .chart-label {
    color: var(--primary);
}
.chart-chevron {
    color: var(--gray-400);
    flex-shrink: 0;
    transition: transform 0.15s ease;
}
.chart-row-btn:hover .chart-chevron {
    color: var(--primary);
    transform: translateX(2px);
}
.chart-label {
    width: 180px;
    font-size: 0.83rem;
    color: var(--gray-700);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}
.chart-bar-track {
    flex: 1;
    height: 8px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}
.chart-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 4px;
}
.chart-bar-primary { background: linear-gradient(90deg, var(--primary), #60a5fa); }
.chart-bar-purple  { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.chart-value {
    width: 40px;
    text-align: right;
    font-size: 0.83rem;
    font-weight: 700;
    color: var(--gray-800);
    flex-shrink: 0;
}

.bar-chart-container {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 1.5rem 1.25rem 1rem;
    min-height: 200px;
    overflow-x: auto;
}
.bar-chart-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
    min-width: 48px;
}
.bar-chart-value {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gray-700);
}
.bar-chart-bar-wrap {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.bar-chart-bar {
    width: 60%;
    max-width: 40px;
    min-height: 4px;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, var(--primary), #60a5fa);
    transition: height 0.4s ease;
    position: relative;
    overflow: hidden;
}
.bar-chart-bar-inner {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: rgba(255,255,255,0.2);
    border-radius: 6px 6px 0 0;
}
.bar-chart-label {
    font-size: 0.68rem;
    color: var(--gray-500);
    font-weight: 500;
    white-space: nowrap;
}

.period-selector {
    display: flex;
    gap: 0.25rem;
    background: var(--gray-100);
    padding: 0.25rem;
    border-radius: 10px;
}
.period-btn {
    padding: 0.4rem 0.85rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--gray-600);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 180ms ease;
    font-family: inherit;
}
.period-btn.active {
    background: #fff;
    color: var(--gray-900);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.period-btn:hover:not(.active) { color: var(--gray-800); }

.shop-tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: #e8f0fe;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 600;
}

/* ===== User Management ===== */
.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}
.role-badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.role-admin {
    background: #fef3c7;
    color: #92400e;
}
.role-shop {
    background: #dcfce7;
    color: #166534;
}

/* ===== System Admin Pages (v2) ===== */
.search-input { position: relative; flex: 0 1 320px; }
.search-input svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-400); pointer-events: none; }
.search-input .form-control-modern { padding-left: 2.35rem; }

.filter-chips { display: inline-flex; gap: 0.375rem; }
.filter-chip {
    border: 1px solid var(--gray-200);
    background: #fff;
    color: var(--gray-600);
    border-radius: 999px;
    padding: 0.3rem 0.9rem;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.stat-card-lg .stat-value { font-size: 1.6rem; }
.stat-card-lg .stat-card-inner { padding: 1.1rem 1.4rem; }
.stat-sub { font-size: 0.7rem; opacity: 0.7; margin-top: 0.15rem; }

.avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 600;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar-xl { width: 60px; height: 60px; font-size: 1.15rem; }

.plan-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.plan-standard { background: var(--gray-100); color: var(--gray-600); }
.plan-pro { background: #ede9fe; color: #6d28d9; }
.plan-enterprise { background: #fef3c7; color: #92400e; }

.usage-pills { display: inline-flex; gap: 0.375rem; flex-wrap: wrap; }
.usage-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.75rem;
    color: var(--gray-600);
    white-space: nowrap;
}
.usage-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.usage-dot-primary { background: var(--primary); }
.usage-dot-purple { background: #8b5cf6; }
.usage-dot-warning { background: var(--warning); }

.count-badge.count-bubble {
    min-width: 30px;
    text-align: center;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
}
.count-badge.count-badge-primary { background: var(--primary); color: #fff; }

.row-selected { background: var(--primary-light) !important; }

.teacher-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}
.teacher-hero h2 { font-size: 1.3rem; }
.teacher-hero-info { flex: 1; min-width: 0; }

.key-alert { border-left: 4px solid var(--warning); }
.key-code-wrap { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.key-code {
    flex: 1;
    padding: 0.6rem 0.8rem;
    background: var(--gray-900);
    color: #e2e8f0;
    border-radius: 8px;
    font-size: 0.8rem;
    word-break: break-all;
    font-family: 'Cascadia Code', Consolas, monospace;
}

.progress-track {
    height: 6px;
    border-radius: 999px;
    background: var(--gray-100);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    transition: width 0.4s ease;
}

.snapshot-row { padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--gray-100); }
.snapshot-row:last-child { border-bottom: none; }
.snapshot-row .progress-track { margin-top: 0.5rem; }

.chart-meta { color: var(--gray-800); }
.chart-total { font-size: 1.4rem; font-weight: 700; }
.chart-total .text-muted { font-size: 0.85rem; font-weight: 400; }

.chart-viz {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 170px;
    padding: 0 2px;
}
.bar-col {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    position: relative;
    min-width: 0;
}
.bar-col .bar-value {
    display: none;
    text-align: center;
    font-size: 0.64rem;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 2px;
}
.bar-col:hover .bar-value { display: block; }
.bar-col .bar-fill {
    width: 100%;
    min-height: 2px;
    border-radius: 4px 4px 2px 2px;
    transition: filter 0.15s ease;
}
.bar-col:hover .bar-fill { filter: brightness(1.12); }
.bar-x-labels {
    display: flex;
    gap: 3px;
    padding: 0.35rem 2px 0;
}
.bar-x-label {
    flex: 1;
    text-align: center;
    font-size: 0.62rem;
    color: var(--gray-400);
}

.teacher-hero .small { line-height: 1.6; }

.tenant-mini-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 0.9rem 1rem;
    background: #fff;
    transition: var(--transition);
    height: 100%;
}
.tenant-mini-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-md); }
.tenant-mini-card .tenant-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }

.btn-icon-activate:hover { background: #dcfce7; color: var(--success); }

/* ═══════════════════════════════════════════════════════════════════════════
   MODERN DESIGN LAYER — shared across every form/modal in the system.
   Pure styling; no mark-up or behaviour changes.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --field-h: 42px;
    --accent-grad: linear-gradient(135deg, var(--primary), #4f8cff);
    --accent-grad-soft: linear-gradient(135deg, rgba(26,86,219,0.08), rgba(79,140,255,0.12));
}

/* ── Buttons: consistent sizing / radius across all pages ── */
.btn {
    height: var(--field-h);
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.btn-sm { height: 32px; border-radius: 8px; }
.btn:disabled { opacity: 0.55; transform: none !important; box-shadow: none !important; }
.btn-primary { background-image: var(--input-grad, none); }
.btn-primary,
.btn-success,
.btn-danger {
    background-image: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0));
}

/* ── Modern aligned form fields (every form in the system) ── */
.form-label {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--gray-700);
    margin-bottom: 0.45rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    letter-spacing: 0.005em;
}
.form-label .req {
    color: var(--danger);
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1;
}
.form-label .field-hint {
    font-weight: 400;
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-inline-start: auto;
}

.form-control,
.form-select,
.form-control-modern,
.input-group > .form-control,
.watermark-textarea {
    height: var(--field-h);
    border-radius: 10px;
    border: 1.5px solid var(--gray-300);
    font-size: 0.875rem;
    padding: 0 0.85rem;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.form-control:hover,
.form-select:hover,
.form-control-modern:hover {
    border-color: var(--gray-400);
}
.form-control:focus,
.form-select:focus,
.form-control-modern:focus,
.input-group:focus-within .form-control {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(26, 86, 219, 0.12);
}
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.4rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
select.form-control-modern {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.6rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
textarea.form-control,
textarea.form-control-modern,
textarea.watermark-textarea {
    height: auto;
    min-height: 110px;
    padding: 0.7rem 0.85rem;
    resize: vertical;
    line-height: 1.5;
}
textarea.watermark-textarea {
    resize: vertical;
    border: 1.5px solid var(--gray-300);
    border-radius: 10px;
    font-size: 0.875rem;
}

/* ── Fields with leading icons ── */
.field-icon-wrap { position: relative; }
.field-icon-wrap > svg {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
    transition: color 0.15s ease;
}
.field-icon-wrap:focus-within > svg { color: var(--primary); }
.field-icon-wrap .form-control,
.field-icon-wrap .form-control-modern { padding-left: 2.5rem; }

/* ── Password visibility toggle ── */
.pw-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--gray-400);
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}
.pw-toggle:hover { color: var(--gray-600); background: var(--gray-100); }
.field-icon-wrap.pw-wrap .form-control,
.field-icon-wrap.pw-wrap .form-control-modern { padding-right: 2.7rem; }

/* ── Forms inside cards: breathing room + aligned footer ── */
.card-body form,
.card-body > .row,
.modal-body > .row { align-items: start; }
.form-actions {
    display: flex;
    gap: 0.6rem;
    padding-top: 1rem;
    margin-top: 0.4rem;
    border-top: 1px dashed var(--gray-200);
}

/* ── Two-section form header (used inside modals / cards) ── */
.form-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gray-500);
    margin: 0.25rem 0 1rem;
}
.form-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-100);
}

/* ── Modern modal ── */
.modal-container {
    border-radius: 18px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 25px 60px -12px rgba(15, 23, 42, 0.35);
    overflow: hidden;
}
.modal-header {
    padding: 1.15rem 1.5rem;
    background: linear-gradient(180deg, #fbfdff, #ffffff);
    border-bottom: 1px solid var(--gray-200);
}
.modal-title {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.modal-title .modal-title-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--accent-grad);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.modal-body { padding: 1.5rem 1.5rem 0.5rem; }
.modal-actions {
    margin-top: 1.5rem;
    padding: 1rem 1.5rem 1.25rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    justify-content: flex-end;
}
.modal-actions .btn { min-width: 110px; justify-content: center; }

/* ── Toast notifications ── */
#toastContainer {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-width: min(400px, calc(100vw - 2.5rem));
    pointer-events: none;
}
.toast-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--gray-400);
    border-radius: 12px;
    box-shadow: 0 12px 28px -8px rgba(15, 23, 42, 0.25);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(24px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast-item.toast-in { opacity: 1; transform: translateX(0); }
.toast-item.toast-out { opacity: 0; transform: translateX(24px); }
.toast-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.toast-msg { flex: 1; font-size: 0.875rem; font-weight: 500; color: var(--gray-800); line-height: 1.45; align-self: center; }
.toast-close {
    border: none;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    padding: 2px;
    border-radius: 6px;
    display: flex;
}
.toast-close:hover { color: var(--gray-600); background: var(--gray-100); }
.toast-success { border-left-color: var(--success); }
.toast-success .toast-icon { background: #ecfdf5; color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-error .toast-icon { background: #fef2f2; color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-warning .toast-icon { background: #fffbeb; color: var(--warning); }
.toast-info { border-left-color: var(--info); }
.toast-info .toast-icon { background: #eff6ff; color: var(--info); }

/* ── Modern alerts (kept as inline confirmation for non-JS flows) ── */
.alert-modern {
    border-radius: 12px;
    border: 1px solid transparent;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.alert-modern.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-modern.alert-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-modern.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-modern.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* Body frozen by the devtools-blocking overlay */
.body-frozen { overflow: hidden; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVENESS (TABLETS & MOBILE)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Large Tablets / iPad Landscape (992px - 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .page-header h1 { font-size: 1.35rem; }
    .content-area { padding: 1.25rem; }
}

/* Tablets / iPad Portrait (768px - 991px) */
@media (max-width: 991px) {
    .page-header h1 { font-size: 1.25rem; }
    
    .detail-grid, .analytics-grid, .analytics-row {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Mobile Phones (up to 767px) */
@media (max-width: 767px) {
    /* Make tables responsive */
    .table-modern {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Stack teacher hero */
    .teacher-hero {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }

    /* Adjust grids for mobile */
    .detail-grid, .analytics-grid, .analytics-row {
        grid-template-columns: 1fr !important;
        gap: 0.5rem;
    }
    
    .stat-card-inner {
        padding: 1rem;
    }
    
    .quick-actions {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .quick-action-item {
        flex-direction: column;
        text-align: center;
        min-width: 100px;
    }
    
    .quick-action-desc {
        display: none; /* Hide desc on mobile to save space */
    }

    /* Modern cards */
    .card-body {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    /* Utilities for mobile padding */
    .p-4 { padding: 1rem !important; }
}

/* Very Small Phones (up to 480px) */
@media (max-width: 480px) {
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header-actions { width: 100%; }
    .page-header-actions .btn { width: 100%; justify-content: center; }
}
.student-viewer-layout.reading-mode { height: 100vh; overflow: hidden; }
