:root {
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.2s ease;
    --shadow-card: 0 8px 16px rgba(0, 0, 0, 0.08);
    --shadow-btn: 0 4px 8px rgba(0, 0, 0, 0.12);
    --bg-main: #6366f1;
    --card-bg: #ffffff;
    --navbar-bg: #ffffff;
    --navbar-text: #374151;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --input-bg: #f9fafb;
    --input-border: #d1d5db;
    --scrollbar-track: #f1f1f1;
    --scrollbar-thumb: #c1c1c1;
    --scrollbar-thumb-hover: #a8a8a8;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg-main: #0f172a;
    --card-bg: #1e293b;
    --navbar-bg: #1e293b;
    --navbar-text: #cbd5e1;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --input-bg: #0f172a;
    --input-border: #475569;
    --scrollbar-track: #1e293b;
    --scrollbar-thumb: #475569;
    --scrollbar-thumb-hover: #64748b;
    color-scheme: dark;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInOpacity {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.animate-fade-in {
    animation: fadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background-color: var(--bg-main) !important;
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.navbar {
    background-color: var(--navbar-bg) !important;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    transition: var(--transition-smooth);
}

.navbar-brand {
    color: var(--text-main) !important;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-brand-lockup {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.05rem;
    line-height: 1;
    white-space: nowrap;
}

.navbar-brand-name {
    font-family: "Manrope", "Inter", system-ui, sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-main);
}

.navbar-brand-domain {
    font-family: "Inter", system-ui, sans-serif;
    font-weight: 500;
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    text-transform: lowercase;
}

.navbar-brand:hover .navbar-brand-domain {
    color: var(--primary-color, #2563eb);
}

.navbar-brand img.navbar-logo,
.navbar-brand svg {
    height: 56px !important;
    width: auto !important;
    max-height: 60px;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.navbar-brand:hover img.navbar-logo,
.navbar-brand:hover svg {
    transform: scale(1.04);
}

.navbar .nav-link,
.navbar .btn-link {
    color: var(--navbar-text) !important;
    font-weight: 500;
    position: relative;
    transition: var(--transition-fast);
}

.navbar .nav-link:not(.dropdown-toggle)::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: #2563eb;
    transition: var(--transition-smooth);
    transform: translateX(-50%);
    border-radius: 2px;
}

.navbar .nav-link:not(.dropdown-toggle):hover::after {
    width: 70%;
}

.navbar .nav-link.active:not(.dropdown-toggle) {
    color: #2563eb !important;
    background: rgba(37, 99, 235, 0.08);
    font-weight: 600;
}

.nav-ticket-alert {
    display: inline-block;
    margin-left: 0.35rem;
    min-width: 1.05rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff !important;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.15rem;
    text-align: center;
    vertical-align: 0.05em;
}

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

.navbar-app .nav-dropdown-menu {
    min-width: 240px;
    padding: 0.5rem;
    border-radius: 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-color) !important;
    margin-top: 0.5rem;
}

.navbar-app .dropdown-item {
    padding: 0.55rem 0.85rem;
    color: var(--text-main);
    font-weight: 500;
}

.navbar-app .dropdown-item.active,
.navbar-app .dropdown-item:active {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

.navbar-app .dropdown-item:hover {
    background: var(--input-bg);
}

.navbar-app .dropdown-header {
    font-weight: 700;
    color: var(--text-main);
    max-width: 220px;
}

.navbar-app .nav-user-toggle {
    display: inline-flex !important;
    align-items: center;
    gap: 0.35rem;
    color: var(--navbar-text) !important;
}

.navbar-app .nav-user-toggle.dropdown-toggle::after {
    display: none !important;
}

.navbar-app .nav-user-toggle:hover,
.navbar-app .nav-user-toggle:focus,
.navbar-app .nav-user-toggle.show {
    color: var(--navbar-text) !important;
    background: rgba(37, 99, 235, 0.08);
}

.navbar-app .nav-user-caret {
    font-size: 0.7rem;
    opacity: 0.65;
    flex-shrink: 0;
}

.navbar-app .nav-user-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.navbar-app .nav-user-avatar--placeholder {
    background: #2563eb;
    color: #fff;
    font-size: 1rem;
    line-height: 1;
}

.navbar-app .nav-user-toggle:hover .nav-user-avatar--placeholder,
.navbar-app .nav-user-toggle.show .nav-user-avatar--placeholder {
    background: #1d4ed8;
    color: #fff;
}

.navbar-app .nav-user-toggle::after {
    display: none;
}

.navbar-app .nav-user-name {
    display: none;
}

.navbar .nav-link:not(.dropdown-toggle):hover {
    color: #2563eb !important;
}

.navbar .nav-link.dropdown-toggle.active {
    color: #2563eb !important;
    background: rgba(37, 99, 235, 0.08);
    font-weight: 600;
}

.profile-page .profile-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.profile-avatar-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    isolation: isolate;
}

.profile-avatar-box {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    background: #2563eb;
    border: 4px solid var(--card-bg);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25), 0 8px 24px rgba(37, 99, 235, 0.15);
    position: relative;
    z-index: 1;
}

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

.profile-avatar-box--editing {
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.profile-avatar-box--editing:active,
.profile-avatar-box--editing.is-dragging {
    cursor: grabbing;
}

.profile-avatar-stage {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 50%;
}

.profile-avatar-img--editable {
    position: absolute;
    left: 0;
    top: 0;
    width: auto;
    height: auto;
    max-width: none;
    object-fit: unset;
    transform-origin: 0 0;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.profile-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 3rem;
    background: linear-gradient(145deg, #3b82f6, #2563eb);
}

.profile-avatar-upload {
    position: absolute;
    right: 2px;
    bottom: 2px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 3px solid var(--card-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: var(--transition-fast);
}

.profile-avatar-upload:hover {
    background: #1d4ed8;
    transform: scale(1.05);
}

.profile-avatar-crop-hint {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    text-align: left;
    font-size: 0.78rem;
    line-height: 1.35;
    color: #1e40af;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 0.75rem;
    padding: 0.55rem 0.7rem;
}

.profile-avatar-crop-hint i {
    flex-shrink: 0;
    margin-top: 0.1rem;
    font-size: 0.95rem;
}

[data-theme="dark"] .profile-avatar-crop-hint {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(147, 197, 253, 0.25);
}

.dept-docs-unlock-icon {
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    font-size: 1.6rem;
}

.main-container {
    flex: 1;
    width: 100% !important;
    max-width: 1400px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    /* Opacity-only: a transform on #spa-content creates a stacking context
       that puts Bootstrap backdrops (on body) above page modals. */
    animation: fadeInOpacity 0.4s ease-out;
}

@media (min-width: 992px) {
    .main-container {
        padding: 30px;
    }
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: var(--transition-smooth);
}

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

button.stat-card {
    background: var(--card-bg, #fff);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

button.stat-card:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.stat-card.is-active {
    box-shadow: 0 0 0 2px #3b82f6, var(--shadow-card, 0 4px 14px rgba(15, 23, 42, 0.08));
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    transition: var(--transition-smooth);
}

.stat-card:hover .stat-icon {
    transform: scale(1.08);
}

.stat-icon.blue { background-color: #eff6ff; color: #3b82f6; }
.stat-icon.green { background-color: #ecfdf5; color: #10b981; }
.stat-icon.yellow { background-color: #fefce8; color: #eab308; }
.stat-icon.red { background-color: #fef2f2; color: #ef4444; }

[data-theme="dark"] .stat-icon.blue { background-color: rgba(59, 130, 246, 0.2); color: #60a5fa; }
[data-theme="dark"] .stat-icon.green { background-color: rgba(16, 185, 129, 0.2); color: #34d399; }
[data-theme="dark"] .stat-icon.yellow { background-color: rgba(234, 179, 8, 0.2); color: #facc15; }
[data-theme="dark"] .stat-icon.red { background-color: rgba(239, 68, 68, 0.2); color: #f87171; }

[data-theme="dark"] .stat-icon i,
[data-theme="dark"] .stat-icon svg {
    color: inherit !important;
    fill: currentColor;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.btn, .badge {
    transition: var(--transition-fast);
}

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

.badge:hover {
    transform: scale(1.03);
}

.theme-switch {
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    transition: var(--transition-smooth);
}

.theme-switch:hover {
    background: var(--border-color);
    transform: translateY(-1px);
}

.form-control,
.form-select,
textarea {
    background-color: var(--input-bg) !important;
    border: 1px solid var(--input-border) !important;
    color: var(--text-main) !important;
    border-radius: 12px;
    padding: 0.65rem 1rem;
    transition: var(--transition-fast);
}

.form-control:focus,
.form-select:focus,
textarea:focus {
    background-color: var(--input-bg) !important;
    color: var(--text-main) !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
    outline: none;
}

.form-control::placeholder,
textarea::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.75 !important;
}

/* Login / auth fields: keep icon + input as one control */
.auth-input-group {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
}

.auth-input-group > .input-group-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.85rem;
    padding: 0.65rem 0.85rem;
    line-height: 1;
    border: 1px solid var(--input-border) !important;
    border-right: 0 !important;
    border-radius: 12px 0 0 12px !important;
    background: var(--input-bg) !important;
    color: var(--text-muted) !important;
}

.auth-input-group > .input-group-text .bi {
    display: block;
    font-size: 1.05rem;
    line-height: 1;
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
}

.auth-input-group > .form-control {
    border-radius: 0 12px 12px 0 !important;
    border-left: 0 !important;
    padding-left: 0.35rem !important;
    box-shadow: none !important;
}

.auth-input-group:focus-within > .input-group-text,
.auth-input-group:focus-within > .form-control {
    border-color: #3b82f6 !important;
}

.auth-input-group:focus-within > .form-control {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
}

.auth-input-group:focus-within > .input-group-text {
    color: #3b82f6 !important;
    z-index: 2;
}

.auth-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: -0.12em;
    line-height: 1;
}

.btn .bi {
    vertical-align: -0.08em;
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}

[data-theme="dark"] .modal-content,
[data-theme="dark"] .card {
    background-color: var(--card-bg) !important;
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
    border-radius: 12px;
}

[data-theme="dark"] .bg-light,
[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-body-tertiary,
[data-theme="dark"] .bg-body-subtle {
    background-color: var(--card-bg) !important;
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .text-dark,
[data-theme="dark"] .text-body,
[data-theme="dark"] .text-black {
    color: var(--text-main) !important;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] label,
[data-theme="dark"] .form-label,
[data-theme="dark"] .card-title,
[data-theme="dark"] .col-form-label {
    color: var(--text-main) !important;
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] small,
[data-theme="dark"] .small,
[data-theme="dark"] .form-text {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .btn-outline-secondary {
    color: #cbd5e1 !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: #334155 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .main-container .border-start,
[data-theme="dark"] .main-container [class*="border-start"],
[data-theme="dark"] .main-container .p-3.mb-3,
[data-theme="dark"] .main-container .p-3.mb-4,
[data-theme="dark"] .main-container .p-3.my-3 {
    background-color: #0b1120 !important;
    border: 1px solid #334155 !important;
    border-radius: 12px !important;
    padding: 1.25rem !important;
    margin-bottom: 1rem !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .alert-success {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
    color: #6ee7b7 !important;
}

[data-theme="dark"] .alert-success .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.table {
    color: var(--text-main) !important;
    vertical-align: middle;
    --bs-table-bg: transparent !important;
    width: 100% !important;
}

.table td,
.table th {
    border-color: var(--border-color) !important;
    background-color: transparent !important;
    color: var(--text-main) !important;
    padding-right: 1.25rem !important;
}

.table thead th + th {
    border-left: 1px dashed var(--border-color);
    padding-left: 1rem !important;
}

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

.table tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.04) !important;
}

.table td {
    word-break: break-word;
    overflow-wrap: anywhere;
}

[data-theme="dark"] .table {
    --bs-table-color: var(--text-main) !important;
    --bs-table-border-color: var(--border-color) !important;
}

[data-theme="dark"] .table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .btn-outline-primary {
    color: #60a5fa !important;
    border-color: #3b82f6 !important;
}

[data-theme="dark"] .btn-outline-primary:hover {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

.badge-department,
.badge-status-returned {
    white-space: nowrap !important;
    text-overflow: ellipsis;
    overflow: hidden;
    display: inline-block;
    max-width: 100%;
    line-height: 1.3;
    padding: 0.4em 0.65em;
    font-size: 0.825rem;
    font-weight: 500;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.badge-department {
    background-color: var(--input-bg);
    color: var(--text-main);
}

.badge-status-returned {
    background-color: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
}

[data-theme="dark"] .badge-status-returned {
    background-color: rgba(194, 65, 12, 0.2);
    color: #fb923c;
    border-color: rgba(194, 65, 12, 0.4);
}

.badge-status-returned:hover {
    transform: scale(1.03);
}

.ticket-description-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    max-height: 2.7em;
}

.nav-tabs {
    border-bottom: 2px solid var(--border-color);
}

.nav-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    padding: 0.6rem 1.2rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link.active {
    color: #2563eb;
    background-color: rgba(37, 99, 235, 0.08);
    font-weight: 600;
}

.modal-content {
    animation: fadeInScale 0.3s ease-out;
    background-color: var(--card-bg);
    border-color: var(--border-color);
    border-radius: 12px;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

#spa-content.spa-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.12s ease;
}

/* ── Админ: обратная связь ── */
.feedback-admin-page {
    max-width: 100%;
}

.feedback-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.feedback-stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.feedback-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
}

.feedback-admin-toolbar {
    background: var(--card-bg);
    border-color: var(--border-color) !important;
    padding: 0.75rem 1rem;
}

.feedback-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.feedback-chip {
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.feedback-chip:hover {
    border-color: #3b82f6;
    color: #2563eb;
}

.feedback-chip.active {
    background: rgba(37, 99, 235, 0.12);
    border-color: #3b82f6;
    color: #2563eb;
    font-weight: 600;
}

.feedback-chip-count {
    display: inline-block;
    min-width: 1.25rem;
    padding: 0 0.35rem;
    margin-left: 0.15rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
    font-size: 0.72rem;
    font-weight: 700;
}

.feedback-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.feedback-card {
    display: flex;
    align-items: stretch;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.15s ease;
}

.feedback-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.feedback-card__accent {
    width: 4px;
    flex-shrink: 0;
    background: var(--border-color);
}

.feedback-card--new .feedback-card__accent {
    background: #ef4444;
}

.feedback-card--cat-bug.feedback-card--new .feedback-card__accent {
    background: #f59e0b;
}

.feedback-card--read .feedback-card__accent {
    background: #3b82f6;
}

.feedback-card--resolved {
    opacity: 0.82;
}

.feedback-card--resolved .feedback-card__accent {
    background: #10b981;
}

.feedback-card__body {
    flex: 1;
    min-width: 0;
    padding: 1rem 1.15rem;
}

.feedback-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.feedback-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.feedback-card__time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.feedback-card__author {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.feedback-card__author i {
    color: var(--text-muted);
}

.feedback-card__message {
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text-main);
    white-space: pre-wrap;
    word-break: break-word;
}

.feedback-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.feedback-cat-pill--bug {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.feedback-cat-pill--wish {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.feedback-cat-pill--other {
    background: var(--input-bg);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.fb-status-pill {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.fb-status-pill--new {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.fb-status-pill--read {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.fb-status-pill--resolved {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.feedback-card__actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.75rem;
    border-left: 1px solid var(--border-color);
    background: var(--input-bg);
}

.feedback-act-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--card-bg);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.feedback-act-btn:hover {
    border-color: #3b82f6;
    color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
}

.feedback-act-btn--done:hover {
    border-color: #10b981;
    color: #059669;
    background: rgba(16, 185, 129, 0.08);
}

.feedback-done-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
}

.feedback-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.feedback-empty i {
    font-size: 2.5rem;
    line-height: 1;
    opacity: 0.4;
    margin-bottom: 0.75rem;
}

@media (max-width: 575px) {
    .feedback-card {
        flex-direction: column;
    }
    .feedback-card__accent {
        width: 100%;
        height: 4px;
    }
    .feedback-card__actions {
        flex-direction: row;
        border-left: none;
        border-top: 1px solid var(--border-color);
        justify-content: flex-end;
    }
}

/* ── Админ: пользователи ── */
.users-admin-page {
    max-width: 100%;
}

.users-admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
}

.users-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.6rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.users-stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    white-space: nowrap;
}

.users-stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
}

.users-create-card {
    background: var(--card-bg);
    border-color: var(--border-color) !important;
    padding: 0.85rem 1rem 1rem;
}

.users-create-card__head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.65rem;
    color: var(--text-main);
}

.users-create-card__head i {
    font-size: 1.1rem;
    color: #3b82f6;
}

.users-create-card__head h5 {
    font-size: 0.95rem;
}

.users-create-form .form-label {
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    color: var(--text-muted);
}

.users-create-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1.15fr) minmax(0, 0.95fr) minmax(0, 0.9fr) minmax(0, 1.25fr) minmax(7.5rem, 0.9fr);
    gap: 0.55rem 0.65rem;
    align-items: end;
}

.users-create-form .form-control-sm,
.users-create-form .form-select-sm,
.users-create-field--btn .users-create-btn {
    height: calc(1.5em + 0.5rem + 2px);
    min-height: calc(1.5em + 0.5rem + 2px);
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    font-size: 0.875rem;
    line-height: 1.5;
    box-sizing: border-box;
}

.users-create-field--btn .users-create-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
    font-weight: 600;
}

.users-list-panel {
    background: var(--card-bg);
    border-color: var(--border-color) !important;
    overflow: hidden;
}

.users-list-toolbar {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.users-search-wrap {
    position: relative;
    flex: 1 1 200px;
    min-width: 0;
    max-width: 320px;
}

.users-search-wrap i {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.85rem;
}

.users-search-wrap input {
    padding-left: 2rem;
    background: var(--input-bg);
    border-color: var(--border-color);
}

.users-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-left: auto;
}

.users-chip {
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    border-radius: 999px;
    padding: 0.28rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.users-chip:hover {
    border-color: #3b82f6;
    color: #2563eb;
}

.users-chip.active {
    background: rgba(37, 99, 235, 0.12);
    border-color: #3b82f6;
    color: #2563eb;
    font-weight: 600;
}

.users-list {
    display: flex;
    flex-direction: column;
}

.users-list-head,
.users-card {
    display: grid;
    grid-template-columns: 38px minmax(0, 1.15fr) minmax(0, 1.35fr) minmax(0, 1.15fr) minmax(88px, 0.65fr) 72px;
    align-items: center;
    gap: 0.5rem 1.25rem;
    padding: 0.6rem 1rem;
}

.users-list-head {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: var(--input-bg);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.users-card {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.12s ease;
}

.users-card:last-child {
    border-bottom: none;
}

.users-card:hover {
    background: rgba(37, 99, 235, 0.03);
}

.users-card.is-hidden {
    display: none;
}

.users-card__avatar {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
}

.users-card__avatar img,
.users-card__initials {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    background: linear-gradient(135deg, #dbeafe, #e0e7ff);
    color: #2563eb;
}

.users-card__body {
    min-width: 0;
}

.users-card__col {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.users-card__col--role {
    align-items: flex-start;
}

.users-card__name {
    font-weight: 600;
    font-size: 0.88rem;
    line-height: 1.3;
}

.users-card__id {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.users-card__last-login {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.15rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.25;
}

.users-card__last-login--never {
    opacity: 0.75;
    font-style: italic;
}

.users-card__email {
    font-size: 0.82rem;
    line-height: 1.35;
    word-break: break-word;
}

.users-card__extra {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.users-role-pill {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.3;
}

.users-role-pill--admin {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.users-role-pill--support {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.users-role-pill--manager {
    background: #f5f3ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

.users-role-pill--user {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.users-stat-value.text-purple {
    color: #7c3aed;
}

.users-card__dept {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.3rem;
    font-size: 0.82rem;
    line-height: 1.35;
    color: var(--text-main);
}

.users-card__dept--empty {
    color: var(--text-muted);
}

.users-card__dept i {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.users-locked-badge {
    color: #dc2626;
    font-weight: 600;
    font-size: 0.72rem;
}

.users-card__actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

.users-card__actions .btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 991px) {
    .users-list-head {
        display: none;
    }
    .users-card {
        grid-template-columns: 38px minmax(0, 1fr) minmax(0, 1fr) 72px;
        grid-template-rows: auto auto;
    }
    .users-card__col--name {
        grid-column: 2 / 3;
        grid-row: 1;
    }
    .users-card__col--email {
        grid-column: 3 / 4;
        grid-row: 1;
    }
    .users-card__col--dept {
        grid-column: 2 / 3;
        grid-row: 2;
    }
    .users-card__col--role {
        grid-column: 3 / 4;
        grid-row: 2;
    }
    .users-card__avatar {
        grid-row: 1 / 3;
    }
    .users-card__actions {
        grid-column: 4 / 5;
        grid-row: 1 / 3;
    }
}

@media (max-width: 1199px) {
    .users-create-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .users-create-field--dept {
        grid-column: span 2;
    }
    .users-create-field--btn {
        grid-column: span 1;
    }
}

@media (max-width: 767px) {
    .users-admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .users-create-grid {
        grid-template-columns: 1fr 1fr;
    }
    .users-create-field--dept,
    .users-create-field--btn {
        grid-column: span 2;
    }
    .users-list-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .users-search-wrap {
        max-width: none;
    }
    .users-filter-chips {
        margin-left: 0;
    }
}

@media (max-width: 575px) {
    .users-list-head,
    .users-card {
        grid-template-columns: 38px minmax(0, 1fr) 72px;
        grid-template-rows: auto auto auto;
    }
    .users-card__col--name {
        grid-column: 2 / 3;
        grid-row: 1;
    }
    .users-card__col--email {
        grid-column: 2 / 3;
        grid-row: 2;
    }
    .users-card__col--dept {
        grid-column: 2 / 3;
        grid-row: 3;
    }
    .users-card__col--role {
        grid-column: 2 / 3;
        grid-row: 4;
    }
    .users-card__avatar {
        grid-row: 1 / 5;
    }
    .users-card__actions {
        grid-column: 3 / 4;
        grid-row: 1 / 5;
        align-self: start;
    }
}

@media (max-width: 479px) {
    .users-create-grid {
        grid-template-columns: 1fr;
    }
    .users-create-field--dept,
    .users-create-field--btn {
        grid-column: span 1;
    }
}

/* ── Админ: заявки на кабинет ── */
.requests-admin-page {
    max-width: 100%;
}

.requests-admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
}

.requests-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.6rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.requests-stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    white-space: nowrap;
}

.requests-stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
}

.requests-list-panel {
    background: var(--card-bg);
    border-color: var(--border-color) !important;
    overflow: hidden;
}

.requests-list-toolbar {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.requests-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.requests-chip {
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    border-radius: 999px;
    padding: 0.28rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.requests-chip:hover {
    border-color: #3b82f6;
    color: #2563eb;
}

.requests-chip.active {
    background: rgba(37, 99, 235, 0.12);
    border-color: #3b82f6;
    color: #2563eb;
    font-weight: 600;
}

.requests-chip-count {
    display: inline-block;
    min-width: 1.25rem;
    padding: 0 0.3rem;
    margin-left: 0.15rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
    font-size: 0.7rem;
    font-weight: 700;
}

.requests-list {
    display: flex;
    flex-direction: column;
}

.requests-card {
    display: grid;
    grid-template-columns: 4px minmax(0, 1fr) auto;
    align-items: stretch;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.12s ease;
}

.requests-card:last-child {
    border-bottom: none;
}

.requests-card:hover {
    background: rgba(37, 99, 235, 0.03);
}

.requests-card.is-hidden {
    display: none;
}

.requests-card__accent {
    background: var(--border-color);
}

.requests-card--pending .requests-card__accent {
    background: #f59e0b;
}

.requests-card--approved .requests-card__accent {
    background: #10b981;
}

.requests-card--rejected .requests-card__accent {
    background: #ef4444;
}

.requests-card__body {
    min-width: 0;
    padding: 0.85rem 1rem;
}

.requests-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    flex-wrap: wrap;
}

.requests-card__person {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.requests-card__avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    background: linear-gradient(135deg, #dbeafe, #e0e7ff);
    color: #2563eb;
}

.requests-card__identity {
    min-width: 0;
}

.requests-card__name {
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.3;
}

.requests-card__email {
    font-size: 0.8rem;
    color: var(--text-muted);
    word-break: break-all;
    line-height: 1.35;
}

.requests-card__badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex-shrink: 0;
}

.requests-status-pill {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.requests-status-pill--pending {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.requests-status-pill--approved {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.requests-status-pill--rejected {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.requests-card__time {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.requests-card__comment {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    margin-top: 0.55rem;
    padding: 0.5rem 0.65rem;
    border-radius: 0.55rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--text-main);
}

.requests-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1rem;
    margin-top: 0.55rem;
}

.requests-card__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: var(--text-main);
}

.requests-card__meta-item i {
    color: var(--text-muted);
    flex-shrink: 0;
}

.requests-card__comment i {
    color: var(--text-muted);
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.requests-card__actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.75rem 1rem;
    border-left: 1px solid var(--border-color);
    min-width: 8.5rem;
}

.requests-card__actions .btn {
    white-space: nowrap;
}

.requests-done-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.requests-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.requests-empty i {
    font-size: 2.5rem;
    line-height: 1;
    color: #93c5fd;
    opacity: 0.85;
    margin-bottom: 0.75rem;
}

@media (max-width: 767px) {
    .requests-admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .requests-card {
        grid-template-columns: 4px minmax(0, 1fr);
        grid-template-rows: auto auto;
    }
    .requests-card__accent {
        grid-row: 1 / 3;
    }
    .requests-card__actions {
        grid-column: 2;
        flex-direction: row;
        justify-content: flex-end;
        border-left: none;
        border-top: 1px solid var(--border-color);
        min-width: 0;
        padding-top: 0.55rem;
    }
}

/* ── Админ: отделы ── */
.depts-admin-page {
    max-width: 100%;
}

.depts-admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
}

.depts-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.6rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.depts-stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    white-space: nowrap;
}

.depts-stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
}

.dept-doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border-color);
}

.dept-doc-item:last-child {
    border-bottom: none;
}

.dept-doc-item__main {
    min-width: 0;
}

.dept-doc-item__name {
    display: inline-block;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
}

.dept-doc-item__name:hover {
    color: #2563eb;
}

.dept-doc-item__meta {
    font-size: 0.78rem;
    color: var(--text-muted, #64748b);
}

.dept-folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.75rem;
}

.dept-folder-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.35rem;
    min-height: 7.5rem;
    padding: 1rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    background: var(--card-bg);
    color: var(--text-main);
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.dept-folder-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
    color: var(--text-main);
}

.dept-folder-card__icon {
    font-size: 1.75rem;
    color: #93c5fd;
    line-height: 1;
}

.dept-folder-card__title {
    font-weight: 700;
    font-size: 0.95rem;
    word-break: break-word;
}

.dept-folder-card__meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.dept-table-wrap {
    overflow: auto;
    max-width: 100%;
}

.dept-table {
    min-width: 100%;
    font-size: 0.88rem;
}

.dept-table--readonly {
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
    font-size: 0.72rem;
}

.dept-table--readonly thead th {
    white-space: normal;
    font-size: 0.66rem;
    padding: 0.35rem 0.4rem;
    line-height: 1.2;
    vertical-align: bottom;
}

.dept-table--readonly .dept-table__cell {
    padding: 0.4rem 0.45rem;
    line-height: 1.3;
    font-size: 0.72rem;
    vertical-align: top;
    word-break: normal;
    overflow-wrap: break-word;
}

.dept-table--readonly .dept-table__num {
    width: 2rem;
    min-width: 2rem;
    max-width: 2rem;
    padding: 0.35rem 0.15rem;
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
    box-sizing: border-box;
    vertical-align: top;
}

.dept-table--readonly thead th.dept-table__num {
    padding: 0.35rem 0.15rem;
    font-size: 0.62rem;
}

.dept-table--readonly [data-col-name="Hostname"] {
    width: 12rem;
    min-width: 12rem;
}

.dept-table--readonly [data-col-name="IP"] {
    width: 7.25rem;
    min-width: 7.25rem;
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
}

.dept-table--readonly [data-col-name="ОС и ядро"] {
    width: 11rem;
    min-width: 11rem;
}

.dept-table--readonly [data-col-name="CPU"] {
    width: 13rem;
    min-width: 13rem;
}

.dept-table--readonly [data-col-name="RAM"] {
    width: 14rem;
    min-width: 14rem;
}

.dept-table--readonly [data-col-name="Диски"] {
    width: 24rem;
    min-width: 22rem;
}

.dept-table--readonly [data-col-name="RAID / СХД"] {
    width: 14rem;
    min-width: 13rem;
}

.dept-table--readonly [data-col-name="Сеть"] {
    width: 18rem;
    min-width: 16rem;
}

.dept-table--readonly [data-col-name="Uptime"] {
    width: 11.5rem;
    min-width: 11.5rem;
    white-space: normal;
    overflow-wrap: break-word;
}

.dept-table--readonly [data-col-name="Оборудование"] {
    width: 11rem;
    min-width: 10rem;
}

.dept-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--card-bg);
    white-space: nowrap;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.dept-table__num {
    width: 1.75rem;
    text-align: center;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.dept-table__actions {
    width: 3rem;
    text-align: center;
}

.dept-table__input {
    min-width: 8rem;
    border-color: transparent;
    background: transparent;
}

.dept-table__input:focus {
    border-color: #93c5fd;
    background: var(--input-bg);
    box-shadow: none;
}

.dept-table__cell {
    padding: 0.55rem 0.75rem;
    vertical-align: middle;
    white-space: pre-wrap;
    word-break: break-word;
}

.dept-table--readonly tbody tr {
    cursor: default;
}

.dept-columns-editor {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dept-column-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 7rem auto;
    gap: 0.5rem;
    align-items: center;
}

.dept-column-row__actions {
    display: flex;
    gap: 0.25rem;
}

@media (max-width: 575px) {
    .dept-column-row {
        grid-template-columns: 1fr;
    }
}

.ftp-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem 0.35rem;
    font-size: 0.9rem;
}

.ftp-breadcrumb__sep {
    color: var(--text-muted, #94a3b8);
}

.ftp-breadcrumb__link {
    border: none;
    background: none;
    padding: 0;
    color: #2563eb;
    font-weight: 500;
}

.ftp-breadcrumb__link.is-active {
    color: var(--text-main);
    font-weight: 600;
    pointer-events: none;
}

.ftp-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border-color);
}

.ftp-item:last-child {
    border-bottom: none;
}

.ftp-item__main {
    min-width: 0;
    flex: 1;
}

.ftp-item__name {
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    max-width: 100%;
    word-break: break-word;
}

.ftp-item__name:hover {
    color: #2563eb;
}

.ftp-item__meta {
    font-size: 0.78rem;
    color: var(--text-muted, #64748b);
    margin-top: 0.15rem;
    padding-left: 1.65rem;
}

.ftp-item__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    flex-shrink: 0;
}

.ftp-item__name--file {
    cursor: default;
}

.ftp-dropzone.is-dragover {
    outline: 2px dashed #2563eb;
    outline-offset: 4px;
    border-radius: 0.75rem;
}

.ftp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.75rem 1rem;
    color: var(--text-muted, #64748b);
}

.ftp-empty i {
    font-size: 1.75rem;
    line-height: 1;
    color: #93c5fd;
    margin-bottom: 0.5rem;
}

.ftp-empty__title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted, #64748b);
}

.ftp-transfer-progress__bar {
    height: 0.5rem;
    background: var(--input-bg);
}

.ftp-transfer-progress__label {
    color: var(--text-main);
}

.ftp-transfer-progress__hint--warn {
    color: var(--bs-warning, #b45309);
}

.ftp-edit-area {
    min-height: 12rem;
    font-size: 0.85rem;
}

.ftp-view-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.85rem;
    max-height: 70vh;
    overflow: auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
}

.ftp-view-image {
    max-height: 70vh;
    margin: 0 auto;
    display: block;
}

.ftp-view-frame {
    width: 100%;
    min-height: 70vh;
    border: 0;
    border-radius: 0.75rem;
}

.station-files-toast {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1080;
    max-width: min(26rem, calc(100vw - 1.5rem));
    animation: stationToastIn 0.28s ease-out;
}

@keyframes stationToastIn {
    from {
        opacity: 0;
        transform: translateY(0.75rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.station-files-toast__card {
    background: var(--card-bg, #fff);
    border: 1px solid rgba(220, 53, 69, 0.28);
    border-radius: 1rem;
    box-shadow: 0 0.75rem 2rem rgba(15, 23, 42, 0.16);
    padding: 0.9rem 1rem 1rem;
}

.station-files-toast__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.station-files-toast__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    font-size: 0.92rem;
    line-height: 1.3;
}

.station-files-toast__list {
    max-height: 9.5rem;
    overflow: auto;
    margin-bottom: 0.75rem;
}

.station-files-toast__list li {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    font-size: 0.84rem;
    padding: 0.35rem 0;
    border-top: 1px solid var(--border-color, #e9ecef);
}

.station-files-toast__list li:first-child {
    border-top: 0;
    padding-top: 0;
}

.station-files-toast__list .text-muted {
    font-size: 0.75rem;
}

.station-files-toast__actions {
    display: flex;
    justify-content: flex-end;
}

.station-files-toast__close {
    margin-top: 0.1rem;
    font-size: 0.7rem;
}

@media (max-width: 576px) {
    .station-files-toast {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
        max-width: none;
    }
}

.depts-create-card {
    background: var(--card-bg);
    border-color: var(--border-color) !important;
    padding: 0.85rem 1rem 1rem;
}

.depts-create-card__head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.65rem;
}

.depts-create-card__head i {
    font-size: 1.1rem;
    color: #3b82f6;
}

.depts-create-card__head h5 {
    font-size: 0.95rem;
}

.depts-create-form .form-label {
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    color: var(--text-muted);
}

.depts-create-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(8rem, 0.55fr);
    gap: 0.55rem 0.85rem;
    align-items: end;
}

.depts-create-grid.backup-settings-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(8.5rem, 0.7fr) minmax(6.5rem, 0.48fr);
    gap: 0.75rem 1rem;
    align-items: end;
}

.backup-settings-grid .backup-settings-field--dir {
    grid-column: 1 / -1;
    align-self: stretch;
}

.backup-settings-grid .form-text {
    margin-top: 0.25rem;
    font-size: 0.72rem;
}

.backup-settings-actions {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-color);
}

.depts-create-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    min-height: calc(1.5em + 0.5rem + 2px);
    align-items: center;
}

.depts-param-tip {
    position: relative;
}

.depts-param-tip .form-check-label {
    border-bottom: 1px dotted transparent;
    cursor: help;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.depts-param-tip:hover .form-check-label,
.depts-param-tip:focus-within .form-check-label {
    color: #2563eb;
    border-bottom-color: rgba(37, 99, 235, 0.45);
}

.depts-param-tip__popup {
    position: absolute;
    bottom: calc(100% + 0.4rem);
    left: 0;
    z-index: 50;
    display: none;
    width: max-content;
    max-width: 15.5rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 0.65rem;
    background: var(--input-bg);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
    font-size: 0.78rem;
    line-height: 1.45;
    font-weight: 400;
    color: var(--text-main);
    white-space: normal;
    pointer-events: none;
}

.depts-param-tip:hover .depts-param-tip__popup,
.depts-param-tip:focus-within .depts-param-tip__popup {
    display: block;
}

.depts-create-card {
    overflow: visible;
}

.depts-create-form .form-control-sm,
.depts-create-field--btn .depts-create-btn {
    height: calc(1.5em + 0.5rem + 2px);
    min-height: calc(1.5em + 0.5rem + 2px);
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    font-size: 0.875rem;
    line-height: 1.5;
    box-sizing: border-box;
}

.depts-create-field--btn .depts-create-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.depts-list-panel {
    background: var(--card-bg);
    border-color: var(--border-color) !important;
    overflow: hidden;
}

.depts-list-toolbar {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.depts-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.depts-chip {
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    border-radius: 999px;
    padding: 0.28rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.depts-chip:hover {
    border-color: #3b82f6;
    color: #2563eb;
}

.depts-chip.active {
    background: rgba(37, 99, 235, 0.12);
    border-color: #3b82f6;
    color: #2563eb;
    font-weight: 600;
}

.depts-list {
    display: flex;
    flex-direction: column;
}

.depts-list-head,
.depts-card {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(90px, 0.7fr) minmax(100px, 0.8fr) minmax(90px, 0.75fr) 76px;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.65rem 1rem;
}

.depts-list-head {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: var(--input-bg);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.depts-card {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.12s ease;
}

.depts-card:last-child {
    border-bottom: none;
}

.depts-card:hover {
    background: rgba(37, 99, 235, 0.03);
}

.depts-card.is-hidden {
    display: none;
}

.depts-card__name {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.depts-group {
    border-bottom: 1px solid var(--border-color);
}

.depts-group:last-child {
    border-bottom: none;
}

.depts-group__children .depts-card {
    background: rgba(37, 99, 235, 0.02);
}

.depts-group.is-collapsed .depts-group__children {
    display: none;
}

.depts-group.is-collapsed .depts-card__toggle i {
    transform: rotate(-90deg);
}

.depts-card--child .depts-card__name {
    padding-left: calc(1.35rem * var(--dept-depth, 1));
}

.depts-group__children .depts-group {
    border-bottom: none;
}

.depts-card__drag {
    width: 1.35rem;
    height: 1.6rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: grab;
    border-radius: 0.35rem;
}

.depts-card__drag:active {
    cursor: grabbing;
}

.depts-card__drag:hover {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
}

.depts-card.is-dragging {
    opacity: 0.45;
}

.depts-card.is-drop-hover,
.depts-root-drop.is-drop-hover {
    background: rgba(37, 99, 235, 0.08);
    outline: 2px dashed #93c5fd;
    outline-offset: -2px;
}

.depts-root-drop {
    margin: 0.75rem 1rem 0.5rem;
    padding: 0.65rem 0.85rem;
    border: 1px dashed var(--border-color);
    border-radius: 0.75rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    background: var(--input-bg);
}

.depts-card__toggle {
    width: 1.6rem;
    height: 1.6rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    border-radius: 0.4rem;
    padding: 0;
}

.depts-card__toggle:hover {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
}

.depts-card__toggle i {
    transition: transform 0.15s ease;
}

.depts-card__child-spacer {
    width: 1.6rem;
    flex-shrink: 0;
}

.depts-card--parent .depts-card__icon {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

.depts-card__icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #dbeafe, #e0e7ff);
    color: #2563eb;
    font-size: 0.95rem;
}

.depts-card__title {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.3;
    word-break: break-word;
}

.depts-card__titles {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.depts-card__short {
    font-size: 0.75rem;
    line-height: 1.2;
}

.depts-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.depts-pill--yes {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.depts-pill--no {
    background: var(--input-bg);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.depts-pill--visible {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.depts-pill--hidden {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.depts-card__actions {
    display: flex;
    gap: 0.3rem;
    justify-content: flex-end;
}

.depts-card__actions .btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.depts-empty,
.users-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.depts-empty i,
.users-empty i {
    font-size: 2.5rem;
    line-height: 1;
    color: #93c5fd;
    opacity: 0.85;
    margin-bottom: 0.75rem;
}

@media (max-width: 767px) {
    .depts-admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .depts-create-grid {
        grid-template-columns: 1fr;
    }
    .depts-list-head {
        display: none;
    }
    .depts-card {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        gap: 0.45rem 0.75rem;
    }
    .depts-card__name {
        grid-column: 1;
        grid-row: 1;
    }
    .depts-card__actions {
        grid-column: 2;
        grid-row: 1;
    }
    .depts-card__flag:nth-of-type(1) {
        grid-column: 1;
        grid-row: 2;
    }
    .depts-card__flag:nth-of-type(2) {
        grid-column: 2;
        grid-row: 2;
        justify-self: end;
    }
}

/* ── Общий пул: панель фильтров ── */
.pool-panel {
    background: var(--card-bg);
    border-color: var(--border-color) !important;
    overflow: hidden;
}

.pool-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.25rem 0.85rem;
}

.pool-panel__title {
    font-size: 1.35rem;
    margin: 0;
}

.pool-panel__subtitle {
    font-size: 0.875rem;
}

.pool-panel__count {
    flex-shrink: 0;
    min-width: 2.75rem;
    height: 2.75rem;
    padding: 0 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
}

.pool-panel__filters {
    display: grid;
    grid-template-columns: 2fr repeat(4, 1fr);
    gap: 0.65rem 0.75rem;
    align-items: end;
    padding: 0.85rem 1.25rem 1.15rem;
    border-top: 1px solid var(--border-color);
    background: var(--input-bg);
}

.pool-field__label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.pool-field__input-wrap {
    position: relative;
}

.pool-field__input-wrap i {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.pool-field__input-wrap .form-control {
    padding-left: 2rem;
    border-radius: 0.5rem;
    border-color: var(--border-color);
    background: var(--card-bg);
}

.pool-panel__filters .form-select {
    border-radius: 0.5rem;
    border-color: var(--border-color);
    background-color: var(--card-bg);
}

@media (max-width: 1199px) {
    .pool-panel__filters {
        grid-template-columns: 1fr 1fr 1fr;
    }
    .pool-field--search {
        grid-column: 1 / -1;
    }
}

@media (max-width: 575px) {
    .pool-panel__filters {
        grid-template-columns: 1fr;
    }
    .pool-panel__header {
        flex-direction: column;
        align-items: flex-start;
    }
}

.tickets-table-card {
    background: var(--card-bg);
    border-color: var(--border-color) !important;
    overflow: hidden;
}

.tickets-table-card.is-loading,
#dashboard-table-wrap.is-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.tickets-table-scroll {
    overflow-x: auto;
}

@media (min-width: 992px) {
    .tickets-pool-page .tickets-table-scroll {
        overflow-x: visible;
    }
}

.tickets-table {
    --bs-table-hover-bg: rgba(37, 99, 235, 0.04);
    width: 100%;
    table-layout: fixed;
    min-width: 0;
}

.tickets-table--admin col.col-id { width: 4%; }
.tickets-table--admin col.col-topic { width: 20%; }
.tickets-table--admin col.col-author { width: 12%; }
.tickets-table--admin col.col-author-dept { width: 5%; }
.tickets-table--admin col.col-dept { width: 5%; }
.tickets-table--admin col.col-priority { width: 10%; }
.tickets-table--admin col.col-status { width: 10%; }
.tickets-table--admin col.col-assignee { width: 12%; }
.tickets-table--admin col.col-date { width: 8%; }
.tickets-table--admin col.col-actions { width: 10%; }

.tickets-table--cabinet col.col-id { width: 5%; }
.tickets-table--cabinet col.col-date { width: 9%; }
.tickets-table--cabinet col.col-topic { width: 28%; }
.tickets-table--cabinet col.col-author { width: 16%; }
.tickets-table--cabinet col.col-author-dept { width: 7%; }
.tickets-table--cabinet col.col-priority { width: 12%; }
.tickets-table--cabinet col.col-status { width: 12%; }
.tickets-table--cabinet col.col-actions { width: 11%; }

.tickets-table:not(.tickets-table--admin):not(.tickets-table--cabinet) col.col-id { width: 5%; }
.tickets-table:not(.tickets-table--admin):not(.tickets-table--cabinet) col.col-topic { width: 26%; }
.tickets-table:not(.tickets-table--admin):not(.tickets-table--cabinet) col.col-author-dept { width: 5%; }
.tickets-table:not(.tickets-table--admin):not(.tickets-table--cabinet) col.col-dept { width: 5%; }
.tickets-table:not(.tickets-table--admin):not(.tickets-table--cabinet) col.col-priority { width: 11%; }
.tickets-table:not(.tickets-table--admin):not(.tickets-table--cabinet) col.col-status { width: 11%; }
.tickets-table:not(.tickets-table--admin):not(.tickets-table--cabinet) col.col-assignee { width: 13%; }
.tickets-table:not(.tickets-table--admin):not(.tickets-table--cabinet) col.col-date { width: 9%; }
.tickets-table:not(.tickets-table--admin):not(.tickets-table--cabinet) col.col-actions { width: 10%; }

.tickets-table thead th {
    background: var(--input-bg);
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-color);
    border-top: none;
    padding: 0.65rem 0.4rem !important;
    white-space: nowrap;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center !important;
}

.tickets-table tbody td {
    padding: 0.55rem 0.4rem !important;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    text-align: center !important;
}

/* Beat global .table / .main-container * left-align + asymmetric padding */
.tickets-table.table td,
.tickets-table.table th,
.tickets-table thead th + th {
    text-align: center !important;
    padding-left: 0.4rem !important;
    padding-right: 0.4rem !important;
}

.tickets-table tbody td.col-id {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center !important;
}

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

.ticket-row-unread {
    background: rgba(37, 99, 235, 0.05);
    box-shadow: inset 3px 0 0 #2563eb;
}

.ticket-row-new {
    background: rgba(100, 116, 139, 0.1);
}

.ticket-row-new:hover > * {
    background: transparent;
}

.tickets-table.table-hover > tbody > tr.ticket-row-new:hover > * {
    --bs-table-bg-state: rgba(100, 116, 139, 0.14);
    background-color: rgba(100, 116, 139, 0.14);
}

[data-theme="dark"] .ticket-row-new {
    background: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .tickets-table.table-hover > tbody > tr.ticket-row-new:hover > * {
    --bs-table-bg-state: rgba(148, 163, 184, 0.18);
    background-color: rgba(148, 163, 184, 0.18);
}

.ticket-new-mark {
    display: inline-block;
    margin: 0.15rem 0 0.1rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    line-height: 1.35;
    text-transform: uppercase;
    color: #15803d;
    background: rgba(34, 197, 94, 0.16);
    white-space: nowrap;
}

[data-theme="dark"] .ticket-new-mark {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.2);
}

.ticket-topic-cell {
    min-width: 0;
    text-align: center !important;
}

.tickets-table .ticket-topic-cell,
.tickets-table .ticket-topic-cell * {
    text-align: center !important;
}

.tickets-table .ticket-topic-cell > .d-flex {
    justify-content: center;
    align-items: center;
}

.ticket-topic-title {
    font-weight: 600;
    font-size: 0.84rem;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-topic-desc {
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 0.1rem;
}

.ticket-author-cell {
    min-width: 0;
    text-align: center !important;
}

.tickets-table .ticket-author-cell,
.tickets-table .ticket-author-cell *,
.tickets-table .ticket-dept-text,
.tickets-table .ticket-date,
.tickets-table .ticket-date * {
    text-align: center !important;
}

.ticket-author-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-author-email {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-dept-text {
    display: block;
    font-size: 0.78rem;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-pill {
    display: inline-block;
    box-sizing: border-box;
    min-width: 5.75rem;
    width: 5.75rem;
    padding: 0.2rem 0.35rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
    border: 1px solid transparent;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tickets-table .ticket-pill {
    min-width: 5.75rem;
    width: 5.75rem;
    text-align: center !important;
}

.tickets-table thead th.col-topic,
.tickets-table thead th.col-priority,
.tickets-table thead th.col-status {
    text-overflow: clip;
    overflow: visible;
}

.ticket-pill--danger { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.ticket-pill--warning { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.ticket-pill--muted { background: var(--input-bg); color: var(--text-muted); border-color: var(--border-color); }
.ticket-pill--success { background: #ecfdf5; color: #059669; border-color: #a7f3d0; }
.ticket-pill--primary { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.ticket-pill--info { background: #ecfeff; color: #0891b2; border-color: #a5f3fc; }
.ticket-pill--released { background: #f8fafc; color: #475569; border-color: #cbd5e1; }
.ticket-pill--done { background: #f0fdf4; color: #15803d; border-color: #86efac; }

.ticket-assignee-chip__done {
    color: #16a34a;
    font-size: 0.85em;
    margin-right: 0.2rem;
    vertical-align: -0.05em;
}
.ticket-assignee-chip--done .ticket-assignee-chip__name {
    color: #166534;
}
.ticket-assignee-chip__done-label {
    color: #15803d;
    font-weight: 600;
}
.ticket-person__name--done {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.ticket-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.05rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.25;
}

.ticket-date-day {
    white-space: nowrap;
}

.ticket-date-time {
    white-space: nowrap;
    opacity: 0.85;
    font-size: 0.72rem;
}

.tickets-table .ticket-row-actions,
.ticket-row-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
}

.ticket-row-actions .btn {
    width: 26px;
    height: 26px;
    padding: 0;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.35rem !important;
    flex-shrink: 0;
}

@media (min-width: 992px) {
    .tickets-pool-page .table-responsive .tickets-table {
        min-width: 0 !important;
    }
}

/* На узких и любых тач-экранах (в т.ч. 2K, CSS-ширина >1200 при DPR≈2) —
   заявки карточками, без «табличной» min-width. */
@media (max-width: 991.98px), ((hover: none) and (pointer: coarse)) {
    .tickets-pool-page .tickets-table--admin,
    .tickets-pool-page .tickets-table:not(.tickets-table--admin),
    #dashboard-page .tickets-table--cabinet,
    .tickets-table-card .tickets-table,
    #dashboard-page .tickets-table {
        min-width: 0 !important;
    }
}

/* Класс с JS: запасной путь, если media (hover/pointer) ведёт себя странно. */
html.touch-ui .tickets-pool-page .tickets-table--admin,
html.touch-ui .tickets-pool-page .tickets-table:not(.tickets-table--admin),
html.touch-ui #dashboard-page .tickets-table--cabinet,
html.touch-ui .tickets-table-card .tickets-table,
html.touch-ui #dashboard-page .tickets-table {
    min-width: 0 !important;
}

.table-clickable tbody tr {
    cursor: pointer;
}

.table-clickable tbody tr td {
    position: relative;
}

.table-clickable tbody tr td a,
.table-clickable tbody tr td button,
.table-clickable tbody tr td .form-check-input {
    position: relative;
    z-index: 2;
}

/* Ширины колонок таблицы заявок */
.table-clickable {
    width: 100%;
}

.table-clickable .col-id,
.table-clickable .col-dept,
.table-clickable .col-author-dept,
.table-clickable .col-priority,
.table-clickable .col-status,
.table-clickable .col-date,
.table-clickable .col-actions {
    white-space: nowrap;
}

.table-clickable .col-topic {
    width: auto;
}

@media (min-width: 992px) {
    .table-clickable:not(.tickets-table) .col-id { width: 65px; }
    .table-clickable:not(.tickets-table) .col-dept { width: 160px; }
    .table-clickable:not(.tickets-table) .col-priority { width: 110px; }
    .table-clickable:not(.tickets-table) .col-status { width: 110px; }
    .table-clickable:not(.tickets-table) .col-date { width: 130px; }
    .table-clickable:not(.tickets-table) .col-actions { width: 210px; }
}

.cursor-pointer {
    cursor: pointer;
}

.border-dashed {
    border-style: dashed !important;
}

.main-container,
.main-container *,
.modal-content,
.modal-content *,
.card,
.card *,
.table td,
.table th {
    text-align: left;
}

a:focus-visible,
button:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

@media (max-width: 576px) {
    body {
        font-size: 14px;
    }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.35rem; }
    h3 { font-size: 1.2rem; }
}

@media (max-width: 991.98px) {
    .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    .navbar-collapse {
        background: var(--card-bg);
        padding: 15px;
        border-radius: 12px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        margin-top: 10px;
    }
    .navbar-nav .btn,
    .navbar-nav .nav-link {
        padding: 10px 15px !important;
    }
    .row.g-3.mb-4 > div {
        flex: 0 0 50%;
        max-width: 50%;
    }
    .stat-card {
        padding: 12px !important;
    }
    .stat-value {
        font-size: 1.25rem !important;
    }
    .stat-label {
        font-size: 0.75rem !important;
    }
    .table-responsive {
        border: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-responsive:not(.tickets-table-scroll) table.table {
        min-width: 960px !important;
    }
    /* Минимальные ширины колонок для корректной горизонтальной прокрутки */
    .table-responsive .table-clickable .col-id { min-width: 55px !important; }
    .table-responsive .table-clickable .col-topic { min-width: 140px !important; }
    .table-responsive .table-clickable .col-dept,
    .table-responsive .table-clickable .col-author-dept { min-width: 52px !important; }
    .table-responsive .table-clickable .col-priority { min-width: 108px !important; }
    .table-responsive .table-clickable .col-status { min-width: 108px !important; }
    .table-responsive .table-clickable .col-date { min-width: 110px !important; }
    .table-responsive .table-clickable .col-actions { min-width: 180px !important; }
    .table-responsive .tickets-table .col-actions { min-width: 118px !important; }

    table.table th,
    table.table td {
        font-size: 13px;
    }
    .container-fluid form.row,
    .main-container form.row {
        flex-direction: column;
    }
    .container-fluid form.row > div,
    .main-container form.row > div {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 10px;
    }
    .table td form {
        display: flex;
        gap: 6px;
    }
    .table td form .form-control {
        width: 100% !important;
        min-width: 0 !important;
    }
    .table-clickable th,
    .table-clickable td {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

@media (max-width: 767.98px) {
    .main-container .col-auto {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 0.75rem !important;
    }

    .main-container .col-auto > div {
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        width: 100% !important;
    }

    .main-container .col-auto .btn {
        width: 100% !important;
        margin-bottom: 0.5rem;
        justify-content: center;
    }

    .main-container h2 {
        font-size: 1.4rem !important;
        margin-bottom: 0.25rem !important;
    }
}

.empty-state,
.empty-state * {
    text-align: center !important;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 1rem;
    color: var(--text-muted);
    animation: fadeIn 0.4s ease-out;
}

.empty-state .empty-icon {
    font-size: 4rem;
    line-height: 1;
    color: #93c5fd;
    margin-bottom: 1.25rem;
}

[data-theme="dark"] .empty-state .empty-icon {
    color: #3b82f6;
    opacity: 0.7;
}

.empty-state p {
    font-size: 1.05rem;
    margin-bottom: 0;
}

[data-theme="dark"] .bg-primary-subtle,
[data-theme="dark"] .bg-success-subtle,
[data-theme="dark"] .bg-danger-subtle,
[data-theme="dark"] .bg-warning-subtle,
[data-theme="dark"] .bg-info-subtle,
[data-theme="dark"] .bg-secondary-subtle {
    background-color: var(--card-bg) !important;
}

[data-theme="dark"] .border-primary-subtle { border-color: rgba(59, 130, 246, 0.4) !important; }
[data-theme="dark"] .border-success-subtle { border-color: rgba(16, 185, 129, 0.4) !important; }
[data-theme="dark"] .border-danger-subtle { border-color: rgba(239, 68, 68, 0.4) !important; }
[data-theme="dark"] .border-warning-subtle { border-color: rgba(234, 179, 8, 0.4) !important; }
[data-theme="dark"] .border-info-subtle { border-color: rgba(56, 189, 248, 0.4) !important; }
[data-theme="dark"] .border-secondary-subtle { border-color: rgba(148, 163, 184, 0.4) !important; }

[data-theme="dark"] .text-primary { color: #60a5fa !important; }
[data-theme="dark"] .text-primary-emphasis { color: #93c5fd !important; }
[data-theme="dark"] .text-success { color: #34d399 !important; }
[data-theme="dark"] .text-danger { color: #f87171 !important; }
[data-theme="dark"] .text-warning,
[data-theme="dark"] .text-warning-emphasis { color: #facc15 !important; }
[data-theme="dark"] .text-info-emphasis { color: #7dd3fc !important; }
/* ── Чат: значки ролей ── */
.chat-avatar-wrap {
    position: relative;
    width: 36px;
    height: 36px;
}

.chat-avatar-img,
.chat-avatar-fallback {
    width: 36px;
    height: 36px;
}

.chat-avatar-fallback--admin {
    background: #059669;
}

.chat-avatar-fallback--support {
    background: #2563eb;
}

.chat-avatar-fallback--user {
    background: #6b7280;
}

.chat-role-badge {
    position: absolute;
    right: -3px;
    bottom: -3px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    color: #fff;
    border: 2px solid var(--card-bg, #fff);
    line-height: 1;
}

.chat-role-badge--support {
    background: #2563eb;
}

.chat-role-badge--admin {
    background: #059669;
}

.chat-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    max-width: 100%;
}

.chat-meta__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.4rem;
    min-width: 0;
}

.chat-meta__sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0.35rem;
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--text-muted);
}

.chat-meta__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    min-width: 0;
}

.chat-meta__chip .bi {
    font-size: 0.68rem;
    opacity: 0.75;
    flex-shrink: 0;
}

.chat-meta__dot {
    opacity: 0.45;
    user-select: none;
}

.chat-role-label {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.3;
    flex-shrink: 0;
}

.chat-role-label--support {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.chat-role-label--admin {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

/* ── FAB обратной связи ── */
.feedback-fab-host {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.65rem;
}

.feedback-popover {
    width: min(360px, calc(100vw - 2rem));
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.feedback-popover__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem 0.35rem;
}

.feedback-popover__title {
    font-size: 1rem;
    font-weight: 700;
}

.feedback-popover__body {
    padding: 0.5rem 1rem 1rem;
}

.feedback-fab {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.feedback-fab:hover,
.feedback-fab.is-open {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(37, 99, 235, 0.42);
    color: #fff;
}

.feedback-fab:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
}

[data-theme="dark"] .feedback-fab {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .feedback-popover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.ticket-assignee {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-main);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-assignee i {
    color: #2563eb;
    flex-shrink: 0;
}

/* ── Страница заявки (ticket detail) ── */
.ticket-view {
    max-width: 1200px;
    margin: 0 auto;
}

.ticket-view-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.ticket-view-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: var(--transition-fast);
}

.ticket-view-back:hover {
    color: #2563eb;
    border-color: #bfdbfe;
    background: #eff6ff;
}

.ticket-view-header {
    display: block;
    padding: 1.1rem 1.15rem;
    margin-bottom: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ticket-view-header__main {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
    flex: 1 1 18rem;
    width: 100%;
}

.ticket-view-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin: 0;
}

.ticket-view-id {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: -0.01em;
}

.ticket-view-number {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0.22rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.25;
    letter-spacing: 0.01em;
}

.ticket-view-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-main);
    word-break: break-word;
}

.ticket-view .ticket-pill {
    min-width: 0;
    width: auto;
    padding: 0.22rem 0.7rem;
    font-size: 0.72rem;
    text-align: center;
    line-height: 1.25;
}

.ticket-view-meta {
    margin-bottom: 0.85rem;
    align-items: stretch;
}

.ticket-view-collab {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.85rem 1.25rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: var(--input-bg);
}

.ticket-collab__owner,
.ticket-collab__participants {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.ticket-collab__owner {
    flex: 0 0 auto;
}

.ticket-collab__participants {
    flex: 1 1 12rem;
}

.ticket-collab__label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ticket-collab__value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.ticket-collab__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.ticket-collab__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 100%;
    padding: 0.18rem 0.45rem 0.18rem 0.55rem;
    border-radius: 0.45rem;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.25;
}

.ticket-collab__chip > span:first-child {
    white-space: normal;
    word-break: break-word;
}

.ticket-collab__chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    line-height: 1;
}

.ticket-collab__chip-remove:hover {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}

.ticket-collab__empty {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.assignee-ms__option--button {
    width: 100%;
    text-align: left;
    cursor: pointer;
    border: 0;
    background: transparent;
}

.assignee-ms__option--button:hover,
.assignee-ms__option--button:focus-visible {
    background: rgba(37, 99, 235, 0.06);
}

.ticket-view-meta > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

.ticket-view-meta .ticket-person {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
}

.ticket-person--summary {
    gap: 0;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.ticket-person--summary-compact {
    padding: 0.42rem 0.5rem;
}

.ticket-person--summary-compact .ticket-person__row {
    padding: 0.2rem 0;
    gap: 0.35rem;
}

.ticket-person--summary-compact .ticket-person__label {
    font-size: 0.6rem;
    gap: 0.2rem;
}

.ticket-person--summary-compact .ticket-person__label i {
    font-size: 0.68rem;
}

.ticket-person--summary-compact .ticket-person__name {
    font-size: 0.78rem;
}

.ticket-person--summary-compact .ticket-person__badge .ticket-pill {
    font-size: 0.66rem;
    padding: 0.1rem 0.38rem;
}

.ticket-person--collab {
    gap: 0;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}

.ticket-person--collab .ticket-person__section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.12rem;
    width: 100%;
    min-width: 0;
    padding: 0.28rem 0;
}

.ticket-person--collab .ticket-person__section + .ticket-person__section {
    border-top: 1px solid var(--border-color);
}

.ticket-person--collab .ticket-person__name {
    font-size: 0.82rem;
    line-height: 1.25;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ticket-person--collab .ticket-person__section--chips .ticket-collab__chips {
    width: 100%;
}

.ticket-person--collab .ticket-collab__empty {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

@media (min-width: 992px) {
    .ticket-view-meta > [class*="col-"] {
        min-width: 0;
    }

    .ticket-view-meta > [class*="col-"]:has(#ticket-assignee-card) {
        overflow: visible;
        z-index: 3;
    }

    .ticket-view-meta .ticket-person__name--multi:not(#ticket-assignee-name) {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

#ticket-assignee-name.ticket-person__name--multi {
    overflow: visible;
    display: block;
    text-overflow: unset;
    white-space: normal;
}

#ticket-assignee-card:has(.ticket-person__name--multi) {
    overflow: visible;
    z-index: 2;
}

#ticket-assignee-card:has(.ticket-assignee-chip:hover),
#ticket-assignee-card:has(.ticket-assignee-chip:focus-within) {
    z-index: 6;
}

.ticket-person--summary .ticket-person__row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.ticket-person--summary .ticket-person__name {
    flex-shrink: 0;
}
.ticket-person__row {
    display: flex;
    width: 100%;
    padding: 0.35rem 0;
}

.ticket-person__row + .ticket-person__row {
    border-top: 1px solid var(--border-color);
}

.ticket-person__badge {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
    line-height: 1;
}

.ticket-person__badge .ticket-pill {
    margin: 0;
}

.ticket-view-status {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
    line-height: 1;
}

.ticket-person {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    min-width: 0;
    margin: 0;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: var(--input-bg);
    box-sizing: border-box;
}

.ticket-person__label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
    line-height: 1.2;
}

.ticket-person__label i {
    font-size: 0.78rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.ticket-person__name {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.ticket-person__name--muted {
    color: var(--text-muted);
    font-weight: 500;
}

.ticket-person__name--multi {
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
}

#ticket-assignee-card:has(.ticket-person__name--multi) {
    overflow: visible;
    z-index: 2;
}

.ticket-assignee-chip {
    position: relative;
    display: inline;
    cursor: default;
}

.ticket-assignee-chip__name {
    border-bottom: 1px dotted transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.ticket-assignee-chip:hover .ticket-assignee-chip__name,
.ticket-assignee-chip:focus-visible .ticket-assignee-chip__name {
    color: #2563eb;
    border-bottom-color: rgba(37, 99, 235, 0.45);
}

.ticket-assignee-chip__sep {
    color: var(--text-main);
}

.ticket-assignee-chip__tip {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: 30;
    display: none;
    min-width: 12rem;
    max-width: 18rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: var(--input-bg);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
    white-space: normal;
}

.ticket-assignee-chip:hover .ticket-assignee-chip__tip,
.ticket-assignee-chip:focus-within .ticket-assignee-chip__tip {
    display: block;
}

.ticket-assignee-chip__sub {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    margin: 0;
}

.ticket-assignee-chip__sub .ticket-person__dot {
    display: none;
}

.ticket-assignee-chip__sub [data-part="position"] {
    display: block;
    width: 100%;
    margin-bottom: 0.15rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.35;
}

.ticket-assignee-chip__sub [data-part="position"] + .ticket-person__dot {
    display: none;
}

.ticket-assignee-chip__sub [data-part="dept"],
.ticket-assignee-chip__sub [data-part="phone"] {
    display: flex;
    align-items: flex-start;
    gap: 0.3rem;
    width: 100%;
    font-size: 0.75rem;
    line-height: 1.35;
}

.ticket-assignee-chip__empty {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ticket-person__sub {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0.35rem;
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.ticket-person__sub .bi {
    font-size: 0.7rem;
    line-height: 1;
    margin-right: 0.15rem;
    vertical-align: -0.05em;
}

.ticket-person__dot {
    opacity: 0.55;
}

.ticket-view-dates {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 1.25rem;
    width: 100%;
    margin: 0;
    padding: 0;
}

.ticket-view-dates__item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.2;
    color: var(--text-main);
}

.ticket-view-dates__item i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.95rem;
    height: 0.95rem;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1;
    flex-shrink: 0;
}

.ticket-view-dates__label {
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.2;
}

.ticket-view-dates__item strong {
    font-weight: 600;
    line-height: 1.2;
}

.ticket-view-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
}

.dashboard-services-dd__menu {
    min-width: 15rem;
}

.dashboard-services-dd__menu .dropdown-item {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
}

.dashboard-services-dd__menu .dropdown-item .bi {
    width: 1.15rem;
    text-align: center;
}

.ticket-actions-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    max-width: min(42rem, 100%);
}

.ticket-actions-bar[hidden] {
    display: none !important;
}

.ticket-actions-bar__items {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}

.ticket-actions-bar__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.ticket-actions-bar__btn .bi {
    font-size: 0.95rem;
}

.ticket-actions-dd {
    position: relative;
}

.ticket-actions-dd__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.ticket-actions-dd__chevron {
    font-size: 0.72rem;
    transition: transform 0.15s ease;
}

.ticket-actions-dd.is-open .ticket-actions-dd__chevron {
    transform: rotate(180deg);
}

.ticket-actions-dd__menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    width: min(18rem, calc(100vw - 2rem));
    padding: 0.45rem;
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    background: var(--card-bg);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
}

.ticket-actions-dd__section {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.35rem;
}

.ticket-actions-dd__section-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ticket-actions-dd__section .assignee-ms {
    min-width: 0;
    max-width: none;
    width: 100%;
}

.ticket-actions-dd__divider {
    height: 1px;
    margin: 0.15rem 0.35rem;
    background: var(--border-color);
}

.ticket-actions-dd__divider[hidden] {
    display: none;
}

.ticket-actions-dd__items {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.15rem;
}

.assignee-modal__search-wrap {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.65rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: var(--input-bg);
}

.assignee-modal__search-wrap .bi-search {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.assignee-modal__search {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text-color);
    font-size: 0.84rem;
}

.assignee-modal__search::placeholder {
    color: var(--text-muted);
}

.assignee-modal__list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    max-height: 16rem;
    overflow: auto;
}

.assignee-modal__empty {
    padding: 0.85rem 0.35rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.ticket-actions-dd__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.45rem 0.55rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--text-main);
    font-size: 0.84rem;
    font-weight: 500;
    text-align: left;
    transition: background-color 0.12s ease;
}

.ticket-actions-dd__item:hover,
.ticket-actions-dd__item:focus-visible {
    background: rgba(37, 99, 235, 0.08);
    color: var(--text-main);
}

.ticket-actions-dd__item .bi {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.ticket-actions-dd__item--success:hover,
.ticket-actions-dd__item--success:focus-visible {
    background: rgba(22, 163, 74, 0.1);
}

.ticket-actions-dd__item--warning:hover,
.ticket-actions-dd__item--warning:focus-visible {
    background: rgba(245, 158, 11, 0.12);
}

.ticket-assign-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
}

.assignee-ms {
    position: relative;
    min-width: 14rem;
    max-width: 18rem;
}

.assignee-ms__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    min-height: 2rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.84rem;
    line-height: 1.3;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.assignee-ms__toggle:hover,
.assignee-ms.is-open .assignee-ms__toggle {
    border-color: rgba(37, 99, 235, 0.45);
}

.assignee-ms.is-open .assignee-ms__toggle {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.assignee-ms__summary {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.assignee-ms__summary.is-placeholder {
    color: var(--text-muted);
}

.assignee-ms__chevron {
    flex-shrink: 0;
    font-size: 0.72rem;
    color: var(--text-muted);
    transition: transform 0.15s ease;
}

.assignee-ms.is-open .assignee-ms__chevron {
    transform: rotate(180deg);
}

.assignee-ms__menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    width: min(20rem, 92vw);
    max-height: 16rem;
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    background: var(--card-bg);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    overflow: hidden;
}

.assignee-ms__search-wrap {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(148, 163, 184, 0.06);
}

.assignee-ms__search-wrap .bi-search {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.assignee-ms__search {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text-color);
    font-size: 0.84rem;
}

.assignee-ms__search::placeholder {
    color: var(--text-muted);
}

.assignee-ms__list {
    overflow: auto;
    padding: 0.35rem;
}

.assignee-ms__option {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0;
    padding: 0.45rem 0.5rem;
    border-radius: 0.55rem;
    font-size: 0.82rem;
    line-height: 1.35;
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.assignee-ms__option:hover {
    background: rgba(37, 99, 235, 0.06);
}

.assignee-ms__option input {
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.assignee-ms__option-body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.assignee-ms__option-name {
    font-weight: 500;
    color: var(--text-color);
}

.assignee-ms__option-dept {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.assignee-ms__option.is-hidden {
    display: none;
}

.ticket-shared-mark {
    display: inline-block;
    margin-left: 0.15rem;
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    vertical-align: middle;
}

.assignee-ms__empty {
    padding: 0.85rem 0.65rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.managed-depts-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 0.35rem 0.75rem;
    max-height: 10rem;
    overflow: auto;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: var(--card-bg);
}

.managed-depts-picker__item {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 0.82rem;
    margin: 0;
    cursor: pointer;
}

.managed-depts-picker__item input {
    margin-top: 0.15rem;
}

.managed-depts-picker__item.is-home-dept {
    opacity: 0.85;
}

.managed-depts-picker__item.is-home-dept span::after {
    content: " (основной)";
    color: var(--text-muted);
    font-size: 0.75rem;
}

.ticket-panel,
.ticket-chat {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.ticket-view-sidebar .ticket-panel + .ticket-panel {
    margin-top: 0.75rem;
}

.ticket-panel__head,
.ticket-chat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.85rem 1.1rem 0.7rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--input-bg);
}

.ticket-panel__title,
.ticket-chat__title {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.ticket-panel__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    font-size: 0.72rem;
    font-weight: 700;
}

.ticket-panel__body {
    padding: 1rem 1.1rem 1.1rem;
}

.ticket-panel__body--flush {
    padding: 0.35rem 0 0.5rem;
}

.ticket-description {
    white-space: pre-wrap;
    font-size: 0.925rem;
    line-height: 1.55;
    color: var(--text-main);
}

.ticket-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center !important;
    padding: 1.75rem 1rem;
    color: var(--text-muted);
}

.ticket-empty,
.ticket-empty * {
    text-align: center !important;
}

.ticket-empty i {
    font-size: 1.75rem;
    color: #93c5fd;
    margin-bottom: 0.5rem;
}

.ticket-empty p {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.ticket-empty__hint {
    margin-top: 0.25rem;
    font-size: 0.78rem;
    opacity: 0.85;
}

.ticket-empty--compact {
    padding: 0.85rem 0.5rem;
}

.ticket-empty--compact i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.ticket-attach-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.ticket-attach-item {
    margin: 0;
}

.ticket-attach-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.65rem;
    border-radius: 0.65rem;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.ticket-attach-link:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #2563eb;
}

.ticket-attach-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.45rem;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    flex-shrink: 0;
}

.ticket-attach-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-attach-dl {
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
    opacity: 0.7;
}

.ticket-attach-form {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-color);
}

.ticket-attach-upload {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-color);
}

.ticket-attach-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    margin: 0;
    padding: 1rem 0.75rem;
    border: 1.5px dashed var(--border-color);
    border-radius: 0.75rem;
    background: var(--input-bg);
    cursor: pointer;
    text-align: center;
    transition: var(--transition-fast);
}

.ticket-attach-dropzone:hover,
.ticket-attach-dropzone.is-dragover {
    border-color: #93c5fd;
    background: rgba(37, 99, 235, 0.06);
}

.ticket-attach-dropzone.is-uploading {
    pointer-events: none;
    opacity: 0.65;
}

.ticket-attach-dropzone__input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ticket-attach-dropzone__icon {
    font-size: 1.35rem;
    color: #2563eb;
    line-height: 1;
}

.ticket-attach-dropzone__title {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-main);
}

.ticket-attach-dropzone__hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.35;
    max-width: 18rem;
}

.ticket-attach-upload-progress {
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ticket-attach-pending {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ticket-attach-pending-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.55rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    font-size: 0.8rem;
}

.ticket-attach-pending-item__icon {
    color: #2563eb;
    flex-shrink: 0;
}

.ticket-attach-pending-item__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-attach-pending-remove {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 0.1rem;
    line-height: 1;
    flex-shrink: 0;
}

.ticket-attach-pending-remove:hover {
    color: #dc2626;
}

.ticket-attach-input {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    margin-bottom: 0.35rem;
}

.ticket-attach-input .form-control {
    flex: 1;
    min-width: 0;
    border-radius: 0.5rem;
    border-color: var(--border-color);
    background: var(--card-bg);
}

.ticket-timeline {
    position: relative;
}

.ticket-timeline__item {
    position: relative;
    display: flex;
    gap: 0.75rem;
    padding: 0.65rem 1.1rem 0.65rem 1.15rem;
}

.ticket-timeline__item:not(:last-child)::before {
    content: "";
    position: absolute;
    left: calc(1.15rem + 0.28rem);
    top: 1.35rem;
    bottom: -0.15rem;
    width: 1px;
    background: var(--border-color);
}

.ticket-timeline__dot {
    width: 0.6rem;
    height: 0.6rem;
    margin-top: 0.3rem;
    border-radius: 999px;
    background: #2563eb;
    border: 2px solid var(--card-bg);
    box-shadow: 0 0 0 1px #bfdbfe;
    flex-shrink: 0;
    z-index: 1;
}

.ticket-timeline__content {
    min-width: 0;
    flex: 1;
}

.ticket-timeline__time {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.3;
    margin-bottom: 0.2rem;
}

.ticket-timeline__actor {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.12rem;
    margin-bottom: 0.2rem;
    min-width: 0;
}

.ticket-timeline__actor-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.ticket-timeline__actor-sub {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem 0.3rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.ticket-timeline__actor-sub .bi {
    font-size: 0.68rem;
    margin-right: 0.12rem;
    line-height: 1;
}

.ticket-timeline__dot-sep {
    opacity: 0.55;
}

.ticket-timeline__action {
    font-size: 0.84rem;
    color: var(--text-main);
    line-height: 1.4;
}

.ticket-history > .ticket-history__summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.ticket-history > .ticket-history__summary::-webkit-details-marker {
    display: none;
}

.ticket-history:not([open]) > .ticket-history__summary {
    border-bottom: none;
}

.ticket-history__summary-main {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1;
}

.ticket-history__summary-main .ticket-panel__title {
    white-space: normal;
    line-height: 1.25;
}

.ticket-history__chevron {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.ticket-history[open] > .ticket-history__summary .ticket-history__chevron {
    transform: rotate(180deg);
}

.ticket-history__summary:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: -2px;
}

.ticket-chat {
    display: flex;
    flex-direction: column;
    height: min(72vh, 44rem);
    min-height: 28rem;
    max-height: min(72vh, 44rem);
    overflow: hidden;
}

.ticket-chat__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: var(--input-bg);
    display: flex;
    flex-direction: column;
}

.ticket-chat__feed {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: auto;
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.chat-typing {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.45rem 1.1rem 0.55rem;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.3;
    min-height: 2.1rem;
}

.chat-typing[hidden] {
    display: none !important;
}

.chat-typing__dots {
    display: inline-flex;
    align-items: center;
    gap: 0.18rem;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
}

.chat-typing__dots span {
    width: 0.34rem;
    height: 0.34rem;
    border-radius: 50%;
    background: #2563eb;
    animation: chat-typing-bounce 1.2s infinite ease-in-out;
}

.chat-typing__dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.chat-typing__dots span:nth-child(3) {
    animation-delay: 0.3s;
}

.chat-typing__text {
    color: var(--text-muted);
    font-weight: 500;
}

@keyframes chat-typing-bounce {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    30% {
        transform: translateY(-0.2rem);
        opacity: 1;
    }
}

[data-theme="dark"] .chat-typing {
    background: var(--card-bg);
}

[data-theme="dark"] .chat-typing__dots {
    background: rgba(96, 165, 250, 0.16);
}

[data-theme="dark"] .chat-typing__dots span {
    background: #60a5fa;
}

.chat-msg {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    max-width: 100%;
}

.chat-msg--mine {
    flex-direction: row-reverse;
}

.chat-msg__content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: min(80%, 32rem);
    min-width: 0;
}

.chat-msg--mine .chat-msg__content {
    align-items: flex-end;
}

.chat-msg--mine .chat-meta {
    align-items: flex-end;
    text-align: right;
}

.chat-msg--mine .chat-meta__top {
    flex-direction: row-reverse;
}

.chat-msg--mine .chat-meta__sub {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.chat-meta__name {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--text-main);
    line-height: 1.3;
}

.chat-meta__time {
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
    opacity: 0.9;
}

.chat-bubble {
    padding: 0.7rem 0.9rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--text-main);
}

.chat-msg--mine .chat-bubble {
    background: #eff6ff;
    border-color: #bfdbfe;
    border-bottom-right-radius: 0.35rem;
}

.chat-msg:not(.chat-msg--mine) .chat-bubble {
    border-bottom-left-radius: 0.35rem;
}

.chat-bubble-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    max-width: 100%;
}

.chat-msg--mine .chat-bubble-wrap {
    align-items: flex-end;
}

.chat-reply-btn {
    position: absolute;
    top: 0.15rem;
    right: -1.65rem;
    width: 1.45rem;
    height: 1.45rem;
    border: none;
    border-radius: 999px;
    background: var(--card-bg);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-msg--mine .chat-reply-btn {
    right: auto;
    left: -1.65rem;
}

.chat-msg:hover .chat-reply-btn,
.chat-reply-btn:focus-visible {
    opacity: 1;
}

.chat-reply-btn:hover {
    color: #2563eb;
    background: #eff6ff;
}

.chat-reply-quote {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    width: 100%;
    margin: 0;
    padding: 0.45rem 0.6rem;
    border: none;
    border-left: 3px solid #3b82f6;
    border-radius: 0.55rem;
    background: rgba(59, 130, 246, 0.08);
    text-align: left;
    cursor: pointer;
}

.chat-msg--mine .chat-reply-quote {
    align-items: flex-end;
    text-align: right;
    border-left: none;
    border-right: 3px solid #3b82f6;
}

.chat-reply-quote__author {
    font-size: 0.72rem;
    font-weight: 700;
    color: #2563eb;
    line-height: 1.2;
}

.chat-reply-quote__text {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-msg--highlight {
    animation: chat-msg-highlight 1.4s ease;
}

@keyframes chat-msg-highlight {
    0% { background: rgba(59, 130, 246, 0.16); }
    100% { background: transparent; }
}

.comment-reply-preview {
    display: flex;
    align-items: stretch;
    gap: 0.55rem;
    margin-bottom: 0.55rem;
    padding: 0.55rem 0.65rem;
    border-radius: 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
}

.comment-reply-preview__bar {
    width: 3px;
    border-radius: 999px;
    background: #3b82f6;
    flex-shrink: 0;
}

.comment-reply-preview__body {
    min-width: 0;
    flex: 1;
}

.comment-reply-preview__label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.comment-reply-preview__author {
    font-size: 0.8rem;
    font-weight: 700;
    color: #2563eb;
}

.comment-reply-preview__text {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comment-reply-preview__close {
    border: none;
    background: transparent;
    color: var(--text-muted);
    align-self: flex-start;
    padding: 0.15rem;
}

.ticket-chat__composer {
    flex-shrink: 0;
    padding: 0.85rem 1.1rem;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
}

.ticket-composer-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.55rem;
}

.ticket-composer-input {
    flex: 1 1 12rem;
    min-height: 2.75rem;
    resize: none;
    max-height: 8rem;
    border-radius: 0.85rem !important;
    border-color: var(--border-color) !important;
    background: var(--input-bg) !important;
    padding: 0.7rem 0.9rem !important;
    font-size: 0.9rem;
}

.ticket-composer-input:focus {
    border-color: #93c5fd !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

.ticket-composer-send {
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border-radius: 999px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.ticket-composer-note {
    text-align: center !important;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.65rem 0.85rem;
    border-radius: 0.65rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
}

.ticket-composer-note--muted {
    font-weight: 400;
}

.ticket-composer-hint {
    margin-top: 0.7rem;
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--text-muted);
    user-select: none;
}

.create-dept-picker.assignee-ms {
    width: 100%;
    min-width: 0;
    max-width: none;
}

.create-dept-picker__toggle {
    min-height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 1rem;
}

.create-dept-picker__menu {
    display: none;
    width: 100%;
    max-width: none;
    max-height: 18rem;
}

.create-dept-picker.is-open .create-dept-picker__menu {
    display: flex;
}

.create-dept-picker .assignee-ms__list {
    max-height: 12.5rem;
}

.create-dept-picker .js-create-dept-option.is-selected {
    background: rgba(37, 99, 235, 0.1);
}

.create-dept-picker .js-create-dept-option.is-selected .assignee-ms__option-name {
    font-weight: 600;
}

@media (max-width: 991.98px) {
    .ticket-chat {
        min-height: 22rem;
        height: min(70vh, 36rem);
        max-height: min(70vh, 36rem);
    }

    .ticket-view-title {
        font-size: 1.15rem;
    }
}

/* Тулбар заявки: кнопки переносятся, не обрезаются по правому краю */
@media (max-width: 991.98px), ((hover: none) and (pointer: coarse)) {
    .ticket-view-toolbar {
        flex-wrap: wrap;
        align-items: stretch;
        gap: 0.65rem;
    }

    .ticket-view-back {
        flex: 0 0 auto;
        max-width: 100%;
    }

    .ticket-view-actions {
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
        justify-content: flex-start;
    }

    .ticket-actions-bar {
        width: 100%;
        max-width: 100%;
        justify-content: flex-start;
    }

    .ticket-actions-bar__items {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.45rem;
    }

    .ticket-actions-bar__btn {
        flex: 1 1 calc(50% - 0.45rem);
        min-width: min(100%, 10.5rem);
        justify-content: center;
        white-space: normal;
        text-align: center;
        line-height: 1.25;
        min-height: 44px;
        padding: 0.45rem 0.65rem;
    }
}

html.touch-ui .ticket-view-toolbar {
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.65rem;
}

html.touch-ui .ticket-view-back {
    flex: 0 0 auto;
    max-width: 100%;
}

html.touch-ui .ticket-view-actions {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
}

html.touch-ui .ticket-actions-bar {
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
}

html.touch-ui .ticket-actions-bar__items {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.45rem;
}

html.touch-ui .ticket-actions-bar__btn {
    flex: 1 1 calc(50% - 0.45rem);
    min-width: min(100%, 10.5rem);
    justify-content: center;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    min-height: 44px;
    padding: 0.45rem 0.65rem;
}

@media (max-width: 575.98px) {
    .ticket-view-header {
        padding: 0.9rem;
    }

    .ticket-view-toolbar {
        align-items: stretch;
    }

    .ticket-actions-bar__btn {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .chat-msg__content {
        max-width: 88%;
    }
}

[data-theme="dark"] .ticket-view-back:hover,
[data-theme="dark"] .ticket-attach-link:hover {
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(59, 130, 246, 0.45);
}

[data-theme="dark"] .chat-msg--mine .chat-bubble {
    background: rgba(37, 99, 235, 0.18);
    border-color: rgba(59, 130, 246, 0.4);
}

[data-theme="dark"] .chat-role-label--support {
    background: rgba(37, 99, 235, 0.18);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.35);
}

[data-theme="dark"] .chat-role-label--admin {
    background: rgba(5, 150, 105, 0.18);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.35);
}

[data-theme="dark"] .ticket-empty i {
    color: #3b82f6;
    opacity: 0.75;
}

.printer-autocomplete {
    position: relative;
}

.printer-autocomplete__list {
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    max-height: 16rem;
    overflow-y: auto;
    margin: 0;
    padding: 0.35rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: var(--card-bg);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.printer-autocomplete__list[hidden] {
    display: none !important;
}

.printer-autocomplete__item {
    padding: 0.45rem 0.65rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-main);
}

.printer-autocomplete__item:hover,
.printer-autocomplete__item:focus {
    background: rgba(37, 99, 235, 0.1);
    outline: none;
}

.cartridge-help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.cartridge-help-toggle {
    flex-shrink: 0;
    padding: 0.2rem 0.65rem;
    border: 1px solid rgba(37, 99, 235, 0.28);
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cartridge-help-toggle:hover {
    background: rgba(37, 99, 235, 0.14);
    border-color: rgba(37, 99, 235, 0.4);
    color: #1e40af;
}

.cartridge-help-toggle[aria-expanded="true"] {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.cartridge-help {
    margin: 0 0 1.25rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 0.85rem;
    background: rgba(37, 99, 235, 0.05);
}

.cartridge-help__lead {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--text-main);
}

.cartridge-help__steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: cartridge-step;
}

.cartridge-help__steps > li {
    display: grid;
    grid-template-columns: 1.6rem 1fr;
    gap: 0.15rem 0.55rem;
    margin: 0 0 0.65rem;
    counter-increment: cartridge-step;
}

.cartridge-help__steps > li:last-child {
    margin-bottom: 0;
}

.cartridge-help__steps > li::before {
    content: counter(cartridge-step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    margin-top: 0.05rem;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
}

.cartridge-help__step-title {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
}

.cartridge-help__step-text {
    display: block;
    grid-column: 2;
    font-size: 0.84rem;
    line-height: 1.4;
    color: var(--text-muted, #64748b);
}

.cartridge-help__tip {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    margin: 0.85rem 0 0;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(37, 99, 235, 0.12);
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--text-muted, #64748b);
}

.cartridge-help__tip .bi {
    flex-shrink: 0;
    margin-top: 0.1rem;
    color: #2563eb;
}

.cartridge-info {
    margin: 0 0 1.25rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.03);
}

.cartridge-info__label {
    margin-bottom: 0.2rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted, #64748b);
}

.cartridge-info__value {
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--text-main);
}

/* ══════════════════════════════════════════════════════════════
   Мобильная оптимизация (телефоны)
   ══════════════════════════════════════════════════════════════ */

@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }

    .feedback-fab-host {
        right: max(1rem, env(safe-area-inset-right));
        bottom: max(1rem, env(safe-area-inset-bottom));
    }

    footer {
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    }
}

/* Карточки заявок: узкие экраны ИЛИ любой тач (телефон/планшет),
   без потолка по CSS-ширине — иначе 2K (≈1280 CSS px при DPR≈2) остаётся таблицей.
   html.touch-ui — запасной класс с JS. */
@media (max-width: 991.98px), ((hover: none) and (pointer: coarse)) {
    .tickets-table-card colgroup,
    #dashboard-page .tickets-table colgroup,
    .tickets-table-card col,
    #dashboard-page .tickets-table col {
        display: none;
        width: auto !important;
    }

    .tickets-table-card .tickets-table-scroll,
    #dashboard-page .tickets-table-scroll {
        overflow: visible;
    }

    .tickets-table-card .table-responsive,
    #dashboard-page .table-responsive {
        overflow: visible;
        border: 0;
    }

    .tickets-table-card .tickets-table,
    .tickets-table-card .table-responsive .tickets-table,
    #dashboard-page .tickets-table,
    #dashboard-page .tickets-table--cabinet,
    .tickets-pool-page .tickets-table--admin,
    .tickets-pool-page .tickets-table:not(.tickets-table--admin) {
        min-width: 0 !important;
        width: 100% !important;
        table-layout: auto;
    }

    .tickets-table-card .tickets-table thead,
    #dashboard-page .tickets-table thead {
        display: none;
    }

    .tickets-table-card .tickets-table tbody,
    #dashboard-page .tickets-table tbody {
        display: flex;
        flex-direction: column;
        gap: clamp(0.55rem, 1.6vw, 0.85rem);
    }

    .tickets-table-card .tickets-table tbody tr[data-ticket-id],
    .tickets-table-card .tickets-table tbody tr[data-href],
    #dashboard-page .tickets-table tbody tr[data-ticket-id],
    #dashboard-page .tickets-table tbody tr[data-href] {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        align-content: flex-start;
        gap: clamp(0.3rem, 1.2vw, 0.55rem) clamp(0.4rem, 1.6vw, 0.7rem);
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: clamp(0.75rem, 2.4vw, 1.15rem) clamp(0.8rem, 3vw, 1.25rem);
        border: 1px solid var(--border-color);
        border-radius: clamp(0.75rem, 2vw, 1rem);
        background: var(--card-bg);
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    }

    .tickets-table-card .tickets-table tbody tr[data-empty-row],
    #dashboard-page .tickets-table tbody tr[data-empty-row],
    .tickets-table-card .tickets-table tbody tr:not([data-ticket-id]):not([data-href]),
    #dashboard-page .tickets-table tbody tr:not([data-ticket-id]):not([data-href]) {
        display: block;
        border: none;
        box-shadow: none;
        padding: 0;
    }

    .tickets-table-card .tickets-table tbody td,
    #dashboard-page .tickets-table tbody td {
        display: block;
        border: none !important;
        padding: 0 !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: 100%;
        white-space: normal !important;
        box-sizing: border-box;
    }

    /* Шапка карточки: отдел+№ и бейджи в 1-й ряд, дата — отдельной строкой */
    .tickets-table-card .tickets-table tbody td.col-author-dept,
    #dashboard-page .tickets-table tbody td.col-author-dept {
        display: block !important;
        order: 1;
        flex: 0 0 auto;
        font-weight: 700;
        font-size: clamp(0.78rem, 2.4vw, 0.9rem);
        color: var(--text-muted);
        text-align: left !important;
    }

    .tickets-table-card .tickets-table tbody td.col-id,
    #dashboard-page .tickets-table tbody td.col-id {
        order: 2;
        flex: 0 0 auto;
        font-weight: 700;
        font-size: clamp(0.78rem, 2.4vw, 0.9rem);
        color: var(--text-muted);
        text-align: left !important;
    }

    .tickets-table-card .tickets-table tbody td.col-priority,
    #dashboard-page .tickets-table tbody td.col-priority {
        order: 3;
        flex: 0 0 auto;
        margin-left: auto;
    }

    .tickets-table-card .tickets-table tbody td.col-status,
    #dashboard-page .tickets-table tbody td.col-status {
        order: 4;
        flex: 0 0 auto;
    }

    .tickets-table-card .tickets-table tbody td.col-date,
    #dashboard-page .tickets-table tbody td.col-date {
        order: 6;
        flex: 1 1 100%;
        width: 100% !important;
        max-width: 100%;
        min-width: 0 !important;
    }

    .tickets-table-card .tickets-table tbody td.col-topic,
    #dashboard-page .tickets-table tbody td.col-topic {
        order: 10;
        flex: 1 1 100%;
        width: 100% !important;
        max-width: 100%;
        min-width: 0 !important;
    }

    .tickets-table-card .tickets-table tbody td.col-author,
    #dashboard-page .tickets-table tbody td.col-author {
        order: 15;
        flex: 1 1 100%;
        width: 100% !important;
        max-width: 100%;
        min-width: 0 !important;
        font-size: clamp(0.78rem, 2.3vw, 0.88rem);
        color: var(--text-muted);
    }

    .tickets-table-card .tickets-table tbody td.col-author::before,
    #dashboard-page .tickets-table tbody td.col-author::before {
        content: "Автор: ";
        display: block;
        font-weight: 600;
        color: var(--text-muted);
        margin-bottom: 0.1rem;
    }

    .tickets-table-card .ticket-topic-cell,
    .tickets-table-card .ticket-topic-cell *,
    .tickets-table-card .ticket-author-cell,
    .tickets-table-card .ticket-author-cell *,
    #dashboard-page .ticket-topic-cell,
    #dashboard-page .ticket-topic-cell *,
    #dashboard-page .ticket-author-cell,
    #dashboard-page .ticket-author-cell * {
        text-align: left !important;
    }

    .tickets-table-card .ticket-topic-cell > .d-flex,
    #dashboard-page .ticket-topic-cell > .d-flex {
        justify-content: flex-start;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .tickets-table-card .tickets-table tbody td.col-date,
    .tickets-table-card .tickets-table tbody td.col-date *,
    #dashboard-page .tickets-table tbody td.col-date,
    #dashboard-page .tickets-table tbody td.col-date * {
        text-align: left !important;
    }

    .tickets-table-card .ticket-date,
    #dashboard-page .ticket-date {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        gap: 0.35rem 0.55rem;
        width: 100%;
    }

    .tickets-table-card .ticket-date-day,
    .tickets-table-card .ticket-date-time,
    #dashboard-page .ticket-date-day,
    #dashboard-page .ticket-date-time {
        white-space: nowrap;
        overflow: visible;
        text-overflow: unset;
    }

    .tickets-table-card .tickets-table tbody td.col-dept {
        display: none !important;
    }

    .tickets-table-card .tickets-table tbody td.col-assignee {
        order: 16;
        flex: 1 1 100%;
        width: 100%;
        font-size: clamp(0.78rem, 2.3vw, 0.88rem);
        color: var(--text-muted);
    }

    .tickets-table-card .tickets-table tbody td.col-assignee::before {
        content: "Исполнитель: ";
        font-weight: 600;
        color: var(--text-muted);
    }

    .tickets-table-card .tickets-table tbody td.col-actions,
    #dashboard-page .tickets-table tbody td.col-actions {
        order: 20;
        flex: 1 1 100%;
        width: 100%;
        margin-top: 0.25rem;
        padding-top: 0.55rem !important;
        border-top: 1px solid var(--border-color) !important;
    }

    .tickets-table-card .ticket-row-actions,
    #dashboard-page .ticket-row-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.35rem;
        width: 100%;
        max-width: 100%;
    }

    .tickets-table-card .ticket-row-actions .btn,
    #dashboard-page .ticket-row-actions .btn {
        width: clamp(34px, 9vw, 42px);
        height: clamp(34px, 9vw, 42px);
        min-height: clamp(34px, 9vw, 42px);
        font-size: clamp(0.8rem, 2.5vw, 0.95rem);
    }

    .tickets-table-card .ticket-pill,
    #dashboard-page .ticket-pill {
        max-width: 100%;
        white-space: nowrap;
        font-size: clamp(0.68rem, 2.1vw, 0.78rem);
        padding: 0.2rem 0.55rem;
    }

    .tickets-table-card .ticket-topic-title,
    #dashboard-page .ticket-topic-title {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        white-space: normal !important;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-word;
        overflow-wrap: anywhere;
        font-size: clamp(0.92rem, 3.2vw, 1.08rem);
        line-height: 1.35;
        max-width: 100%;
        flex: 1 1 auto;
        min-width: 0;
    }

    .tickets-table-card .ticket-topic-desc,
    #dashboard-page .ticket-topic-desc {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 4;
        line-clamp: 4;
        white-space: normal !important;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-word;
        overflow-wrap: anywhere;
        max-width: 100%;
        font-size: clamp(0.75rem, 2.5vw, 0.88rem);
    }

    .tickets-table-card .ticket-author-name,
    .tickets-table-card .ticket-author-email,
    #dashboard-page .ticket-author-name,
    #dashboard-page .ticket-author-email {
        white-space: normal !important;
        overflow: visible;
        text-overflow: unset;
        word-break: break-word;
        overflow-wrap: anywhere;
        max-width: 100%;
    }

    .tickets-table-card .table-responsive .table-clickable .col-id,
    .tickets-table-card .table-responsive .table-clickable .col-topic,
    .tickets-table-card .table-responsive .table-clickable .col-dept,
    .tickets-table-card .table-responsive .table-clickable .col-author-dept,
    .tickets-table-card .table-responsive .table-clickable .col-priority,
    .tickets-table-card .table-responsive .table-clickable .col-status,
    .tickets-table-card .table-responsive .table-clickable .col-date,
    .tickets-table-card .table-responsive .table-clickable .col-actions,
    .tickets-table-card .table-responsive .tickets-table .col-actions,
    #dashboard-page .table-responsive .table-clickable td,
    #dashboard-page .table-responsive .table-clickable th {
        min-width: 0 !important;
    }
}

/* Запасной путь через html.touch-ui (см. theme-init.js) — те же карточки. */
html.touch-ui .tickets-table-card colgroup,
html.touch-ui #dashboard-page .tickets-table colgroup,
html.touch-ui .tickets-table-card col,
html.touch-ui #dashboard-page .tickets-table col {
    display: none;
    width: auto !important;
}

html.touch-ui .tickets-table-card .tickets-table-scroll,
html.touch-ui #dashboard-page .tickets-table-scroll {
    overflow: visible;
}

html.touch-ui .tickets-table-card .table-responsive,
html.touch-ui #dashboard-page .table-responsive {
    overflow: visible;
    border: 0;
}

html.touch-ui .tickets-table-card .tickets-table,
html.touch-ui .tickets-table-card .table-responsive .tickets-table,
html.touch-ui #dashboard-page .tickets-table,
html.touch-ui #dashboard-page .tickets-table--cabinet,
html.touch-ui .tickets-pool-page .tickets-table--admin,
html.touch-ui .tickets-pool-page .tickets-table:not(.tickets-table--admin) {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: auto;
}

html.touch-ui .tickets-table-card .tickets-table thead,
html.touch-ui #dashboard-page .tickets-table thead {
    display: none;
}

html.touch-ui .tickets-table-card .tickets-table tbody,
html.touch-ui #dashboard-page .tickets-table tbody {
    display: flex;
    flex-direction: column;
    gap: clamp(0.55rem, 1.6vw, 0.85rem);
}

html.touch-ui .tickets-table-card .tickets-table tbody tr[data-ticket-id],
html.touch-ui .tickets-table-card .tickets-table tbody tr[data-href],
html.touch-ui #dashboard-page .tickets-table tbody tr[data-ticket-id],
html.touch-ui #dashboard-page .tickets-table tbody tr[data-href] {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    align-content: flex-start;
    gap: clamp(0.3rem, 1.2vw, 0.55rem) clamp(0.4rem, 1.6vw, 0.7rem);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: clamp(0.75rem, 2.4vw, 1.15rem) clamp(0.8rem, 3vw, 1.25rem);
    border: 1px solid var(--border-color);
    border-radius: clamp(0.75rem, 2vw, 1rem);
    background: var(--card-bg);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

html.touch-ui .tickets-table-card .tickets-table tbody tr[data-empty-row],
html.touch-ui #dashboard-page .tickets-table tbody tr[data-empty-row],
html.touch-ui .tickets-table-card .tickets-table tbody tr:not([data-ticket-id]):not([data-href]),
html.touch-ui #dashboard-page .tickets-table tbody tr:not([data-ticket-id]):not([data-href]) {
    display: block;
    border: none;
    box-shadow: none;
    padding: 0;
}

html.touch-ui .tickets-table-card .tickets-table tbody td,
html.touch-ui #dashboard-page .tickets-table tbody td {
    display: block;
    border: none !important;
    padding: 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100%;
    white-space: normal !important;
    box-sizing: border-box;
}

html.touch-ui .tickets-table-card .tickets-table tbody td.col-author-dept,
html.touch-ui #dashboard-page .tickets-table tbody td.col-author-dept {
    display: block !important;
    order: 1;
    flex: 0 0 auto;
    font-weight: 700;
    font-size: clamp(0.78rem, 2.4vw, 0.9rem);
    color: var(--text-muted);
    text-align: left !important;
}

html.touch-ui .tickets-table-card .tickets-table tbody td.col-id,
html.touch-ui #dashboard-page .tickets-table tbody td.col-id {
    order: 2;
    flex: 0 0 auto;
    font-weight: 700;
    font-size: clamp(0.78rem, 2.4vw, 0.9rem);
    color: var(--text-muted);
    text-align: left !important;
}

html.touch-ui .tickets-table-card .tickets-table tbody td.col-priority,
html.touch-ui #dashboard-page .tickets-table tbody td.col-priority {
    order: 3;
    flex: 0 0 auto;
    margin-left: auto;
}

html.touch-ui .tickets-table-card .tickets-table tbody td.col-status,
html.touch-ui #dashboard-page .tickets-table tbody td.col-status {
    order: 4;
    flex: 0 0 auto;
}

html.touch-ui .tickets-table-card .tickets-table tbody td.col-date,
html.touch-ui #dashboard-page .tickets-table tbody td.col-date {
    order: 6;
    flex: 1 1 100%;
    width: 100% !important;
    max-width: 100%;
    min-width: 0 !important;
}

html.touch-ui .tickets-table-card .tickets-table tbody td.col-topic,
html.touch-ui #dashboard-page .tickets-table tbody td.col-topic {
    order: 10;
    flex: 1 1 100%;
    width: 100% !important;
    max-width: 100%;
    min-width: 0 !important;
}

html.touch-ui .tickets-table-card .tickets-table tbody td.col-author,
html.touch-ui #dashboard-page .tickets-table tbody td.col-author {
    order: 15;
    flex: 1 1 100%;
    width: 100% !important;
    max-width: 100%;
    min-width: 0 !important;
    font-size: clamp(0.78rem, 2.3vw, 0.88rem);
    color: var(--text-muted);
}

html.touch-ui .tickets-table-card .tickets-table tbody td.col-author::before,
html.touch-ui #dashboard-page .tickets-table tbody td.col-author::before {
    content: "Автор: ";
    display: block;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.1rem;
}

html.touch-ui .tickets-table-card .ticket-topic-cell,
html.touch-ui .tickets-table-card .ticket-topic-cell *,
html.touch-ui .tickets-table-card .ticket-author-cell,
html.touch-ui .tickets-table-card .ticket-author-cell *,
html.touch-ui #dashboard-page .ticket-topic-cell,
html.touch-ui #dashboard-page .ticket-topic-cell *,
html.touch-ui #dashboard-page .ticket-author-cell,
html.touch-ui #dashboard-page .ticket-author-cell * {
    text-align: left !important;
}

html.touch-ui .tickets-table-card .ticket-topic-cell > .d-flex,
html.touch-ui #dashboard-page .ticket-topic-cell > .d-flex {
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

html.touch-ui .tickets-table-card .tickets-table tbody td.col-date,
html.touch-ui .tickets-table-card .tickets-table tbody td.col-date *,
html.touch-ui #dashboard-page .tickets-table tbody td.col-date,
html.touch-ui #dashboard-page .tickets-table tbody td.col-date * {
    text-align: left !important;
}

html.touch-ui .tickets-table-card .ticket-date,
html.touch-ui #dashboard-page .ticket-date {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem 0.55rem;
    width: 100%;
}

html.touch-ui .tickets-table-card .ticket-date-day,
html.touch-ui .tickets-table-card .ticket-date-time,
html.touch-ui #dashboard-page .ticket-date-day,
html.touch-ui #dashboard-page .ticket-date-time {
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
}

html.touch-ui .tickets-table-card .tickets-table tbody td.col-dept {
    display: none !important;
}

html.touch-ui .tickets-table-card .tickets-table tbody td.col-assignee {
    order: 16;
    flex: 1 1 100%;
    width: 100%;
    font-size: clamp(0.78rem, 2.3vw, 0.88rem);
    color: var(--text-muted);
}

html.touch-ui .tickets-table-card .tickets-table tbody td.col-assignee::before {
    content: "Исполнитель: ";
    font-weight: 600;
    color: var(--text-muted);
}

html.touch-ui .tickets-table-card .tickets-table tbody td.col-actions,
html.touch-ui #dashboard-page .tickets-table tbody td.col-actions {
    order: 20;
    flex: 1 1 100%;
    width: 100%;
    margin-top: 0.25rem;
    padding-top: 0.55rem !important;
    border-top: 1px solid var(--border-color) !important;
}

html.touch-ui .tickets-table-card .ticket-row-actions,
html.touch-ui #dashboard-page .ticket-row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.35rem;
    width: 100%;
    max-width: 100%;
}

html.touch-ui .tickets-table-card .ticket-row-actions .btn,
html.touch-ui #dashboard-page .ticket-row-actions .btn {
    width: clamp(34px, 9vw, 42px);
    height: clamp(34px, 9vw, 42px);
    min-height: clamp(34px, 9vw, 42px);
    font-size: clamp(0.8rem, 2.5vw, 0.95rem);
}

html.touch-ui .tickets-table-card .ticket-pill,
html.touch-ui #dashboard-page .ticket-pill {
    max-width: 100%;
    white-space: nowrap;
    font-size: clamp(0.68rem, 2.1vw, 0.78rem);
    padding: 0.2rem 0.55rem;
}

html.touch-ui .tickets-table-card .ticket-topic-title,
html.touch-ui #dashboard-page .ticket-topic-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    white-space: normal !important;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: clamp(0.92rem, 3.2vw, 1.08rem);
    line-height: 1.35;
    max-width: 100%;
    flex: 1 1 auto;
    min-width: 0;
}

html.touch-ui .tickets-table-card .ticket-topic-desc,
html.touch-ui #dashboard-page .ticket-topic-desc {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    white-space: normal !important;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
    font-size: clamp(0.75rem, 2.5vw, 0.88rem);
}

html.touch-ui .tickets-table-card .ticket-author-name,
html.touch-ui .tickets-table-card .ticket-author-email,
html.touch-ui #dashboard-page .ticket-author-name,
html.touch-ui #dashboard-page .ticket-author-email {
    white-space: normal !important;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
}

html.touch-ui .tickets-table-card .table-responsive .table-clickable .col-id,
html.touch-ui .tickets-table-card .table-responsive .table-clickable .col-topic,
html.touch-ui .tickets-table-card .table-responsive .table-clickable .col-dept,
html.touch-ui .tickets-table-card .table-responsive .table-clickable .col-author-dept,
html.touch-ui .tickets-table-card .table-responsive .table-clickable .col-priority,
html.touch-ui .tickets-table-card .table-responsive .table-clickable .col-status,
html.touch-ui .tickets-table-card .table-responsive .table-clickable .col-date,
html.touch-ui .tickets-table-card .table-responsive .table-clickable .col-actions,
html.touch-ui .tickets-table-card .table-responsive .tickets-table .col-actions,
html.touch-ui #dashboard-page .table-responsive .table-clickable td,
html.touch-ui #dashboard-page .table-responsive .table-clickable th {
    min-width: 0 !important;
}


@media (max-width: 767.98px) {
    .navbar {
        padding: 0.55rem 0.75rem;
    }

    .navbar-brand img.navbar-logo,
    .navbar-brand svg {
        height: 46px !important;
    }

    .navbar-toggler {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem;
    }

    .navbar-app .nav-user-avatar {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .theme-switch {
        min-width: 44px;
        min-height: 44px;
    }

    .main-container {
        margin-top: 0.35rem;
        margin-bottom: 1rem;
        padding: 0.85rem 0.75rem;
        border-radius: 12px;
    }

    .pool-panel__title {
        font-size: 1.15rem;
    }

    .pool-panel__count {
        min-width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }

    .feedback-admin-stats .col-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .feedback-filter-chips,
    .requests-filter-chips,
    .users-filter-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.15rem;
    }

    .feedback-filter-chips::-webkit-scrollbar,
    .requests-filter-chips::-webkit-scrollbar,
    .users-filter-chips::-webkit-scrollbar {
        display: none;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
        justify-content: center;
    }

    .pagination .page-link {
        min-width: 40px;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.35rem 0.55rem;
    }

    .modal-dialog {
        margin: 0.65rem;
        max-width: calc(100% - 1.3rem);
    }

    .modal-footer {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
        margin: 0;
        min-height: 44px;
    }

    .btn,
    .form-control,
    .form-select {
        min-height: 44px;
    }

    input.form-control,
    select.form-select,
    textarea.form-control {
        font-size: 16px;
    }

    .btn-sm {
        min-height: 38px;
    }

    .ticket-view-header {
        padding: 0.85rem;
    }

    .ticket-view-body .ticket-view-sidebar {
        order: 2;
    }

    .ticket-view-body .ticket-view-main {
        order: 1;
    }

    .ticket-chat {
        min-height: 16rem;
        height: min(72dvh, 30rem);
        max-height: 72dvh;
    }

    .ticket-composer-form {
        align-items: stretch;
    }

    .ticket-composer-send {
        width: 44px;
        height: 44px;
        min-height: 44px;
        align-self: flex-end;
    }

    .feedback-fab {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .feedback-popover {
        width: min(360px, calc(100vw - 1.25rem));
        max-height: min(80dvh, 32rem);
        overflow-y: auto;
    }

    .profile-page .card-body {
        padding: 1rem !important;
    }

    .depts-admin-stats,
    .users-admin-stats,
    .requests-admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .depts-create-actions,
    .users-create-field--btn .btn {
        width: 100%;
    }

    .profile-page .d-flex.justify-content-end {
        justify-content: stretch !important;
    }

    .profile-page .d-flex.justify-content-end .btn {
        width: 100%;
        min-height: 44px;
    }

    .ticket-view-body.row {
        display: flex;
        flex-direction: column;
    }
}

@media (max-width: 575.98px) {
    .row.g-3.mb-4 > .col-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .stat-card {
        padding: 0.75rem !important;
        gap: 0.65rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.15rem;
    }

    .stat-value {
        font-size: 1.2rem !important;
    }

    .ticket-view-dates {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.45rem;
    }

    .ticket-person__sub {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }

    .ticket-person__dot {
        display: none;
    }

    .login-page-wrap,
    .row.justify-content-center.align-items-center[style*="min-height"] {
        min-height: auto !important;
        padding-top: 0.5rem;
        padding-bottom: 1rem;
    }
}

@media (max-width: 399.98px) {
    .depts-admin-stats,
    .users-admin-stats,
    .requests-admin-stats,
    .feedback-admin-stats .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .depts-admin-stats,
    .users-admin-stats,
    .requests-admin-stats {
        grid-template-columns: 1fr;
    }
}


/* ── Avatar hover preview (fixed overlay, not clipped by chat overflow) ── */
.chat-avatar-img,
.navbar-app .nav-user-avatar:not(.nav-user-avatar--placeholder),
.users-card__avatar img {
    cursor: zoom-in;
}

.avatar-zoom-preview {
    position: fixed;
    z-index: 2000;
    width: 120px;
    height: 120px;
    border-radius: 999px;
    object-fit: cover;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.34);
    transform-origin: center center;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.35);
    border: 3px solid #fff;
    background: #e5e7eb;
    transition:
        opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}

.avatar-zoom-preview.is-visible {
    opacity: 1;
    transform: scale(1);
    transition:
        opacity 0.2s ease-out,
        transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] .avatar-zoom-preview {
    border-color: #1e293b;
    background: #334155;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}

@media (prefers-reduced-motion: reduce) {
    .avatar-zoom-preview {
        transition: none;
    }
    .avatar-zoom-preview.is-visible {
        transition: none;
    }
}
