/* Базовые настройки темы и скроллбара */
body {
    background-color: #0b0f19;
    color: #f1f5f9;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    margin: 0;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }

/* Шапка (Header) */
.main-header {
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 40;
}
.header-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo-area { display: flex; align-items: center; gap: 0.75rem; }
.logo-icon {
    height: 2.5rem; width: 2.5rem; border-radius: 0.75rem;
    background: linear-gradient(to top right, #4f46e5, #8b5cf6);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; color: white; box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.2);
}
.logo-text h1 { font-size: 1rem; font-weight: 800; color: white; margin: 0; display: flex; align-items: center; gap: 0.5rem; }
.badge-dev {
    font-size: 0.75rem; font-weight: 400; color: #818cf8;
    background-color: rgba(99, 102, 241, 0.1); padding: 0.125rem 0.5rem;
    border-radius: 9999px; border: 1px solid rgba(99, 102, 241, 0.2);
}
.status-bar { display: flex; align-items: center; gap: 0.375rem; font-family: monospace; font-size: 11px; color: #94a3b8; margin-top: 0.125rem; }
.status-dot { width: 0.5rem; height: 0.5rem; border-radius: 9999px; background-color: #10b981; animation: pulse 2s infinite; }

/* Кнопки и Утилиты шапки */
.utility-area { display: flex; align-items: center; gap: 0.75rem; }
.import-form { display: flex; align-items: center; gap: 0.5rem; background-color: #0f172a; border: 1px solid #1e293b; border-radius: 0.75rem; padding: 0.25rem 0.5rem; }
.btn-file-select { padding: 0.5rem 0.75rem; border-radius: 0.5rem; background-color: #1e293b; border: 1px solid rgba(51, 65, 85, 0.5); font-size: 0.75rem; font-weight: 500; color: #e2e8f0; cursor: pointer; }
.file-name-text { font-size: 11px; color: #94a3b8; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: monospace; }
.btn-primary { padding: 0.5rem 0.75rem; border-radius: 0.5rem; background-color: #4f46e5; color: white; font-size: 0.75rem; font-weight: 600; border: none; cursor: pointer; }
.btn-primary:hover { background-color: #4338ca; }
.btn-secondary { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1rem; border-radius: 0.75rem; background-color: #0f172a; border: 1px solid #1e293b; font-size: 0.75rem; font-weight: 600; color: #cbd5e1; cursor: pointer; }
.btn-secondary:hover { background-color: #1e293b; color: white; }
.btn-danger-outline { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1rem; border-radius: 0.75rem; background-color: rgba(244, 63, 94, 0.05); border: 1px solid rgba(244, 63, 94, 0.2); font-size: 0.75rem; font-weight: 600; color: #fb7185; cursor: pointer; }
.btn-danger-outline:hover { background-color: rgba(244, 63, 94, 0.15); }

/* Вертикальный последовательный макет */
.dashboard-flexible-layout {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-sizing: border-box;
}

/* Монолитные карточки */
.card-premium { background-color: #111726; border: 1px solid #1e293b; border-radius: 1rem; padding: 1.5rem; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3); position: relative; box-sizing: border-box; width: 100%; }

/* Шапка горизонтальной формы */
.horizontal-card-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border-bottom: 1px solid #1e293b;
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
}
.horizontal-card-header .card-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.horizontal-card-header h2 { font-size: 0.95rem; font-weight: 800; color: white; margin: 0; }
.card-subtitle-text { font-size: 11px; color: #64748b; margin: 0; }
.mode-badge { padding: 0.15rem 0.5rem; border-radius: 0.375rem; font-size: 9px; font-weight: 700; font-family: monospace; text-transform: uppercase; background-color: rgba(99, 102, 241, 0.1); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.2); }

/* ГОРИЗОНТАЛЬНАЯ СЕТКА ПОЛЕЙ ВВОДА ФОРМЫ */
.horizontal-form-grid {
    display: grid;
    grid-template-cols: 1fr;
    gap: 1rem;
    align-items: end;
}
@media (min-width: 640px) { .horizontal-form-grid { grid-template-cols: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .horizontal-form-grid { grid-template-cols: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1400px) { .horizontal-form-grid { grid-template-cols: repeat(6, minmax(0, 1fr)); } }

.form-group { position: relative; display: flex; flex-direction: column; width: 100%; box-sizing: border-box; }
.form-label { display: block; font-size: 11px; font-weight: 600; color: #cbd5e1; margin-bottom: 0.375rem; text-align: left; }
.form-label .required { color: #f43f5e; }
.form-input { width: 100%; box-sizing: border-box !important; background-color: #090d16; border: 1px solid #1e293b; border-radius: 0.75rem; padding: 0.625rem 0.875rem; font-size: 0.75rem; color: white; height: 2.5rem; }
.form-input::placeholder { color: #475569; }
.form-input:focus { outline: none; border-color: #4f46e5; box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15); }

/* Фикс позиционирования иконок внутри полей */
.input-with-icon { position: relative !important; display: flex !important; align-items: center !important; }
.input-icon-span { position: absolute !important; left: 0.75rem !important; top: 50% !important; transform: translateY(-50%) !important; color: #94a3b8; font-size: 0.875rem; pointer-events: none; z-index: 10; line-height: 1; }
.input-with-icon .form-input { padding-left: 2.25rem !important; }

/* Кнопки действий формы */
.horizontal-form-actions {
    display: flex !important;
    gap: 0.5rem !important;
    width: 100%;
    box-sizing: border-box;
    height: 2.5rem;
}
@media (min-width: 1400px) {
    /* На больших мониторах кнопки занимают одну ячейку сетки, расширяясь по вертикали */
    .horizontal-form-actions { grid-column: span 2; }
}
.btn-form-cancel { flex: 1; background-color: #0f172a; border: 1px solid #1e293b; border-radius: 0.75rem; color: #cbd5e1; font-weight: 600; cursor: pointer; font-size: 0.75rem; height: 100%; border: 1px solid #1e293b; }
.btn-form-cancel:hover { background-color: #1e293b; color: white; }
.btn-form-submit { flex: 1; background: linear-gradient(to right, #4f46e5, #4338ca); border: none; border-radius: 0.75rem; color: white; font-weight: 600; cursor: pointer; font-size: 0.75rem; height: 100%; }
.btn-form-submit:hover { background: linear-gradient(to right, #4338ca, #3730a3); }

/* Средняя панель фильтрации */
.search-filter-bar { display: flex; flex-direction: column; gap: 1rem; box-sizing: border-box; }
@media (min-width: 768px) { .search-filter-bar { flex-direction: row; } }
.search-wrapper { position: relative; flex: 1; display: flex; align-items: center; }
.search-icon { position: absolute; left: 0.875rem; color: #475569; pointer-events: none; font-size: 0.75rem; z-index: 10; }
.search-input { width: 100%; box-sizing: border-box; background-color: rgba(9, 13, 22, 0.6); border: 1px solid #1e293b; border-radius: 0.75rem; padding: 0.625rem 1rem 0.625rem 2.5rem; font-size: 0.75rem; color: white; height: 2.5rem; }
.search-input:focus { outline: none; border-color: #4f46e5; }
.filter-dropdowns { display: flex; gap: 0.75rem; width: 100%; }
@media (min-width: 768px) { .filter-dropdowns { width: auto; } }
.filter-select { background-color: #090d16; border: 1px solid #1e293b; border-radius: 0.75rem; padding: 0.625rem 0.875rem; font-size: 0.75rem; color: #e2e8f0; width: 100%; cursor: pointer; box-sizing: border-box; height: 2.5rem; }
@media (min-width: 768px) { .filter-select { width: 11rem; } }

/* Таблица сотрудников */
.table-container { background-color: rgba(17, 23, 38, 0.5); border: 1px solid rgba(30, 41, 59, 0.6); border-radius: 1rem; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); width: 100%; box-sizing: border-box; }
.responsive-table-wrapper { overflow-x: auto; width: 100%; }
.emp-table { width: 100%; text-align: left; border-collapse: collapse; }
.table-th { background-color: #0f1422; border-bottom: 1px solid rgba(30, 41, 59, 0.8); padding: 1rem 1.5rem; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; }
.table-tr { border-bottom: 1px solid rgba(30, 41, 59, 0.6); font-size: 0.75rem; }
.table-tr:hover { background-color: rgba(30, 41, 59, 0.2); }
.table-td { padding: 1rem 1.5rem; vertical-align: middle; }
.td-id { font-family: monospace; color: #64748b; font-weight: 600; }
.td-name { font-weight: 700; color: #e2e8f0; font-size: 0.875rem; }
.td-badge-pos { display: inline-flex; align-items: center; padding: 0.25rem 0.625rem; border-radius: 0.5rem; font-weight: 600; background-color: #1e293b; color: #cbd5e1; border: 1px solid rgba(51, 65, 85, 0.3); }
.td-salary { text-align: right; }
.salary-amount { color: #34d399; font-weight: 800; font-size: 0.875rem; letter-spacing: 0.02em; }
.hire-date-sub { color: #64748b; margin-top: 0.25rem; font-size: 11px; font-family: monospace; }
    color: #64748b;
    margin-top: 0.25rem;
    font-size: 11px;
    font-family: monospace;
}

/* Список контактов — ТОЧНЫЙ ФИКС ВЕРТИКАЛЬНОГО СПИСКА */
.table-contacts-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.375rem !important;
    align-items: flex-start !important;
    max-width: 240px;
}
.contact-item-row {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    white-space: nowrap !important;
    text-align: left !important;
}
.contact-email { color: #818cf8; }
.contact-phone { color: #94a3b8; }
.contact-telegram { color: #38bdf8; }
.contact-slack { color: #c084fc; }

/* Действия над строками таблицы */
.actions-cell-wrapper {
    display: flex !important;
    flex-direction: row !important; /* Принудительно выстраиваем кнопки в ряд */
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 0.5rem !important;
    white-space: nowrap !important; /* Защита от переноса кнопок */
}
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border-radius: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.75rem;
    border: none;
    transition: transform 0.1s ease;
}
.btn-action:active {
    transform: scale(0.95);
}
.btn-edit {
    color: #818cf8;
    background-color: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.15) !important;
}
.btn-edit:hover {
    background-color: rgba(99, 102, 241, 0.15);
}
.btn-delete {
    color: #f43f5e;
    background-color: rgba(244, 63, 94, 0.05);
    border: 1px solid rgba(244, 63, 94, 0.15) !important;
}
.btn-delete:hover {
    background-color: rgba(244, 63, 94, 0.15);
}

/* Нижняя сетка графиков аналитики (Перенесены в конец) */
.analytics-grid {
    display: grid;
    grid-template-cols: 1fr;
    gap: 1.5rem;
    margin-top: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}
@media (min-width: 768px) {
    .analytics-grid { grid-template-cols: 1fr 1fr; }
}
.chart-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.chart-container {
    height: 14rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Ключевые анимации */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}
