/**
 * WO 2.1 — Основные стили
 *
 * @version 2.1.13
 * @since   2.1.0
 *
 * Принципы:
 * - Mobile-first
 * - Консистентность
 * - Минимализм
 * - Компонентный подход
 */

:root {
    /* Цвета */
    --color-bg: #F5F7FA;
    --color-surface: #FFFFFF;
    --color-text: #111827;
    --color-text-muted: #6B7280;
    --color-border: #E5E7EB;
    --color-primary: #2563EB;
    --color-primary-hover: #1D4ED8;
    --color-danger: #DC2626;
    --color-success: #10B981;
    --color-success-hover: #059669;
    --color-info: #0284C7;
    --color-info-hover: #0369A1;

    /* Статусы */
    --status-plan-bg: #7AC1FF;     --status-plan-text: #1D4ED8;
    --status-work-bg: #FFD333;     --status-work-text: #95500C;
    --status-done-bg: #38F538;     --status-done-text: #166534;
    --status-moved-bg: #FF9BAA;    --status-moved-text: #BE123C;
    --status-cancel-bg: #F5E9FF;   --status-cancel-text: #6B21A8;

    /* Размеры */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 999px;

    /* Тени */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 6px rgba(15, 23, 42, 0.08);

    /* Макет */
    --header-height: 56px;
    --bottom-nav-height: 56px;

    /* Масштаб UI */
    --ui-scale: 1;

    /* Шрифты */
    --text-xs:   calc(11px * var(--ui-scale, 1));
    --text-sm:   calc(13px * var(--ui-scale, 1));
    --text-base: calc(14px * var(--ui-scale, 1));
    --text-lg:   calc(16px * var(--ui-scale, 1));
    --text-xl:   calc(18px * var(--ui-scale, 1));
    --text-2xl:  calc(20px * var(--ui-scale, 1));
}

/* ============================================================
 * 1. БАЗОВЫЕ СТИЛИ
 * ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-size: var(--text-base);
    line-height: 1.4;
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }
img { max-width: 100%; display: block; }

/* ============================================================
 * 2. МАКЕТ
 * ============================================================ */

.page { min-height: 100vh; display: flex; flex-direction: column; }
.page-content { flex: 1 1 auto; padding: 8px 0 60px; }

.container {
    width: 100%;
    max-width: 900px;
    padding: 0 8px;
    margin: 0 auto;
}

.container-fluid { width: 100%; padding: 0 8px; }

/* Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.header-inner {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-weight: 700;
    font-size: var(--text-lg);
    letter-spacing: 0.02em;
    color: var(--color-primary);
}

.top-nav {
    display: none;
    align-items: center;
    gap: 12px;
}

.top-nav a {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    padding: 4px 6px;
    border-radius: var(--radius-full);
}

.top-nav a.active {
    color: var(--color-primary);
    background: #DBEAFE;
    font-weight: 600;
}

/* Mobile menu */
.mobile-menu-toggle {
    border: none;
    background: transparent;
    font-size: var(--text-xl);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.mobile-menu {
    display: none;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.mobile-menu.open { display: block; }
.mobile-menu-inner {
    padding: 8px 16px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mobile-menu-inner a {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    padding: 6px 10px;
    border-radius: var(--radius-full);
    background: #F3F4F6;
}

.mobile-menu-inner a.active {
    color: var(--color-primary);
    background: #DBEAFE;
    font-weight: 600;
}

/* Bottom nav */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--bottom-nav-height);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 15;
}

.bottom-nav a {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    padding: 4px 2px;
    text-decoration: none;
}

.bottom-nav a.active {
    color: var(--color-primary);
    font-weight: 600;
}

.bottom-nav .icon {
    font-size: var(--text-xl);
    line-height: 1;
}

/* Режимы нижней панели */
.bottom-nav.mode-icons-text a {
    flex-direction: column;
}
.bottom-nav.mode-icons-text .icon {
    display: block;
}
.bottom-nav.mode-icons-text span:last-child {
    display: block;
}

.bottom-nav.mode-icons a {
    flex-direction: column;
}
.bottom-nav.mode-icons .icon {
    display: block;
}
.bottom-nav.mode-icons span:last-child {
    display: none;
}

.bottom-nav.mode-text a {
    flex-direction: row;
    justify-content: center;
}
.bottom-nav.mode-text .icon {
    display: none;
}
.bottom-nav.mode-text span:last-child {
    display: block;
}

/* ============================================================
 * 3. КОМПОНЕНТЫ
 * ============================================================ */

/* --- Кнопки --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    min-height: 35px;
    font-size: var(--text-lg);
    font-weight: 600;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.1s;
    white-space: nowrap;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

.btn-secondary {
    background: #E5E7EB;
    color: #111827;
    border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: #D1D5DB; }

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

.btn-info {
    background: var(--color-info);
    color: #FFFFFF;
}
.btn-info:hover { background: var(--color-info-hover); }

.btn-danger {
    background: #DC2626;
    color: #FFFFFF;
}
.btn-danger:hover { 
    background: #991B1B;
    color: #FFFFFF;
}

.btn-ghost {
    background: #F3F4F6;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}
.btn-ghost:hover { background: #E5E7EB; }

.btn-small {
    padding: 2px 8px;
    font-size: var(--text-sm);
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    background: #E5E7EB;
    cursor: pointer;
    min-height: 25px;
}
.btn-small:hover { background: #D1D5DB; }

/* Цветовые варианты для маленьких кнопок */
.btn-small.btn-primary {
    background: var(--color-primary);
    color: #FFFFFF;
    border-color: var(--color-primary);
}
.btn-small.btn-primary:hover {
    background: var(--color-primary-hover);
}

.btn-small.btn-secondary {
    background: #E5E7EB;
    color: #111827;
}
.btn-small.btn-secondary:hover {
    background: #D1D5DB;
}

.btn-small.btn-success {
    background: #059669;
    color: #FFFFFF;
    border-color: #059669;
}
.btn-small.btn-success:hover {
    background: #047857;
}

.btn-small.btn-danger {
    background: #DC2626;
    color: #FFFFFF;
    border-color: #DC2626;
}
.btn-small.btn-danger:hover {
    background: #991B1B;
}

.btn-large {
    padding: 10px 24px;
    font-size: var(--text-xl);
    min-height: 45px;
}

/* Кнопки действий */
.actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.actions-inline {
    flex-direction: row;
    align-items: center;
    margin-top: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.actions button {
    padding: 10px 16px;
    font-size: var(--text-lg);
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* --- Карточки --- */

.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    padding: 8px 8px 12px;
    margin-bottom: 8px;
}

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

.card-title {
    font-size: var(--text-lg);
    font-weight: 600;
}

.card-subtitle {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.card-subtitle.section-title,
.card-subtitle--section {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text);
    margin-top: 12px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
}

/* Карточка наряда/заявки (универсальная) */
.card-item {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border-radius: 10px;
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--status-plan-bg);
    padding: 10px 12px 10px 18px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.card-item.status-plan { border-left-color: var(--status-plan-bg); }
.card-item.status-work { border-left-color: var(--status-work-bg); }
.card-item.status-done { border-left-color: var(--status-done-bg); }
.card-item.status-moved { border-left-color: var(--status-moved-bg); }
.card-item.status-cancelled { border-left-color: var(--status-cancel-bg); }

/* Алиас для обратной совместимости */
.card-item.status-inprogress { border-left-color: var(--status-work-bg); }

.card-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.card-item-title {
    font-size: var(--text-base);
    font-weight: 600;
}

.card-item-meta {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.card-item-description {
    font-size: var(--text-base);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    -webkit-line-clamp: 2;
}

.card-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.card-item-icons {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
}

.card-item-time {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.badge-counter {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: var(--text-xs);
}

/* --- Формы --- */

.form-field { margin-bottom: 12px; }
.form-field label {
    display: block;
    font-size: var(--text-base);
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.form-field label.required::after {
    content: ' *';
    color: var(--color-danger);
    font-weight: 700;
}

.input, .select, .textarea,
.form-field input[type="text"],
.form-field input[type="password"],
.form-field input[type="tel"],
.form-field input[type="date"],
.form-field input[type="number"],
.form-field textarea,
.form-field select {
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: #FFFFFF;
    font-size: var(--text-base);
    color: var(--color-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder,
.form-field input::placeholder,
.textarea::placeholder {
    color: #9CA3AF;
    font-style: italic;
}

.input:focus, .select:focus, .textarea:focus,
.job-field input:focus, .job-field textarea:focus, .job-field select:focus {
    outline: none;
    border-color: var(--color-primary);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input[readonly], .job-field input[readonly], .textarea[readonly] {
    background: #F3F4F6;
    cursor: not-allowed;
}

/* Уведомления (alert) */
.alert {
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.alert-warning {
    background: #FEF3C7;
    border-left: 4px solid #F59E0B;
    color: #92400E;
}

.alert-success {
    background: #DCFCE7;
    border-left: 4px solid #16A34A;
    color: #166534;
}

.alert-info {
    background: #DBEAFE;
    border-left: 4px solid #2563EB;
    color: #1E40AF;
}

.alert-error {
    background: #FEE2E2;
    border-left: 4px solid #DC2626;
    color: #991B1B;
}

.input:disabled, .job-field input:disabled, .textarea:disabled, select:disabled {
    background: #F3F4F6;
    cursor: not-allowed;
    opacity: 0.6;
}

.textarea, .job-field textarea {
    min-height: 80px;
    resize: vertical;
}

/* Фильтр в одну линию */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 8px;
}

.filter-form .job-field {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-form .btn {
    padding: 10px 20px;
    font-size: var(--text-base);
}

/* --- Таблицы --- */

.table-wrapper {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    overflow: auto;
}

.table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

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

.table-wrapper thead {
    background: #F9FAFB;
}

.table-wrapper th {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-muted);
}

/* ============================================================
 * 4. СТАТУСЫ
 * ============================================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-badge.status-plan      { background: var(--status-plan-bg); color: var(--status-plan-text); }
.status-badge.status-work      { background: var(--status-work-bg); color: var(--status-work-text); }
.status-badge.status-done      { background: var(--status-done-bg); color: var(--status-done-text); }
.status-badge.status-moved     { background: var(--status-moved-bg); color: var(--status-moved-text); }
.status-badge.status-cancelled { background: var(--status-cancel-bg); color: var(--status-cancel-text); }

/* Алиас для обратной совместимости */
.status-badge.status-inprogress { background: var(--status-work-bg); color: var(--status-work-text); }

.status-cell { font-weight: 600; }

/* ============================================================
 * 5. СТРАНИЦЫ
 * ============================================================ */

/* Детальная страница */
.page-detail {
    padding: 8px 8px 80px;
    max-width: 900px;
    margin: 0 auto;
}

.grid-page {
    padding: 8px 8px 80px;
    margin: 0 auto;
    width: 100%;
}

.page-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #E5E7EB;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.page-header-date {
    font-size: var(--text-lg);
    font-weight: 600;
}

.page-header-title {
    font-size: var(--text-base);
    font-weight: 500;
    margin-left: 8px;
    text-align: right;
}

/* Навигация в деталях */
.page-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.btn-back {
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    background: #E5E7EB;
    padding: 4px 10px;
    font-size: var(--text-sm);
    cursor: pointer;
}

.page-edit-link {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.page-edit-link:hover { color: var(--color-primary); }

/* Карточка сводки */
.summary-card { margin-bottom: 8px; }
.summary-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.summary-main { flex: 1 1 auto; }
.summary-status { flex: 0 0 auto; }
.summary-line {
    font-size: var(--text-base);
    margin-bottom: 4px;
}

.summary-label {
    font-weight: 600;
    margin-right: 4px;
}

.summary-link { color: var(--color-primary); }
.summary-link:hover { color: var(--color-primary-hover); }

/* Страница списка нарядов */
.list-container {
    padding: 8px 4px 60px;
    max-width: 900px;
    margin: 0 auto;
}

.list-header-title {
    font-size: var(--text-xl);
    font-weight: 700;
    margin: 8px 0 6px;
}

.list-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.list-date-input {
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    padding: 4px 10px;
    font-size: var(--text-base);
    background: #F9FAFB;
    color: var(--color-text);
}

.list-mode-row { margin-bottom: 10px; }

/* Сегментированный переключатель */
.segmented-control {
    display: inline-flex;
    border-radius: var(--radius-full);
    background: #E5E7EB;
    padding: 2px;
    justify-content: space-between;
}

.segmented-control button {
    border: none;
    background: transparent;
    padding: 6px 12px;
    font-size: var(--text-sm);
    border-radius: var(--radius-full);
    cursor: pointer;
    color: var(--color-text-muted);
}

.segmented-control button.active {
    background: #FFFFFF;
    color: var(--color-primary);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

/* Список карточек */
.cards-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

/* Кнопка "+ работа" */
.list-add-extra { margin: 8px 0 16px; }
.list-add-extra-btn {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-full);
    border: none;
    font-size: var(--text-lg);
    cursor: pointer;
}

/* ============================================================
 * 6. СПЕЦИАЛЬНЫЕ КОМПОНЕНТЫ
 * ============================================================ */

/* Чип "Резерв" */
.chip-reserve {
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    margin-left: 8px;
    border-radius: var(--radius-full);
    background: #FEF3C7;
    color: #92400E;
    font-size: var(--text-xs);
    font-weight: 500;
}

/* Вложения */
.attachments-grid {
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.attachment-thumb {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    background: #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.attachment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Факт-время */
.fact-times {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* Автодополнение */
.autocomplete {
    position: relative;
    flex: 2 1 0;
    min-width: 200px;
}

.autocomplete .autocomplete-input {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid #d1d5db;
    padding: 6px 28px 6px 8px;
    font-size: var(--text-base);
    box-sizing: border-box;
}

.autocomplete .autocomplete-arrow {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    font-size: var(--text-xl);
    color: #6b7280;
}

.autocomplete .autocomplete-arrow:hover { color: #3b82f6; }

.autocomplete .autocomplete-list {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-sm);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: var(--text-sm);
    margin-top: 2px;
}

.autocomplete .autocomplete-item {
    padding: 8px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
}

.autocomplete .autocomplete-item:hover { background: #e5e7eb; }

/* Строка материалов */
.materials-row {
    display: block;
    margin-bottom: 12px;
    padding: 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: #F9FAFB;
}

.materials-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.materials-row-header .card-subtitle {
    margin: 0;
    padding: 0;
    border: none;
}

.materials-row-comment {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid #d1d5db;
    padding: 4px 6px;
    font-size: var(--text-base);
    box-sizing: border-box;
}

/* Настройки (settings.php) */
.input-stepper-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.input-stepper-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: #F9FAFB;
    font-size: var(--text-xl);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.input-stepper-btn:hover {
    background: #E5E7EB;
}

.input-stepper-input {
    width: 80px;
    text-align: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: 8px;
    font-size: var(--text-base);
}

.helper-text {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 8px;
    line-height: 1.4;
}

/* Быстрый заказ */
.quick-order-info-card {
    background: #F0F9FF;
    border-left: 4px solid #0284C7;
    padding: 16px;
    margin: 16px 0;
}

.quick-order-info-card h3 {
    margin: 0 0 12px 0;
    color: #0C4A6E;
    font-size: var(--text-base);
}

.quick-order-info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.quick-order-info-table td { padding: 6px 8px; }
.quick-order-info-table td:first-child {
    font-weight: 600;
    color: #64748B;
    width: 120px;
}

.quick-order-info-table td:last-child {
    color: #1E293B;
    font-weight: 500;
}

.quick-order-draft-status {
    background: #FEF3C7;
    border-left: 4px solid #F59E0B;
    padding: 12px;
    border-radius: var(--radius-md);
    margin: 16px 0;
}

.quick-order-draft-status p {
    margin: 0;
    color: #92400E;
    font-size: var(--text-sm);
}

.quick-order-draft-status a {
    color: #0284C7;
    text-decoration: underline;
    margin-left: 12px;
}

.materials-row-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

/* Инфо-карточка (быстрый заказ) */
.info-card {
    background: #F0F9FF;
    border-left: 4px solid #0284C7;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.info-table td {
    padding: 6px 8px;
}

.info-table td:first-child {
    font-weight: 600;
    color: #64748B;
    width: 120px;
}

.info-table td:last-child {
    color: #1E293B;
    font-weight: 500;
}

.input-readonly {
    background: #F3F4F6;
    cursor: not-allowed;
}

.input-center {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: 8px 12px;
    font-size: var(--text-base);
    text-align: center;
}

.form-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

/* ============================================================
 * 7. TOAST-УВЕДОМЛЕНИЯ
 * ============================================================ */

.toast-container {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.toast-container-bottom-center {
    left: 50%;
    bottom: 80px;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
    padding: 0 16px;
    box-sizing: border-box;
}

.toast-container-bottom-right {
    right: 20px;
    bottom: 80px;
}

.toast-container-top-center {
    left: 50%;
    top: 80px;
    transform: translateX(-50%);
}

.toast-container-top-right {
    right: 20px;
    top: 80px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #FFFFFF;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 100%;
    pointer-events: auto;
    animation: toast-slide-in 0.3s ease-out;
}

@keyframes toast-slide-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.toast-success { background: #16a34a; color: #FFFFFF; }
.toast-error { background: #dc2626; color: #FFFFFF; }
.toast-warning { background: #f59e0b; color: #FFFFFF; }
.toast-info { background: #2563eb; color: #FFFFFF; }

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    font-weight: 700;
}

.toast-message {
    flex: 1;
    font-size: var(--text-base);
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s;
    padding: 0;
}

.toast-close:hover { opacity: 1; }

/* ============================================================
 * QR-сканер (materials_order.php)
 * ============================================================ */
.qr-scan-btn {
    width: 100%;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #FFFFFF;
}

.qr-scan-container {
    display: none;
    margin-bottom: 12px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.qr-scan-container #reader {
    width: 100%;
}

.qr-scan-overlay {
    padding: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #FFFFFF;
    text-align: center;
}

.qr-scan-overlay .btn {
    margin-left: 12px;
    color: #FFFFFF;
    border: 1px solid #FFFFFF;
}

.qr-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.qr-input-group .input {
    flex: 1;
}

/* ============================================================
 * Формы и фильтры
 * ============================================================ */
.filter-form-card {
    margin-bottom: 12px;
}

.form-section {
    margin-top: 6px;
}

.filter-actions {
    display: flex;
    gap: 4px;
}

.filter-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-left: auto;
}

/* ============================================================
 * Утилиты
 * ============================================================ */
.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
 * Уведомления (alert)
 * ============================================================ */
.alert {
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.alert-message {
    margin: 0;
    font-size: var(--text-sm);
}

.alert-warning {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.alert-success {
    background: #DCFCE7;
    border-left: 4px solid #16A34A;
    color: #166534;
}

.alert-error {
    background: #FEE2E2;
    border-left: 4px solid #DC2626;
    color: #991B1B;
}

.alert-warning {
    background: #FEF3C7;
    border-left: 4px solid #F59E0B;
    color: #92400E;
}

.alert-info {
    background: #DBEAFE;
    border-left: 4px solid #2563EB;
    color: #1E40AF;
}

/* Новая система (utils.js) */
.wo-toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 400px;
    padding: 0 16px;
    box-sizing: border-box;
    pointer-events: none;
}

.wo-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #FFFFFF;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 100%;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.wo-toast.wo-toast-visible {
    opacity: 1;
    transform: translateY(0);
}

.wo-toast-success { background: #16a34a; color: #FFFFFF; }
.wo-toast-error { background: #dc2626; color: #FFFFFF; }
.wo-toast-warning { background: #f59e0b; color: #FFFFFF; }
.wo-toast-info { background: #2563eb; color: #FFFFFF; }

.wo-toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    font-weight: 700;
}

.wo-toast-message {
    flex: 1;
    font-size: var(--text-base);
    line-height: 1.4;
}

/* ============================================================
 * 8. АДАПТИВ
 * ============================================================ */

@media (min-width: 768px) {
    .top-nav { display: flex; }
    .mobile-menu-toggle { display: none; }
    .mobile-menu { display: none !important; }
    .page-content { padding: 20px 0 24px; }
    .bottom-nav { display: none; }
}

@media (max-width: 600px) {
    body { font-size: 15px; }
    .page-detail { padding: 4px 6px 80px; }
    .card-item { padding: 8px 10px 8px 16px; }
    .card-item-title { font-size: var(--text-base); }
    .toast { min-width: auto; }
    .toast-container-bottom-center {
        bottom: 70px;
        padding: 0 12px;
        left: 0;
        right: 0;
        transform: none;
        width: 100%;
    }
    .wo-toast-container {
        bottom: 70px;
        padding: 0 12px;
        left: 0;
        right: 0;
        transform: none;
        width: 100%;
    }
    .materials-row-grid { grid-template-columns: 1fr; }
}

/* ============================================================
 * АЛИАСЫ (обратная совместимость)
 * ============================================================ */

/* Кнопки действий */
.job-actions, .actions { }
.job-actions-inline, .actions-inline { }

/* Страницы */
.job-detail, .page-detail { }
.job-chip-reserve, .chip-reserve { }

/* Формы */
.job-field, .form-field { }

/* Навигация */
.job-top-bar, .page-nav { }
.job-admin-edit-link, .page-edit-link { }

/* Сводка */
.job-summary-card, .summary-card { }
.job-summary-row, .summary-row { }
.job-summary-main, .summary-main { }
.job-summary-status, .summary-status { }
.job-summary-line, .summary-line { }
.job-summary-label, .summary-label { }
.job-summary-link, .summary-link { }

/* Списки */
.tasks-container, .list-container { }
.tasks-header-title, .list-header-title { }
.tasks-filter-row, .list-header-row { }
.tasks-date-input, .list-date-input { }
.tasks-mode-row, .list-mode-row { }
.tasks-add-extra, .list-add-extra { }
.tasks-add-extra-btn, .list-add-extra-btn { }

/* Вложения */
.job-attachments, .attachments-grid { }
.job-attachment-thumb, .attachment-thumb { }
.job-fact-times, .fact-times { }

/* Автодополнение */
.material-autocomplete, .autocomplete { }
.material-input, .autocomplete-input { }
.material-arrow, .autocomplete-arrow { }
.material-suggest-list, .autocomplete-list { }
.material-suggest-item, .autocomplete-item { }

/* Настройки */
.settings-scale-row, .input-stepper-row { }
.settings-scale-btn, .input-stepper-btn { }
.settings-scale-input, .input-stepper-input { }
