/* --- THEME VARIABLES --- */
:root {
    --bg-body: #0f172a; 
    --bg-panel: #1e293b; 
    --bg-input: #334155; 
    --bg-darker: #020617;
    
    --border-subtle: 1px solid rgba(255,255,255,0.1);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8; /* Светло-серый для второстепенного */
    
    --col-res: #06b6d4; 
    --col-ai: #a855f7;
    --col-success: #10b981; 
    --col-warning: #f59e0b; 
    --col-danger: #ef4444; 
    --col-action: #3b82f6; 
    --col-drive: #1f9d55;
    
    --radius: 8px; 
    --nav-height: 60px;
}

/* --- RESET & BASE --- */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }
body { font-family: 'Inter', sans-serif; background-color: var(--bg-body); color: var(--text-main); font-size: 14px; padding-bottom: 100px; }
a { text-decoration: none; color: inherit; cursor: pointer; }

/* --- UTILS --- */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; align-items: center; gap: 10px; }
.badge { padding: 2px 6px; border-radius: 4px; font-size: 0.65rem; font-weight: 600; text-transform: uppercase; }
.bg-res { background: rgba(6, 182, 212, 0.15); color: var(--col-res); border: 1px solid rgba(6, 182, 212, 0.3); }
.bg-ai { background: rgba(168, 85, 247, 0.15); color: var(--col-ai); border: 1px solid rgba(168, 85, 247, 0.3); }

/* --- NAVBAR --- */
.navbar {
    height: var(--nav-height); background: rgba(15, 23, 42, 0.95); border-bottom: var(--border-subtle);
    padding: 0 2rem; position: sticky; top: 0; z-index: 100; backdrop-filter: blur(10px);
}
.brand-logo { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 1.1rem; letter-spacing: -0.5px; }
.brand-logo span { color: var(--col-res); }
.brand-tagline { font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; letter-spacing: 0.5px; }
.highlight { color: #fff; font-weight: 600; }

.lang-switch { display: flex; background: rgba(255,255,255,0.05); padding: 2px; border-radius: 6px; margin-right: 15px; }
.lang-btn { background: transparent; border: none; color: var(--text-muted); padding: 2px 6px; font-size: 0.7rem; font-weight: 600; cursor: pointer; border-radius: 4px; transition: 0.2s; }
.lang-btn.active { background: var(--col-res); color: #fff; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--col-ai); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.7rem; }

/* --- KPI DASHBOARD (CARDS) --- */
.kpi-container { max-width: 1200px; margin: 2rem auto; padding: 0 1rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.kpi-card { 
    background: var(--bg-panel); border: var(--border-subtle); border-radius: var(--radius); 
    padding: 1.25rem; position: relative; overflow: hidden; 
    transition: transform 0.2s, border-color 0.2s; cursor: pointer; box-shadow: var(--shadow-card);
}
.kpi-card:hover { transform: translateY(-3px); border-color: var(--col-res); }
.kpi-header-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.kpi-icon-lg { font-size: 1.5rem; color: rgba(255,255,255,0.05); position: absolute; top: 15px; right: 15px; }

.kpi-val { font-family: 'Montserrat', sans-serif; font-size: 1.8rem; font-weight: 700; color: #fff; line-height: 1; }
.kpi-lbl { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; margin-top: 5px; font-weight: 600; letter-spacing: 0.5px; }

.kpi-progress { height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; margin-top: auto; overflow: hidden; }
.kpi-progress-bar { height: 100%; background: var(--col-res); width: 0%; transition: width 1s ease; }
.kpi-subtext { font-size: 0.7rem; color: var(--text-muted); margin-top: 8px; display: flex; justify-content: space-between; align-items: center; }

/* --- DIGEST --- */
.digest-wrapper { max-width: 1200px; margin: 0 auto 3rem; padding: 0 1rem; }
.digest-title { font-family: 'Montserrat', sans-serif; font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; display: flex; align-items: center; gap: 10px; color: #fff; }
.digest-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 2rem; }
.digest-box { background: var(--bg-panel); border: var(--border-subtle); border-radius: var(--radius); padding: 1.5rem; }
.box-header { font-size: 0.85rem; font-weight: 600; margin-bottom: 1rem; color: var(--col-res); text-transform: uppercase; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 0.5rem; }

/* --- MODULES (ACCORDION) --- */
.content-wrapper { max-width: 1000px; margin: 0 auto; padding: 0 1rem; }
.section-header { margin: 3rem 0 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 0.5rem; display: flex; align-items: center; gap: 1rem; }
.section-header h2 { font-family: 'Montserrat', sans-serif; font-size: 1.4rem; font-weight: 700; }
.acc-item { background: var(--bg-panel); border: var(--border-subtle); border-radius: var(--radius); margin-bottom: 0.8rem; overflow: hidden; }
.acc-header { padding: 1rem; cursor: pointer; transition: background 0.2s; display: flex; align-items: center; justify-content: space-between; }
.acc-header:hover { background: rgba(255,255,255,0.05); }
.acc-left { display: flex; align-items: center; gap: 1rem; }
.acc-icon-box { width: 36px; height: 36px; border-radius: 6px; background: rgba(255,255,255,0.05); display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.acc-item.research .acc-icon-box { color: var(--col-res); background: rgba(6, 182, 212, 0.1); }
.acc-item.ai .acc-icon-box { color: var(--col-ai); background: rgba(168, 85, 247, 0.1); }
.acc-title h3 { font-size: 0.95rem; font-weight: 600; }
.acc-title p { font-size: 0.75rem; color: var(--text-muted); }

.acc-body { display: none; background: var(--bg-darker); border-top: 1px solid rgba(255,255,255,0.1); }
.acc-item.open .acc-body { display: block; animation: fadeIn 0.3s; }

/* --- TABS --- */
.tabs-nav { display: flex; border-bottom: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.2); }
.tab-btn { flex: 1; padding: 0.8rem; background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--text-muted); font-size: 0.8rem; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.tab-btn.active { color: #fff; border-bottom-color: var(--col-res); background: rgba(6, 182, 212, 0.05); }
.tab-pane { display: none; padding: 1.5rem; }
.tab-pane.active { display: block; }

/* --- TABLES (CLEAN) --- */
.task-table, .prof-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.task-table th, .prof-table th { 
    text-align: left; color: var(--text-muted); padding: 10px 12px; 
    border-bottom: 1px solid rgba(255,255,255,0.1); 
    font-size: 0.7rem; text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px;
}
.task-table td, .prof-table td { 
    padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.05); 
    vertical-align: middle; color: #e2e8f0;
}
.prof-table tr:hover td { background: rgba(255,255,255,0.02); }

.status-pill { padding: 3px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 500; white-space: nowrap; }
.st-done { background: rgba(16, 185, 129, 0.15); color: #4ade80; }
.st-prog { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.st-new { background: rgba(255, 255, 255, 0.1); color: #cbd5e1; }

.btn-new-task { width: 100%; margin-top: 15px; padding: 10px; border: 1px dashed rgba(255,255,255,0.2); background: transparent; color: var(--text-muted); border-radius: 6px; cursor: pointer; font-size: 0.8rem; }
.btn-new-task:hover { border-color: var(--text-muted); color: #fff; }

/* --- MODALS & OVERLAYS --- */
.modal-overlay, .dash-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 500; display: none; backdrop-filter: blur(5px); }
.modal-overlay.open, .dash-overlay.open { display: flex; animation: fadeIn 0.2s; }

/* Task Modal */
.modal-form { background: #1e293b; width: 100%; max-width: 500px; border-radius: 10px; padding: 2rem; border: 1px solid rgba(255,255,255,0.1); margin: 10vh auto; height: fit-content; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5); }
.form-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.form-input, .form-select { width: 100%; background: var(--bg-input); border: 1px solid rgba(255,255,255,0.1); color: #fff; padding: 10px; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.form-label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 5px; }

/* --- DASHBOARD MODAL (DETAILED) --- */
.dash-overlay { display: none; padding: 2rem; overflow-y: auto; justify-content: center; align-items: flex-start; }
.dash-overlay.open { display: flex; }

.dash-content { 
    background: var(--bg-body); width: 100%; max-width: 1000px; 
    border-radius: 12px; border: 1px solid rgba(255,255,255,0.1); 
    display: flex; flex-direction: column; overflow: hidden; 
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    margin-top: 5vh; min-height: 70vh;
}

.dash-header { padding: 1.5rem; background: var(--bg-panel); border-bottom: 1px solid rgba(255,255,255,0.05); display: flex; justify-content: space-between; align-items: center; }
.dash-title h2 { font-family: 'Montserrat', sans-serif; font-size: 1.2rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }

.dash-grid { display: grid; grid-template-columns: 260px 1fr; height: 100%; flex-grow: 1; }
.dash-sidebar { background: var(--bg-panel); padding: 1.5rem; border-right: 1px solid rgba(255,255,255,0.05); }
.dash-main { padding: 2rem; background: var(--bg-darker); }

.metric-group { margin-bottom: 2rem; }
.metric-group h4 { font-size: 0.7rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.8rem; font-weight: 600; letter-spacing: 0.5px; }

.big-stat .num { font-size: 2.2rem; font-weight: 700; color: #fff; line-height: 1; margin-bottom: 5px; }

.dash-section-title { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; display: flex; align-items: center; gap: 10px; color: var(--col-res); margin-top: 1rem; }
.dash-section-title:first-child { margin-top: 0; }

.btn-close { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; transition: color 0.2s; }
.btn-close:hover { color: #fff; }
.btn-submit { background: var(--col-action); color: #fff; border: none; padding: 10px 20px; border-radius: 6px; font-weight: 600; cursor: pointer; float: right; }

.btn-source { 
    background: transparent; border: 1px solid rgba(255,255,255,0.2); 
    color: var(--text-muted); padding: 8px 12px; border-radius: 6px; 
    font-size: 0.75rem; cursor: pointer; display: flex; align-items: center; gap: 8px; width: 100%; justify-content: center; transition: 0.2s;
}
.btn-source:hover { border-color: #fff; color: #fff; background: rgba(255,255,255,0.05); }

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

/* --- DIGEST SPECIFIC (ВОССТАНОВЛЕНИЕ) --- */

/* Верхняя полоска статистики */
.event-stats { 
    display: flex; gap: 1.5rem; margin-bottom: 1.5rem; 
    background: rgba(255,255,255,0.02); padding: 12px 15px; 
    border-radius: var(--radius); border: 1px solid rgba(255,255,255,0.05); 
    align-items: center;
}
.ev-stat-item { display: flex; align-items: center; gap: 10px; }
.ev-val { font-weight: 700; font-size: 1.1rem; color: #fff; }
.ev-lbl { font-size: 0.75rem; color: var(--text-muted); }
.ev-grow { 
    font-size: 0.65rem; color: var(--col-success); 
    background: rgba(16, 185, 129, 0.1); padding: 2px 6px; border-radius: 4px; 
}

/* Карточки событий (Календарики) */
.upcoming-row { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 5px; }
.up-card { 
    background: rgba(0,0,0,0.2); border-radius: 8px; overflow: hidden; 
    border: 1px solid rgba(255,255,255,0.05); display: flex; min-width: 220px;
}
.up-date { 
    background: #334155; width: 60px; display: flex; flex-direction: column; 
    align-items: center; justify-content: center; padding: 0.5rem; flex-shrink: 0; 
}
.up-day { font-size: 1.4rem; font-weight: 700; color: #fff; line-height: 1; }
.up-month { font-size: 0.65rem; text-transform: uppercase; color: var(--col-res); font-weight: 700; margin-bottom: 2px; }

.up-info { padding: 10px; display: flex; flex-direction: column; justify-content: center; }
.up-title { font-size: 0.85rem; font-weight: 600; line-height: 1.2; margin-bottom: 4px; color: #fff; }
.up-prof { font-size: 0.7rem; color: var(--text-muted); }

/* Список прошлых событий */
.event-list-item { 
    display: flex; gap: 1rem; margin-top: 1rem; padding-top: 1rem; 
    border-top: 1px solid rgba(255,255,255,0.05); 
}
.ev-date-sm { font-size: 0.75rem; color: var(--text-muted); min-width: 50px; font-weight: 600; }
.ev-title { font-size: 0.85rem; font-weight: 600; color: #e2e8f0; margin-bottom: 2px; }
.ev-meta { font-size: 0.7rem; color: var(--text-muted); }

/* Таблица инициатив (справа) */
.proj-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.proj-table th { 
    text-align: left; color: var(--text-muted); padding: 8px 0; 
    border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 0.7rem; text-transform: uppercase; 
}
.proj-table td { 
    padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.05); 
    vertical-align: middle; color: #e2e8f0; 
}
/* Статусы в таблице */
.st-appr { background: rgba(245, 158, 11, 0.15); color: #fbbf24; padding: 2px 8px; border-radius: 4px; font-size: 0.7rem; }
.st-fund { background: rgba(168, 85, 247, 0.15); color: #c084fc; padding: 2px 8px; border-radius: 4px; font-size: 0.7rem; }