/* ============================================
   Базовые стили и переменные
   ============================================ */

:root {
    /* Цветовая схема как на market-potolok.ru */
    --primary: #242424;
    --primary-dark: #1a1a1a;
    --primary-light: #333333;
    --accent: #242424;
    --success: #48bb78;
    --warning: #ed8936;
    --danger: #f56565;
    --purple: #9f7aea;
    --gray: #767676;

    /* Фоны */
    --bg-main: #f7f7f7;
    --bg-light: #ffffff;
    --bg-lighter: #ffffff;
    --bg-white: #ffffff;
    --bg-hover: #f3f3f3;
    --bg-accent: #f1f1f1;

    /* Текст */
    --text-primary: #242424;
    --text-secondary: #767676;
    --text-dark: #242424;
    --text-light: #767676;

    /* Границы */
    --border: #e0e0e0;
    --border-light: #f1f1f1;
    --border-dark: #cccccc;

    /* Кнопки */
    --btn-bg: #f3f3f3;
    --btn-color: #242424;
    --btn-hover-bg: #e0e0e0;
    --btn-primary-bg: #242424;
    --btn-primary-hover-bg: #1a1a1a;
    --btn-primary-color: #ffffff;
    --btn-radius: 6px;
    --btn-height: 44px;
    --btn-padding: 12px 24px;

    /* Шрифты */
    --text-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --title-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --title-font-weight: 600;
    --font-size-base: 14px;
    --font-size-small: 12px;
    --font-size-large: 16px;

    /* Размеры */
    --sidebar-width: 260px;
    --header-height: 64px;
    --spacing-small: 8px;
    --spacing-medium: 16px;
    --spacing-large: 24px;

    /* Тени */
    --shadow-small: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.15);
    --shadow-large: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.2);

    /* Переходы */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

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

body {
    font-family: var(--text-font);
    font-size: var(--font-size-base);
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: 0.2px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--title-font);
    font-weight: var(--title-font-weight);
    color: var(--text-dark);
    margin: 0 0 15px 0;
    line-height: 1.3;
}

h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 22px; }
h4 { font-size: 18px; }
h5 { font-size: 16px; }
h6 { font-size: 14px; }

/* ============================================
   Login Page
   ============================================ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-lighter);
    background-image:
        linear-gradient(45deg, var(--border-light) 25%, transparent 25%),
        linear-gradient(-45deg, var(--border-light) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--border-light) 75%),
        linear-gradient(-45deg, transparent 75%, var(--border-light) 75%);
    background-size: 60px 60px;
    background-position: 0 0, 0 30px, 30px -30px, -30px 0px;
}

.login-container {
    width: 100%;
    max-width: 480px;
    padding: 20px;
}

.login-box {
    background: var(--bg-white);
    border-radius: 0;
    padding: 50px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header .logo {
    font-size: 48px;
    margin-bottom: 15px;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    color: var(--primary);
    font-weight: var(--title-font-weight);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.test-accounts-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-align: center;
}

.test-accounts {
    display: grid;
    gap: 8px;
    font-size: 12px;
}

.test-account {
    padding: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    text-align: center;
}

/* ============================================
   Header
   ============================================ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-large);
    z-index: 100;
    box-shadow: var(--shadow-small);
    transition: var(--transition-fast);
}

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

.logo-image {
    height: 40px;
    width: auto;
}

.logo-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0;
}

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

/* Online Status Indicator */
.online-status {
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.online-status.online {
    background: #E8F5E9;
    color: #2E7D32;
}

.online-status.offline {
    background: #FFEBEE;
    color: #C62828;
    animation: pulse 2s infinite;
}

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

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============================================
   Main Container
   ============================================ */

.main-container {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    padding: 0;
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: 0;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.03);
}

.sidebar-nav ul {
    list-style: none;
    padding: 15px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 16px var(--spacing-large);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    color: var(--text-primary);
    font-weight: 400;
    font-size: var(--font-size-base);
    border-left: 4px solid transparent;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.nav-item.active {
    background: var(--bg-accent);
    border-left-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active .nav-icon {
    color: var(--primary);
}

.nav-icon {
    font-size: 22px;
    margin-right: var(--spacing-medium);
    width: 28px;
    text-align: center;
    transition: var(--transition-fast);
}

.nav-label {
    flex: 1;
    font-size: var(--font-size-base);
    font-family: var(--text-font);
    letter-spacing: 0.3px;
}

.nav-separator {
    height: 1px;
    background: var(--border-light);
    margin: 15px 25px;
}

.badge {
    background: var(--primary);
    color: var(--bg-white);
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 3px;
    font-weight: 600;
    min-width: 22px;
    text-align: center;
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px;
}

/* ============================================
   Actions Panel
   ============================================ */

.actions-panel {
    background: var(--bg-white);
    border-radius: 0;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.actions-panel:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.search-box {
    flex: 1;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: var(--btn-radius);
    font-size: 14px;
    font-family: var(--text-font);
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(62, 62, 62, 0.1);
}

.filters {
    display: flex;
    gap: 10px;
}

.filter-select {
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

/* ============================================
   Tasks Grid
   ============================================ */

.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.task-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s;
    cursor: pointer;
}

.task-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.task-number {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
}

.task-title {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-primary);
    font-weight: 600;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-secondary);
}

.meta-item .icon {
    font-size: 14px;
}

.task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.assignee {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

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

.task-counters {
    display: flex;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.no-tasks {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 16px;
}

.error {
    text-align: center;
    padding: 40px;
    color: var(--danger);
}

/* ============================================
   Status Badges
   ============================================ */

.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-new {
    background: #E3F2FD;
    color: #1976D2;
}

.status-in-assembly {
    background: #FFF3E0;
    color: #F57C00;
}

.status-assembled {
    background: #E8F5E9;
    color: #388E3C;
}

.status-moderation {
    background: #FFEBEE;
    color: #D32F2F;
}

.status-courier-assigned {
    background: #F3E5F5;
    color: #7B1FA2;
}

.status-shipped {
    background: #ECEFF1;
    color: #455A64;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    padding: var(--btn-padding);
    height: var(--btn-height);
    border-radius: var(--btn-radius);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    font-family: var(--text-font);
    text-transform: none;
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

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

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-color);
    box-shadow: var(--shadow-small);
}

.btn-primary:hover:not(:disabled) {
    background: var(--btn-primary-hover-bg);
    box-shadow: var(--shadow-medium);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--shadow-small);
}

.btn-secondary {
    background: var(--btn-bg);
    color: var(--btn-color);
    border: 1px solid var(--border-dark);
    box-shadow: var(--shadow-small);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--text-dark);
    box-shadow: var(--shadow-medium);
    transform: translateY(-1px);
}

.btn-secondary:active:not(:disabled) {
    transform: translateY(0);
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-danger:active:not(:disabled) {
    transform: translateY(0);
}

.btn-small {
    padding: 4px 16px;
    height: 36px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    text-decoration: none;
}

.btn-remove {
    background: var(--danger);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
}

/* ============================================
   Forms
   ============================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: var(--title-font-weight);
    font-size: 13px;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--btn-radius);
    font-size: 14px;
    font-family: var(--text-font);
    transition: var(--transition);
    background: var(--bg-white);
    color: var(--text-primary);
    height: var(--btn-height);
}

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
    background: var(--bg-white);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: var(--primary-light);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23767676' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

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

.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.error-message {
    padding: 12px;
    background: #FFEBEE;
    color: #D32F2F;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
    display: none;
}

.error-message.active {
    display: block;
}

/* ============================================
   Items Table
   ============================================ */

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

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

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

.items-table th {
    font-weight: 600;
    background: var(--bg-light);
}

.items-table input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* ============================================
   Modal
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-dialog {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.modal-dialog.modal-large {
    max-width: 900px;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    overflow: hidden;
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: var(--bg-lighter);
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.modal-header h2 {
    font-size: 22px;
    margin: 0;
    font-weight: var(--title-font-weight);
    color: var(--text-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    transition: var(--transition);
    padding: 5px 10px;
}

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

.modal-body {
    padding: 30px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    background: var(--bg-lighter);
}

/* ============================================
   Tabs
   ============================================ */

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    margin: -30px -30px 0 -30px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    position: sticky;
    top: -30px;
    background: white;
    z-index: 10;
}

.tab {
    padding: 15px 20px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

#tabContent {
    padding-top: 20px;
}

/* ============================================
   Info Grid
   ============================================ */

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.info-section {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 8px;
}

.info-section.full-width {
    grid-column: 1 / -1;
}

.info-section h3 {
    font-size: 14px;
    margin-bottom: 15px;
    font-weight: 600;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid white;
    font-size: 14px;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .label {
    color: var(--text-secondary);
}

.comment-box {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin: 0;
}

/* ============================================
   Data Table
   ============================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

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

.data-table th {
    background: var(--bg-light);
    font-weight: 600;
}

.data-table tfoot td {
    font-weight: 600;
    background: var(--bg-light);
}

/* ============================================
   Cargo Info
   ============================================ */

.cargo-info {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
    margin-top: 15px;
}

/* ============================================
   Files
   ============================================ */

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.file-card {
    background: var(--bg-light);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-preview {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
}

.file-icon {
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: white;
    border-radius: 6px;
}

.file-name {
    font-weight: 600;
    font-size: 14px;
    word-break: break-word;
}

.file-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.file-actions {
    display: flex;
    gap: 10px;
}

.file-upload-section {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.file-upload-section .btn {
    margin-bottom: 10px;
}

.file-upload-section small {
    display: block;
    color: var(--text-secondary);
}

.files-preview {
    margin-top: 15px;
}

.files-preview-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--bg-light);
    border-radius: 6px;
    font-size: 13px;
}

.file-preview-item .file-icon {
    font-size: 18px;
}

.file-preview-item .file-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-preview-item .file-size {
    color: var(--text-secondary);
    font-size: 12px;
}

/* ============================================
   Comments
   ============================================ */

.comments-list {
    margin: 15px 0;
}

.comment {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.comment.pending-sync {
    background: #FFF9E6;
    border-left: 3px solid var(--warning);
}

.sync-indicator {
    font-size: 12px;
    color: var(--warning);
    font-weight: 500;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-author .avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.comment-author .name {
    font-weight: 600;
}

.comment-author .role {
    color: var(--text-secondary);
    font-size: 12px;
}

.comment-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.comment-body {
    font-size: 14px;
    line-height: 1.6;
}

.comment-form {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ============================================
   Timeline
   ============================================ */

.timeline {
    margin-top: 15px;
}

.timeline-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    position: relative;
}

.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 9px;
    top: 40px;
    bottom: -15px;
    width: 2px;
    background: var(--border);
}

.timeline-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

.timeline-content {
    flex: 1;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.timeline-header strong {
    font-weight: 600;
}

.timeline-header .time {
    font-size: 12px;
    color: var(--text-secondary);
}

.timeline-details {
    font-size: 13px;
    color: var(--text-secondary);
}

.timeline-details em {
    font-style: italic;
}

/* ============================================
   Pagination
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.pagination-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============================================
   Utilities
   ============================================ */

.text-muted {
    color: var(--text-secondary);
}

/* ============================================
   Admin Panel & Statistics
   ============================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 28px;
    margin: 0;
}

.table-container {
    background: var(--bg-white);
    border-radius: 0;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
    border: 1px solid var(--border);
}

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

.users-table th,
.users-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.users-table th {
    background: var(--bg-lighter);
    font-weight: var(--title-font-weight);
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: var(--title-font);
}

.users-table tbody tr {
    transition: var(--transition);
}

.users-table tbody tr:hover {
    background: var(--bg-light);
}

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

.users-table .user-inactive {
    opacity: 0.5;
}

.actions-cell {
    white-space: nowrap;
}

.role-badge {
    padding: 5px 12px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.role-badge.role-admin {
    background: #FF5722;
    color: white;
}

.role-badge.role-manager {
    background: #2196F3;
    color: white;
}

.role-badge.role-warehouse {
    background: #FF9800;
    color: white;
}

.role-badge.role-courier {
    background: #9C27B0;
    color: white;
}

.status-active {
    color: var(--success);
    font-weight: 600;
}

.status-inactive {
    color: var(--danger);
    font-weight: 600;
}

.status-online {
    color: #059669;
    font-weight: 600;
}

.status-offline {
    color: #6b7280;
    font-weight: 600;
}

.checkbox-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}

.checkbox-filter input[type="checkbox"] {
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.modal-small .modal-dialog {
    max-width: 400px;
}

.modal-fullscreen .modal-dialog {
    max-width: 90vw;
    max-height: 90vh;
}

.image-viewer-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    max-height: 70vh;
    background: #000;
    padding: 0;
}

.image-viewer-body img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

/* User Stats */
.user-stats {
    padding: 10px 0;
}

.stats-header {
    text-align: center;
    margin-bottom: 30px;
}

.stats-header h3 {
    font-size: 22px;
    margin-bottom: 5px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-card {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Dashboard Statistics */
.stats-dashboard {
    padding: 0;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card-large {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.2s;
}

.stat-card-large:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 48px;
    opacity: 0.8;
}

.stat-content {
    flex: 1;
}

.stat-value-large {
    font-size: 42px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label-large {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

.text-center {
    text-align: center;
}

/* Cargo Form */
.cargo-form {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
}

.cargo-form .form-control {
    width: 100%;
}

.cargo-form .form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.cargo-form .form-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.form-actions {
    margin-top: 20px;
    text-align: right;
}

/* Places input */
#dimensionsContainer {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
}

#dimensionsContainer h4 {
    margin-bottom: 15px;
    font-size: 16px;
    color: var(--text);
}

.place-row {
    margin-bottom: 15px;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.place-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.place-header strong {
    font-size: 14px;
    color: var(--text);
}

.place-fields {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.form-group-inline {
    display: flex;
    flex-direction: column;
}

.form-group-inline label {
    font-size: 12px;
    margin-bottom: 5px;
    color: var(--text-light);
}

.form-group-inline .form-control {
    padding: 8px;
    font-size: 14px;
}

/* Places view mode */
.places-view {
    margin-top: 8px;
}

.place-view-item {
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 14px;
}

.place-view-item strong {
    color: var(--primary);
    margin-right: 8px;
}

/* Mobile adjustments for places */
@media (max-width: 768px) {
    .place-fields {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Collection Progress
   ============================================ */

.collection-progress {
    margin: 15px 0 20px 0;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
}

.collection-progress .progress-info {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #66BB6A);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

/* Collection checkboxes */
.collection-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.items-collection-table tbody tr {
    transition: background-color 0.2s ease;
}

.items-collection-table tbody tr.item-collected {
    background-color: #E8F5E9 !important;
    opacity: 0.8;
}

.items-collection-table tbody tr.item-collected td {
    text-decoration: line-through;
    color: var(--text-light);
}

.items-collection-table tbody tr.item-collected td:first-child {
    text-decoration: none;
}

.items-collection-table tbody tr.item-collected .collection-checkbox {
    text-decoration: none;
}

/* ============================================
   Bulk Import & Calendar
   ============================================ */

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.bulk-import-help {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.bulk-import-help h4 {
    margin-bottom: 10px;
    font-size: 16px;
}

.bulk-import-help p {
    margin-bottom: 8px;
}

.example-box {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-family: monospace;
    font-size: 13px;
    margin-top: 10px;
    line-height: 1.6;
}

.bulk-preview {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.bulk-preview h4 {
    margin-bottom: 15px;
    font-size: 16px;
}

.bulk-preview .items-table {
    margin-bottom: 10px;
}

/* PDF Upload Zone */
.pdf-upload-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: var(--bg-light);
    transition: all 0.3s ease;
    cursor: pointer;
}

.pdf-upload-zone:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.pdf-upload-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.upload-text {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--text);
}

.upload-subtext {
    font-size: 14px;
    color: var(--text-muted);
    margin: 10px 0;
}

.upload-status {
    margin-top: 20px;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
}

.upload-status:empty {
    display: none;
}

.quick-dates {
    margin-top: 20px;
}

.quick-dates h4 {
    margin-bottom: 10px;
    font-size: 14px;
}

.quick-dates button {
    margin-right: 10px;
    margin-bottom: 10px;
}

/* ============================================
   Hamburger Menu
   ============================================ */

.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-right: 15px;
    z-index: 1001;
}

.hamburger-menu span {
    width: 100%;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger-menu.active span:nth-child(1) {
    transform: translateY(11px) rotate(45deg);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: translateY(-11px) rotate(-45deg);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    /* Login page mobile */
    .login-container {
        padding: 15px;
    }

    .login-box {
        padding: 30px 20px;
    }

    .login-header h1 {
        font-size: 20px;
    }

    .test-accounts {
        font-size: 11px;
    }

    /* Hamburger menu visible on mobile */
    .hamburger-menu {
        display: flex;
    }

    /* Hide logo text on very small screens */
    .logo {
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Header adjustments */
    .header {
        padding: 0 10px;
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
    }

    .header-left {
        display: contents;
    }

    .hamburger-menu {
        grid-column: 1;
    }

    .logo {
        grid-column: 2;
        text-align: center;
        justify-self: center;
    }

    .header-right {
        grid-column: 3;
        gap: 8px;
    }

    .user-name {
        display: none;
    }

    .logo-text {
        display: none;
    }

    /* Sidebar mobile behavior */
    .sidebar {
        position: fixed;
        left: -260px;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        width: var(--sidebar-width);
        z-index: 1000;
        transition: left 0.3s;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .sidebar .nav-label,
    .sidebar .badge {
        display: inline-block;
    }

    /* Main content takes full width */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 15px 10px;
    }

    /* Task cards in single column */
    .tasks-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Actions panel stacked */
    .actions-panel {
        flex-direction: column;
        gap: 10px;
    }

    .search-box {
        width: 100%;
    }

    .filters {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }

    .filter-select {
        width: 100%;
    }

    /* Info grid single column */
    .info-grid {
        grid-template-columns: 1fr;
    }

    /* Form rows single column */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* Stats overview single column */
    .stats-overview {
        grid-template-columns: 1fr;
    }

    /* Table horizontal scroll */
    .table-container {
        overflow-x: auto;
    }

    /* Modal adjustments */
    .modal {
        align-items: center;
        padding: 10px 0;
    }

    .modal-dialog {
        max-width: 100%;
        width: 100%;
        max-height: min(90vh, 90dvh);
        margin: 0 auto;
        border-radius: 8px;
    }

    .modal-content {
        border-radius: 8px;
        max-height: min(90vh, 90dvh);
    }

    .modal-body {
        padding: 15px;
        overflow-y: auto;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-header {
        padding: 15px;
        flex-shrink: 0;
    }

    .modal-footer {
        padding: 15px;
        flex-shrink: 0;
    }

    /* Tabs: horizontal scroll на mobile + sticky под хедером */
    .tabs {
        padding: 0 10px;
        margin: -15px -15px 0 -15px;
        gap: 5px;
        flex-shrink: 0;
        position: sticky;
        top: -15px;
        background: white;
        z-index: 10;
    }

    /* Контент под табами - отступ чтобы не скрывался */
    .tab-content {
        padding-top: 10px;
    }

    .tabs::-webkit-scrollbar {
        height: 3px;
    }

    .tabs::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 3px;
    }

    .tab {
        padding: 12px 15px;
        font-size: 13px;
    }

    .modal-fullscreen .modal-dialog {
        max-width: 100%;
        max-height: 100vh;
        margin: 0;
    }

    .image-viewer-body {
        max-height: 80vh;
    }

    .image-viewer-body img {
        max-height: 80vh;
    }

    /* Items table mobile */
    .items-table-container {
        overflow-x: auto;
    }

    .items-table {
        min-width: 500px;
    }

    /* Files grid mobile */
    .files-grid {
        grid-template-columns: 1fr;
    }

    /* Button groups wrap */
    .btn-group {
        flex-wrap: wrap;
    }

    /* Admin table mobile */
    .users-table {
        min-width: 600px;
    }

    /* Pagination mobile */
    .pagination-controls {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }

    .pagination-info {
        width: 100%;
        text-align: center;
        order: -1;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    /* Login page extra small */
    .login-container {
        padding: 10px;
    }

    .login-box {
        padding: 25px 15px;
    }

    .login-header .logo {
        font-size: 36px;
    }

    .login-header h1 {
        font-size: 18px;
    }

    .login-header p {
        font-size: 12px;
    }

    /* Main app extra small */
    .logo {
        font-size: 12px;
        max-width: 150px;
    }

    .user-role {
        display: none;
    }

    .btn-small {
        padding: 6px 10px;
        font-size: 12px;
    }

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

    .stat-card-large {
        padding: 20px;
    }

    .stat-value-large {
        font-size: 32px;
    }

    .stat-icon {
        font-size: 36px;
    }
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid var(--primary);
    min-width: 320px;
}

.toast.toast-success {
    border-left-color: var(--success);
}

.toast.toast-error {
    border-left-color: var(--danger);
}

.toast.toast-warning {
    border-left-color: var(--warning);
}

.toast.toast-info {
    border-left-color: var(--primary);
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}

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

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    white-space: pre-wrap;
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
    transition: background-color 0.2s;
}

.toast-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

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

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

.toast.removing {
    animation: slideOut 0.3s ease-out forwards;
}

@media (max-width: 768px) {
    .toast-container {
        top: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .toast {
        min-width: 0;
    }
}

/* ============================================
   Dialog (Confirm/Prompt)
   ============================================ */

.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dialog-overlay.active {
    opacity: 1;
}

.dialog-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.dialog-overlay.active .dialog-box {
    transform: scale(1);
}

.dialog-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.dialog-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.dialog-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.dialog-body p {
    margin: 0 0 16px 0;
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-wrap;
}

.dialog-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s;
}

.dialog-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.dialog-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.dialog-footer .btn {
    min-width: 100px;
}

@media (max-width: 768px) {
    .dialog-box {
        width: 95%;
        max-width: none;
    }

    .dialog-header {
        padding: 16px 20px;
    }

    .dialog-body {
        padding: 20px;
    }

    .dialog-footer {
        padding: 12px 20px;
        flex-direction: column-reverse;
    }

    .dialog-footer .btn {
        width: 100%;
    }
}

/* Settings */
.settings-section {
    margin-bottom: 24px;
}

.settings-section h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    color: var(--text-primary);
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 12px;
}

.settings-label {
    flex: 1;
}

.settings-label strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.settings-description {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
    margin-left: 16px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Button icon */
.btn-icon {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .settings-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .toggle-switch {
        margin-left: 0;
        align-self: flex-end;
    }
}

/* ============================================
   PDF Drop Zone для загрузки товаров
   ============================================ */
.pdf-drop-zone {
    background: white;
    border: 2px dashed #0ea5e9;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.pdf-drop-zone:hover {
    background: #f0f9ff;
    border-color: #0284c7;
}

.pdf-drop-zone.drag-over {
    background: #dbeafe;
    border-color: #0284c7;
    border-style: solid;
    transform: scale(1.02);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Мобильная адаптация для админки
   ============================================ */
@media (max-width: 1024px) {
    /* Адаптация таблицы пользователей */
    .users-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .users-table table {
        min-width: 800px;
    }
}

/* Скрываем мобильную кнопку на десктопе */
.btn-add-user-mobile {
    display: none;
}

@media (max-width: 768px) {
    /* Убираем горизонтальный скролл на всей странице */
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Показываем мобильную кнопку, скрываем десктопную */
    .btn-add-user-desktop {
        display: none;
    }

    .btn-add-user-mobile {
        display: block;
        width: 100%;
        margin-top: 12px;
    }

    /* Скрываем sidebar на мобилках, показываем через бургер-меню */
    .admin-layout {
        flex-direction: column;
        width: 100% !important;
        max-width: 100vw !important;
    }

    .sidebar {
        position: fixed;
        left: -250px;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        width: 250px;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        width: 100% !important;
        max-width: 100vw !important;
        padding: 12px !important;
        box-sizing: border-box !important;
        margin: 0 !important;
    }

    /* Адаптация панели фильтров */
    .actions-panel {
        flex-direction: column;
        gap: 12px;
    }

    .filters {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .filter-select {
        width: 100%;
    }

    /* Адаптация таблицы - карточный вид */
    .table-container {
        padding: 12px !important;
        overflow-x: hidden !important;
        background: white !important;
        border-radius: 8px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
        box-sizing: border-box !important;
    }

    .users-table {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    .users-table table {
        display: block !important;
        border: none !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .users-table thead {
        display: none !important;
    }

    .users-table {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .users-table tbody {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    /* Карточка пользователя - вертикальное расположение */
    .users-table tr {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 0 12px 0 !important;
        border: 1px solid #e5e7eb !important;
        border-radius: 12px !important;
        padding: 12px !important;
        background: white !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        contain: layout !important;
    }

    /* Все ячейки вертикально */
    .users-table td {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 6px 0 !important;
        border: none !important;
        box-sizing: border-box !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        overflow: hidden !important;
    }

    /* Все текстовые элементы внутри */
    .users-table td * {
        max-width: 100% !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    /* Скрываем лейблы через :before */
    .users-table td:before {
        display: none !important;
    }

    /* Имя пользователя - крупно вверху */
    .users-table td[data-label="Имя"] {
        font-size: 1.2em !important;
        font-weight: 700 !important;
        color: #111827 !important;
        padding-bottom: 4px !important;
        margin-bottom: 8px !important;
        border-bottom: 2px solid #f3f4f6 !important;
    }

    .users-table td[data-label="Имя"]:before {
        content: '👤 ' !important;
        display: inline !important;
    }

    /* Логин с @ */
    .users-table td[data-label="Логин"]:before {
        content: '@ ' !important;
        display: inline !important;
        color: #9ca3af !important;
    }

    .users-table td[data-label="Логин"] strong {
        font-weight: 600 !important;
        color: #6b7280 !important;
    }

    /* Роль - цветной бадж */
    .users-table td[data-label="Роль"] {
        margin-top: 8px !important;
    }

    .users-table .role-badge {
        display: inline-block !important;
        padding: 4px 12px !important;
        border-radius: 16px !important;
        font-size: 0.85em !important;
        font-weight: 600 !important;
    }

    .users-table .role-admin {
        background: #fef3c7 !important;
        color: #92400e !important;
    }

    .users-table .role-warehouse {
        background: #dbeafe !important;
        color: #1e40af !important;
    }

    .users-table .role-courier {
        background: #d1fae5 !important;
        color: #065f46 !important;
    }

    /* Отдел */
    .users-table td[data-label="Отдел"]:before {
        content: '🏢 Отдел: ' !important;
        display: inline !important;
        color: #9ca3af !important;
        font-size: 0.9em !important;
    }

    /* Статистика */
    .users-table td[data-label="В работе"]:before {
        content: '📋 В работе: ' !important;
        display: inline !important;
        color: #9ca3af !important;
        font-size: 0.9em !important;
    }

    .users-table td[data-label="Выполнено"]:before {
        content: '✅ Выполнено: ' !important;
        display: inline !important;
        color: #9ca3af !important;
        font-size: 0.9em !important;
    }

    /* Статус */
    .users-table td[data-label="Статус"] {
        margin-top: 8px !important;
        padding-top: 12px !important;
        border-top: 1px solid #f3f4f6 !important;
    }

    .users-table .status-active {
        color: #059669 !important;
        font-weight: 600 !important;
    }

    .users-table .status-active:before {
        content: '● ' !important;
    }

    .users-table .status-inactive {
        color: #dc2626 !important;
        font-weight: 600 !important;
    }

    .users-table .status-inactive:before {
        content: '● ' !important;
    }

    /* Скрываем ID */
    .users-table td[data-label="ID"] {
        display: none !important;
    }

    /* Действия внизу */
    .users-table .actions-cell {
        display: flex !important;
        flex-direction: row !important;
        gap: 6px !important;
        padding-top: 12px !important;
        margin-top: 8px !important;
        border-top: 1px solid #f3f4f6 !important;
        justify-content: flex-start !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .users-table .actions-cell:before {
        display: none !important;
    }

    /* Кнопки действий - маленькие фиксированного размера */
    .users-table .btn-icon {
        flex: 0 0 auto !important;
        width: 42px !important;
        height: 42px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #f9fafb !important;
        border-radius: 8px !important;
        border: 1px solid #e5e7eb !important;
        font-size: 1.2em !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    .users-table .btn-icon:active {
        transform: scale(0.92) !important;
        background: #f3f4f6 !important;
    }

    /* Адаптация модальных окон */
    .modal-dialog {
        width: 95%;
        max-width: 95%;
        margin: 20px auto;
    }

    .modal-body {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }

    /* Адаптация статистики */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 16px;
    }
}
