/* Портал заказчика — единый стиль для страниц входа и дашборда.
   Акцентный цвет клиента приходит через --accent (см. base.html). */

:root {
  --accent: #333;
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --ink: #1c1e21;
  --muted: #6b7280;
  --line: #e5e7eb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--accent); }

/* ---------- Вход ---------- */
.auth-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  border-top: 4px solid var(--accent);
}

.auth-brand { text-align: center; margin-bottom: 22px; }

.auth-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  color: #fff;
  background: var(--accent);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.auth-brand h1 { font-size: 20px; margin: 0 0 4px; }
.auth-sub { margin: 0; color: var(--muted); font-size: 14px; }

.auth-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }

.auth-form input {
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.btn-primary {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  padding: 11px 14px;
  cursor: pointer;
  transition: filter .15s;
}
.btn-primary:hover { filter: brightness(1.06); }

/* ---------- Верхняя панель дашборда ---------- */
.topbar { background: var(--card-bg); border-bottom: 1px solid var(--line); }
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-badge {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
}
.topbar-title { font-weight: 600; }
.topbar-logout { display: flex; align-items: center; gap: 12px; }
.topbar-user { color: var(--muted); font-size: 14px; }

.btn-ghost {
  font-size: 14px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background .15s;
}
.btn-ghost:hover { background: var(--bg); }

/* ---------- Контент ---------- */
.page { flex: 1; max-width: 1080px; margin: 0 auto; padding: 32px 20px; width: 100%; }

.hero { margin-bottom: 28px; }
.hero h1 { font-size: 26px; margin: 0 0 8px; }
.hero-sub { margin: 0; color: var(--muted); max-width: 640px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 17px; margin: 0 0 8px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.card-tag {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 3px 9px;
  border-radius: 999px;
}
.card-soon { opacity: .92; }

/* ---------- Подвал ---------- */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

/* ---------- Топбар: бренд-ссылка + хлебные крошки ---------- */
.topbar-home { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.topbar-crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.topbar-crumbs a { color: var(--muted); text-decoration: none; }
.topbar-crumbs a:hover { color: var(--accent); }
.topbar-crumbs .crumb-sep { color: var(--line); }

.hero-compact { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

/* ---------- Стартовая: две половины ---------- */
.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.split-card {
  position: relative;
  display: block;
  text-decoration: none;
  color: var(--ink);
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 24px;
  min-height: 150px;
  transition: transform .12s, box-shadow .12s;
}
.split-card:hover:not(.is-soon) { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(16,24,40,.08), 0 16px 32px rgba(16,24,40,.10); }
.split-oz { border-top-color: #7c3aed; }
.split-kicker { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.split-card h2 { font-size: 22px; margin: 6px 0 8px; }
.split-card p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.split-go { font-weight: 600; color: var(--accent); }
.split-card.is-soon { opacity: .85; }

/* ---------- Оглавление WB ---------- */
.wb-toc { list-style: none; counter-reset: none; margin: 0 0 24px; padding: 0; }
.wb-toc-item { margin-bottom: 10px; }
.wb-toc-item a {
  display: flex; align-items: center; gap: 12px;
  background: var(--card-bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; text-decoration: none; color: var(--ink); font-weight: 500;
  box-shadow: var(--shadow); transition: border-color .12s, transform .12s;
}
.wb-toc-item a:hover { border-color: var(--accent); transform: translateX(2px); }
.wb-toc-item.is-soon a { color: var(--muted); font-weight: 400; }
.wb-toc-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 999px; flex: none;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
  font-size: 13px; font-weight: 700;
}
.wb-toc-item .card-tag { margin-left: auto; position: static; }

.wb-download-wrap { text-align: right; }
.wb-download { color: var(--accent); font-weight: 600; text-decoration: none; }
.wb-download:hover { text-decoration: underline; }

/* ---------- Фильтр сезонов ---------- */
.wb-toolbar { display: flex; align-items: center; gap: 10px; }
.wb-toolbar label { font-size: 13px; color: var(--muted); }
.wb-toolbar select {
  font-size: 14px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card-bg); color: var(--ink); cursor: pointer;
}
.wb-toolbar select:focus { outline: none; border-color: var(--accent); }

/* ---------- Блоки и таблицы ---------- */
.wb-block { margin-bottom: 28px; }
.wb-block-title { font-size: 17px; margin: 0 0 12px; }

.wb-table-wrap {
  overflow-x: auto;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.wb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wb-table th, .wb-table td { padding: 9px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.wb-table thead th {
  position: sticky; top: 0; background: var(--bg); color: var(--muted);
  font-weight: 600; font-size: 12px; text-align: left; z-index: 1;
  padding-right: 26px; cursor: pointer; user-select: none;
}
.wb-table thead th:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
.wb-table thead th.sort-asc .th-label::after { content: " ▲"; font-size: 9px; color: var(--accent); }
.wb-table thead th.sort-desc .th-label::after { content: " ▼"; font-size: 9px; color: var(--accent); }
.th-filter {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; cursor: pointer; color: var(--muted);
  font-size: 11px; line-height: 1; padding: 3px 4px; border-radius: 4px; opacity: .45;
}
.wb-table thead th:hover .th-filter { opacity: 1; }
.wb-table thead th.has-filter .th-filter { opacity: 1; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* Excel-подобный поповер фильтра/сортировки */
.wb-filter-pop {
  position: fixed; z-index: 50; width: 252px;
  background: var(--card-bg); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 10px; font-size: 13px;
}
.pop-sort { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.pop-sort-btn {
  text-align: left; background: transparent; border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px; cursor: pointer; font-size: 13px; color: var(--ink);
}
.pop-sort-btn:hover { border-color: var(--accent); color: var(--accent); }
.pop-search { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; }
.pop-search:focus { outline: none; border-color: var(--accent); }
.pop-all { display: flex; align-items: center; gap: 6px; font-weight: 600; padding: 3px 0; border-bottom: 1px solid var(--line); margin-bottom: 4px; cursor: pointer; }
.pop-list { max-height: 200px; overflow-y: auto; }
.pop-item { display: flex; align-items: center; gap: 6px; padding: 3px 2px; cursor: pointer; }
.pop-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-item:hover { background: var(--bg); }
.pop-actions { display: flex; gap: 8px; margin-top: 8px; }
.pop-apply, .pop-clear { flex: 1; padding: 7px; font-size: 13px; border-radius: 8px; cursor: pointer; }
.pop-clear { border: 1px solid var(--line); background: transparent; }

/* --- Стратегия (Коммерческое предложение): иконка + цветная метка + тултип --- */
.strat {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px 2px 7px; border-radius: 999px; cursor: help;
  font-weight: 600; font-size: 12px; white-space: nowrap;
  border: 1px solid transparent;
}
.strat::before { content: attr(data-ico); font-size: 13px; }
.strat-zahvat { color: #0a7d33; background: #e7f6ec; border-color: #b7e3c4; }
.strat-optim  { color: #9a6a00; background: #fdf4e3; border-color: #f2dcae; }
.strat-uhod   { color: #b42318; background: #fdeceb; border-color: #f6c9c5; }
/* сезонность (порядковая, сине-градиентная) */
.seas-strong { color: #123f78; background: #e2ecfa; border-color: #b9d2f4; }
.seas-mid    { color: #1c5cab; background: #eef4fc; border-color: #cfe0f8; }
.seas-none   { color: #6b7280; background: #f1f1ef; border-color: #e2e1db; }

/* --- Графики над таблицей --- */
.charts-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.chart-card {
  margin: 0; background: var(--card-bg); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px;
}
.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--ink); }
.chart-note { margin-top: 10px; font-size: 12px; color: var(--muted); }
.chart-empty { color: var(--muted); font-size: 13px; padding: 20px 0; text-align: center; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-lbl { fill: #52514e; font-size: 11px; }
.chart-val { fill: #1c1e21; font-size: 11px; font-variant-numeric: tabular-nums; }

/* донат + легенда */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-svg { width: 132px; height: 132px; flex: none; }
.donut-center { fill: #1c1e21; font-size: 20px; font-weight: 700; }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 150px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.lg-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.lg-ico { font-size: 13px; }
.lg-lb { color: var(--ink); }
.lg-val { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

/* --- Тултип --- */
.wb-tip {
  position: fixed; z-index: 60; max-width: 300px;
  background: #1c1e21; color: #fff; padding: 9px 11px; border-radius: 8px;
  font-size: 12px; line-height: 1.45; box-shadow: 0 8px 24px rgba(0,0,0,.28);
  pointer-events: none;
}
.wb-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg) 55%, transparent); }
.wb-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.wb-table td:first-child, .wb-table th:first-child { position: sticky; left: 0; }
.align-r { text-align: right; }
.align-l { text-align: left; }
.wb-empty { text-align: center; color: var(--muted); padding: 22px; }
.wb-rows-extra.is-collapsed { display: none; }

.wb-below { display: flex; align-items: center; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.wb-caption { color: var(--muted); font-size: 13px; }
.wb-caption a { color: var(--accent); }

/* ---------- Пустой блок «Выводы» ---------- */
.wb-note {
  border: 1px dashed var(--line); border-radius: 12px; padding: 18px 20px;
  color: var(--muted); background: color-mix(in srgb, var(--bg) 50%, transparent);
}

/* ---------- Заглушка «Скоро» ---------- */
.soon-wrap { display: grid; place-items: center; padding: 40px 0; }
.soon-card { max-width: 460px; text-align: center; padding: 32px; }
.soon-card h1 { font-size: 22px; margin: 8px 0; }
.soon-card p { color: var(--muted); margin: 0 0 18px; }
