/* === Переменные === */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --light: #f1f5f9;
    --dark: #1e293b;
    --sidebar-bg: #071a29;
    --white: #ffffff;
    --border: #e2e8f0;
    --text: #334155;
    --text-muted: #64748b;
    
    --sidebar-width: 270px;
    --header-height: 75px;
    --radius: 10px;
    --shadow: 0 1px 3.8px rgba(0,0,0,0.1);
    --shadow-lg: 0 5px 7.5px rgba(0,0,0,0.1);
}

/* === Сброс === */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 17.5px;
    line-height: 1.6;
    color: var(--text);
    background: var(--light);
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

/* === Layout === */
.layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-areas:
        "header"
        "main";
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

/* === Header === */
.header {
    grid-area: header;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: var(--shadow);
    z-index: 10;
  
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.burger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: var(--dark);
    position: relative;
    min-width: 55px;
    min-height: 55px;
}

.page-title {
    font-size: 22.5px;
    font-weight: 600;
    color: var(--dark);
}

.breadcrumbs {
    display: flex;
    gap: 10px;
    font-size: 16.2px;
    color: var(--text-muted);
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--primary); }

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-box {
    position: relative;
}
.search-box input {
    padding: 10px 15px 10px 45px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 350px;
    font-size: 17.5px;
    transition: border-color 0.2s;
    background: var(--white);
}
.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}
.search-box::before {
    content: "🔍";
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 17.5px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7.5px 15px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
}
.user-menu:hover { background: var(--light); }

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex: 0 0 auto;
}

.user-avatar--photo {
    padding: 0;
    overflow: hidden;
    background: var(--light);
}

.user-avatar--photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* === Sidebar === */
.sidebar {
    background: var(--sidebar-bg);
    color: var(--white);
    overflow-y: auto;
    transition: transform 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    z-index: 100;
}
.sidebar-header {
    padding: 15px 12.5px 12.5px;
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header--stacked {
    flex-direction: column;
    gap: 10px;
    padding-bottom: 15px;
}

.logo-img {
    display: block;
    width: 70%;
    height: auto;
    object-fit: contain;
    object-position: center center;
}

.sidebar-header--stacked .logo-img {
    width: 70%;
}

.sidebar-brand-text {
    width: 70%;
    box-sizing: border-box;
    padding: 0;
    text-align: center;
    color: #fff;
    font-size: 17.5px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.sidebar-brand-text--under-logo {
    font-size: 17.5px;
    font-weight: 700;
    color: #fff;
}

.sidebar-menu {
    padding: 7.5px 10px 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    list-style: none;
}

.menu-section {
    margin-top: 7.5px;
}

.menu-section-title {
    padding: 5px 12.5px 2.5px;
    font-size: 11.2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.45);
    font-weight: 600;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 8.8px;
    padding: 6.2px 11.2px;
    color: rgba(255,255,255,0.78);
    border-radius: 7.5px;
    text-decoration: none;
    font-size: 13.8px;
    line-height: 1.2;
    transform-origin: center;
    transition:
        transform 0.22s ease,
        background 0.22s ease,
        color 0.22s ease,
        box-shadow 0.22s ease;
}

.menu-item a:hover {
    transform: scale(1.04);
    background: rgba(37, 99, 235, 0.22);
    color: var(--white);
    text-decoration: none;
    box-shadow:
        0 0 17.5px rgba(37, 99, 235, 0.35),
        0 0 5px rgba(255, 255, 255, 0.12);
}

.menu-item.active a {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 0 12.5px rgba(37, 99, 235, 0.25);
}

.menu-item.active a:hover {
    transform: scale(1.03);
    background: #3b82f6;
    box-shadow:
        0 0 20px rgba(59, 130, 246, 0.45),
        0 0 5px rgba(255, 255, 255, 0.14);
}

.menu-item .icon {
    font-size: 16.2px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    transition: transform 0.22s ease;
}

.menu-item a:hover .icon {
    transform: scale(1.08);
}

/* === Overlay (mobile menu backdrop) === */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 4900;
}

.overlay.active {
    display: block;
}

.menu-badge {
    margin-left: auto;
    background: var(--primary);
    color: white;
    font-size: 13.8px;
    padding: 2.5px 10px;
    border-radius: 12.5px;
    font-weight: 600;
}

/* Full HD и ноутбуки: компактнее боковое меню */
@media (max-width: 2400px) {
    :root {
        --sidebar-width: 240px;
    }

    .sidebar-header {
        padding: 12.5px 10px 10px;
    }

    .sidebar-menu {
        padding: 5px 7.5px 10px;
    }

    .menu-section {
        margin-top: 3.8px;
    }

    .menu-section-title {
        padding: 2.5px 10px 1px;
        font-size: 10px;
        letter-spacing: 0.4px;
    }

    .menu-item a {
        gap: 6.2px;
        padding: 3.8px 8.8px;
        font-size: 12.5px;
        line-height: 1.15;
    }

    .menu-item .icon {
        font-size: 15px;
        width: 17.5px;
    }

    .menu-badge {
        font-size: 12.5px;
        padding: 1px 7.5px;
    }
}

/* === Main content === */
.main {
    grid-area: main;
    padding: 30px;
    overflow-y: auto;
}

/* === Cards === */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 25px;
    margin-bottom: 25px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--dark);
}

/* === Stats grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(275px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-icon {
    width: 70px;
    height: 70px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 35px;
}

.stat-icon.blue { background: #dbeafe; }
.stat-icon.green { background: #d1fae5; }
.stat-icon.yellow { background: #fef3c7; }
.stat-icon.purple { background: #ede9fe; }

.stat-info h3 {
    font-size: 30px;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.stat-info p {
    font-size: 16.2px;
    color: var(--text-muted);
    margin: 0;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7.5px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 17.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    background: var(--light);
    color: var(--text);
}

.btn:hover {
    text-decoration: none;
    background: var(--border);
}

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

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

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

.btn-sm { padding: 5px 12.5px; font-size: 15px; }
.btn-lg { padding: 15px 30px; font-size: 20px; }

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

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

table th {
    background: var(--light);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 16.2px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 2.5px solid var(--border);
}

table td {
    padding: 15px;
    border-bottom: 1px solid var(--border);
}

table tr:hover td { background: var(--light); }

/* Календарь: ячейки дней не подсвечивать при наведении */
body.page-events-calendar .fc table tr:hover td,
body.page-events-calendar .fc table tr:hover th {
    background: transparent !important;
}
body.page-events-calendar .fc td.fc-day-today,
body.page-events-calendar .fc table tr:hover td.fc-day-today {
    background: var(--fc-today-bg-color, rgba(37, 99, 235, 0.18)) !important;
}

/* === Forms === */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 7.5px;
    font-weight: 500;
    font-size: 17.5px;
    color: var(--dark);
}

.form-group label .required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 12.5px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 17.5px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3.8px rgba(37, 99, 235, 0.1);
}

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

/* === Alerts === */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border-left: 5px solid;
    display: flex;
    align-items: center;
    gap: 12.5px;
}

.alert-success { background: #d1fae5; border-color: var(--success); color: #065f46; }
.alert-danger { background: #fee2e2; border-color: var(--danger); color: #991b1b; }
.alert-warning { background: #fef3c7; border-color: var(--warning); color: #92400e; }
.alert-info { background: #dbeafe; border-color: var(--primary); color: #1e40af; }

.alert[hidden] {
    display: none !important;
}

/* === Badges === */
.badge {
    display: inline-block;
    padding: 3.8px 12.5px;
    border-radius: 15px;
    font-size: 15px;
    font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* Метки «Где находится» (цвета из справочника) */
.status-badge {
    display: inline-block;
    padding: 6.2px 15px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    line-height: 1.3;
    white-space: nowrap;
}

.status-badge-compact {
    padding: 3.8px 11.2px;
    font-size: 13.8px;
    border-radius: 17.5px;
}

.status-badge.success { background: #28a745; }
.status-badge.warning { background: #ffc107; color: #212529; }
.status-badge.danger { background: #dc3545; }
.status-badge.info { background: #17a2b8; }
.status-badge.secondary { background: #6c757d; }
.status-badge.primary { background: #007bff; }
.status-badge.dark { background: #343a40; }
.status-badge.light {
    background: #f8f9fa;
    color: #212529;
    border: 1px solid #dee2e6;
}

/* === Modals (global) === */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    background: var(--white);
    margin: 0 auto;
    padding: 25px;
    width: 100%;
    max-width: 700px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    font-size: 22.5px;
    line-height: 1.3;
}

.close {
    font-size: 35px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    background: none;
    border: none;
    padding: 0 5px;
    flex-shrink: 0;
}

.form-actions {
    display: flex;
    gap: 12.5px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 25px;
}

/* === Form layout (shared across equipment pages) === */
.form-section {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.form-section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2.5px solid var(--border);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(312.5px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Пара полей даты (сдача / возврат) */
.date-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.date-row .form-group {
    margin-bottom: 0;
    min-width: 0;
}

.date-row input[type="date"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* === Sticky action panels === */
.sticky-edit-panel,
.sticky-add-panel {
    background: var(--white);
    padding: 20px 0;
    margin-bottom: 25px;
    border-bottom: 2.5px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.sticky-edit-buttons,
.sticky-add-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* === Dictionary pages === */
.dictionary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.dictionary-header h1 {
    margin: 0;
    font-size: 30px;
    color: var(--dark);
}

.dictionary-table {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.action-buttons {
    display: flex;
    gap: 7.5px;
    flex-wrap: wrap;
}

/* === Pagination === */
.pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 5px;
    text-decoration: none;
    color: var(--text);
    min-width: 50px;
    text-align: center;
}

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

.quick-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(312.5px, 1fr));
    gap: 20px;
}

/* === Mobile: tablet === */
@media (max-width: 1240px) {
    .layout {
        margin-left: 0;
    }

    .sidebar {
        transform: translateX(-100%);
        z-index: 5000;
    }

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

    .overlay.active {
        display: block;
    }

    .burger-btn {
        display: block;
        z-index: 5100;
    }

    .header {
        padding: 0 20px;
    }

    .search-box input { width: 200px; }

    body.menu-open {
        overflow: hidden;
    }

    /* При открытом меню опускаем все fixed/sticky блоки контента */
    body.menu-open .header,
    body.menu-open .sticky-edit-panel,
    body.menu-open .sticky-add-panel,
    body.menu-open .sticky-edit-panel.fixed,
    body.menu-open .sticky-add-panel.fixed,
    body.menu-open .filters-card,
    body.menu-open .card-header {
        z-index: 1 !important;
    }

    .sticky-edit-panel.fixed,
    .sticky-add-panel.fixed {
        z-index: 900 !important;
    }

    .main { padding: 20px; }

    .card { padding: 20px; }

    .card-header {
        flex-wrap: wrap;
        gap: 15px;
    }

    .sticky-edit-panel.fixed,
    .sticky-add-panel.fixed {
        left: 0 !important;
        right: 0;
        padding: 15px 20px;
    }
}

/* === Mobile: phone === */
@media (max-width: 960px) {
    html,
    body {
        overflow-x: hidden;
        max-width: 100%;
    }

    body {
        font-size: 18.8px;
    }

    .layout {
        max-width: 100%;
        overflow-x: hidden;
    }

    .header {
        padding: 0 15px;
        min-height: var(--header-height);
        gap: 10px;
        min-width: 0;
    }

    .header-left {
        min-width: 0;
        flex: 1 1 auto;
        overflow: hidden;
    }

    .header-left > div {
        min-width: 0;
        overflow: hidden;
    }

    .page-title {
        font-size: 20px;
        line-height: 1.3;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-right {
        flex-shrink: 0;
        gap: 10px;
    }

    .breadcrumbs {
        display: none;
    }

    .user-menu span:not(.user-avatar) {
        display: none;
    }

    .main {
        padding: 15px;
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
        max-width: 100%;
        overflow-x: hidden;
        min-width: 0;
    }

    .card {
        padding: 17.5px;
        margin-bottom: 17.5px;
        max-width: 100%;
        overflow-x: hidden;
    }

    .card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .card-header .card-title {
        min-width: 0;
        word-break: break-word;
    }

    .card-header .card-header-actions {
        width: 100%;
    }

    .card-header .btn,
    .card-header .pagination {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12.5px;
    }

    .stat-card {
        padding: 17.5px;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .stat-icon {
        width: 55px;
        height: 55px;
        font-size: 27.5px;
    }

    .stat-info h3 { font-size: 25px; }

    /* Touch-friendly controls */
    .btn {
        min-height: 55px;
        padding: 12.5px 20px;
    }

    .btn-sm {
        min-height: 50px;
        padding: 10px 15px;
        font-size: 16.2px;
    }

    .form-control,
    select.form-control,
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="url"],
    input[type="email"],
    input[type="tel"],
    input[type="search"],
    select,
    textarea {
        font-size: 20px; /* предотвращает зум на iOS */
    }

    .form-section {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .date-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .sticky-edit-panel,
    .sticky-add-panel {
        flex-direction: column;
        align-items: stretch;
        padding: 15px 0;
    }

    .sticky-edit-buttons,
    .sticky-add-buttons {
        width: 100%;
    }

    .sticky-edit-buttons .btn,
    .sticky-add-buttons .btn {
        flex: 1;
        justify-content: center;
    }

    .dictionary-header {
        flex-direction: column;
        align-items: stretch;
    }

    .dictionary-header h1 {
        font-size: 25px;
        min-width: 0;
        word-break: break-word;
    }

    .dictionary-header-actions {
        width: 100%;
    }

    .dictionary-header-actions .view-toggle {
        display: flex;
        max-width: 100%;
    }

    .dictionary-header-actions .view-toggle button {
        flex: 1;
    }

    .dictionary-header .btn {
        width: 100%;
        justify-content: center;
    }

    .dictionary-table {
        max-width: 100%;
        overflow-x: hidden;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    .actions-cell {
        flex-wrap: wrap;
        justify-content: center;
    }

    .actions-cell .btn {
        min-width: 55px;
    }

    /* Modals — почти на весь экран */
    .modal {
        padding: 0;
        align-items: flex-end;
    }

    .modal-content {
        max-width: 100%;
        max-height: 92vh;
        margin: 0;
        border-radius: var(--radius) var(--radius) 0 0;
        overflow-y: auto;
        padding: 20px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .modal-header h2 {
        font-size: 21.2px;
    }

    /* Grids for file previews */
    .existing-files,
    .pending-grid,
    .files-grid {
        grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)) !important;
        gap: 12.5px !important;
    }

    .filters-grid {
        grid-template-columns: 1fr !important;
    }

    /* View page */
    .view-header {
        flex-direction: column !important;
        padding: 20px !important;
    }

    /* View page — компактные кнопки в одну строку на телефоне */
    .view-actions {
        width: 100%;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 7.5px;
    }

    .view-actions .btn {
        width: auto;
        flex: 1 1 0;
        min-width: 0;
        justify-content: center;
    }

    .equipment-view .view-actions .btn-mobile-label {
        display: none;
    }

    .equipment-view .view-actions .btn {
        min-height: 55px;
        padding: 12.5px 7.5px;
        font-size: 22.5px;
        line-height: 1;
        gap: 0;
    }

    .info-grid {
        grid-template-columns: 1fr !important;
    }

    /* Responsive tables → cards */
    .table-responsive-cards thead {
        display: none;
    }

    .table-responsive-cards .table-container {
        overflow: visible;
    }

    .table-responsive-cards tbody tr {
        display: block;
        margin-bottom: 15px;
        padding: 17.5px;
        background: var(--white);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        cursor: pointer;
        max-width: 100%;
        box-sizing: border-box;
    }

    .table-responsive-cards tbody tr:hover td {
        background: transparent;
    }

    .table-responsive-cards tbody tr.child-row {
        margin-left: 0;
        border-left: 3.8px solid var(--primary);
        background: #f8fafc;
    }

    .table-responsive-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 15px;
        padding: 7.5px 0;
        border: none;
        text-align: right;
        min-width: 0;
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    .table-responsive-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 13.8px;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.4px;
        text-align: left;
        flex: 0 0 42%;
        padding-top: 2.5px;
    }

    .table-responsive-cards tbody td.td-photo,
    .table-responsive-cards tbody td.td-title,
    .table-responsive-cards tbody td.td-actions,
    .table-responsive-cards tbody td.td-no-label {
        display: block;
        text-align: left;
    }

    .table-responsive-cards tbody td.td-photo::before,
    .table-responsive-cards tbody td.td-title::before,
    .table-responsive-cards tbody td.td-actions::before,
    .table-responsive-cards tbody td.td-no-label::before {
        content: none;
    }

    .table-responsive-cards tbody td.td-photo {
        text-align: center;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 5px;
    }

    .table-responsive-cards tbody td.td-photo img,
    .table-responsive-cards tbody td.td-photo .no-image {
        margin: 0 auto;
    }

    .table-responsive-cards tbody td.td-title {
        font-size: 20px;
        font-weight: 600;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 5px;
    }

    .table-responsive-cards tbody td.td-actions {
        border-top: 1px solid var(--border);
        margin-top: 10px;
        padding-top: 15px;
    }

    .table-responsive-cards tbody td.td-actions .actions-cell,
    .table-responsive-cards tbody td.td-actions .action-buttons {
        flex-direction: row;
        justify-content: center;
    }

    .table-responsive-cards .child-indent::before {
        display: none;
    }

    .table-responsive-cards .child-indent {
        padding-left: 0 !important;
    }

    /* Equipment list: липкая панель на мобильных */
    body.page-equipment-list .equipment-list-sticky {
        position: sticky !important;
        top: 0;
        z-index: 1000;
        box-shadow: var(--shadow) !important;
        border-radius: var(--radius) !important;
        margin-bottom: 7.5px !important;
    }

    body.page-equipment-list .equipment-list-card {
        border-radius: var(--radius) !important;
        border-top: 1px solid var(--border) !important;
    }

    .filters-card,
    .filters-card + .card .card-header {
        position: static !important;
        top: auto !important;
        box-shadow: var(--shadow) !important;
        border-radius: var(--radius) !important;
        margin-bottom: 17.5px !important;
    }

    .filters-card {
        margin-bottom: 17.5px !important;
        border-bottom: 1px solid var(--border) !important;
    }

    .filters-card + .card {
        border-radius: var(--radius) !important;
        border-top: 1px solid var(--border) !important;
    }

    /* Home page */
    .quick-actions {
        display: flex;
        gap: 15px;
        flex-wrap: wrap;
    }

    .quick-actions .btn {
        flex: 1;
        min-width: 100%;
        justify-content: center;
    }

    .recent-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Cropper modal */
    .crop-controls .btn-group {
        flex-wrap: wrap;
        gap: 10px;
    }

    .crop-controls .btn-group .btn {
        flex: 1;
        min-width: calc(50% - 5px);
        justify-content: center;
    }

    .crop-container {
        max-height: min(45vh, calc(98vh - 312.5px));
    }
}

@media (max-width: 720px) {
    .search-box input {
        width: min(150px, 24vw);
        padding-left: 40px;
        font-size: 16.2px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .pagination a,
    .pagination span {
        padding: 12.5px 17.5px;
    }
}
