﻿/* ========================================
   Планер КБ — современная светлая тема
   (только оформление; классы и верстка без изменений)
   ======================================== */

:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e8edf4;
    --border-strong: #d8e0ea;
    --text: #0f172a;
    --text-2: #475569;
    --muted: #7c8899;
    --accent: #4f46e5;
    --accent-2: #6366f1;
    --accent-soft: #eef0ff;
    --accent-ring: rgba(79, 70, 229, 0.18);
    --green: #16a34a;
    --amber: #d97706;
    --red: #dc2626;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.05);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.06), 0 2px 6px rgba(16, 24, 40, 0.04);
    --shadow-lg: 0 18px 45px -12px rgba(16, 24, 40, 0.22), 0 8px 20px -12px rgba(16, 24, 40, 0.14);
    --radius: 14px;
    --radius-sm: 10px;
}

/* Базовые настройки */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-size: 14px;
    background:
        radial-gradient(1100px 500px at 100% -10%, #eef1ff 0%, rgba(238, 241, 255, 0) 60%),
        var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d5dce6; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #c2ccdb; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* Flex утилиты */
.h-screen { height: 100vh; }
.flex-row { flex-direction: row; }
.flex-1 { flex: 1; min-width: 0; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.flex-col { flex-direction: column; }
.w-full { width: 100%; }
.h-full { height: 100%; }

/* Каркас приложения */
.app-shell { display: flex; flex-direction: row; height: 100vh; }
.app-main { flex: 1; min-width: 0; overflow-y: auto; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    object-fit: contain;
    background: var(--surface-2);
    padding: 4px;
}

.sidebar-brand-name {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.page-subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.cell-strong { font-weight: 600; color: var(--text); }

.link-accent { color: var(--accent); text-decoration: none; font-weight: 600; }
.link-accent:hover { text-decoration: underline; }

/* ========================================
   Навигация (левая панель)
   ======================================== */
.sidebar {
    width: 264px;
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo span {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-flex;
    align-items: center;
}

.sidebar-logo i {
    margin-right: 8px;
    color: var(--accent-2);
}

.sidebar-logo-img {
    height: 40px;
    width: 40px;
    margin-right: 8px;
    vertical-align: middle;
    border-radius: 8px;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.sidebar-nav a {
    position: relative;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav a:hover {
    background-color: var(--surface-2);
    color: var(--text);
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 8px 18px -8px rgba(79, 70, 229, 0.75);
}

.sidebar-nav a.active::before {
    display: none;
}

.sidebar-nav a i {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    font-size: 14px;
    text-align: center;
    opacity: 0.9;
}

.sidebar-nav a.active i { opacity: 1; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--muted);
}

.sidebar-footer i {
    margin-right: 4px;
}

/* ========================================
   Верхняя панель (header)
   ======================================== */
.topbar {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 0 0 auto;
}

.topbar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    position: relative;
}

.search-box {
    position: relative;
    width: 200px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 12px;
}

.search-box input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    font-size: 13px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    outline: none;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.search-box input::placeholder {
    color: var(--muted);
}

.current-date {
    font-size: 13px;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 7px 12px;
    border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease;
}

.current-date:hover {
    background-color: var(--surface-2);
    color: var(--text);
}

.current-date i {
    color: var(--muted);
}

/* Календарь */
.calendar-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 10px;
    background-color: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    padding: 16px;
    z-index: 100;
    display: block;
    min-width: 288px;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.2s;
}

.calendar-dropdown.active {
    visibility: visible;
    opacity: 1;
}

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

.calendar-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.calendar-nav {
    display: flex;
    gap: 4px;
}

.calendar-nav button {
    padding: 4px 8px;
    color: var(--text-2);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    font-size: 12px;
}

.calendar-nav button:hover {
    background-color: var(--surface-2);
    color: var(--text);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 8px;
}

.calendar-weekday {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-align: center;
    padding: 4px;
}

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

.calendar-day {
    font-size: 12px;
    color: var(--text);
    text-align: center;
    padding: 7px;
    border-radius: 8px;
    cursor: default;
}

.calendar-day.other-month {
    color: #c3cbd8;
}

.calendar-day.today {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #ffffff;
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-btn {
    position: relative;
    padding: 6px;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.15s ease, color 0.15s ease;
}

.topbar-btn:hover {
    color: var(--accent);
    background-color: var(--surface-2);
}

.topbar-btn i {
    font-size: 18px;
}

.topbar-btn .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background-color: var(--red);
    border-radius: 50%;
    border: 2px solid #ffffff;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 16px;
    border-left: 1px solid var(--border);
}

.user-profile span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #eef0ff, #e6e9ff);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* ========================================
   Основной контент
   ======================================== */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
}

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

.page-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.page-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========================================
   Кнопки
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    border: none;
    white-space: nowrap;
}

.btn i {
    font-size: 12px;
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #6d5ce7);
    color: #ffffff;
    box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.55);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -8px rgba(79, 70, 229, 0.6);
}

.btn-secondary {
    background-color: var(--surface);
    color: var(--text-2);
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
    background-color: var(--surface-2);
    border-color: #b9c4d4;
    color: var(--text);
    transform: translateY(-1px);
}

/* ========================================
   Карточки KPI
   ======================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    background-color: var(--surface);
    padding: 20px 22px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

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

.kpi-label {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
}

.kpi-icon {
    font-size: 15px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
}

.kpi-icon.indigo { color: #6366f1; background: #eef0ff; }
.kpi-icon.amber { color: #d97706; background: #fff7ed; }
.kpi-icon.blue { color: #2563eb; background: #eff6ff; }
.kpi-icon.green { color: #16a34a; background: #ecfdf5; }

.kpi-value {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.15;
}

.kpi-subtext {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.kpi-subtext.success { color: var(--green); }
.kpi-subtext.warning { color: var(--amber); }
.kpi-subtext.danger { color: var(--red); }

/* Компактные карточки для страницы проекта */
.project-kpi-card {
    background-color: var(--surface);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.project-kpi-card .kpi-label {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.project-kpi-card .kpi-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

/* ========================================
   Таблицы
   ======================================== */
.data-table-container {
    background-color: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.data-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}

.data-table-header h2 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.data-table-actions {
    display: flex;
    gap: 8px;
}

.data-table-actions button {
    padding: 7px 12px;
    font-size: 13px;
    color: var(--text-2);
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    border-radius: 8px;
}

.data-table-actions button:hover {
    background-color: var(--surface-2);
    border-color: var(--border);
}

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

.data-table th {
    padding: 12px 22px;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-align: left;
    background-color: var(--surface-2);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 14px 22px;
    font-size: 13px;
    color: var(--text);
    border-bottom: 1px solid #f1f4f9;
}

.data-table tbody tr:hover {
    background-color: #fafbfe;
}

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

/* ========================================
   Статусы
   ======================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 11px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid transparent;
}

.status-planning { background-color: #eef0ff; color: #4338ca; border-color: #e0e3ff; }
.status-active { background-color: #dcfce7; color: #15803d; border-color: #c8f5d4; }
.status-completed { background-color: #ecfdf5; color: #166534; border-color: #d8f3e4; }
.status-cancelled { background-color: #fef2f2; color: #dc2626; border-color: #fbdcdc; }
.status-on-track { background-color: #dcfce7; color: #15803d; border-color: #c8f5d4; }
.status-at-risk { background-color: #fff7ed; color: #d97706; border-color: #fbe4cc; }
.status-delayed { background-color: #fee2e2; color: #dc2626; border-color: #fbd0d0; }
.status-pending { background-color: #f1f5f9; color: #64748b; border-color: #e6ebf1; }
.status-in-progress { background-color: #dbeafe; color: #2563eb; border-color: #cfe2fd; }

/* ========================================
   Прогресс бары
   ======================================== */
.progress-bar {
    width: 100px;
    height: 7px;
    background-color: #e9edf3;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
}

.progress-bar-fill.green { background-color: #22c55e; }
.progress-bar-fill.amber { background-color: #f59e0b; }
.progress-bar-fill.red { background-color: #ef4444; }
.progress-bar-fill.blue { background-color: #3b82f6; }

/* ========================================
   Формы
   ======================================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    outline: none;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    outline: none;
    background-color: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.form-textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    outline: none;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ========================================
   Модальные окна
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

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

.modal {
    background-color: var(--surface);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    width: 80%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.96) translateY(6px);
    transition: transform 0.2s ease;
}

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

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.modal-close {
    padding: 6px;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 17px;
    border-radius: 10px;
    transition: background 0.15s ease, color 0.15s ease;
}

.modal-close:hover {
    color: var(--text);
    background-color: var(--surface-2);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ========================================
   Утилиты
   ======================================== */
.text-muted { color: var(--muted); }
.text-success { color: var(--green); }
.text-warning { color: var(--amber); }
.text-danger { color: var(--red); }

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

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

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