:root {
  --bg: #12121f;
  --bg2: #1e1e35;
  --bg3: #12121f;
  --border: #2a2a4a;
  --text: #e0e0ff;
  --muted: #555;
  --green: #4ade80;
  --yellow: #fbbf24;
  --red: #f87171;
  --blue: #7eb8f7;
  --purple: #a78bfa;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { background: var(--bg); color: var(--text); font-family: system-ui, sans-serif; font-size: 14px; }

.app { display: flex; flex-direction: column; min-height: 100vh; }

/* Шапка */
.header { display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--bg2); }
.header-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: bold; }
.header-logo { font-size: 20px; }

/* Вкладки */
.tabs { display: flex; gap: 4px; }
.tab { background: transparent; border: 1px solid var(--border); border-radius: 6px;
  color: var(--muted); padding: 6px 16px; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; gap: 6px; transition: all 0.15s; }
.tab:hover { color: var(--text); border-color: var(--blue); }
.tab--active { background: var(--bg2); color: var(--text); border-color: var(--blue); }
.tab-lock { background: var(--border); border-radius: 3px; padding: 1px 4px; font-size: 10px; }

/* Вкладки контент */
.tab-content { display: none; flex: 1; }
.tab-content--active { display: flex; flex-direction: column; flex: 1; }
.hidden { display: none !important; }

/* Layout дашборда */
.dashboard-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px;
  align-items: start; padding: 16px; min-height: calc(100vh - 60px); }

/* Карточки */
.cards-column { display: flex; flex-direction: column; gap: 10px; }

.card { background: var(--bg2); border-radius: 10px; padding: 14px;
  border-left: 3px solid var(--green); }
.card--warn { border-left-color: var(--yellow); }
.card--danger { border-left-color: var(--red); border: 1px solid #4a1a1a; border-left: 3px solid var(--red); }

.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.card-address { font-size: 13px; font-weight: bold; color: var(--text); }
.card-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

.stage-badge { padding: 3px 9px; border-radius: 4px; font-size: 11px; white-space: nowrap;
  background: #1d4a2e; color: var(--green); }
.stage-badge--warn { background: #3a2a00; color: var(--yellow); }
.stage-badge--danger { background: #3a1a1a; color: var(--red); }

/* Финансовый блок */
.card-financials { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.fin-cell { background: var(--bg3); border-radius: 6px; padding: 7px 8px; }
.fin-label { font-size: 10px; color: var(--muted); margin-bottom: 2px; }
.fin-value { font-size: 13px; font-weight: bold; }
.fin-value--yellow { color: var(--yellow); }
.fin-value--green { color: var(--green); }
.fin-value--red { color: var(--red); }
.fin-value--white { color: var(--text); }

/* Бегунки */
.bars { display: flex; flex-direction: column; gap: 5px; }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-label { font-size: 11px; width: 90px; flex-shrink: 0; }
.bar-label--purple { color: var(--purple); }
.bar-label--blue { color: var(--blue); }
.bar-label--green { color: var(--green); }
.bar-label--muted { color: var(--muted); }
.bar-track { flex: 1; height: 5px; background: #0f1030; border-radius: 3px; }
.bar-fill { height: 100%; border-radius: 3px; }
.bar-fill--purple { background: var(--purple); }
.bar-fill--blue { background: var(--blue); }
.bar-fill--green { background: var(--green); }
.bar-fill--yellow { background: var(--yellow); }
.bar-fill--red { background: var(--red); }
.bar-fill--gradient { background: linear-gradient(90deg, var(--green), #a8edbe); }
.bar-value { font-size: 10px; color: var(--muted); width: 45px; text-align: right; flex-shrink: 0; }

.bar-divider { border-top: 1px solid var(--border); margin: 3px 0; }

/* Гант */
.gantt-toggle { display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 10px; padding: 5px; border: 1px dashed var(--border); border-radius: 6px;
  cursor: pointer; color: var(--muted); font-size: 11px; user-select: none; }
.gantt-toggle:hover { border-color: var(--blue); color: var(--blue); }
.gantt-toggle--open { border-style: solid; color: var(--blue); }

.gantt-block { margin-top: 10px; background: var(--bg3); border-radius: 8px; padding: 10px; }
.gantt-header { display: flex; justify-content: space-between; margin-bottom: 8px; }
.gantt-title { color: var(--blue); font-size: 11px; font-weight: bold; }
.gantt-period { color: var(--muted); font-size: 10px; }
.gantt-months { display: flex; margin-bottom: 5px; padding-left: 90px; }
.gantt-month { flex: 1; font-size: 9px; color: var(--muted); text-align: center; }
.gantt-month--current { color: var(--blue); font-weight: bold; }
.gantt-rows { position: relative; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--red); opacity: 0.6; pointer-events: none; }
.gantt-row { display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }
.gantt-row-label { width: 86px; font-size: 9px; color: var(--muted); text-align: right; flex-shrink: 0; }
.gantt-row-label--active { color: var(--green); font-weight: bold; }
.gantt-row-track { flex: 1; height: 10px; background: var(--bg); border-radius: 2px; position: relative; overflow: visible; }
.gantt-bar { position: absolute; height: 10px; border-radius: 2px; }
.gantt-bar--done { background: #3a3a5a; }
.gantt-bar--active { background: var(--green); border: 1px solid var(--border); }
.gantt-bar--active-dimmed { background: #2a5a3a; border: 1px solid var(--border); }
.gantt-bar--plan { background: #1a3a26; border: 1px dashed #4ade8022; }
.gantt-legend { display: flex; gap: 12px; margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.gantt-legend-item { font-size: 9px; color: var(--muted); display: flex; align-items: center; gap: 3px; }

/* Правая панель */
.summary-panel { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 16px; }
.panel-block { background: var(--bg2); border-radius: 8px; padding: 12px; }
.panel-title { font-size: 11px; font-weight: bold; margin-bottom: 8px; }
.panel-title--yellow { color: var(--yellow); }
.panel-title--red { color: var(--red); }
.panel-title--blue { color: var(--blue); }
.panel-kpi { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.kpi-cell { background: var(--bg3); border-radius: 6px; padding: 8px; text-align: center; }
.kpi-value { font-size: 15px; font-weight: bold; }
.kpi-label { font-size: 9px; color: var(--muted); margin-top: 2px; }
.alert-item { background: var(--bg3); border-radius: 5px; padding: 7px; margin-bottom: 4px; }
.alert-name { font-size: 11px; font-weight: bold; }
.alert-name--red { color: var(--red); }
.alert-name--yellow { color: var(--yellow); }
.alert-desc { font-size: 10px; color: var(--muted); margin-top: 1px; }

/* PIN */
.pin-screen { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 60px); }
.pin-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px;
  padding: 28px; text-align: center; min-width: 220px; }
.pin-icon { font-size: 28px; margin-bottom: 10px; }
.pin-title { font-size: 14px; font-weight: bold; margin-bottom: 4px; }
.pin-subtitle { font-size: 11px; color: var(--muted); margin-bottom: 16px; }
.pin-dots { display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; }
.pin-dots span { width: 28px; height: 36px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--text); }
.pin-error { color: var(--red); font-size: 11px; min-height: 16px; margin-bottom: 8px; }
.pin-keyboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; max-width: 150px; margin: 0 auto; }
.pin-key { background: var(--border); border: none; border-radius: 6px; padding: 8px;
  font-size: 14px; color: var(--text); cursor: pointer; transition: background 0.1s; }
.pin-key:hover { background: #3a3a6a; }
.pin-key--del { background: #3a1a1a; color: var(--red); }

/* Аналитика */
.analytics-content { padding: 16px; }
.analytics-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.analytics-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.chart-block { background: var(--bg2); border-radius: 8px; padding: 12px; }
.chart-title { font-size: 11px; font-weight: bold; margin-bottom: 10px; }
.chart-title--yellow { color: var(--yellow); }
.chart-title--blue { color: var(--blue); }
.expenses-block { background: var(--bg2); border-radius: 8px; padding: 12px; }
.expenses-title { font-size: 11px; font-weight: bold; color: var(--muted); margin-bottom: 10px; }
.expense-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.expense-label { font-size: 12px; width: 160px; flex-shrink: 0; }
.expense-input { background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 5px 8px; font-size: 12px; width: 140px; }
.expense-input:focus { outline: none; border-color: var(--blue); }
.save-btn { background: var(--green); color: #000; border: none; border-radius: 6px;
  padding: 7px 16px; font-size: 12px; cursor: pointer; font-weight: bold; margin-top: 4px; }
.save-btn:hover { opacity: 0.85; }
.month-selector { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.month-select { background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.analytics-summary { background: var(--bg2); border-radius: 8px; padding: 12px;
  display: flex; justify-content: space-between; align-items: center; }
.summary-stat { text-align: center; }
.summary-stat-val { font-size: 14px; font-weight: bold; }
.summary-stat-label { font-size: 10px; color: var(--muted); margin-top: 2px; }

.loading { color: var(--muted); font-size: 13px; padding: 20px; text-align: center; }
