*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #020617;
  --bg-elevated: #020617;
  --card: #020617;
  --card-border: #1e293b;
  --muted: #9ca3af;
  --text: #e5e7eb;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.1);
  --danger: #f97373;
  --spacing: 16px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.75);
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background: radial-gradient(circle at top, #020617 0, #020617 45%, #020617 100%);
  color: var(--text);
}

/* Topbar */

.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.95);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-title {
  font-size: 18px;
  font-weight: 650;
}

.user-label {
  margin-right: 8px;
  font-size: 14px;
  color: var(--muted);
}

/* Layout */

.page {
  min-height: calc(100vh - 52px);
}

.page-inner {
  padding: 20px clamp(16px, 3vw, 32px) 32px;
}

.page-title {
  font-size: 22px;
  font-weight: 650;
  margin-bottom: 20px;
}

.page-two-columns {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 20px;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Cards */

.card {
  background: radial-gradient(circle at top left, #020617 0, #020617 55%, #020617 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(15, 23, 42, 0.85);
  box-shadow: var(--shadow-soft);
  padding: 16px 18px 14px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 3px;
}

.card-title {
  font-size: 18px;
  font-weight: 650;
}

.card-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.card-meta {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.card-body {
  font-size: 13px;
}

.card-text {
  margin: 0 0 8px;
}

.card-link {
  text-decoration: none;
  color: inherit;
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, border-color 0.08s linear, background 0.08s linear;
  cursor: pointer;
}

.card-link:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.9);
  box-shadow: 0 20px 48px rgba(30, 64, 175, 0.6);
}

/* Scenario grid */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.scenarios-grid {
  align-content: flex-start;
}

.card-scenario {
  min-height: 260px;
}

/* Key-value lists */

.kv {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 6px 18px;
  font-size: 13px;
}

.kv dt {
  font-weight: 500;
  color: var(--muted);
}

.kv dd {
  margin: 0;
}

.kv-tight {
  grid-template-columns: 1.2fr 1.1fr;
}

/* Tables */

.table-scroll {
  overflow-x: auto;
  margin: 4px 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 420px;
}

.table th,
.table td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.9);
  text-align: right;
}

.table th:first-child,
.table td:first-child {
  text-align: left;
}

.table thead th {
  font-weight: 500;
  color: var(--muted);
}

/* Details */

.details-block {
  margin-top: 10px;
  font-size: 12px;
}

.details-block summary {
  cursor: pointer;
  list-style: none;
  color: var(--accent);
  margin-bottom: 4px;
}

.details-block summary::-webkit-details-marker {
  display: none;
}

/* Forms */

.layout-center {
  min-height: calc(100vh - 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.card-auth {
  width: 100%;
  max-width: 360px;
}

.form-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.input {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(30, 64, 175, 0.9);
  padding: 7px 9px;
  background: #020617;
  color: var(--text);
  font-size: 14px;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.7);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 13px;
  padding: 6px 14px;
  cursor: pointer;
  text-decoration: none;
  background: rgba(51, 65, 85, 0.9);
  color: #e5e7eb;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-color: rgba(59, 130, 246, 0.7);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.6);
}

.btn-block {
  width: 100%;
}

/* Alerts */

.alert {
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 8px;
}

.alert-error {
  background: rgba(248, 113, 113, 0.06);
  border: 1px solid rgba(248, 113, 113, 0.9);
}

/* Helpers */

.hint {
  color: var(--muted);
  font-size: 12px;
}

/* Responsive */

@media (max-width: 960px) {
  .page-two-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .column-right {
    order: -1;
  }
}

@media (max-width: 600px) {
  .page-inner {
    padding-inline: 12px;
  }

  .card {
    padding-inline: 12px;
  }

  .table {
    min-width: 360px;
  }
}
/* ===== Финмодель v7: лейаут дашборда и адаптив ===== */

/* Двухколоночный лейаут: слева вводимые данные, справа сценарии */
.layout-two-columns {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

/* Левая колонка с блоками проекта */
.layout-left {
    flex: 1.3;
    min-width: 0;
}

/* Правая колонка со сценариями */
.layout-right {
    flex: 1;
    min-width: 0;
}

/* Адаптив: на узких экранах колонки под друг другом */
@media (max-width: 900px) {
    .layout-two-columns {
        flex-direction: column;
    }
}

/* Ограничиваем ширину контента, чтобы форма не размазывалась по всему экрану */
.page-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

/* Формы настройки проекта делаем чуть уже */
.form-vertical {
    max-width: 900px;
}

/* Список KPI в карточках сценариев */
.kpi-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.kpi-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.kpi-list li span:first-child {
    opacity: 0.8;
}

/* Подзаголовки внутри карточек (например, в сценариях) */
.section-title {
    margin-top: 12px;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Горизонтальная прокрутка для широких таблиц (команда) */
.scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Таблица команды: делаем первые колонки шире, чтобы было видно текст и суммы */
.table.team-table th:first-child,
.table.team-table td:first-child {
    min-width: 220px; /* название роли */
}

.table.team-table th:nth-child(2),
.table.team-table td:nth-child(2) {
    min-width: 140px; /* ЗП */
}

.table.team-table th:nth-child(3),
.table.team-table td:nth-child(3),
.table.team-table th:nth-child(4),
.table.team-table td:nth-child(4) {
    min-width: 110px; /* налоги и рост */
}

/* Квартальные ячейки: делаем их шире и читаемыми */
.table.team-table th:nth-child(n+5),
.table.team-table td:nth-child(n+5) {
    min-width: 70px;
}

.table.team-table input {
    text-align: center;
    font-size: 0.9rem;
}
.link-button {
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 8px;
    color: #4ea3ff;
    cursor: pointer;
    font: inherit;
}

.link-button:hover {
    text-decoration: underline;
}

.monthly-table-wrapper {
    max-height: 420px;
}


