/* =====================================================
   ПОЛНЫЙ СТИЛЬ ДЛЯ СИСТЕМЫ ЗАЯВОК
   Версия: 5.2 (все стили в одном файле, авто-высота Quill)
   ===================================================== */

/* ----- БАЗОВЫЕ СТИЛИ ----- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.5;
    overflow-y: scroll;
}

/* ----- КОНТЕЙНЕРЫ ----- */
.desktop-container {
    max-width: 1400px;
    margin: 0 auto;
    background: #f5f7fa;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

.main-content {
    padding: 30px 35px;
    background: #f5f7fa;
    overflow-x: auto;
}

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

.page-header h1 {
    font-size: 1.1rem;
    color: #2c3e66;
    font-weight: 600;
    background-color: #ddd;
    padding: 3px 15px 7px 15px;
    border-radius: 8px;
}

.page-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.date-info {
    color: #6c757d;
    background: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ===== ВЕРХНЯЯ ПАНЕЛЬ ===== */
.top-bar {
    background: linear-gradient(135deg, #2c3e66 0%, #1a2639 100%);
    color: white;
    padding: 12px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.top-bar-logo h2 {
    font-size: 1.3rem;
    margin: 0;
}

.top-bar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    gap: 15px;
}

.top-bar-user .user-name {
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
}

.top-bar-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.settings-btn {
    background: #6c757d;
    color: white;
    flex-shrink: 0;
}

.settings-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.logout-btn {
    background: #dc3545;
    color: white;
    flex-shrink: 0;
}

.logout-btn:hover {
    background: #c82333;
}

/* ===== ГОРИЗОНТАЛЬНОЕ МЕНЮ С ПРОКРУТКОЙ ===== */
.nav-menu-scroll {
    background: #2c3e66;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    scrollbar-width: thin;
}

.nav-menu-scroll::-webkit-scrollbar {
    height: 4px;
}

.nav-menu-scroll::-webkit-scrollbar-track {
    background: #2c3e66;
}

.nav-menu-scroll::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.nav-menu-flex {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    white-space: nowrap;
    min-width: 100%;
}

.nav-menu-flex > .nav-links,
.nav-menu-flex > .admin-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    white-space: nowrap;
    background: transparent;
    width: auto !important;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-link.active {
    background: white;
    color: #2c3e66 !important;
    font-weight: bold;
}

.nav-divider {
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.2rem;
    margin: 0 5px;
}

.admin-links {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.admin-links.hidden {
    display: none;
}

/* ----- СТАТИСТИКА В ОДНУ СТРОКУ С ПРОКРУТКОЙ ----- */
.stats-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    padding-bottom: 8px;
}

.stats-scroll .stats-inner {
    display: inline-flex;
    gap: 12px;
    white-space: nowrap;
}

.stat-mini {
    background: #e9ecef;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #2c3e66;
    display: inline-block;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}

.stat-mini:hover {
    background: #dee2e6;
}

.stat-mini.active {
    background: #2c3e66;
    color: white;
}

.stat-mini.active:hover {
    background: #2c3e66;
}

/* ----- КАРТОЧКИ ОРГАНИЗАЦИЙ / ЗАЯВОК ----- */
.org-card, .user-card {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.org-card:hover, .user-card:hover {
    background: #fefefe;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.org-actions button, .user-actions button {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 6px;
    transition: 0.2s;
}

.org-actions button:hover, .user-actions button:hover {
    background: #e9ecef;
}

/* ----- ФИЛЬТР ПОЛЬЗОВАТЕЛЕЙ ----- */
.user-filter-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    padding-bottom: 8px;
}

.user-filter-scroll .user-filter-inner {
    display: inline-flex;
    gap: 8px;
    white-space: nowrap;
}

.user-btn {
    background: #e9ecef;
    color: #2c3e66;
    padding: 6px 14px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: 0.2s;
    cursor: pointer;
    display: inline-flex;
    white-space: nowrap;
}

.user-btn.active {
    background: #2c3e66;
    color: white;
}

.user-btn:hover {
    background: #cbd3da;
}

/* ----- ПОИСК И ФИЛЬТРАЦИЯ ----- */
.filter-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: nowrap;
}

.filter-bar input, .filter-bar select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    flex: 1;
    min-width: 0;
}

.filter-bar button {
    background: #2c3e66;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

.filter-bar a {
    background: #6c757d;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    flex-shrink: 0;
}

.search-highlight {
    background-color: #ffeb3b;
    font-weight: bold;
}

/* ----- КАРТОЧКИ ЗАЯВОК ----- */
.ticket-card {
    background: white;
    margin: 8px 0;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    border-left: 4px solid #dee2e6;
}

.ticket-card:hover {
    transform: translateX(5px);
    background: #fefefe;
}

.ticket-card.overdue {
    background: #ffe6e6;
    border-left-color: #dc3545;
}

.ticket-card.completed {
    background: #e6f3ff;
    border-left-color: #007bff;
}

.ticket-row-first {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 5px;
}

.ticket-id {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    color: white;
    background: #6c757d;
    font-size: 0.85rem;
}

.ticket-org {
    font-size: 0.9rem;
}

.ticket-addr {
    font-size: 0.85rem;
    color: #666;
}

.ticket-subj {
    font-size: 0.95rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.ticket-executor {
    background-color: #f1f3f5;
    border: 1px solid #ced4da;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.75rem;
    color: #495057;
    margin-left: auto;
    white-space: nowrap;
}

.ticket-row-second {
    font-size: 0.95rem;
    color: #333;
    padding-left: 5px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.ticket-subject {
    flex: 1;
}

.date-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    white-space: nowrap;
}

.completion-date {
    font-size: 0.7rem;
    color: #28a745;
    background: #e8f5e9;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.ticket-row {
    background: white;
    margin: 12px 0;
    padding: 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
    border-left: 4px solid #dee2e6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.ticket-row:hover {
    background: #f8f9fa;
    transform: translateX(5px);
}

.ticket-new {
    border-left-color: #28a745;
    background: #f0fff4;
}

.ticket-assigned {
    border-left-color: #ffc107;
    background: #fff9e6;
}

.ticket-completed {
    border-left-color: #007bff;
    background: #e6f3ff;
}

.ticket-overdue {
    background: #ffe6e6 !important;
    border-left-color: #dc3545;
}

/* ----- ИНФОРМАЦИОННАЯ СЕТКА ----- */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

/* ----- МОДАЛЬНЫЕ ОКНА ----- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    overflow: auto;
    z-index: 1000;
    cursor: pointer;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
//    background: white;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
}


/* ----- МОДАЛЬНОЕ ОКНО ПРОСМОТРА АКТА ----- */
.act-view-modal { cursor: default; }
.act-view-content {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    max-width: none; max-height: none;
    transform: none;
    padding: 0; border-radius: 0;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.act-view-image-wrap {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    touch-action: none;
    -webkit-user-select: none; user-select: none;
}
.act-view-img {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
    touch-action: none;
    -webkit-user-drag: none;
}

/* ----- МОДАЛЬНОЕ ОКНО ПРЕДПРОСМОТРА АКТА ----- */
.act-preview-content {
    max-width: 500px; width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    cursor: default;
    position: absolute;
}
.act-preview-image-wrap {
    width: 100%;
    max-height: 50vh;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 12px;
}
.act-preview-img {
    max-width: 100%; max-height: 50vh;
    object-fit: contain;
    border-radius: 8px;
}
.act-preview-doc {
    text-align: center;
    padding: 20px 0;
}
.act-preview-doc-icon { font-size: 64px; margin-bottom: 12px; }
.act-preview-doc-name { font-weight: 600; margin-bottom: 4px; word-break: break-all; }
.act-preview-doc-size { color: #666; margin-bottom: 16px; }
.act-preview-actions {
    display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
    margin-top: 12px;
}
.act-preview-info {
    text-align: center; color: #555; font-size: 0.85rem;
    margin: 8px 0;
}
.act-preview-error {
    text-align: center; padding: 30px 20px;
}
.act-preview-error p { margin-bottom: 16px; }

/* ----- СООБЩЕНИЯ ЧАТА ----- */
.message-content img {
    max-width: 100%;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.act-file-mobile {
    display: none !important;
}

.act-file-desktop {
    display: flex;
    align-items: center;
    gap: 8px;
}

.act-file-desktop .btn-primary {
    white-space: nowrap;
}

/* ----- БЛОК АКТА ВЫПОЛНЕННЫХ РАБОТ ----- */
.act-buttons input {
    width: 65%;
}

input.noact {
    width: 25px;
}

.act-file-section {
    background: #e8f0fe;
    border-radius: 16px;
    padding: 10px 15px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.act-status, .act-buttons, .act-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
}

.act-checkbox {
    margin-left: auto;
}

.act-file-row {
    display: flex;
    gap: 8px;
}

.btn-photo, .btn-choose {
    border: 1px solid #ccc;
    background: #fff;
    white-space: nowrap;
}

.btn-photo:hover, .btn-choose:hover {
    background: #e8f0fe;
    border-color: #007bff;
}

/* ----- РАЗДЕЛ ВЫПОЛНЕННЫХ РАБОТ ----- */
.work-description-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

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

.work-description-header strong {
    font-size: 1rem;
}

.work-description-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.work-description-section button {
    margin-left: 0;
}

.work-display {
    padding: 10px;
    background: white;
    border-radius: 6px;
    min-height: 80px;
}

.empty-work {
    color: #999;
}

.work-editor {
    margin-top: 10px;
}

/* ----- БЕЙДЖИ И МЕТКИ ----- */
.badge-ip, .badge-fp {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-left: 8px;
    vertical-align: middle;
}

.badge-ip {
    background: #d4edda;
    color: #155724;
}

.badge-fp {
    background: #cce5ff;
    color: #004085;
}

/* ----- ОТДЕЛЬНАЯ ЗАГРУЗКА ФАЙЛОВ ----- */
.separate-upload {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

/* ----- БЕЙДЖ ДАТЫ ЗАЯВКИ ----- */
.ticket-date-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-right: 10px;
    white-space: nowrap;
}

/* ----- КНОПКИ-ПЕРЕКЛЮЧАТЕЛИ ----- */
.toggle-btn {
    background: #6c757d;
    color: white;
}

.toggle-btn.active {
    background: #2c3e66;
}

/* ----- ГРУППЫ ЗАЯВОК ----- */
.group-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-top: 25px;
    margin-bottom: 15px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
}

.group-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e66;
    margin: 0;
}

.group-badge {
    background: #28a745;
    color: white;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.85rem;
}

.section-header {
    margin-top: 30px;
    margin-bottom: 15px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e66;
    border-left: 4px solid #007bff;
    padding-left: 15px;
}

/* ----- ГРУППА КНОПОК ДЕЙСТВИЙ ----- */
.btn-group-right {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* ===== ДЕСКТОПНЫЙ СТИЛЬ ДЛЯ ВСЕХ КНОПОК ===== */
.btn-group-right .btn-primary,
.btn-group-right .btn-secondary,
.btn-group-right .btn-danger,
.btn-group-right .toggle-btn,
.btn-group-right form button,
.btn-group-right a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    background: #2c3e66;
    color: white;
}

.btn-group-right .btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-group-right .btn-danger {
    background: #dc3545;
    color: white;
}

.btn-group-right .toggle-btn.active {
    background: #28a745;
    color: white;
}

.btn-group-right .toggle-btn {
    background: #2c3e66;
    color: white;
}

.btn-group-right form button {
    background: #28a745;
    color: white;
}

.btn-group-right a[onclick*="confirm"] {
    background: #17a2b8;
    color: white;
}

.btn-group-right .btn-primary:hover,
.btn-group-right .btn-secondary:hover,
.btn-group-right .btn-danger:hover,
.btn-group-right .toggle-btn:hover,
.btn-group-right form button:hover,
.btn-group-right a:hover {
    transform: translateY(-2px);
    filter: brightness(0.9);
}

/* На десктопе скрываем иконки, показываем текст */
@media (min-width: 1001px) {
    .btn-group-right .btn-icon {
        display: none !important;
    }
    .btn-group-right .btn-text {
        display: inline-block !important;
    }
}

/* ----- КАРТОЧКА ОРГАНИЗАЦИИ ----- */
.info-block {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.info-row {
    display: flex;
    margin-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 8px;
}

.info-label {
    font-weight: bold;
    width: 180px;
    color: #2c3e66;
}

.info-value {
    flex: 1;
    word-break: break-word;
}

.branch-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.branch-card ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.branch-card li {
    margin-bottom: 5px;
}

.org-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-left: 10px;
    vertical-align: middle;
}

.service-info-block {
    border-left: 5px solid #28a745;
    padding: 15px;
    margin-top: 20px;
    border-radius: 8px;
    border-top: 1px solid #ccc;
    border-right: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
}

/* ----- ТАБЛИЦЫ ----- */
.ticket-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.ticket-table th, .ticket-table td {
    border: 1px solid #e0e0e0;
    padding: 10px;
    text-align: left;
}

.ticket-table th {
    background: #2c3e66;
    color: white;
}

.ticket-table tr:hover {
    background: #f1f1f1;
    cursor: pointer;
}

.ticket-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* ----- ФОРМЫ ----- */
.form-group {
    margin-bottom: 18px;
}

label {
    font-weight: 500;
    display: block;
    margin-bottom: 6px;
    color: #2c3e66;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #2c3e66;
    box-shadow: 0 0 0 3px rgba(44, 62, 102, 0.1);
}

.inline-radio-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.inline-radio-group label {
    font-weight: normal;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.inline-radio-group input[type="text"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
    margin-bottom: 15px;
}

.checkbox-label input {
    width: auto;
    margin-right: 5px;
}

/* ----- КНОПКИ ----- */
button, .btn-primary, .btn-secondary {
    background: #2c3e66;
    color: white;
    border: none;
    padding: 7px 20px;
    min-height: 32px;
    box-sizing: border-box;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.2;
    transition: 0.2s;
    margin: 5px;
    text-decoration: none;
}

/* ----- ЕДИНАЯ БАЗА КНОПОК ----- */
/* .btn — только геометрия, шрифт и поведение, без цвета.
   Цвета и назначение остаются в семантических классах
   (.btn-primary, .btn-secondary, .btn-danger и т.д.). */
.btn {
    font: inherit;
    font-size: .9rem;
    font-weight: 500;
    line-height: 1.2;
    padding: 7px 20px;
    min-height: 32px;
    box-sizing: border-box;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    transition: background .2s, transform .2s;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Компактный размер (замена .btn-sm и мелких инлайн-вариантов). */
.btn--sm {
    padding: 6px 12px;
    font-size: .85rem;
    min-height: 0;
}

/* Растягивание на всю ширину (замена inline style="width:100%"). */
.btn--block {
    width: 100%;
}

.btn-primary:hover, button:hover {
    background: #1e2a48;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

.btn-contract {
    background: #28a745;
    color: white;
    margin-right: 10px;
}

.btn-contract-gray {
    background: #6c757d;
}

/* ----- ВЫПАДАЮЩИЕ СПИСКИ ДЛЯ ПОИСКА ОРГАНИЗАЦИЙ ----- */
.search-select {
    position: relative;
}

.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 200;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dropdown div {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dropdown div:hover {
    background: #e9ecef;
}

/* ----- МАНУАЛЬНЫЙ ВВОД КОНТАКТА ----- */
.manual-contact-row {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    align-items: center;
}

.manual-contact-row input {
    flex: 1;
}

.manual-contact-row button {
    width: auto;
    padding: 8px 12px;
}

/* ----- ЧАТ И СООБЩЕНИЯ ----- */
.chat-container {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.chat-header {
    background: linear-gradient(135deg, #2c3e66 0%, #1a2639 100%);
    color: white;
    padding: 15px 20px;
}

.messages-area {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
}

.message {
    margin-bottom: 20px;
    display: flex;
}

.message-org {
    justify-content: flex-start;
}

.message-admin, .message-master {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
}

.message-org .message-bubble {
    background: #e3f2fd;
    border-bottom-left-radius: 4px;
}

.message-admin .message-bubble {
    background: #f3e5f5;
    border-bottom-right-radius: 4px;
}

.message-master .message-bubble {
    background: #e8f5e9;
    border-bottom-right-radius: 4px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin: 0px 10px;
    font-size: 12px;
    color: #666;
}

.message-text {
    font-size: 14px;
    line-height: 1.5;
}

.message-text img {
    max-width: 100%;
    border-radius: 8px;
}

.message-input-area {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    background: white;
}

/* ----- ПАГИНАЦИЯ ----- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.pagination .page-link {
    display: inline-block;
    padding: 8px 14px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: #2c3e66;
    cursor: pointer;
    font-size: 0.9rem;
}

.pagination .page-link:hover {
    background: #e9ecef;
    border-color: #2c3e66;
}

.pagination .page-link.active {
    background: #2c3e66;
    color: white;
    border-color: #2c3e66;
    cursor: default;
}

.pagination .page-link.disabled {
    color: #ccc;
    border-color: #eee;
    cursor: not-allowed;
}

.pagination .page-dots {
    padding: 8px 4px;
    color: #999;
}

/* ===== QUILL EDITOR - АВТОМАТИЧЕСКОЕ РАСШИРЕНИЕ ПО ВЫСОТЕ ===== */
.ql-container {
    font-size: 0.9rem;
    font-family: inherit;
}

.ql-editor {
    min-height: 150px;
    height: auto !important;
    max-height: none;
    overflow-y: auto !important;
    overflow-x: auto;
}

#editor,
#workDescriptionEditor {
    min-height: 200px;
    height: auto;
}

#editorMsg .ql-editor,
#workQuillEditor .ql-editor {
    min-height: 100px;
    max-height: 300px;
    height: auto !important;
    overflow-y: auto !important;
}

.ql-snow .ql-editor img,
.work-display img,
.ticket-message img,
.additional-info-block img,
.kb-article-content img {
    max-width: min(100%, 900px);
    max-height: 500px;
    object-fit: contain;
    height: auto;
}

.ql-image-resize-container {
    position: absolute;
    border: 2px solid #4a90d9;
    pointer-events: none;
    z-index: 1000;
}

.ql-image-resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #4a90d9;
    border: 1px solid #fff;
    pointer-events: all;
}

.ql-image-resize-handle.nw { top: -5px; left: -5px; cursor: nwse-resize; }
.ql-image-resize-handle.ne { top: -5px; right: -5px; cursor: nesw-resize; }
.ql-image-resize-handle.sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.ql-image-resize-handle.se { bottom: -5px; right: -5px; cursor: nwse-resize; }

.ql-toolbar {
    border-radius: 8px 8px 0 0;
}

.ql-container {
    border-radius: 0 0 8px 8px;
}

/* ----- ПУСТЫЕ СОСТОЯНИЯ ----- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 16px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.loading {
    text-align: center;
    padding: 40px;
}

/* ----- УТИЛИТЫ ----- */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 10px;
}

.mb-2 {
    margin-bottom: 10px;
}

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

.w-100 {
    width: 100%;
}

.hidden {
    display: none;
}

.chat-container, .separate-upload {
    transition: 0.3s ease;
}

.chat-container.hidden, .separate-upload.hidden {
    display: none;
}

/* ----- ФОРМЫ В НЕСКОЛЬКО СТРОК ----- */
.form-row-4 {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.form-row-4 .form-group {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

.form-row-3 {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.form-row-3 .form-group {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

/* ===== МОБИЛЬНЫЙ СТИЛЬ ===== */
@media (max-width: 1000px) {
    .info-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px;
        font-size: 0.85rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .page-header h1 {
        font-size: 1.2rem;
        word-break: break-word;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }
    
    .btn-group-right {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        width: 100%;
        padding-bottom: 8px;
    }
    
    .btn-group-right::-webkit-scrollbar {
        height: 3px;
    }
    
    .btn-group-right .btn-primary,
    .btn-group-right .btn-secondary,
    .btn-group-right .btn-danger,
    .btn-group-right .toggle-btn,
    .btn-group-right form,
    .btn-group-right button,
    .btn-group-right a {
        flex-shrink: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        padding: 0 !important;
        margin: 0 !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        border-radius: 8px !important;
        border: none !important;
        cursor: pointer !important;
        text-decoration: none !important;
        text-align: center !important;
        background: #2c3e66 !important;
        transition: all 0.2s ease !important;
        font-size: 1.3rem !important;
        font-weight: normal !important;
        overflow: hidden !important;
    }
    
    .btn-group-right .btn-primary .btn-text,
    .btn-group-right .btn-secondary .btn-text,
    .btn-group-right .btn-danger .btn-text,
    .btn-group-right .toggle-btn .btn-text {
        display: none !important;
    }
    
    .btn-group-right .btn-icon {
        display: inline-block !important;
    }
    
    .btn-group-right .btn-primary:hover,
    .btn-group-right .btn-secondary:hover,
    .btn-group-right .btn-danger:hover,
    .btn-group-right .toggle-btn:hover,
    .btn-group-right button:hover,
    .btn-group-right a:hover {
        transform: translateY(-2px);
        filter: brightness(0.95);
    }
    
    .btn-group-right .toggle-btn.active {
        background: #2c3e66 !important;
        color: white !important;
    }
    
    .btn-group-right .btn-danger {
        background: #dc3545 !important;
        color: white !important;
    }
    
    .btn-group-right .btn-secondary {
        background: #6c757d !important;
        color: white !important;
    }
    
    .btn-group-right form button {
        background: #28a745 !important;
        color: white !important;
    }
    
    .btn-group-right a[onclick*="confirm"] {
        background: #17a2b8 !important;
        color: white !important;
    }
    
    .act-status strong {
        font-size: 0.85rem;
    }
    
    .act-file-section {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
    }
    
    .act-buttons form {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        flex-wrap: nowrap;
    }
    
    .act-buttons input[type="file"] {
        width: auto;
        flex: 1;
        min-width: 100px;
    }
    
    .act-file-desktop {
        display: none;
    }
    
    .act-file-mobile {
        display: block !important;
    }
    
    .act-buttons .act-file-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    
    .act-buttons .btn-photo,
    .act-buttons .btn-choose {
        width: auto;
        margin: 0;
        padding: 12px 10px;
        font-size: 0.85rem;
    }
    
    .act-buttons button {
        white-space: nowrap;
        padding: 5px 10px;
        font-size: 0.7rem;
    }
    
    .act-checkbox {
        margin-left: 0;
    }
    
    .act-checkbox label {
        font-size: 0.8rem;
    }
    
    .work-description-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .chat-header {
        font-size: 0.9rem;
        padding: 10px;
    }
    
    .messages-area {
        height: 350px;
        padding: 10px;
    }
    
    .message-bubble {
        max-width: 90%;
        padding: 8px 12px;
    }
    
    .message-header {
        font-size: 0.7rem;
    }
    
    .message-text {
        font-size: 0.85rem;
    }
    
    .message-input-area {
        padding: 10px;
    }
    
    .ql-editor {
        min-height: 80px;
        max-height: 300px;
        height: auto !important;
        overflow-y: auto !important;
        font-size: 0.85rem;
    }
    
    button[type="submit"] {
        width: 100%;
        padding: 10px;
        margin-top: 10px;
    }
    
    .ticket-date-badge {
        font-size: 0.7rem;
        white-space: normal;
    }
    
    #statsContainer > div {
        overflow-x: auto;
        white-space: nowrap;
        display: block;
        flex-wrap: nowrap !important;
    }
    
    #statsContainer .stat-mini {
        display: inline-flex;
        white-space: nowrap;
    }
    
    .user-filter-buttons {
        overflow-x: auto;
        white-space: nowrap;
        display: block;
        flex-wrap: nowrap !important;
    }
    
    .user-filter-buttons .user-btn {
        display: inline-flex;
        white-space: nowrap;
    }
    
    .filter-bar {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 8px;
    }
    
    .filter-bar input {
        flex: 1;
        min-width: 0;
        width: auto;
    }
    
    .filter-bar a {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 8px 16px;
    }
    
    .filter-bar button {
        display: none !important;
    }
    
    .act-file-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .act-status, .act-buttons, .act-checkbox {
        justify-content: space-between;
        width: 100%;
        margin-left: 0;
    }
    
    .act-buttons form {
        width: 100%;
        flex-direction: column;
    }
    
    .act-buttons input[type="file"] {
        width: 100%;
    }
    
    .act-buttons button {
        width: 100%;
        justify-content: center;
    }
    .act-buttons .btn-photo,
    .act-buttons .btn-choose {
        width: auto !important;
        margin: 0 !important;
    }
    
    .ticket-row-first {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .ticket-executor {
        margin-left: 0;
        white-space: normal;
    }
    
    .ticket-row-second {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .group-header h2 {
        font-size: 1.1rem;
    }
    
    .stat-mini {
        font-size: 0.75rem;
        padding: 3px 10px;
    }
    
    .date-badge {
        white-space: normal;
    }
    
    .pagination {
        gap: 5px;
    }
    
    .pagination .page-link {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .form-row-4, .form-row-3 {
        flex-direction: column;
        gap: 15px;
    }
    
    .form-row-4 .form-group, .form-row-3 .form-group {
        width: 100%;
        margin-bottom: 0;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .manual-contact-row {
        flex-direction: column;
    }
    
    .manual-contact-row button {
        width: 100%;
    }
    
    .top-bar {
        padding: 10px 15px;
    }
    
    .top-bar-logo h2 {
        display: none;
    }
    
    .top-bar-user {
        width: 100%;
    }
    
    .top-bar-user .user-name {
        font-size: 0.9rem;
    }
    
    .settings-btn {
        padding: 5px 10px;
        font-size: 0.9rem;
    }
    
    .logout-btn {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    
    .nav-link {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .nav-divider {
        font-size: 1rem;
        margin: 0 3px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header h1 {
        font-size: 1.2rem;
    }

    .act-view-content {
        position: fixed;
        top: 0; left: 0; width: 100vw; height: 100vh;
        max-width: none; max-height: none;
    }
    .act-view-image-wrap {
        width: 100vw; height: 100vh;
    }
    .act-view-img {
        max-width: 100vw; max-height: 100vh;
        width: 100%; height: auto;
    }

    .act-preview-content {
        width: 95%;
        padding: 14px;
        max-height: 85vh;
    }
    .act-preview-image-wrap {
        max-height: 40vh;
    }
    .act-preview-img {
        max-height: 40vh;
    }
    .act-preview-actions {
        flex-direction: column;
    }
    .act-preview-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1rem;
    }
    
    .info-grid {
        font-size: 0.75rem;
    }
    
    .ticket-date-badge {
        font-size: 0.65rem;
    }
    
    .filter-bar a {
        padding: 6px 12px;
        font-size: 0.8rem;
        min-width: 60px;
    }
    
    .filter-bar input {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .message-bubble {
        max-width: 95%;
    }
    
    .btn-group-right .btn-primary,
    .btn-group-right .btn-secondary,
    .btn-group-right .btn-danger,
    .btn-group-right .toggle-btn,
    .btn-group-right form,
    .btn-group-right button,
    .btn-group-right a {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        font-size: 1.2rem !important;
    }
    
    .info-label, .info-value {
        font-size: 0.85rem;
    }
    
    .branch-card {
        padding: 12px;
    }
    
    .btn, .btn-contract, .btn-primary, .btn-secondary, .btn-danger {
        font-size: 0.85rem;
        padding: 8px;
    }
    
    .org-type-badge {
        font-size: 0.6rem;
        margin-left: 5px;
    }
    
    .ql-editor {
        min-height: 80px;
        max-height: 250px;
        font-size: 0.85rem;
    }
}

.ticket-message {
    margin-bottom: 15px;
}

.work-display ol {
    padding-left: 16px;
}

.attachments-list {
    margin: 25px 0px;
}

/* ===== СТИЛИ ДЛЯ ПЕЧАТИ АКТА (print_ticket.php) ===== */
.print-wrapper {
    width: 800px;
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    margin: 0 auto;
}

.act-content {
    padding: 10px 30px;
}

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

.header .ip,
.header .company {
    font-size: 16px;
}

.header .name,
.header .company-name {
    font-weight: bold;
    font-size: 18px;
    margin-top: 5px;
}

.header .inn {
    font-weight: bold;
    margin-top: 5px;
    font-size: 14px;
}

.header .inn span {
    font-weight: normal;
}

.top-row {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    border-bottom: 1px solid #ccc;
    padding-bottom: 8px;
}

.title {
    text-align: center;
    font-weight: bold;
    font-size: 20px;
    margin: 20px 0;
}

.content {
    margin: 20px 0;
}

.field {
    margin-bottom: 20px;
}

.field-label {
    font-weight: bold;
    margin-bottom: 6px;
    font-size: 15px;
}

.field-value {
    margin-left: 0;
    padding-left: 0;
    white-space: pre-wrap;
    line-height: 1.5;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}

.work-field-value {
    margin-left: 0;
    padding-left: 0;
    white-space: pre-wrap;
    line-height: 1.5;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}

.signatures {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

.signature-item {
    width: 45%;
}

.signature-label {
    font-weight: bold;
    margin-bottom: 8px;
}

.signature-line {
    padding-top: 20px;
    margin-top: 8px;
    width: 100%;
    border-top: 1px solid #000;
}

/* Панель выбора даты и шрифта - все элементы в одну строку */
.date-picker-bar {
    background: #f8f9fa;
    padding: 12px 20px;
    border-bottom: 1px solid #ddd;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

/* Поле даты - кликабельная область */
.date-field {
    display: inline-flex;
    align-items: center;
    background: white;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    transition: 0.2s;
}

.date-field:hover {
    border-color: #2c3e66;
}

.date-field input {
    border: none;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    background: transparent;
    outline: none;
}

.date-field input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    padding: 4px;
}

/* Кнопки */
.date-picker-bar button,
.date-picker-bar a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.apply-btn {
    background: #2c3e66;
    color: white;
    border: none;
}

.apply-btn:hover {
    background: #1a2639;
}

.print-btn {
    background: #28a745;
    color: white;
    border: none;
}

.print-btn:hover {
    background: #218838;
}

.back-btn {
    background: #6c757d;
    color: white;
}

.back-btn:hover {
    background: #5a6268;
}

/* Управление размером шрифта */
.font-size-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #e9ecef;
    padding: 4px 12px;
    border-radius: 30px;
}

.font-size-control .font-btn {
    background: #2c3e66;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    padding: 0;
}

.font-size-control .font-btn:hover {
    background: #1a2639;
    transform: scale(1.05);
}

.font-size-control .font-size-value {
    min-width: 35px;
    text-align: center;
    font-weight: bold;
    color: #2c3e66;
    font-size: 14px;
}

/* Стили для печати */
@media print {
    body {
        background: white;
        padding: 0;
        margin: 0;
    }
    
    .print-wrapper {
        width: 100%;
        box-shadow: none;
        border-radius: 0;
    }
    
    .act-content {
        padding: 20mm;
    }
    
    .date-picker-bar {
        display: none !important;
    }
    
    .signature-line {
        border-top: 1px solid #000;
    }
}

/* Адаптация для узких экранов */
@media (max-width: 700px) {
    .date-picker-bar {
        flex-wrap: wrap;
    }
    
    .print-wrapper {
        width: 100%;
        border-radius: 0;
    }
}

/* ----- ПРИКРЕПЛЁННЫЕ ФАЙЛЫ (компактный вариант) ----- */
.attachments-block {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.attachments-block strong {
    display: block;
    margin-bottom: 10px;
}

.attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.attachment-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 4px 12px !important;
    background: white !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    color: #2c3e66 !important;
    font-size: 0.8rem !important;
    transition: all 0.2s ease !important;
    width: auto !important;
    flex-shrink: 0;
    max-width: 100%;
}

.attachment-link:hover {
    background: #e9ecef !important;
    border-color: #2c3e66 !important;
}

.attachment-link small {
    font-size: 0.6rem !important;
    opacity: 0.6;
    color: #6c757d;
}

@media (max-width: 768px) {
    .attachments-list {
        flex-direction: column;
        gap: 6px;
    }
    
    .attachment-link {
        width: 100% !important;
        padding: 6px 12px !important;
    }
}

/* =====================================================
   СТИЛИ ДЛЯ organization_dashboard.php
   ===================================================== */

/* Меню с поиском */
.menu-with-search {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    width: 100%;
}

.menu-with-search .nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.menu-with-search .nav-divider {
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.2rem;
    margin: 0 5px;
}

.menu-with-search .search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.menu-with-search .search-bar input {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    width: 220px;
    background: rgba(255,255,255,0.15);
    color: white;
    transition: 0.3s;
}

.menu-with-search .search-bar input::placeholder {
    color: rgba(255,255,255,0.6);
}

.menu-with-search .search-bar input:focus {
    outline: none;
    background: rgba(255,255,255,0.25);
    width: 280px;
}

.menu-with-search .search-bar .search-loading {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Карточки заявок в dashboard */
.ticket-row {
    background: white;
    margin: 12px 0;
    padding: 15px;
    border-radius: 10px;
    cursor: pointer;
    border-left: 4px solid #dee2e6;
    transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.ticket-row:hover {
    transform: translateX(5px);
    background: #fefefe;
}

.ticket-new {
    border-left-color: #28a745;
    background: #f0fff4;
}

.ticket-assigned {
    border-left-color: #ffc107;
    background: #fff9e6;
}

.ticket-completed {
    border-left-color: #007bff;
    background: #e6f3ff;
}

.ticket-overdue {
    background: #ffe6e6 !important;
    border-left-color: #dc3545;
}

.ticket-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    font-size: 0.95rem;
}

.ticket-id {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: bold;
    color: white;
    margin-right: 0;
    font-size: 0.85rem;
}

.badge-new {
    background: #ffc107;
    color: #333;
}

.badge-assigned {
    background: #28a745;
}

.badge-completed {
    background: #007bff;
}

.badge-overdue {
    background: #dc3545;
}

.search-highlight {
    background-color: #ffeb3b;
    font-weight: bold;
    padding: 0 2px;
    border-radius: 3px;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: #2c3e66;
    cursor: pointer;
}

.pagination a:hover {
    background: #e9ecef;
}

.pagination .active {
    background: #2c3e66;
    color: white;
    border-color: #2c3e66;
}

.pagination .disabled {
    color: #ccc;
    cursor: not-allowed;
}

/* Контейнер заявок */
.tickets-container {
    transition: opacity 0.3s;
}

.tickets-container.loading {
    opacity: 0.5;
}

/* Приветствие */
.greeting h1 {
    font-size: 1.3rem;
    color: #2c3e66;
    margin-bottom: 15px;
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 16px;
}

/* Группы заявок */
.group-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-top: 25px;
    margin-bottom: 15px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
}

.group-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e66;
    margin: 0;
}

.group-badge {
    background: #28a745;
    color: white;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.85rem;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .menu-with-search {
        flex-direction: column;
        gap: 10px;
    }
    
    .menu-with-search .nav-links {
        justify-content: center;
        width: 100%;
    }
    
    .menu-with-search .search-bar {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    
    .menu-with-search .search-bar input {
        width: 100%;
        max-width: 300px;
    }
    
    .menu-with-search .search-bar input:focus {
        width: 100%;
        max-width: 300px;
    }
    
    .ticket-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .ticket-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .menu-with-search .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .menu-with-search .search-bar input {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
}
/* ===== СТРАНИЦА ЛОГИНА (login.php) ===== */
body.login-page {
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.login-container { max-width: 420px; width: 100%; }
.login-card {
    background: white;
    border-radius: 24px;
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: fadeInUp 0.5s ease;
}
@keyframes fadeInUp {
    from { opacity:0; transform:translateY(30px); }
    to { opacity:1; transform:translateY(0); }
}
.logo { text-align:center; margin-bottom:30px; }
.logo-icon { font-size:64px; margin-bottom:10px; }
.logo h1 { font-size:1.6rem; color:#333; margin-bottom:5px; }
.logo p { color:#666; font-size:0.85rem; }
.btn-login {
    width:100%; background:linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color:white; border:none; padding:12px; border-radius:12px;
    font-size:1rem; font-weight:600; cursor:pointer; transition:0.2s;
}
.btn-login:hover { transform:translateY(-2px); box-shadow:0 6px 20px rgba(102,126,234,0.4); }
.login-error {
    background:#fee2e2; color:#dc2626; padding:12px; border-radius:12px;
    margin-bottom:20px; text-align:center; font-size:0.9rem;
}

/* ===== СТРАНИЦА ОШИБКИ (error.php) ===== */
body.error-page {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}
.error-container {
    background: white;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.error-icon {
    font-size: 80px;
    margin-bottom: 20px;
}
.error-container h1 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 10px;
}
.error-container p {
    color: #666;
    margin-bottom: 20px;
}
.error-btn {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    text-decoration: none;
    transition: 0.3s;
}
.error-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

/* ===== АДМИН ДЭШБОРД (admin_dashboard.php) ===== */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}
.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.action-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #e9ecef;
}
.action-card:hover {
    background: #f8f9fa;
    transform: translateY(-3px);
    border-color: #2c3e66;
}
.action-icon {
    font-size: 48px;
    margin-bottom: 15px;
}
.action-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e66;
}
.greeting {
    background: linear-gradient(135deg, #2c3e66 0%, #1a2639 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 16px;
    margin-bottom: 30px;
}
.greeting h1 {
    font-size: 1.6rem;
    margin-bottom: 5px;
    color: white;
}
.greeting p {
    opacity: 0.9;
}

/* ===== СТАТИСТИКА НА ДЭШБОРДЕ ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px,1fr));
    gap: 15px;
    margin-bottom: 30px;
}
.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.stat-value { font-size: 32px; font-weight: bold; }
.stat-total .stat-value { color: #2c3e66; }
.stat-new .stat-value { color: #28a745; }
.stat-assigned .stat-value { color: #ffc107; }
.stat-completed .stat-value { color: #007bff; }
.stat-overdue .stat-value { color: #dc3545; }

/* ===== ЛОГ АУДИТА (logs.php) ===== */
.log-filters {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}
.log-filters .filter-group {
    flex: 1;
    min-width: 150px;
}
.log-filters label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 4px;
    display: block;
}
.log-filters select, .log-filters input {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ddd;
}
.log-filters button {
    background: #2c3e66;
    color: white;
}
.log-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border-collapse: collapse;
}
.log-table th, .log-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: top;
    white-space: pre-wrap;
}
.log-table th {
    background: #2c3e66;
    color: white;
    font-weight: 500;
}
.log-table tr:hover {
    background: #f8f9fa;
}
.badge-action {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}
.badge-login { background: #28a745; color: white; }
.badge-create { background: #007bff; color: white; }
.badge-update { background: #ffc107; color: #333; }
.badge-delete { background: #dc3545; color: white; }
.badge-view { background: #17a2b8; color: white; }
.badge-export { background: #6c757d; color: white; }
.details-json {
    font-family: monospace;
    font-size: 0.75rem;
    background: #f5f5f5;
    padding: 4px;
    border-radius: 4px;
    max-width: 300px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.empty-logs {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
}

/* ===== РЕДАКТИРОВАНИЕ ОРГАНИЗАЦИИ (edit_organization.php) ===== */
.branch-item {
    border:1px solid #ddd; padding:15px; margin-bottom:15px;
    border-radius:8px; background:#f9f9f9;
}
.remove-branch {
    background:#dc3545; color:white; border:none;
    padding:5px 10px; border-radius:4px; cursor:pointer;
}
.add-branch { background:#28a745; margin-bottom:15px; }
.service-info-section {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}
.service-info-section button { margin-top: 10px; }
.form-actions {
    margin-top: 25px;
    display: flex;
    gap: 15px;
    justify-content: flex-start;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 500;
}
.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== УДАЛЁННЫЕ ЗАЯВКИ (deleted_tickets.php) ===== */
.ticket-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    font-size: 0.95rem;
}
.ticket-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
}
.btn-restore {
    background: #28a745;
    color: white;
}
.btn-delete-permanent {
    background: #dc3545;
    color: white;
}
.btn-restore:hover { background: #218838; }
.btn-delete-permanent:hover { background: #c82333; }

/* ===== РЕДАКТИРОВАНИЕ ЗАЯВКИ (edit_ticket.php) ===== */
.attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}
.attachment-item a {
    text-decoration: none;
    color: #2c3e66;
}
.attachment-item .delete-attachment {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 0.7rem;
    transition: 0.2s;
}
.attachment-item .delete-attachment:hover { background: #c82333; }
.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}
.form-row .form-group { flex: 1; min-width: 150px; }
.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}
.checkbox-inline input { width: auto; margin: 0; }
.checkbox-inline label { margin: 0; font-weight: normal; }
.additional-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 10px;
}

/* ===== КАРТОЧКА ОРГАНИЗАЦИИ (organization_card.php) ===== */
/* (геометрия .btn-contract — из единой базы .btn, цвета — выше) */
.btn-contract-gray { background: #6c757d; }

/* ===== ИНФОГРИД В ЗАЯВКЕ (tickets_new.php) ===== */
.info-grid-label { font-weight: bold; color: #2c3e66; }
.act-status, .act-buttons, .act-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== МОБИЛЬНЫЕ ДОПОЛНЕНИЯ ===== */
@media (max-width: 768px) {
    .login-card { padding: 30px 20px; }
    .error-container { padding: 30px 20px; }
    .dashboard-stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .dashboard-actions { grid-template-columns: 1fr; gap: 12px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 15px; }
    .stat-value { font-size: 24px; }
    .log-table { display: block; overflow-x: auto; }
    .log-filters { flex-direction: column; }
    .log-filters .filter-group { width: 100%; }
    .log-filters button { width: 100%; }
    .ticket-actions { margin-left: 0; margin-top: 10px; width: 100%; }
    .btn-restore, .btn-delete-permanent { width: 100%; text-align: center; }
    .form-row { flex-direction: column; gap: 0; }
    .form-actions { flex-direction: column; }
    .form-actions button, .form-actions a { width: 100%; }
    .additional-info-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .dashboard-stats { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 22px; }
}

/* ===== УТИЛИТЫ С КЛЮЧЕВЫМИ РАЗМЕРАМИ ===== */
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-flex { display: inline-flex; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-column { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-5 { gap: 5px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-15 { gap: 15px; }
.gap-20 { gap: 20px; }
.mt-5 { margin-top: 5px; }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mb-5 { margin-bottom: 5px; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.ml-auto { margin-left: auto; }
.mr-10 { margin-right: 10px; }
.p-5 { padding: 5px; }
.p-10 { padding: 10px; }
.p-15 { padding: 15px; }
.p-20 { padding: 20px; }
.w-auto { width: auto; }
.h-auto { height: auto; }
.min-h-80 { min-height: 80px; }
.min-h-100 { min-height: 100px; }
.min-h-150 { min-height: 150px; }
.min-h-200 { min-height: 200px; }
.max-w-90 { max-width: 90%; }
.max-w-75 { max-width: 75%; }
.overflow-auto { overflow: auto; }
.cursor-pointer { cursor: pointer; }
.text-nowrap { white-space: nowrap; }
.text-small { font-size: 0.85rem; }
.text-muted {
    color: #6c757d;
}

/* ===== РАДИОКНОПКИ ===== */
.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 0;
}
.radio-label input[type="radio"] {
    width: auto;
    margin: 0;
}

/* ===== МОДАЛЬНЫЕ ОКНА ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}
.modal-overlay.show {
    display: flex;
}
.modal-window {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
}
.bg-white { background: white; }
.bg-light { background: #f8f9fa; }
.bg-danger { background: #dc3545; color: white; }
.bg-success { background: #28a745; color: white; }
.bg-info { background: #17a2b8; color: white; }
.bg-warning { background: #ffc107; color: #333; }
.br-4 { border-radius: 4px; }
.br-6 { border-radius: 6px; }
.br-8 { border-radius: 8px; }
.br-12 { border-radius: 12px; }
.border { border: 1px solid #e0e0e0; }
.border-bottom { border-bottom: 1px solid #e0e0e0; }
.text-green { color: #28a745; }
.text-red { color: #dc3545; }
.text-bold { font-weight: bold; }

/* ===== ДЕЙСТВИЯ НАД ЗАЯВКОЙ (ticket_view.php) ===== */
.ticket-actions-block {
    margin-top: 30px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.ticket-actions-header {
    font-weight: 600;
    color: #2c3e66;
    margin-bottom: 15px;
    font-size: 1rem;
}
.ticket-actions-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ticket-action-item {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
    display: flex;
    gap: 10px;
    align-items: baseline;
}
.ticket-action-item:nth-child(odd) {
    background: #f8f9fa;
}
.ticket-action-time {
    font-size: 0.8rem;
    color: #555;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 135px;
}
.ticket-action-desc {
    color: #333;
}

/* ===== БАЗА ЗНАНИЙ (ПУБЛИЧНАЯ ЧАСТЬ) ===== */
.kb-search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    align-items: center;
}
.kb-search-input {
    flex: 1;
    max-width: 400px;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 0.95rem;
}
.kb-section {
    margin-bottom: 24px;
    background: #fff;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.kb-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e66;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}
.kb-article-link {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    color: #007bff;
    text-decoration: none;
    transition: background 0.15s;
}
.kb-article-link:hover {
    background: #e8f4fd;
    text-decoration: underline;
}
.kb-section-badge {
    font-size: 0.75rem;
    color: #888;
    margin-left: 8px;
}
.kb-article-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    line-height: 1.7;
}
.kb-article-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 12px 0;
}
.kb-attachments {
    margin-top: 24px;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.kb-attachments h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: #333;
}
.kb-attachment-item {
    padding: 6px 0;
}
.kb-attachment-item a {
    color: #007bff;
    text-decoration: none;
}
.kb-attachment-item a:hover {
    text-decoration: underline;
}
.badge-kb-section {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.rdp-form-wrap {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 28px;
    border: 1px solid #e8e8e8;
}
.rdp-form-wrap h2 {
    font-size: 18px;
    color: #1a1a2e;
    margin-bottom: 16px;
}
.rdp-form-group {
    margin-bottom: 14px;
}
.rdp-form-group label {
    display: block;
    font-size: 13px;
    color: #555;
    margin-bottom: 5px;
    font-weight: 600;
}
.rdp-form-group select,
.rdp-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color .2s;
    background: #fff;
}
.rdp-form-group select:focus,
.rdp-form-group textarea:focus {
    outline: none;
    border-color: #2aabe4;
    box-shadow: 0 0 0 3px rgba(42,171,228,.15);
}
.rdp-form-group textarea {
    min-height: 80px;
    resize: vertical;
    line-height: 1.5;
}

.rdp-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #e74c3c;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    transition: border-color .3s, background .3s;
}
.rdp-card.closed {
    border-color: #28a745;
    background: #f0fdf4;
    border-left: 4px solid #28a745;
}
.rdp-card .rdp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.rdp-card .rdp-meta {
    font-size: 12px;
    color: #888;
    display: flex;
    gap: 16px;
}
.rdp-card .rdp-meta strong {
    color: #555;
}
.rdp-card .rdp-org {
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 6px;
}
.rdp-card .rdp-text {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 10px;
    word-break: break-word;
}
.rdp-card .rdp-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.rdp-card .rdp-status-closed {
    font-size: 12px;
    color: #28a745;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.rdp-empty {
    text-align: center;
    padding: 40px 0;
    color: #999;
    font-size: 14px;
}
.rdp-layout { width: 100%; margin: 0 auto; }
.rdp-form-row { display: flex; gap: 12px; align-items: stretch; }
.rdp-form-row .search-select { flex: 0 0 380px; }
.rdp-form-row textarea { flex: 1; min-height: 40px; height: 40px; resize: vertical; }
.rdp-form-row .rdp-btn { flex-shrink: 0; }
.rdp-btn { white-space: nowrap; }
.rdp-btn-primary { background: #2aabe4; color: #fff; }
.rdp-btn-primary:hover { background: #2188b8; }
.rdp-btn-danger { background: #e74c3c; color: #fff; }
.rdp-btn-danger:hover { background: #c0392b; }
/* (компактный размер rdp-кнопок — через единый .btn--sm) */
.rdp-success-msg { background: #d4edda; color: #155724; padding: 10px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; border: 1px solid #c3e6cb; }
.rdp-error-msg { background: #f8d7da; color: #721c24; padding: 10px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; border: 1px solid #f5c6cb; }
@media (max-width: 768px) {
    .rdp-form-row { display: block !important; }
    .rdp-form-row .search-select { display: block !important; width: 100% !important; margin-bottom: 12px !important; }
    .rdp-form-row textarea { display: block !important; width: 100% !important; margin-bottom: 12px !important; }
    .rdp-form-row .rdp-date-picker { float: left !important; margin-bottom: 12px !important; margin-right: 8px !important; display: block !important; }
    .rdp-form-row .rdp-btn { display: block !important; overflow: hidden !important; width: auto !important; }
    .rdp-card .rdp-header { flex-direction: column !important; }
}

@media (max-width: 640px) {
    .rdp-card { padding: 12px 14px; }
    .rdp-card .rdp-meta { flex-direction: column; gap: 4px; }
    .rdp-card .rdp-actions { margin-top: 4px; width: 100%; }
    .rdp-card .rdp-org { font-size: 14px; }
    .rdp-card .rdp-text { font-size: 13px; }
    .rdp-closed-label { font-size: 11px; padding: 3px 10px; }
}
.rdp-closed-label {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px; background: #d4edda; color: #155724;
    border-radius: 20px; font-size: 12px; font-weight: 600;
}

@media (max-width: 640px) {
    .rdp-card { padding: 12px 14px; }
    .rdp-card .rdp-meta { flex-direction: column; gap: 4px; }
    .rdp-card .rdp-actions { margin-top: 4px; width: 100%; }
    .rdp-card .rdp-org { font-size: 14px; }
    .rdp-card .rdp-text { font-size: 13px; }
    .rdp-closed-label { font-size: 11px; padding: 3px 10px; }
}



/* ===== НАСТРОЙКИ (settings.php) ===== */
.settings-btn-active {
    background: #f8f9fa !important;
    color: #2c3e66 !important;
    font-weight: 600;
}

.settings-layout {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 140px);
    background: #f5f7fa;
}

.settings-sidebar {
    width: 230px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e3e6ea;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: none;
    background: transparent;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 0.92rem;
    color: #2c3e66;
    transition: all 0.2s;
}

.settings-item:hover { background: #eef1f7; }

.settings-item.active { background: #2c3e66; color: #fff; font-weight: 600; }

.settings-manual-toc {
    display: none;
    flex-direction: column;
    gap: 1px;
    margin: 2px 0 6px 14px;
    padding: 5px 0 5px 8px;
    border-left: 2px solid #d9e0ea;
}
.settings-manual-toc.visible { display: flex; }
.settings-manual-toc button {
    border: 0;
    background: transparent;
    color: #5b6575;
    text-align: left;
    padding: 7px 9px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.86rem;
    line-height: 1.25;
    display: flex;
    align-items: center;
    gap: 9px;
}
.settings-manual-toc button:hover { background: #eef1f7; color: #2c3e66; }
.settings-manual-toc button.active { background: #e4e9f2; color: #2c3e66; font-weight: 700; }
.settings-manual-toc .manual-toc-icon { width:18px; height:18px; display:inline-flex; align-items:center; justify-content:center; flex:0 0 18px; }
.settings-manual-toc .manual-toc-icon svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

.settings-ic { width:18px; height:18px; display:inline-flex; align-items:center; justify-content:center; flex:0 0 18px; }
.settings-ic svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

.settings-content {
    flex: 1;
    min-width: 0;
    background: #f5f7fa;
    overflow: hidden;
}

.settings-frame {
    display: none;
    width: 100%;
    height: calc(100vh - 140px);
    border: 0;
    background: #fff;
}

.settings-frame.visible { display: block; }

/* ----- ДАШБОРД СТАТИСТИКИ ----- */
.dashboard { padding: 25px 30px; }

.dashboard-grid {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.dashboard-grid.stats { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }

.dashboard-grid.stats.mini { grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }

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

.dashboard-grid.two { grid-template-columns: repeat(2, 1fr); }

.dash-card {
    background: #fff;
    border-radius: 12px;
    border-left: 5px solid #2c3e66;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
}

.dash-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

.dash-num { font-size: 1.7rem; font-weight: 700; color: #2c3e66; line-height: 1; }

.dash-label { font-size: 0.8rem; color: #6c757d; }

.dash-panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 18px 20px;
}

.dash-title { font-size: 0.95rem; font-weight: 600; color: #2c3e66; margin: 0 0 16px; }

.dash-empty { color: #adb5bd; font-size: 0.9rem; padding: 10px 0; }

.dash-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 170px;
    padding: 5px 0 0;
}

.dash-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    gap: 3px;
    min-width: 0;
}

.dash-col-bar {
    width: 70%;
    max-width: 34px;
    background: linear-gradient(180deg, #4a6bb5, #2c3e66);
    border-radius: 4px 4px 0 0;
    position: relative;
    min-height: 4px;
    transition: height 0.3s;
}

.dash-col-bar:hover { background: #1f2743; }

.dash-col-val {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.68rem;
    color: #495057;
    white-space: nowrap;
}

.dash-col-label { font-size: 0.68rem; color: #6c757d; white-space: nowrap; }

.donut {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin: 0 auto;
    position: relative;
}

.donut-hole {
    position: absolute;
    inset: 28px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.donut-total { font-size: 1.6rem; font-weight: 700; color: #2c3e66; line-height: 1; }

.donut-total-label { font-size: 0.7rem; color: #6c757d; margin-top: 2px; }

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 14px;
    font-size: 0.8rem;
    color: #495057;
}

.donut-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 6px;
}

.dash-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

.dash-bar-label {
    width: 150px;
    flex-shrink: 0;
    font-size: 0.82rem;
    color: #343a40;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-bar-track { flex: 1; height: 12px; background: #eef1f7; border-radius: 6px; overflow: hidden; }

.dash-bar-fill { height: 100%; background: #2c3e66; border-radius: 6px; }

.dash-bar-fill.urg { background: #4a6bb5; }

.dash-bar-num {
    width: 95px;
    flex-shrink: 0;
    text-align: right;
    font-size: 0.78rem;
    color: #6c757d;
}

.dash-top-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

.dash-top-rank {
    width: 22px;
    height: 22px;
    background: #2c3e66;
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.dash-top-name {
    width: 170px;
    flex-shrink: 0;
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-top-track { flex: 1; height: 10px; background: #eef1f7; border-radius: 5px; overflow: hidden; }

.dash-top-fill { display: block; height: 100%; background: #f39c12; border-radius: 5px; }

.dash-top-fill.master { background: #28a745; }

.dash-top-cnt {
    width: 40px;
    text-align: right;
    font-weight: 600;
    color: #343a40;
    font-size: 0.85rem;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .settings-layout {
        flex-direction: column;
        min-height: auto;
    }
    .settings-sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid #e3e6ea;
        padding: 8px;
    }
    .settings-item { width: auto; white-space: nowrap; padding: 8px 12px; flex-shrink: 0; }
    .dashboard { padding: 12px; }
    .dashboard-grid.three, .dashboard-grid.two { grid-template-columns: 1fr; }
    .dashboard-grid.stats { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid.stats.mini { grid-template-columns: repeat(2, 1fr); }
    .dash-card { padding: 12px 12px; border-left-width: 4px; }
    .dash-num { font-size: 1.4rem; }
    .settings-frame {
        height: calc(100vh - 200px);
        min-height: 460px;
    }
    .dash-bars { overflow-x: auto; }
    .dash-col { min-width: 16px; }
    .dash-col-val { display: none; }
    .dash-col-label { font-size: 0.6rem; }
    .dash-bar-row { gap: 6px; }
    .dash-bar-label {
        width: auto;
        flex: 1 1 60px;
        min-width: 60px;
        max-width: 140px;
        font-size: 0.75rem;
    }
    .dash-bar-track { min-width: 30px; }
    .dash-bar-num { width: auto; font-size: 0.7rem; }
    .dash-top-row { gap: 6px; }
    .dash-top-name {
        width: auto;
        flex: 1 1 80px;
        min-width: 60px;
        font-size: 0.78rem;
    }
    .dash-top-track { min-width: 30px; }
    .dash-top-cnt { font-size: 0.78rem; }
    .donut { width: 130px; height: 130px; }
    .donut-hole { inset: 24px; }
    .dash-title { font-size: 0.88rem; }
}

@media (max-width: 480px) {
    .dashboard-grid.stats { grid-template-columns: 1fr 1fr; }
    .dash-bar-label { display: block; max-width: 40vw; }
}

/* Сворачиваемый блок просроченных заявок */
.overdue-toggle {
    cursor: pointer;
    user-select: none;
}

.overdue-toggle h2::before {
    content: '▶';
    display: inline-block;
    margin-right: 8px;
    font-size: 0.85em;
    transition: transform 0.15s ease;
}

.overdue-toggle.expanded h2::before {
    transform: rotate(90deg);
}

/* Очерёдность заявок */
.ticket-queue-options { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:6px; }
.ticket-queue-option { cursor:pointer; margin:0; }
.ticket-queue-option input { position:absolute; opacity:0; pointer-events:none; }
.ticket-queue-option span { display:inline-flex; align-items:center; justify-content:center; min-width:42px; height:34px; padding:0 12px; border:1px solid #cfd6de; border-radius:18px; background:#fff; color:#333; font-weight:600; box-sizing:border-box; }
.ticket-queue-option input:checked + span { background:#e7f1ff; border-color:#6ea8fe; color:#0b57a3; box-shadow:0 0 0 2px rgba(13,110,253,.08); }
.ticket-queue-badge { min-width:42px; margin-right:10px; padding:5px 7px; border-radius:8px; background:#e7f1ff; border:1px solid #9ec5fe; color:#0b57a3; font-size:1.15rem; font-weight:800; display:inline-flex; align-items:center; justify-content:center; vertical-align:middle; }

.ticket-card:has(.ticket-queue-badge) { display:grid; grid-template-columns:52px minmax(0,1fr); column-gap:0; align-items:stretch; }
.ticket-card:has(.ticket-queue-badge) > .ticket-queue-badge { grid-column:1; grid-row:1 / span 2; margin:-1px 10px -1px -1px; min-height:100%; }
.ticket-card:has(.ticket-queue-badge) > .ticket-row-first,
.ticket-card:has(.ticket-queue-badge) > .ticket-row-second,
.ticket-card:has(.ticket-queue-badge) > .ticket-subj { grid-column:2; }

/* Компактная очерёдность слева от номера заявки */
.ticket-card:has(.ticket-row-first .ticket-queue-badge) { display:block; }
.ticket-card .ticket-row-first .ticket-queue-badge {
    align-self:center;
    min-width:34px;
    height:30px;
    min-height:0;
    margin:0 7px 0 0;
    padding:0 7px;
    border-radius:7px;
    font-size:1rem;
    line-height:1;
    flex:0 0 auto;
}

/* На мобильных № очереди и номер заявки всегда в одной строке */
@media (max-width: 768px) {
    .ticket-card .ticket-row-first:has(.ticket-queue-badge) {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }
    .ticket-card .ticket-row-first .ticket-queue-badge {
        order: 0;
        margin: 0;
    }
    .ticket-card .ticket-row-first .ticket-id {
        order: 1;
    }
    .ticket-card .ticket-row-first .ticket-org {
        order: 2;
        flex-basis: 100%;
    }
    .ticket-card .ticket-row-first .ticket-addr {
        order: 3;
        flex-basis: 100%;
    }
    .ticket-card .ticket-row-first .ticket-executor {
        order: 4;
        flex-basis: 100%;
    }
}

/* Дата в верхней строке карточки на мобильных */
.mobile-top-date { display:none; }
@media (max-width: 768px) {
    .ticket-card .ticket-row-first .mobile-top-date {
        display:inline-flex;
        order:2;
        margin-left:auto;
        flex:0 0 auto;
    }
    .ticket-card .ticket-row-first .mobile-top-date .date-badge {
        display:inline-flex;
        align-items:center;
        justify-content:center;
        height:30px;
        min-height:0;
        margin:0;
        padding:0 7px;
        border-radius:7px;
        border:1px solid #9ec5fe;
        background:#e7f1ff !important;
        color:#0b57a3 !important;
        font-size:.82rem;
        font-weight:700;
        line-height:1;
        white-space:nowrap;
    }
    .ticket-card .desktop-date-badge { display:none; }
    .ticket-card .ticket-row-first .ticket-org { order:3; }
    .ticket-card .ticket-row-first .ticket-addr { order:4; }
    .ticket-card .ticket-row-first .ticket-executor { order:5; }
}

/* Верхняя мобильная строка: очередь + номер + дата */
@media (max-width: 768px) {
    .ticket-card .ticket-row-first:has(.ticket-queue-badge) {
        display:flex;
        flex-direction:row;
        flex-wrap:wrap;
        align-items:center;
        width:100%;
    }
    .ticket-card .ticket-row-first .ticket-queue-badge { order:0; }
    .ticket-card .ticket-row-first .ticket-id { order:1; }
    .ticket-card .ticket-row-first .mobile-top-date {
        order:2;
        margin-left:auto;
    }
    .ticket-card .ticket-row-first .ticket-org {
        order:3;
        flex:0 0 100%;
    }
    .ticket-card .ticket-row-first .ticket-addr {
        order:4;
        flex:0 0 100%;
    }
    .ticket-card .ticket-row-first .ticket-executor {
        order:5;
        flex:0 0 100%;
    }
}

/* Мобильная верхняя строка работает и у заявок без номера очерёдности */
@media (max-width: 768px) {
    .ticket-card .ticket-row-first:has(.mobile-top-date) {
        display:flex;
        flex-direction:row;
        flex-wrap:wrap;
        align-items:center;
        width:100%;
        gap:8px;
    }
    .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-queue-badge {
        order:0;
    }
    .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-id {
        order:1;
    }
    .ticket-card .ticket-row-first:has(.mobile-top-date) .mobile-top-date {
        display:inline-flex;
        order:2;
        margin-left:auto;
        flex:0 0 auto;
    }
    .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-org {
        order:3;
        flex:0 0 100%;
    }
    .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-addr {
        order:4;
        flex:0 0 100%;
    }
    .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-executor {
        order:5;
        flex:0 0 100%;
    }
}

/* Единая верхняя строка карточки на desktop: очередь + номер + дата */
@media (min-width: 769px) {
    .ticket-card .ticket-row-first:has(.mobile-top-date) {
        display:flex;
        flex-direction:row;
        flex-wrap:wrap;
        align-items:center;
        width:100%;
        gap:8px;
    }
    .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-queue-badge {
        order:0;
        align-self:center;
        min-width:34px;
        height:30px;
        min-height:0;
        margin:0;
        padding:0 7px;
        border-radius:7px;
        font-size:1rem;
        line-height:1;
        flex:0 0 auto;
    }
    .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-id {
        order:1;
    }
    .ticket-card .ticket-row-first:has(.mobile-top-date) .mobile-top-date {
        display:inline-flex;
        order:2;
        margin-left:auto;
        flex:0 0 auto;
    }
    .ticket-card .ticket-row-first:has(.mobile-top-date) .mobile-top-date .date-badge {
        display:inline-flex;
        align-items:center;
        justify-content:center;
        height:30px;
        min-height:0;
        margin:0;
        padding:0 7px;
        border-radius:7px;
        border:1px solid #9ec5fe;
        background:#e7f1ff !important;
        color:#0b57a3 !important;
        font-size:.82rem;
        font-weight:700;
        line-height:1;
        white-space:nowrap;
    }
    .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-org {
        order:3;
        flex:0 0 100%;
    }
    .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-addr {
        order:4;
        flex:0 0 100%;
    }
    .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-executor {
        order:5;
        flex:0 0 100%;
    }
    .ticket-card .desktop-date-badge {
        display:none;
    }
}

/* TEST: компактная двухстрочная карточка «Все заявки» на desktop */
@media (min-width: 769px) {
    body.page-tickets .ticket-card {
        padding:8px 12px;
        min-height:0;
    }
    body.page-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) {
        display:flex;
        flex-wrap:nowrap;
        align-items:center;
        gap:8px;
        min-height:30px;
        width:100%;
    }
    body.page-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-queue-badge,
    body.page-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-id,
    body.page-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .mobile-top-date,
    body.page-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-executor,
    body.page-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-org,
    body.page-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-addr {
        flex:0 0 auto;
        margin:0;
    }
    body.page-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-queue-badge { order:0; }
    body.page-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-id { order:1; }
    body.page-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .mobile-top-date { order:2; margin-left:0; }
    body.page-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-executor { order:3; }
    body.page-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-org { order:4; }
    body.page-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-addr {
        order:5;
        min-width:0;
        overflow:hidden;
        text-overflow:ellipsis;
        white-space:nowrap;
    }
    body.page-tickets .ticket-card .ticket-row-second {
        margin-top:4px;
        min-height:0;
        line-height:1.25;
    }
}

/* TEST: компактная двухстрочная карточка «Мои заявки» на desktop */
@media (min-width: 769px) {
    body.page-my-tickets .ticket-card {
        padding:8px 12px;
        min-height:0;
    }
    body.page-my-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) {
        display:flex;
        flex-wrap:nowrap;
        align-items:center;
        gap:8px;
        min-height:30px;
        width:100%;
    }
    body.page-my-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-queue-badge,
    body.page-my-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-id,
    body.page-my-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .mobile-top-date,
    body.page-my-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-executor,
    body.page-my-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-org,
    body.page-my-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-addr {
        flex:0 0 auto;
        margin:0;
    }
    body.page-my-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-queue-badge { order:0; }
    body.page-my-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-id { order:1; }
    body.page-my-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .mobile-top-date { order:2; margin-left:0; }
    body.page-my-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-executor { order:3; }
    body.page-my-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-org { order:4; }
    body.page-my-tickets .ticket-card .ticket-row-first:has(.mobile-top-date) .ticket-addr {
        order:5;
        min-width:0;
        overflow:hidden;
        text-overflow:ellipsis;
        white-space:nowrap;
    }
    body.page-my-tickets .ticket-card .ticket-row-second {
        margin-top:4px;
        min-height:0;
        line-height:1.25;
    }
}

/* Очерёдность справа от заголовка создания/редактирования заявки */
.page-title-with-queue { display:flex; align-items:center; gap:22px; min-width:0; }
.page-title-with-queue h1 { margin:0; }
.ticket-queue-header { display:flex; align-items:center; gap:10px; margin:0; }
.ticket-queue-header .ticket-queue-title { font-weight:600; white-space:nowrap; }
.ticket-queue-header .ticket-queue-options { margin:0; flex-wrap:nowrap; gap:5px; }
.ticket-queue-header .ticket-queue-option span { min-width:34px; height:30px; padding:0 9px; }
@media (max-width:768px) {
    .page-title-with-queue { flex-wrap:wrap; gap:8px 14px; }
    .ticket-queue-header { flex-wrap:wrap; }
    .ticket-queue-header .ticket-queue-options { flex-wrap:wrap; }
}

/* Плашка наличия акта у выполненной заявки */
.ticket-act-badge {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    height:30px;
    min-width:42px;
    padding:0 10px;
    border-radius:6px;
    color:#fff;
    font-weight:700;
    font-size:.9rem;
    line-height:1;
    flex:0 0 auto;
    box-sizing:border-box;
}
.ticket-act-badge.no-act { background:#dc3545; cursor:default; }
.ticket-act-badge.has-act { background:#28a745; cursor:pointer; }
.ticket-act-badge.has-act:hover { filter:brightness(.94); }
@media (min-width:769px) {
    body.page-tickets .ticket-row-first .ticket-act-badge,
    body.page-my-tickets .ticket-row-first .ticket-act-badge {
        order:3;
    }
    body.page-tickets .ticket-row-first .ticket-executor,
    body.page-my-tickets .ticket-row-first .ticket-executor { order:4 !important; }
    body.page-tickets .ticket-row-first .ticket-org,
    body.page-my-tickets .ticket-row-first .ticket-org { order:5 !important; }
    body.page-tickets .ticket-row-first .ticket-addr,
    body.page-my-tickets .ticket-row-first .ticket-addr { order:6 !important; }
}
@media (max-width:768px) {
    .ticket-row-first .ticket-act-badge { order:3; }
}

/* Модальный просмотр акта из списков заявок */
.list-act-preview {
    position:fixed;
    inset:0;
    z-index:10000;
    display:none;
    align-items:center;
    justify-content:center;
    padding:24px;
    background:rgba(0,0,0,.86);
    box-sizing:border-box;
}
.list-act-preview-body {
    width:min(1100px, 94vw);
    height:min(90vh, 1000px);
    display:flex;
    align-items:center;
    justify-content:center;
}
.list-act-preview-body img {
    display:block;
    max-width:100%;
    max-height:100%;
    object-fit:contain;
}
.list-act-preview-body iframe {
    width:100%;
    height:100%;
    border:0;
    background:#fff;
}
.list-act-preview-close {
    position:fixed;
    top:18px;
    right:24px;
    z-index:10001;
    width:48px;
    height:48px;
    border:0;
    border-radius:50%;
    background:rgba(255,255,255,.94);
    color:#222;
    font-size:36px;
    line-height:44px;
    font-weight:400;
    cursor:pointer;
    box-shadow:0 2px 12px rgba(0,0,0,.35);
}
.list-act-preview-close:hover { background:#fff; }
body.act-preview-open { overflow:hidden; }
@media (max-width:768px) {
    .list-act-preview { padding:10px; }
    .list-act-preview-body { width:100%; height:94vh; }
    .list-act-preview-close { top:10px; right:10px; width:44px; height:44px; font-size:32px; }
}

/* TEST: выполненные заявки — вся верхняя строка строго от левого края */
@media (min-width:769px) {
    body.page-tickets .ticket-card.ticket-completed .ticket-row-first,
    body.page-my-tickets .ticket-card.completed .ticket-row-first {
        display:flex;
        flex-flow:row nowrap;
        justify-content:flex-start;
        align-items:center;
        gap:8px;
        width:100%;
    }

    body.page-tickets .ticket-card.ticket-completed .ticket-row-first > *,
    body.page-my-tickets .ticket-card.completed .ticket-row-first > * {
        margin-left:0 !important;
        margin-right:0;
        flex:0 0 auto;
    }

    body.page-tickets .ticket-card.ticket-completed .ticket-row-first .ticket-queue-badge,
    body.page-my-tickets .ticket-card.completed .ticket-row-first .ticket-queue-badge { order:0; }

    body.page-tickets .ticket-card.ticket-completed .ticket-row-first .ticket-id,
    body.page-my-tickets .ticket-card.completed .ticket-row-first .ticket-id { order:1; }

    body.page-tickets .ticket-card.ticket-completed .ticket-row-first .mobile-top-date,
    body.page-my-tickets .ticket-card.completed .ticket-row-first .mobile-top-date { order:2; }

    body.page-tickets .ticket-card.ticket-completed .ticket-row-first .ticket-act-badge,
    body.page-my-tickets .ticket-card.completed .ticket-row-first .ticket-act-badge { order:3; }

    body.page-tickets .ticket-card.ticket-completed .ticket-row-first .ticket-executor,
    body.page-my-tickets .ticket-card.completed .ticket-row-first .ticket-executor { order:4 !important; }

    body.page-tickets .ticket-card.ticket-completed .ticket-row-first .ticket-org,
    body.page-my-tickets .ticket-card.completed .ticket-row-first .ticket-org { order:5 !important; }

    body.page-tickets .ticket-card.ticket-completed .ticket-row-first .ticket-addr,
    body.page-my-tickets .ticket-card.completed .ticket-row-first .ticket-addr {
        order:6 !important;
        min-width:0;
        overflow:hidden;
        text-overflow:ellipsis;
        white-space:nowrap;
    }

    body.page-tickets .ticket-card.ticket-completed .ticket-row-first .ticket-assign-date,
    body.page-my-tickets .ticket-card.completed .ticket-row-first .ticket-assign-date {
        display:none !important;
    }
}

/* Названия организаций в списках заявок */
body.page-tickets .ticket-org,
body.page-my-tickets .ticket-org {
    font-weight: 700;
}

/* Статусы карточек: назначена — зелёный край; жёлтый зарезервирован для «В ожидании» */
.ticket-assigned {
    border-left-color: #28a745;
}

/* Основные заявки: статус «В ожидании» */
.ticket-waiting { border-left-color:#f0ad00 !important; }
.badge-waiting { background:#ffc107 !important; color:#3d3200 !important; }
.ticket-waiting-pill { display:inline-flex;align-items:center;max-width:100%;padding:3px 8px;border-radius:999px;background:#fff3cd;border:1px solid #e5b700;color:#6b5500;font-size:.78rem;font-weight:700;line-height:1.2;white-space:normal; }
.waiting-reason-dialog{width:min(460px,calc(100vw - 32px));border:0;border-radius:12px;padding:0;box-shadow:0 18px 60px rgba(15,23,42,.35)}
.waiting-reason-dialog::backdrop{background:rgba(15,23,42,.55)}
.waiting-reason-dialog form{padding:22px}.waiting-reason-dialog h3{margin:0 0 7px;color:#263e6a}.waiting-reason-dialog p{margin:0 0 12px;color:#64748b;font-size:.9rem}.waiting-reason-dialog textarea{width:100%;box-sizing:border-box;resize:vertical;min-height:80px;padding:10px 12px;border:1px solid #cbd5e1;border-radius:8px;font:inherit}.waiting-reason-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:14px}
/* Центрирование модального окна причины ожидания */
.waiting-reason-dialog[open]{position:fixed;inset:0;margin:auto;max-height:max-content}
/* Номер заявки «В ожидании» — жёлтый */
.ticket-id.badge-waiting{background:#ffc107 !important;border-color:#e0a800 !important;color:#3d3200 !important;}
/* Иконка выхода в шапке */
.logout-btn .logout-icon{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:0 0 16px;vertical-align:-3px;margin-right:4px;}
