/* ==========================================================================
   GigPay — дизайн-система (веб-кабинеты заказчика).

   Визуальный язык — по мотивам сервиса «Самокат»: кораллово-красный акцент,
   плашечные (pill) кнопки, сильно скруглённые карточки, жирная скруглённая
   типографика, тёплые пастельные подложки. Это НЕ копия логотипа/бренда
   Самоката — своё название и вордмарк GigPay, только язык формы и цвета.

   Цвета статусов и палитра — по методике skill/dataviz (references/palette.md):
   валидированы на контраст и CVD-безопасность через scripts/validate_palette.js
   (accent+accent-600 прошли все 4 проверки; статусные цвета — раздельно,
   каждый используется только как одиночный статус с иконкой+подписью,
   никогда как соседние категориальные серии).
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@500;700;800;900&display=swap');

:root {
  --ink:        #1a1310;
  --ink-2:      #6b5f5c;   /* secondary ink */
  --ink-muted:  #a89a95;   /* muted / axis-labels */
  --page:       #fff8f5;   /* page plane — warm cream tint, Самокат-style */
  --surface:    #ffffff;   /* card surface */
  --border:     rgba(26,19,16,0.08);
  --gridline:   #f1e4dd;

  /* Кораллово-красный акцент (по мотивам Самоката). Основной #DE2E48 даёт
     AA-контраст (4.57:1) для белого текста на кнопках; #EF3E52 — более яркий
     тон для подсветок/градиентов; #C82A3D — глубокий шаг для hover/градиентов. */
  --accent:       #DE2E48;
  --accent-bright:#EF3E52;
  --accent-600:   #C82A3D;
  --accent-100:   #fdebec; /* тёплая розовая подложка (промо-плашки Самоката) */

  --good:      #0ca30c;
  --good-bg:   #e8f8e8;
  --warning:   #b3760a;
  --warning-bg:#fdf1de;
  --serious:   #c1502a;
  --serious-bg:#fbe9e1;
  --critical:  #c53030;
  --critical-bg:#fbe9e9;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow-1: 0 1px 2px rgba(26,19,16,0.05), 0 1px 1px rgba(26,19,16,0.03);
  --shadow-2: 0 10px 28px rgba(222,46,72,0.12), 0 2px 8px rgba(26,19,16,0.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "DejaVu Sans", sans-serif;
  background: var(--page);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; font-weight: 700; }
a:hover { text-decoration: underline; }
code { background: var(--accent-100); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }

/* --------------------------------------------------------------- topbar -- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 32px; background: rgba(255,248,245,0.88); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.topbar .brand { font-weight: 900; font-size: 1.25em; color: var(--ink); letter-spacing: -0.02em; }
.topbar .brand .dot { color: var(--accent); }
.topbar nav a { margin-left: 22px; color: var(--ink-2); font-size: 0.94em; font-weight: 700; }
.topbar nav a:hover { color: var(--accent); text-decoration: none; }

.container { max-width: 900px; margin: 0 auto; padding: 36px 24px 72px; }
.container.narrow { max-width: 440px; }

/* ----------------------------------------------------------------- hero -- */
.hero {
  text-align: center; padding: 96px 24px 56px;
  background:
    radial-gradient(60% 60% at 50% 0%, var(--accent-100) 0%, transparent 70%);
}
.hero h1 {
  font-size: 2.5em; margin-bottom: 0.3em; color: var(--ink); letter-spacing: -0.02em;
  font-weight: 900; line-height: 1.12;
}
.hero p { color: var(--ink-2); font-size: 1.12em; max-width: 580px; margin: 0 auto 2.2em; font-weight: 500; }
.hero .cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 24px; border-radius: 999px; border: none;
  background: var(--accent); color: white; font-weight: 800; cursor: pointer; font-size: 0.95em;
  transition: transform 0.05s ease, background 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-1);
}
.btn:hover { background: var(--accent-600); text-decoration: none; box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn.secondary { background: var(--surface); color: var(--accent); border: 1.5px solid var(--border); box-shadow: none; }
.btn.secondary:hover { background: var(--accent-100); border-color: var(--accent-100); }
.btn.small { padding: 7px 16px; font-size: 0.86em; border-radius: 999px; }
.btn.danger { background: var(--critical); }
.btn.block { display: flex; width: 100%; justify-content: center; }

/* ------------------------------------------------------------------ card -- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 26px; margin-bottom: 18px; box-shadow: var(--shadow-1);
}
.card h2, .card h3 { margin-top: 0; letter-spacing: -0.01em; font-weight: 800; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 680px) { .grid-2 { grid-template-columns: 1fr; } }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 680px) { .grid-3 { grid-template-columns: 1fr; } }

.stat { font-size: 1.95em; font-weight: 900; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: proportional-nums; }
.stat-label { color: var(--ink-2); font-size: 0.85em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }

.balance-card {
  background: linear-gradient(135deg, var(--accent-bright) 0%, var(--accent-600) 100%);
  color: white; border: none;
}
.balance-card .stat-label { color: rgba(255,255,255,0.8); }
.balance-card .stat { color: white; }
.balance-card input::placeholder { color: rgba(255,255,255,0.8); }
.balance-card input:focus { box-shadow: 0 0 0 3px rgba(255,255,255,0.3); border-color: rgba(255,255,255,0.6); }

/* ------------------------------------------------------------- mode-card -- */
.mode-card {
  display: block; cursor: pointer; background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; transition: border-color 0.15s ease, background 0.15s ease;
}
.mode-card:hover { border-color: var(--accent-bright); }
.mode-card.active { border-color: var(--accent); background: var(--accent-100); }
.mode-card-title { font-weight: 800; font-size: 1.05em; margin-bottom: 6px; }
.mode-card-desc { color: var(--ink-2); font-size: 0.88em; line-height: 1.5; }

table { width: 100%; border-collapse: collapse; font-size: 0.93em; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--gridline); }
th { color: var(--ink-muted); font-weight: 800; font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }

/* ---------------------------------------------------------------- badges -- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 999px; font-size: 0.78em; font-weight: 800;
}
.badge.ok { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warning-bg); color: var(--warning); }
.badge.serious { background: var(--serious-bg); color: var(--serious); }
.badge.danger { background: var(--critical-bg); color: var(--critical); }
.badge.neutral { background: #f4ece8; color: var(--ink-2); }

form.inline { display: inline; }
label { display: block; font-size: 0.85em; color: var(--ink-2); font-weight: 700; margin-bottom: 5px; margin-top: 14px; }
input, select, textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.96em; font-family: inherit; background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100);
}
.field { margin-bottom: 4px; }
.actions { margin-top: 22px; }

.notice { padding: 13px 18px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 0.92em; font-weight: 700; }
.notice.error { background: var(--critical-bg); color: var(--critical); }
.notice.info { background: var(--accent-100); color: var(--accent-600); }

.risk-row.high { border-left: 3px solid var(--critical); padding-left: 14px; }
.risk-row.medium { border-left: 3px solid var(--warning); padding-left: 14px; }
.risk-row.low { border-left: 3px solid var(--ink-muted); padding-left: 14px; }

.footnote { color: var(--ink-muted); font-size: 0.82em; margin-top: 32px; line-height: 1.6; }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ------------------------------------------------------------ bar-chart -- */
.bar-chart { display: flex; align-items: flex-end; gap: 14px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; }
.bar-value { font-size: 0.74em; font-weight: 800; color: var(--ink-2); margin-bottom: 4px; font-variant-numeric: tabular-nums; height: 1.2em; }
.bar-track { width: 100%; max-width: 34px; height: 120px; display: flex; align-items: flex-end; background: var(--page); border-radius: 8px; }
.bar-fill { width: 100%; min-height: 3px; background: var(--accent); border-radius: 6px 6px 0 0; transition: height 0.2s ease; }
.bar-label { font-size: 0.76em; color: var(--ink-muted); margin-top: 8px; text-transform: capitalize; }

::selection { background: var(--accent-100); }

/* ------------------------------------------------------------- sidebar -- */
/* Кабинет заказчика — по мотивам Jump.Finance: весь навигационный каркас
   слева, а не топбаром сверху (см. customer_shell.html). */
body.has-sidebar { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  width: 264px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-top { padding: 20px 18px 14px; border-bottom: 1px solid var(--border); }
.sidebar-company { display: flex; gap: 10px; align-items: center; min-width: 0; }
.sidebar-avatar {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: var(--accent-100); color: var(--accent-600);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1em; text-transform: uppercase;
}
.sidebar-company-info { min-width: 0; }
.sidebar-company-name {
  font-weight: 800; font-size: 0.92em; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 170px;
}
.sidebar-company-email {
  font-size: 0.76em; color: var(--ink-muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 170px;
}
.sidebar-nav { flex: 1; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 12px; color: var(--ink-2); font-weight: 700; font-size: 0.9em;
  text-decoration: none; position: relative;
}
.sidebar-nav a:hover { background: var(--accent-100); text-decoration: none; color: var(--accent-600); }
.sidebar-nav a.active { background: var(--accent-100); color: var(--accent-600); }
.sidebar-nav a .icon { font-size: 1.1em; width: 22px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--accent); color: white; font-size: 0.72em;
  font-weight: 800; border-radius: 999px; padding: 1px 7px; line-height: 1.5;
}
.sidebar-bottom { padding: 12px; border-top: 1px solid var(--border); }
.sidebar-bottom a {
  display: flex; gap: 12px; align-items: center; padding: 10px 12px;
  border-radius: 12px; color: var(--ink-2); font-weight: 700; font-size: 0.9em; text-decoration: none;
}
.sidebar-bottom a:hover { background: var(--accent-100); text-decoration: none; color: var(--accent-600); }
.sidebar-bottom .icon { font-size: 1.1em; width: 22px; text-align: center; }

.sidebar-main { flex: 1; min-width: 0; }

@media (max-width: 880px) {
  body.has-sidebar { flex-direction: column; }
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar-top { border-bottom: none; border-right: 1px solid var(--border); flex-shrink: 0; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; padding: 10px; }
  .sidebar-nav a { white-space: nowrap; }
  .sidebar-bottom { border-top: none; border-left: 1px solid var(--border); flex-shrink: 0; }
}

/* -------------------------------------------------------- header/toolbar -- */
.page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; padding: 32px 32px 0;
}
.page-header h2 { margin: 0 0 4px; }
.page-header .sub { color: var(--ink-2); margin: 0; font-size: 0.92em; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sidebar-main .container { padding-top: 26px; }
.sidebar-main .container.narrow { max-width: 480px; }

/* --------------------------------------------------------------- tabs ---- */
.tab-row { display: flex; gap: 6px; margin: 0 0 20px; border-bottom: 1px solid var(--border); padding: 0 0 0; flex-wrap: wrap; }
.tab-row a {
  padding: 10px 16px; font-weight: 700; font-size: 0.9em; color: var(--ink-2);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-row a:hover { color: var(--accent); text-decoration: none; }
.tab-row a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ------------------------------------------------------ checklist / lna -- */
.check-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--gridline); }
.check-row:last-child { border-bottom: none; }
.check-dot { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 0.78em; font-weight: 800; }
.check-dot.ready { background: var(--good-bg); color: var(--good); }
.check-dot.pending { background: #f4ece8; color: var(--ink-muted); }
.check-title { flex: 1; font-weight: 600; }

/* ------------------------------------------------------ dropzone / import -- */
.dropzone {
  border: 1.5px dashed var(--border); border-radius: var(--radius-sm); padding: 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

/* ---------------------------------------------------------- settings hub -- */
.settings-grid { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .settings-grid { grid-template-columns: repeat(3, 1fr); } }
.settings-card {
  display: block; color: inherit; text-decoration: none; cursor: pointer;
  transition: border-color 0.15s ease, transform 0.05s ease;
  border: 1.5px solid var(--border);
}
.settings-card:hover { border-color: var(--accent-bright); text-decoration: none; box-shadow: var(--shadow-2); }
.settings-card-title { font-weight: 800; font-size: 1.02em; margin-bottom: 4px; }
.settings-card-desc { color: var(--ink-2); font-size: 0.85em; }
.settings-back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 700; font-size: 0.88em; margin-bottom: 16px; }
.settings-back:hover { color: var(--accent); text-decoration: none; }

/* ------------------------------------------------------------ dashboard --- */
.grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 900px) { .grid-4 { grid-template-columns: 1fr; } }
.mini-stats { display: flex; gap: 14px; margin-top: 6px; }
.mini-stat { flex: 1; }
.mini-stat-value { font-size: 1.5em; font-weight: 900; letter-spacing: -0.02em; }
.mini-stat-value.danger { color: var(--critical); }
.mini-stat-value.warn { color: var(--warning); }
.mini-stat-label { color: var(--ink-2); font-size: 0.8em; font-weight: 700; }
.period-tabs { display: flex; gap: 4px; background: var(--page); border-radius: 999px; padding: 3px; }
.period-tabs button {
  border: none; background: transparent; padding: 6px 13px; border-radius: 999px;
  font-weight: 700; font-size: 0.8em; color: var(--ink-2); cursor: pointer; font-family: inherit;
}
.period-tabs button.active { background: var(--surface); color: var(--accent-600); box-shadow: var(--shadow-1); }
.limits-table { width: 100%; font-size: 0.9em; }
.limits-table td { padding: 7px 0; border-bottom: 1px solid var(--gridline); }
.limits-table tr:last-child td { border-bottom: none; }
.limits-table td:last-child { text-align: right; font-weight: 800; }
.credential-box {
  background: var(--accent-100); border: 1px solid var(--accent); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 18px; font-size: 0.92em;
}
.credential-box code { background: white; }
