/* Искра — фирменный стиль из брендбука (web/design/brand, тёмная тема):
   тёплый графит + эмбер; Unbounded (заголовки) / Golos Text (текст) /
   JetBrains Mono (цифры). Не сине-зелёный финтех. */
* { box-sizing: border-box; }

:root {
  --bg: #1B1820;            /* BG тёмной темы */
  --bg-side: #171519;       /* Ink */
  --card: #242029;          /* Surface */
  --card-hover: #2B2830;    /* Ink Soft */
  --border: #38333C;
  --border-soft: #2E2A33;
  --text: #F2EDE4;
  --text-soft: #CFC8BB;
  --text-dim: #A79E93;
  --text-faint: #8C8878;
  --accent: #FF7A45;        /* Spark (тёмная тема) */
  --accent-deep: #E0521F;   /* Spark Deep — hover/pressed */
  --accent-soft: rgba(255, 122, 69, 0.14);
  --green: #4FBE82;         /* Positive — приток/рост */
  --red: #E8685E;           /* Negative — отток/убыток */
  --yellow: #F0B429;        /* Warning — требует внимания */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Golos Text', system-ui, sans-serif;
  overflow: hidden;
}
.mono { font-family: 'JetBrains Mono', monospace; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--card-hover); border-radius: 4px; }
::selection { background: var(--accent); color: var(--bg-side); }

@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.layout { display: flex; width: 100%; height: 100vh; overflow: hidden; }

/* ── Сайдбар ── */
.sidebar {
  flex: none; width: 216px; display: flex; flex-direction: column;
  background: var(--bg-side); border-right: 1px solid var(--border-soft);
  padding: 18px 12px;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.logo svg { flex: none; }
.logo-name {
  font-family: 'Unbounded', sans-serif; font-weight: 700; font-size: 15px;
  letter-spacing: 0.02em; color: var(--text);
}

.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 7px; cursor: pointer; margin-bottom: 2px;
  color: var(--text-soft); font-size: 13px; font-weight: 500;
}
.nav-item:hover { background: var(--card); }
.nav-item.active { background: var(--accent-soft); color: #FFA47C; font-weight: 600; }
.nav-badge {
  flex: none; width: 30px; height: 20px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-size: 9.5px; font-weight: 700;
  background: var(--card); color: var(--text-faint);
}
.nav-item.active .nav-badge { background: var(--accent); color: var(--bg-side); }

.sidebar-spacer { flex: 1; }
.secure-note {
  display: flex; align-items: center; gap: 7px; padding: 9px 10px; margin-bottom: 8px;
  border-radius: 7px; background: rgba(79, 190, 130, 0.08);
  border: 1px solid rgba(79, 190, 130, 0.25);
  font-size: 10.5px; color: var(--green); line-height: 1.3;
}
.secure-note .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  flex: none; animation: pulse-dot 2s infinite;
}
.secure-note span { color: var(--text-dim); }

/* ── Основная колонка ── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.topbar {
  flex: none; height: 56px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 26px;
  border-bottom: 1px solid var(--border-soft); background: var(--bg-side);
}
.topbar-title {
  font-family: 'Unbounded', sans-serif; font-size: 13px; font-weight: 600;
  color: var(--text);
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-client { font-size: 11px; color: var(--text-dim); }
.topbar-sep { width: 1px; height: 18px; background: var(--border); }
select.company {
  background: var(--card); color: var(--text-soft); border: 1px solid var(--border);
  border-radius: 7px; padding: 6px 8px; font-size: 11.5px; font-family: inherit;
  outline: none; cursor: pointer; max-width: 180px;
}

.content { flex: 1; overflow-y: auto; padding: 28px 30px 40px; }
.screen { display: flex; flex-direction: column; gap: 22px; max-width: 1160px; animation: fadeIn 0.15s ease; }

/* ── Выбор периода ── */
.period-nav { display: flex; align-items: center; gap: 12px; }
.period-btn {
  width: 30px; height: 30px; border-radius: 7px; background: var(--card);
  border: 1px solid var(--border); color: var(--text-soft); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  user-select: none;
}
.period-btn:hover { border-color: var(--accent); }
.period-btn.disabled { opacity: 0.3; pointer-events: none; }
.period-label { font-size: 13px; font-weight: 600; color: var(--text); min-width: 120px; text-align: center; }

/* ── KPI ── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi-card {
  background: var(--card); border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 17px 18px; display: flex; flex-direction: column; gap: 8px;
}
.kpi-label { font-size: 11px; color: var(--text-dim); font-weight: 500; letter-spacing: 0.01em; }
.kpi-value { font-family: 'JetBrains Mono', monospace; font-size: 23px; font-weight: 600; }
.kpi-delta { font-size: 11px; }

/* ── Панели ── */
.panel {
  background: var(--card); border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 20px 22px;
}
.panel-title { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.legend { display: flex; gap: 14px; font-size: 10.5px; color: var(--text-dim); }
.legend div { display: flex; align-items: center; gap: 5px; }
.legend i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }

/* ── График ── */
.chart { display: flex; align-items: flex-end; gap: 18px; height: 150px; padding: 0 4px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bars { display: flex; align-items: flex-end; gap: 3px; height: 122px; }
.chart-bars .bar { width: 11px; border-radius: 2px 2px 0 0; }
.chart-month { font-size: 10.5px; color: var(--text-faint); }

/* ── Алерты ── */
.alert-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: 9px; background: var(--card-hover); border: 1px solid var(--border-soft);
  margin-bottom: 8px;
}
.alert-row .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.alert-text { flex: 1; font-size: 12.5px; color: var(--text); }
.alert-amount { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 600; }
.empty-note { font-size: 12px; color: var(--text-dim); padding: 6px 0; }

/* ── Вкладки отчётов ── */
.tabs { display: flex; gap: 6px; }
.tab {
  padding: 8px 16px; border-radius: 7px; font-size: 12.5px; font-weight: 500;
  color: var(--text-soft); background: var(--card); border: 1px solid var(--border-soft);
  cursor: pointer; user-select: none;
}
.tab:hover { border-color: var(--text-faint); }
.tab.active { background: var(--accent-soft); color: #FFA47C; border-color: rgba(255, 122, 69, 0.4); font-weight: 600; }

/* ── Строки отчётов ── */
.trow {
  display: grid; grid-template-columns: 1fr auto; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border-soft);
  font-size: 12.5px; color: var(--text-soft); align-items: center;
}
.trow.item { padding-left: 16px; color: var(--text-dim); }
.trow.section { color: var(--text); font-weight: 600; }
.trow.total { color: var(--text); font-weight: 700; }
.trow.head { color: var(--text-faint); font-size: 10.5px; border-bottom-color: var(--border); }
/* многоколоночные таблицы (маржа, ДЗ) */
.trow:has(> div:nth-child(5)) { grid-template-columns: 2fr 1fr 1fr 1fr 1.3fr; }

/* ── Лента первички ── */
.dropzone {
  display: flex; gap: 14px; align-items: center; padding: 22px;
  border: 1.5px dashed var(--border); border-radius: 12px;
  background: var(--bg-side);
}
.dropzone.drag { border-color: var(--accent); background: rgba(255, 122, 69, 0.06); }
.dz-icon {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  background: var(--accent-soft); border: 1px solid rgba(255, 122, 69, 0.4);
  display: flex; align-items: center; justify-content: center;
}
.dz-icon::after { content: ''; width: 14px; height: 14px; border: 2px solid var(--accent); border-radius: 2px; }
.btn-accent, .btn-green, .btn-ghost {
  padding: 9px 16px; border-radius: 7px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; flex: none; user-select: none; text-align: center;
}
.btn-accent { background: var(--accent); color: var(--bg-side); }
.btn-accent:hover { background: var(--accent-deep); color: var(--text); }
.btn-green { background: var(--green); color: var(--bg-side); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-soft); font-weight: 500; }

.doc-row {
  display: flex; align-items: center; gap: 14px; padding: 11px 4px;
  border-bottom: 1px solid var(--border-soft);
}
.doc-icon {
  width: 42px; height: 34px; border-radius: 8px; background: var(--card-hover);
  display: flex; align-items: center; justify-content: center; flex: none;
  font-size: 8.5px; font-weight: 700; color: var(--text-faint);
}
.doc-main { flex: 1; min-width: 0; }
.doc-name { font-size: 13px; font-weight: 500; color: var(--text); }
.doc-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.doc-amount { font-size: 13px; font-weight: 600; flex: none; }

.review-row {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  border-radius: 9px; background: var(--card-hover); border: 1px solid var(--border-soft);
  margin-bottom: 8px; cursor: pointer;
}
.review-row.dup { border-color: rgba(240, 180, 41, 0.45); }
.review-row input { margin-top: 3px; accent-color: var(--accent); }

/* ── Чат ── */
.chat-screen { height: calc(100vh - 56px - 68px); max-width: 860px; }
.chat-box {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
  padding: 4px 2px 12px;
}
.msg {
  max-width: 85%; padding: 10px 13px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.5; white-space: normal; word-wrap: break-word;
}
.msg.me { align-self: flex-end; background: var(--accent); color: var(--bg-side); }
.msg.ai { align-self: flex-start; background: var(--card-hover); color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 11.5px; }
.msg.typing { color: var(--text-dim); animation: pulse-dot 1.5s infinite; }
.chat-file { display: block; margin-top: 8px; color: inherit; font-weight: 600; }
.chat-input-row {
  display: flex; gap: 8px; align-items: center; padding: 12px 0 0;
  border-top: 1px solid var(--border-soft);
}
.chat-input-row input {
  flex: 1; background: var(--card); border: 1px solid var(--border);
  border-radius: 9px; padding: 11px 13px; font-size: 12.5px; font-family: inherit;
  color: var(--text); outline: none;
}
.chat-input-row input:focus { border-color: var(--accent); }

/* ── Заглушка ── */
.stub {
  padding: 60px 20px; text-align: center; color: var(--text-dim); font-size: 13px;
  border: 1.5px dashed var(--border); border-radius: 12px; background: var(--bg-side);
}
