/* =====================================================
   IT Inventory Management System
   Современный минималистичный дизайн
   ===================================================== */

/* CSS Variables - Light Theme */
:root {
    /* Цветовая палитра */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #0ea5e9;
    --info-light: #e0f2fe;
    
    /* Нейтральные */
    --white: #ffffff;
    --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;
    
    /* Семантические */
    --bg-body: var(--gray-100);
    --bg-sidebar: var(--white);
    --bg-card: var(--white);
    --bg-input: var(--white);
    --border-color: var(--gray-200);
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-500);
    
    /* Тени */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Радиусы */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Анимации */
    --transition: all 0.2s ease;
}

/* Dark Theme */
[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #1e3a5f;
    --success-light: #064e3b;
    --warning-light: #78350f;
    --danger-light: #7f1d1d;
    --info-light: #0c4a6e;
    
    --white: #1e293b;
    --gray-50: #1e293b;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;
    
    --bg-body: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --border-color: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-body);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: background-color 0.3s;
}

.sidebar-header {
    height: 65px;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.sidebar-logo svg {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.5rem;
    color: var(--gray-600);
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
    border-right: 3px solid var(--primary);
}

.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}

/* sidebar-footer удалён — профиль перенесён в topbar */

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 0;
    min-height: 100vh;
}

/* Header */
.page-header {
    height: 65px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
    line-height: 1.3;
}

.page-subtitle {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin: 0;
    line-height: 1.3;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

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

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: background-color 0.3s;
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--gray-50);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: background-color 0.3s;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.primary {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-icon.danger {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-icon.info {
    background: var(--info-light);
    color: var(--info);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn svg {
    width: 18px;
    height: 18px;
}

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

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

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #dc2626;
}

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-label.required::after {
    content: '*';
    color: var(--danger);
    margin-left: 0.25rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.form-control:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.375rem;
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 0.375rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-row-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: var(--gray-50);
    white-space: nowrap;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Таблицы внутри карточек (инвентаризация) */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.data-table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: var(--gray-50);
    white-space: nowrap;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Ячейка с кнопками действий.
   Раньше здесь был display:flex прямо на <td> — ячейка переставала быть
   табличной, не растягивалась на высоту строки, и нижняя линия строки
   «подпрыгивала» вверх, когда соседние ячейки занимали 2 строки текста. */
.table-actions {
    white-space: nowrap;
}
td.table-actions {
    display: table-cell;
    vertical-align: middle;
}
.table-actions > * {
    vertical-align: middle;
}
.table-actions > * + * {
    margin-left: 0.25rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: #b45309;
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-info {
    background: var(--info-light);
    color: #0284c7;
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-600);
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
}

.alert-info {
    background: var(--info-light);
    color: #075985;
}

/* Search & Filters */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-box input {
    padding-left: 2.5rem;
}

.search-box svg {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--gray-400);
}

.filter-select {
    min-width: 160px;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95);
    transition: var(--transition);
}

.modal-backdrop.active .modal {
    transform: scale(1);
}

.modal-lg {
    max-width: 700px;
}

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

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--gray-400);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--gray-600);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--gray-50);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
}

.pagination-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    background: var(--white);
    border-radius: var(--radius);
    color: var(--gray-700);
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--gray-100);
}

.pagination-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    color: var(--gray-700);
    margin: 0 0 0.5rem 0;
}

.empty-state p {
    color: var(--gray-500);
    margin: 0 0 1.5rem 0;
}

/* Timeline / History */
.timeline {
    position: relative;
    padding-left: 1.5rem;
}

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

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0.25rem;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    transform: translateX(-50%);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.timeline-content {
    background: var(--gray-50);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
}

.timeline-content strong {
    color: var(--gray-800);
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
    padding: 1rem;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo svg {
    width: 48px;
    height: 48px;
    color: var(--primary);
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0.75rem 0 0.25rem;
}

.login-logo p {
    color: var(--gray-500);
    margin: 0;
}

/* Responsive */
/* =====================================================
   RESPONSIVE STYLES
   ===================================================== */

/* Top Bar — всегда виден, содержит профиль пользователя */
.topbar {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    height: 65px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 50;
}

.mobile-logo {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--gray-900);
    display: none;
}

/* Профиль пользователя в topbar */
.topbar-user {
    margin-left: auto;
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 0.75rem;
}

.topbar-avatar {
    width: 34px;
    height: 34px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.topbar-info {
    min-width: 0;
}

.topbar-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.topbar-role {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Burger Menu Button */
.burger-menu {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--gray-700);
    flex-shrink: 0;
}

.burger-menu svg {
    width: 24px;
    height: 24px;
}

/* Mobile Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* Tablet + Phone: < 1024px - бургер-меню */
@media (max-width: 1024px) {
    .burger-menu {
        display: block;
    }

    .mobile-logo {
        display: block;
    }

    /* На мобильных скрываем имя/роль — только аватар и кнопки */
    .topbar-info {
        display: none;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 100;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-row-3 {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr !important;
        max-width: 100% !important;
    }
    
    .page-header {
        height: auto;
        min-height: 55px;
        padding: 0.75rem 1rem;
    }
}

/* Phone: < 576px - компактнее */
@media (max-width: 576px) {
    .sidebar {
        width: 260px;
    }
    
    .sidebar-header {
        height: 55px;
        padding: 0 1rem;
    }
    
    .sidebar-logo {
        font-size: 1rem;
    }
    
    .sidebar-logo svg {
        width: 26px;
        height: 26px;
    }
    
    .nav-section-title {
        padding: 0.4rem 1rem;
        font-size: 0.65rem;
    }
    
    .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        gap: 0.6rem;
    }
    
    .nav-link svg {
        width: 18px;
        height: 18px;
    }
    
    
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    
    .user-name {
        font-size: 0.85rem;
    }
    
    .user-role {
        font-size: 0.7rem;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .burger-menu {
        display: block;
    }
    
    /* Шапка */
    .page-header {
        height: auto;
        min-height: 55px;
        padding: 0.75rem 1rem;
    }
}

/* Mobile: < 768px */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        height: auto;
        padding: 1rem;
    }
    
    .page-header > div:first-child {
        width: 100%;
    }
    
    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .header-actions .btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
    
    .filters-bar {
        flex-direction: column;
    }
    
    .filters-row {
        flex-direction: column;
        width: 100%;
    }
    
    .filters-row .form-control,
    .filters-row .btn {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .search-box {
        width: 100%;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .content {
        padding: 1rem;
    }
    
    /* Таблицы */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
    
    .table th,
    .table td {
        padding: 0.625rem 0.75rem;
        font-size: 0.85rem;
    }
    
    /* Карточки */
    .card-header {
        padding: 0.875rem 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-title {
        font-size: 0.95rem;
    }
    
    /* Кнопки */
    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.85rem;
    }
    
    .btn-sm {
        padding: 0.375rem 0.625rem;
    }
    
    /* Формы */
    .form-control {
        font-size: 16px; /* Предотвращает зум на iOS */
    }
    
    /* Info grid в карточке оборудования */
    .info-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Small Mobile: < 480px */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-title {
        font-size: 1rem;
    }
    
    .page-subtitle {
        font-size: 0.7rem;
    }
    
    .header-actions .btn {
        width: 100%;
        min-width: auto;
    }
    
    .table {
        min-width: 500px;
        font-size: 0.8rem;
    }
    
    .badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* Sidebar на маленьких экранах */
    .sidebar {
        width: 280px;
    }
    
    .sidebar-logo {
        font-size: 1.1rem;
    }
    
    .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .page-header,
    .filters-bar,
    .btn,
    .table-actions,
    .burger-menu {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.w-100 { width: 100%; }
.hidden { display: none !important; }

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    display: none;
}

[data-theme="light"] .theme-toggle .icon-moon,
:root:not([data-theme]) .theme-toggle .icon-moon {
    display: block;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

/* ============================================================
   Компактные списки (fix-15)
   Класс .list-compact ставится на <div class="content"> страницы-списка.
   Собран по образцу страницы «Оборудование»: экономит вертикальное место,
   не затрагивая страницы, где класс не проставлен.
   ============================================================ */
.list-compact {
    padding: 16px 2rem;
}

.list-compact .table th {
    padding: 6px 10px;
    font-size: 0.7rem;
}

.list-compact .table td,
.list-compact .data-table td {
    padding: 5px 10px;
    font-size: 12.5px;
}

.list-compact .data-table th {
    padding: 6px 10px;
    font-size: 0.7rem;
}

/* Кругляш с инициалами в списке — меньше, иначе он задаёт высоту строки */
.list-compact .table .user-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 11px;
}

.list-compact .table td .badge,
.list-compact .data-table td .badge {
    font-size: 11px;
    padding: 2px 8px;
}

.list-compact .btn-sm {
    padding: 5px 11px;
    font-size: 12.5px;
}

.list-compact .form-control-sm {
    padding: 4px 8px;
    font-size: 12.5px;
    height: 30px;
}

/* Карточка с фильтрами над таблицей */
.list-compact .filters-card {
    margin-bottom: 10px !important;
}

.list-compact .filters-card .card-body {
    padding: 10px 14px;
}

.list-compact .filters-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.list-compact .filters-row .form-control {
    height: 32px;
    padding: 5px 10px;
    font-size: 13px;
}

.list-compact .filters-row .btn {
    padding: 6px 14px;
    font-size: 13px;
}

/* Панель фильтров/поиска над таблицей */
.list-compact .filters-bar,
.list-compact .filters-compact {
    margin-bottom: 10px;
}

.list-compact .card-header {
    padding: 8px 14px;
}

.list-compact .card + .card {
    margin-top: 10px;
}

/* «На странице» в шапке страницы */
.page-header .header-actions {
    align-items: center;
}

.list-perpage {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 12.5px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.list-perpage select {
    width: auto;
    min-width: 64px;
}

/* ============================================================
   Область таблицы с липкой строкой заголовков.
   Высоту задаёт assets/js/list-fit.js по размеру окна;
   без JS ведёт себя как обычный контейнер с прокруткой.
   ============================================================ */
.fit-scroll {
    overflow: auto;
}

.fit-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--gray-50);
}

.fit-scroll thead th::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    border-bottom: 1px solid var(--border-color);
}

/* ============================================================
   Постраничная навигация
   ============================================================ */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 14px;
    border-top: 1px solid var(--border-color);
    font-size: 12.5px;
    color: var(--text-secondary);
}

.pager__nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.pager__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 12.5px;
    text-decoration: none;
    cursor: pointer;
}

.pager__btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pager__btn.is-current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
    cursor: default;
}

.pager__btn.is-disabled {
    opacity: .35;
    pointer-events: none;
}

.pager__gap {
    padding: 0 2px;
    color: var(--text-secondary);
}

.pager__jump {
    white-space: nowrap;
}

@media (max-width: 900px) {
    .list-compact {
        padding: 12px 1rem;
    }

    .pager {
        justify-content: center;
    }

    .pager__info,
    .pager__jump {
        width: 100%;
        text-align: center;
    }
}
