/* =====================================================
   IT HelpDesk - Main Stylesheet
   ===================================================== */

/* CSS Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;

    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

html {
    font-size: 16px;
    line-height: 1.5;
}

body {
    font-family: var(--font-family);
    background-color: var(--gray-50);
    color: var(--gray-800);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a:hover {
    text-decoration: underline;
}

/* =====================================================
   Header
   ===================================================== */
.header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-brand {
    flex-shrink: 0;
}

.header-brand .logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.header-nav {
    display: flex;
    gap: 8px;
    margin-left: 40px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: 6px;
    color: var(--gray-600);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--gray-900);
    text-decoration: none;
}

.nav-link.active {
    background: var(--primary-color);
    color: white;
}

.nav-admin {
    color: var(--warning-color);
}

.nav-primary {
    background: var(--primary-color);
    color: white !important;
}

.nav-primary:hover {
    background: var(--primary-dark);
    color: white !important;
}

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

.user-name {
    font-weight: 600;
    color: var(--gray-800);
}

.user-roles {
    font-size: 0.75rem;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 12px;
}

/* =====================================================
   Main Content
   ===================================================== */
.main-content {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* =====================================================
   Footer
   ===================================================== */
.footer {
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: 16px 24px;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
}

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}
/* Иконка + текст: текст прижат к иконке, кнопки (если есть) уходят вправо */
.card-header > .card-icon + div { flex: 1; min-width: 0; }

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Module Cards Grid */
.module-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.module-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.module-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.module-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.module-card-icon.onboarding {
    background: #dcfce7;
    color: #16a34a;
}

.module-card-icon.offboarding {
    background: #fee2e2;
    color: #dc2626;
}

.module-card-icon.tickets {
    background: #e0e7ff;
    color: #4f46e5;
}

.module-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.module-card p {
    color: var(--gray-600);
    font-size: 0.875rem;
    flex: 1;
    margin-bottom: 16px;
}

.module-card .stats {
    display: flex;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

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

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
}

.stat-value.warning { color: var(--warning-color); }
.stat-value.danger { color: var(--danger-color); }
.stat-value.success { color: var(--success-color); }

/* =====================================================
   Buttons
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.btn:hover {
    text-decoration: none;
}

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

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

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

.btn-warning {
    background: var(--warning-color);
    color: white;
}

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-100);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

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

/* =====================================================
   Forms
   ===================================================== */
.form-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.form-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

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

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

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: white;
    color: var(--gray-800);
    transition: all 0.15s;
}

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

.form-control:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

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

.form-text {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 4px;
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger-color);
    margin-top: 4px;
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.form-check-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-check-label {
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

/* =====================================================
   Tables
   ===================================================== */
.table-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

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

.table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--gray-600);
    letter-spacing: 0.05em;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

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

.table-link {
    color: var(--primary-color);
    font-weight: 500;
}

/* =====================================================
   Status Badges
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
}

.badge-new {
    background: #dbeafe;
    color: #1e40af;
}

.badge-in-progress {
    background: #fef3c7;
    color: #92400e;
}

.badge-waiting {
    background: #e0e7ff;
    color: #4338ca;
}

.badge-done {
    background: #dcfce7;
    color: #166534;
}

.badge-canceled {
    background: var(--gray-200);
    color: var(--gray-600);
}

.badge-overdue {
    background: #fee2e2;
    color: #991b1b;
}

.badge-pending-confirm {
    background: #fef3c7;
    color: #92400e;
}

.email-html-body {
    font-size: 14px;
    line-height: 1.6;
    color: #334155;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.email-html-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}
.email-html-body table {
    border-collapse: collapse;
    max-width: 100%;
    font-size: 13px;
}
.email-html-body td, .email-html-body th {
    padding: 4px 8px;
    border: 1px solid #e5e7eb;
}
.email-html-body a {
    color: var(--primary-color);
    text-decoration: underline;
}
.email-html-body p {
    margin: 0 0 8px;
}

.badge-merged {
    background: #e0e7ff;
    color: #3730a3;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    white-space: nowrap;
}

/* =====================================================
   Filters
   ===================================================== */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
}

/* =====================================================
   Ticket Detail
   ===================================================== */
.ticket-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}

.ticket-id {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.ticket-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.ticket-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.ticket-meta-item {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.ticket-meta-item strong {
    color: var(--gray-800);
}

.ticket-actions {
    display: flex;
    gap: 12px;
}

.ticket-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .ticket-grid {
        grid-template-columns: 1fr;
    }
}

.ticket-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.ticket-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.ticket-data-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}

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

.ticket-data-label {
    width: 40%;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.ticket-data-value {
    width: 60%;
    font-size: 0.875rem;
    color: var(--gray-800);
    font-weight: 500;
}

/* Timeline / Audit */
.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}

.timeline-item {
    position: relative;
    padding-bottom: 16px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-300);
    border: 2px solid #fff;
    z-index: 1;
}

.timeline-item.created::before { background: var(--success-color); width: 12px; height: 12px; left: -25px; top: 5px; }
.timeline-item.status::before { background: var(--primary-color); }
.timeline-item.comment::before { background: var(--info-color); width: 12px; height: 12px; left: -25px; top: 5px; }
.timeline-item.reminder::before { background: var(--warning-color); }
.timeline-item.internal-note::before { background: #f59e0b; }
.timeline-item.returned::before { background: var(--danger-color); }

.timeline-item.returned .timeline-event-text {
    color: var(--danger-color);
    font-weight: 500;
}

/* События (создано, статус, назначение) — компактная строка */
.timeline-event {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.timeline-event-text {
    font-size: 0.8125rem;
    color: var(--gray-600);
}

.timeline-event-meta {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* Комментарии и заметки — «пузыри» */
.timeline-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.timeline-time {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.timeline-user {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--gray-800);
}

.timeline-bubble {
    background: #f0f4f8;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--gray-700);
    line-height: 1.5;
    border: 1px solid var(--gray-100);
}

.timeline-bubble.note-bubble {
    background: #fef9ee;
    border-color: #fde68a;
}

.timeline-content {
    font-size: 0.875rem;
    color: var(--gray-700);
}

/* Comments */
.comments-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.comments-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 12px;
}

/* =====================================================
   Login Page
   ===================================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
}

.login-box {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.login-logo p {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-top: 8px;
}

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

.login-form .btn {
    width: 100%;
}

.login-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 20px;
}

.login-info {
    background: #e0f2fe;
    color: #075985;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    margin-top: 20px;
}

/* =====================================================
   Admin
   ===================================================== */
.admin-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.admin-nav a {
    padding: 8px 16px;
    background: var(--gray-100);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.admin-nav a:hover,
.admin-nav a.active {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
}

.json-editor {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    padding: 16px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: var(--gray-50);
    min-height: 400px;
    resize: vertical;
}

/* =====================================================
   Alerts
   ===================================================== */
.alert {
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.875rem;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #7dd3fc;
}

/* =====================================================
   Utilities
   ===================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--danger-color); }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }

.hidden { display: none; }

/* Loading */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal,
.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal,
.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-content.modal-lg {
    max-width: 680px;
}

.modal-content.modal-sm {
    max-width: 400px;
}

.modal-header {
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3,
.modal-header span {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-body {
    padding: 24px 28px;
}

.modal-body .form-group {
    margin-bottom: 18px;
}

.modal-footer {
    padding: 18px 28px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--gray-50);
    border-radius: 0 0 16px 16px;
}

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

.modal-title h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.modal-icon svg {
    width: 20px;
    height: 20px;
}

.modal-icon.orange {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.modal-icon.red {
    background: linear-gradient(135deg, #ef4444, #f87171);
}

.modal-icon.green {
    background: linear-gradient(135deg, #22c55e, #4ade80);
}

/* Scrollbar inside modal */
.modal::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
    width: 6px;
}
.modal::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track {
    background: transparent;
}
.modal::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

@media (max-width: 600px) {
    .modal-overlay {
        padding: 12px;
        align-items: flex-end;
    }
    .modal,
    .modal-content {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }
    .modal-overlay.active .modal,
    .modal-overlay.active .modal-content {
        transform: translateY(0);
    }
    .modal-header {
        padding: 20px 20px 16px;
    }
    .modal-body {
        padding: 20px;
    }
    .modal-footer {
        padding: 16px 20px;
    }
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        height: auto;
        padding: 12px;
    }

    .header-nav {
        order: 3;
        width: 100%;
        margin-left: 0;
        margin-top: 12px;
        overflow-x: auto;
    }

    .header-user {
        margin-left: auto;
    }

    .main-content {
        padding: 16px;
    }

    .module-cards {
        grid-template-columns: 1fr;
    }

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

    .ticket-header {
        flex-direction: column;
        gap: 16px;
    }

    .ticket-actions {
        width: 100%;
    }

    .ticket-actions .btn {
        flex: 1;
    }

    .filters {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select,
    .filter-group input {
        flex: 1;
    }
}

/* =====================================================
   Department Switcher
   ===================================================== */
.dept-switcher {
    position: relative;
    margin-right: 8px;
}

.dept-switcher-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--gray-100, #f3f4f6);
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: var(--border-radius, 8px);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700, #374151);
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
    line-height: 1.4;
}

.dept-switcher-btn:hover {
    background: var(--gray-200, #e5e7eb);
    border-color: var(--gray-300, #d1d5db);
}

.dept-switcher-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color, #2563eb);
    flex-shrink: 0;
}

.dept-switcher-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dept-switcher-arrow {
    font-size: 10px;
    color: var(--gray-400, #9ca3af);
    margin-left: 2px;
}

.dept-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: var(--border-radius, 8px);
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0,0,0,.1));
    z-index: 200;
    padding: 4px;
    animation: deptDropdownIn 0.15s ease-out;
}

.dept-dropdown.open {
    display: block;
}

@keyframes deptDropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.dept-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--gray-700, #374151);
    font-size: 13px;
    transition: background 0.1s;
}

.dept-dropdown-item:hover {
    background: var(--gray-100, #f3f4f6);
}

.dept-dropdown-item.active {
    background: var(--primary-color, #2563eb);
    color: #fff;
}

.dept-dropdown-item.active .dept-dropdown-role {
    color: rgba(255,255,255,0.7);
}

.dept-dropdown-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dept-dropdown-role {
    font-size: 11px;
    color: var(--gray-400, #9ca3af);
    white-space: nowrap;
}

/* Department badge (for ticket lists) */
.dept-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    background: var(--gray-100, #f3f4f6);
    color: var(--gray-600, #4b5563);
    white-space: nowrap;
}

.dept-badge .dept-switcher-dot {
    width: 6px;
    height: 6px;
}

/* Forward indicator */
.forward-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--gray-500, #6b7280);
    margin-top: 2px;
}

.forward-indicator svg {
    width: 14px;
    height: 14px;
}

/* Forward history in timeline */
.timeline-item.forward .timeline-dot {
    background: #8b5cf6;
}

/* Mobile: hide dept name, show only dot */
@media (max-width: 768px) {
    .dept-switcher-name {
        display: none;
    }
    .dept-switcher-btn {
        padding: 6px 8px;
    }
    .dept-dropdown {
        right: -40px;
    }
}

/* ============================================================
   VACATIONS MODULE — глобальные стили
   ============================================================ */

/* Статус-бейджи отпусков */
.vac-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.vac-badge-pending   { background: #fef9c3; color: #854d0e; }
.vac-badge-approved  { background: #dcfce7; color: #166534; }
.vac-badge-rejected  { background: #fee2e2; color: #991b1b; }
.vac-badge-canceled  { background: #f1f5f9; color: #64748b; }
.vac-badge-active    { background: #dbeafe; color: #1e40af; }
.vac-badge-finished  { background: #f0fdf4; color: #166534; }

/* Тип отпуска */
.vac-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    background: #eff6ff;
    color: #2563eb;
}
.vac-type-annual  { background: #eff6ff; color: #2563eb; }
.vac-type-unpaid  { background: #f8fafc; color: #64748b; }
.vac-type-sick    { background: #fef2f2; color: #dc2626; }
.vac-type-study   { background: #f0fdf4; color: #166534; }
.vac-type-other   { background: #faf5ff; color: #7c3aed; }

/* Сегментированный прогресс-бар (used | planned | remaining) */
.vac-seg-bar-wrap { margin-bottom: 8px; }
.vac-seg-bar {
    height: 10px;
    background: #e5e7eb;
    border-radius: 99px;
    overflow: hidden;
    display: flex;
}
.vac-seg-used    { background: #3b82f6; height: 100%; transition: width .4s; }
.vac-seg-planned { background: #f59e0b; height: 100%; transition: width .4s; }
.vac-seg-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.vac-seg-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    flex-shrink: 0;
}
.vac-seg-legend-item {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--gray-600, #4b5563);
}

/* Список своих отпусков в профиле */
.vac-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.vac-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--gray-50, #f9fafb);
    border-radius: 10px;
    border: 1px solid var(--gray-200, #e5e7eb);
}
.vac-item-dates {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800, #1f2937);
    flex: 1;
    min-width: 0;
}
.vac-item-days {
    font-size: 12px;
    color: var(--gray-400, #9ca3af);
    margin-top: 2px;
}

/* Модалка запроса отпуска */
.vac-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.vac-modal-overlay.open { display: flex; }
.vac-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}
.vac-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f1f5f9;
}
.vac-modal-header h3 { margin: 0; font-size: 17px; font-weight: 700; color: #0f172a; }
.vac-modal-close {
    width: 32px; height: 32px; border-radius: 8px;
    background: #f1f5f9; color: #64748b;
    cursor: pointer; border: none;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; line-height: 1;
    transition: background .15s;
}
.vac-modal-close:hover { background: #fef2f2; color: #dc2626; }
.vac-modal-body { padding: 20px 24px; }
.vac-modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
}

/* Дни-превью в модалке */
.vac-days-preview {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
}
.vac-days-num {
    font-size: 28px;
    font-weight: 700;
    color: #1d4ed8;
    line-height: 1;
}
.vac-days-warn { background: #fef9c3; border-color: #fde047; color: #854d0e; }
.vac-days-err  { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }

/* Форма в модалке */
.vac-form-group { margin-bottom: 14px; }
.vac-form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 5px;
}
.vac-form-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #0f172a;
    background: #fff;
    transition: border-color .15s;
    box-sizing: border-box;
}
.vac-form-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.vac-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Гант-диаграмма в admin/department.php */
.gantt-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    background: #fff;
}
.gantt-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
}
.gantt-table th, .gantt-table td {
    padding: 0;
    border: none;
}
.gantt-name-col {
    width: 160px;
    min-width: 140px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #0f172a;
    border-right: 2px solid #f1f5f9;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 1;
}
.gantt-month-header {
    padding: 6px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #64748b;
    text-align: center;
    border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.gantt-month-header.sticky-hdr {
    position: sticky;
    top: 0;
    z-index: 2;
}
.gantt-corner {
    position: sticky;
    left: 0;
    top: 0;
    z-index: 3;
    background: #f8fafc;
    border-right: 2px solid #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}
.gantt-row { border-bottom: 1px solid #f8fafc; }
.gantt-row:hover .gantt-name-col { background: #f8fafc; }
.gantt-row:hover .gantt-cell { background: #fafafa; }
.gantt-cell {
    position: relative;
    padding: 4px 2px;
    border-right: 1px solid #f5f7fa;
    height: 36px;
    vertical-align: middle;
}
.gantt-bar {
    position: absolute;
    top: 5px;
    bottom: 5px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    z-index: 1;
    cursor: default;
    transition: opacity .15s;
    min-width: 4px;
}
.gantt-bar:hover { opacity: .85; }
.gantt-bar-pending  { background: #fef08a; color: #713f12; border: 1px solid #fde047; }
.gantt-bar-approved { background: #86efac; color: #14532d; border: 1px solid #4ade80; }
.gantt-bar-active   { background: #93c5fd; color: #1e3a8a; border: 1px solid #60a5fa; }
.gantt-bar-finished { background: #d1d5db; color: #374151; border: 1px solid #9ca3af; }
.gantt-bar-rejected { background: #fca5a5; color: #7f1d1d; border: 1px solid #f87171; }
.gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ef4444;
    opacity: .6;
    pointer-events: none;
    z-index: 2;
}
.gantt-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
}
.gantt-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #64748b;
}
.gantt-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}
.gantt-empty {
    padding: 32px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
}

/* Карточки баланса в department tab */
.vac-balance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.vac-balance-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
}
.vac-balance-name {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vac-balance-days {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 8px;
}
.vac-balance-days strong {
    color: #0f172a;
    font-size: 16px;
}
.vac-balance-mini-bar {
    height: 5px;
    background: #e5e7eb;
    border-radius: 99px;
    overflow: hidden;
    display: flex;
}
.vac-next-vac {
    font-size: 11px;
    color: #64748b;
    margin-top: 6px;
}

/* Очередь согласования */
.vac-queue-list { display: flex; flex-direction: column; gap: 10px; }
.vac-queue-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
}
.vac-queue-who { flex: 1; min-width: 0; }
.vac-queue-name { font-size: 14px; font-weight: 600; color: #0f172a; }
.vac-queue-meta { font-size: 12px; color: #64748b; margin-top: 2px; }
.vac-queue-actions { display: flex; gap: 8px; flex-shrink: 0; }
.vac-approve-btn {
    padding: 7px 14px; background: #0f766e; color: #fff;
    border: none; border-radius: 8px; cursor: pointer;
    font-size: 13px; font-weight: 500; transition: background .15s;
}
.vac-approve-btn:hover { background: #0d6b63; }
.vac-reject-btn {
    padding: 7px 14px; background: transparent; color: #dc2626;
    border: 1px solid #fca5a5; border-radius: 8px; cursor: pointer;
    font-size: 13px; font-weight: 500; transition: all .15s;
}
.vac-reject-btn:hover { background: #fef2f2; }


/* ── Гант-диаграмма отпусков v2 (continuous timeline) ── */
.gantt-yearnav { display:flex; align-items:center; gap:2px; background:#f1f5f9; border-radius:8px; padding:3px; }
.gantt-yearnav strong { font-size:14px; color:#0f172a; min-width:52px; text-align:center; font-variant-numeric:tabular-nums; }
.gantt-yearbtn { width:28px; height:28px; border:none; background:transparent; border-radius:6px; cursor:pointer; font-size:20px; color:#475569; line-height:1; display:flex; align-items:center; justify-content:center; transition:background .12s,color .12s; }
.gantt-yearbtn:hover { background:#fff; color:#2563eb; }
.gx { min-width:760px; font-family:var(--font-family,inherit); }
.gx-row { display:flex; align-items:stretch; }
.gx-name { width:172px; flex-shrink:0; padding:0 12px; display:flex; align-items:center; font-size:13px; color:#0f172a; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; border-right:1px solid #eef2f6; background:#fff; position:sticky; left:0; z-index:2; }
.gx-track { position:relative; flex:1; height:36px; }
.gx-ruler { border-bottom:1px solid #e2e8f0; }
.gx-ruler .gx-track { height:28px; }
.gx-corner, .gx-ruler .gx-name { background:#f8fafc; }
.gx-mo { position:absolute; top:0; bottom:0; display:flex; align-items:center; justify-content:center; font-size:10.5px; font-weight:600; text-transform:uppercase; letter-spacing:.4px; color:#94a3b8; overflow:hidden; }
.gx-mo-alt { background:#fafbfc; }
.gx-sep { position:absolute; top:0; bottom:0; width:1px; background:#f1f5f9; }
.gx-row:nth-child(even) .gx-track { background:#fcfcfd; }
.gx-row:hover .gx-track, .gx-row:hover .gx-name { background:#f6f9ff; }
.gx-bar { position:absolute; top:6px; bottom:6px; border-radius:6px; display:flex; align-items:center; justify-content:center; font-size:10.5px; font-weight:700; overflow:hidden; white-space:nowrap; cursor:default; box-shadow:0 1px 2px rgba(0,0,0,.08); transition:transform .1s,box-shadow .1s; min-width:3px; }
.gx-bar:hover { transform:translateY(-1px); box-shadow:0 3px 9px rgba(0,0,0,.16); z-index:5; }
.gx-bar-pending  { background:linear-gradient(135deg,#fde68a,#fcd34d); color:#713f12; }
.gx-bar-approved { background:linear-gradient(135deg,#86efac,#4ade80); color:#14532d; }
.gx-bar-active   { background:linear-gradient(135deg,#93c5fd,#60a5fa); color:#0c2a66; }
.gx-bar-finished { background:linear-gradient(135deg,#e5e9ef,#cbd5e1); color:#475569; }
.gx-bar-rejected { background:repeating-linear-gradient(45deg,#fecaca,#fecaca 4px,#fca5a5 4px,#fca5a5 8px); color:#7f1d1d; opacity:.75; }
.gx-today { position:absolute; top:0; bottom:0; width:2px; background:#ef4444; z-index:4; pointer-events:none; }

.gx-name { gap:8px; }
.gx-nm { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.gx-av { width:26px; height:26px; border-radius:50%; object-fit:cover; flex-shrink:0; background:#e2e8f0; }
.gx-av-ph { display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; color:#64748b; }

/* ── Vacation Calendar Picker ── */
.vac-modal-wide {
    max-width: 860px;
}
@media (max-width: 768px) {
    .vac-modal-wide { max-width: 100%; }
}

/* Navigation */
.vcal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.vcal-nav-label {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}
.vcal-nav-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #374151;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.vcal-nav-btn:hover { background: #e0e7ff; color: #2563eb; }

/* Grid of months side by side */
.vcal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 10px;
}
@media (max-width: 768px) {
    .vcal-grid { grid-template-columns: 1fr; }
}

/* Single month block */
.vcal-month {
    min-width: 0;
}
.vcal-month-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-align: center;
    margin-bottom: 6px;
    text-transform: capitalize;
}

/* Days grid: 7 columns */
.vcal-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

/* Weekday headers */
.vcal-wday {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: #94a3b8;
    text-align: center;
    padding: 2px 0 4px;
}
.vcal-wday-weekend { color: #f87171; }

/* Individual day cell */
.vcal-cell {
    position: relative;
    border-radius: 6px;
    padding: 4px 2px 2px;
    min-height: 36px;
    text-align: center;
    cursor: pointer;
    transition: background .1s;
    user-select: none;
}
.vcal-cell:not(.vcal-past):not(.vcal-cell-empty):hover {
    background: #eff6ff;
}
.vcal-cell-empty { cursor: default; }
.vcal-past {
    opacity: .4;
    cursor: default;
    pointer-events: none;
}
.vcal-today .vcal-day-num {
    font-weight: 700;
    color: #2563eb;
}
.vcal-today::after {
    content: '';
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #2563eb;
    margin: 1px auto 0;
}
.vcal-weekend .vcal-day-num { color: #f87171; }

.vcal-day-num {
    font-size: 13px;
    line-height: 1.3;
    color: #1e293b;
    display: block;
}

/* Selected range */
.vcal-selected {
    background: #dbeafe !important;
}
.vcal-sel-start {
    background: #2563eb !important;
    border-radius: 6px 0 0 6px;
}
.vcal-sel-start .vcal-day-num { color: #fff !important; font-weight: 700; }
.vcal-sel-end {
    background: #2563eb !important;
    border-radius: 0 6px 6px 0;
}
.vcal-sel-end .vcal-day-num { color: #fff !important; font-weight: 700; }
.vcal-sel-start.vcal-sel-end {
    border-radius: 6px !important;
}

/* Peer dots */
.vcal-peer-dots {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-top: 2px;
}
.vcal-peer-dot {
    width: 7px; height: 7px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}
.vcal-dot-approved { background: #22c55e; }
.vcal-dot-pending  { background: #f59e0b; }
.vcal-peer-dot-more {
    font-size: 8px;
    color: #64748b;
    line-height: 5px;
}

/* Legend */
.vcal-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 11px;
    color: #64748b;
    padding: 8px 0 4px;
    border-top: 1px solid #f1f5f9;
    margin-bottom: 4px;
}
.vcal-leg-item { display: flex; align-items: center; gap: 5px; }
.vcal-leg-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.vcal-leg-dot-sel { background: #2563eb; border-radius: 50%; width: 10px; height: 10px; }

/* Status bar */
.vcal-status {
    min-height: 28px;
    font-size: 13px;
    color: #374151;
    padding: 6px 10px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-top: 8px;
    line-height: 1.6;
}

/* Занятые дни команды читаются зоной, не только точкой */
.vcal-cell.vcal-busy-approved { background: #f0fdf4; }
.vcal-cell.vcal-busy-pending { background: #fefce8; }
.vcal-peer-dot { width: 7px; height: 7px; }

/* Карточки коллег в отпуске (в статусе слотпикера) */
.vcal-peers-cards { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.vcal-pc { display:flex; align-items:center; gap:8px; background:#fff; border:1px solid #dbeafe; border-radius:10px; padding:6px 10px 6px 6px; }
.vcal-pc-av { width:32px; height:32px; border-radius:50%; object-fit:cover; flex-shrink:0; background:#e2e8f0; }
.vcal-pc-ph { display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:700; color:#64748b; }
.vcal-pc-name { font-size:13px; font-weight:600; color:#0f172a; line-height:1.1; }
.vcal-pc-dates { font-size:11.5px; color:#64748b; margin-top:1px; }

/* Внутренние деления месяца в Ганте (видны половины/трети) */
.gx-sep-mid { background: #f7f9fb; }

/* Фильтры Ганта отпусков */
.gx-filters{display:flex;gap:6px;flex-wrap:wrap;padding:0 0 12px;}
.gx-chip{padding:5px 12px;border:1px solid #e2e8f0;border-radius:999px;background:#fff;color:#475569;font-size:12.5px;cursor:pointer;transition:all .12s;}
.gx-chip:hover{border-color:#94a3b8;}
.gx-chip.is-active{background:var(--primary-color,#2563eb);color:#fff;border-color:var(--primary-color,#2563eb);}


/* ── Кастомный ховер-попап для баров Ганта отпусков ── */
#gx-tip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    min-width: 200px;
    max-width: 280px;
    background: #ffffff;
    border: 1px solid var(--gray-200, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,.10), 0 4px 6px -2px rgba(0,0,0,.05);
    padding: 12px 14px;
    font-family: var(--font-family, inherit);
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--gray-700, #334155);
    opacity: 0;
    transform: translateY(4px) scale(.96);
    transform-origin: bottom center;
    transition: opacity .14s ease, transform .14s ease;
}
#gx-tip.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}
#gx-tip.gx-tip--below {
    transform-origin: top center;
    transform: translateY(-4px) scale(.96);
}
#gx-tip.gx-tip--below.is-visible {
    transform: translateY(0) scale(1);
}
@media (prefers-reduced-motion: reduce) {
    #gx-tip { transition: none; }
}

/* Стрелка — дефолт: остриё вниз (попап над баром) */
#gx-tip::before,
#gx-tip::after {
    content: "";
    position: absolute;
    left: var(--arrow-x, 50%);
    transform: translateX(-50%);
    border: 7px solid transparent;
}
/* ::before — бордер (на 1px снаружи) */
#gx-tip::before {
    top: 100%;
    border-top-color: var(--gray-200, #e2e8f0);
    margin-top: 1px;
}
/* ::after — заливка белая */
#gx-tip::after {
    top: calc(100% - 1px);
    border-top-color: #ffffff;
}

/* Флип: стрелка остриём вверх (попап под баром) */
#gx-tip.gx-tip--below::before {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 1px;
    border-top-color: transparent;
    border-bottom-color: var(--gray-200, #e2e8f0);
}
#gx-tip.gx-tip--below::after {
    top: auto;
    bottom: calc(100% - 1px);
    border-top-color: transparent;
    border-bottom-color: #ffffff;
}

/* Нет стрелки (боковой режим или узкий вьюпорт) */
#gx-tip.gx-tip--noarrow::before,
#gx-tip.gx-tip--noarrow::after { display: none; }

/* Внутренние элементы попапа */
.gx-tip-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--gray-900, #0f172a);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gx-tip-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    margin-bottom: 8px;
}
.gx-tip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.gx-tip-divider {
    border: none;
    border-top: 1px solid var(--gray-100, #f1f5f9);
    margin: 8px 0;
}
.gx-tip-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--gray-600, #475569);
    margin-top: 5px;
}
.gx-tip-icon {
    font-size: 13px;
    flex-shrink: 0;
    width: 16px;
    text-align: center;
}
.gx-tip-val {
    color: var(--gray-800, #1e293b);
}

/* Цвета бейджей по статусу */
.gx-tip-badge--pending  { background: #fffbeb; color: #92400e; }
.gx-tip-badge--pending  .gx-tip-dot { background: #f59e0b; }
.gx-tip-badge--approved { background: #f0fdf4; color: #15803d; }
.gx-tip-badge--approved .gx-tip-dot { background: #22c55e; }
.gx-tip-badge--active   { background: #eff6ff; color: #1e3a8a; }
.gx-tip-badge--active   .gx-tip-dot { background: #2563eb; }
.gx-tip-badge--finished { background: #f1f5f9; color: #475569; }
.gx-tip-badge--finished .gx-tip-dot { background: #64748b; }
.gx-tip-badge--rejected { background: #fef2f2; color: #b91c1c; }
.gx-tip-badge--rejected .gx-tip-dot { background: #ef4444; }
.gx-tip-badge--canceled { background: #f8fafc; color: #64748b; }
.gx-tip-badge--canceled .gx-tip-dot { background: #94a3b8; }

