/* Модули продавца — стили продукта. Отдельный файл, legacy styles.css не затрагивается. */

:root {
  /* Продукт светлый по дизайну: отключаем автозатемнение браузера, иначе
     системные элементы и фон инвертируются и текст теряет читаемость. */
  color-scheme: light;
  --canvas: #f1f3ee;
  --surface: #ffffff;
  --surface-2: #f7f8f4;
  --ink: #191d1c;
  --ink-2: #464b47;
  --muted: #565c55;
  /* было #92968c: контраст 2.7:1 на канвасе — ниже WCAG AA для текста */
  --faint: #666c60;
  --line: #dde0d7;
  --line-strong: #c7cbbf;
  --accent: #0e5c4a;
  --accent-dark: #0a4537;
  --accent-pale: #e2efe9;
  --signal: #8f620f;
  --signal-pale: #f7efd9;
  --ok: #2c6a3d;
  --ok-pale: #e5f0e7;
  --danger: #a63a44;
  --danger-pale: #f8e8ea;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(25, 29, 28, .05), 0 14px 30px -24px rgba(25, 29, 28, .45);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
output { display: block; }

:focus-visible { outline: 3px solid #78a99a; outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: fixed; top: -60px; left: 12px; z-index: 40;
  padding: 10px 14px; border-radius: 0 0 8px 8px;
  background: var(--ink); color: #fff; text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 0; }

/* ---------- Загрузка ---------- */
.boot {
  min-height: 100dvh; display: grid; align-content: center; justify-items: center; gap: 10px;
  padding: 40px 20px; text-align: center;
}
.boot-brand { display: flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.boot-note { color: var(--muted); font-size: 13px; }

/* ---------- Марка ---------- */
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; font-weight: 700; letter-spacing: -.3px; color: var(--ink); }
.brand-mark {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 11px 11px 11px 4px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; letter-spacing: -.5px;
}
.brand-name { font-size: 14px; line-height: 1.1; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 15px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .12s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-secondary { border-color: var(--line-strong); background: var(--surface); color: var(--accent-dark); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-pale); }
.btn-quiet { border-color: var(--line); background: var(--surface); color: var(--ink-2); }
.btn-quiet:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface-2); }
.btn-danger { border-color: var(--danger); color: var(--danger); background: var(--surface); }
.btn-danger:hover:not(:disabled) { background: var(--danger-pale); }
.btn-block { width: 100%; }
.btn-small { min-height: 32px; padding: 0 11px; font-size: 12.5px; }

/* ---------- Поля и формы ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field-hint, .form-note { color: var(--muted); font-size: 12px; line-height: 1.5; }
.field input, .field select, .field textarea, .input {
  width: 100%; min-height: 42px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { min-height: 100px; padding: 10px 12px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-pale); outline: none;
}
.field input:disabled, .field select:disabled { background: var(--surface-2); color: var(--faint); }
.form-note { margin-top: 10px; }
.feedback {
  margin-top: 14px; padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--danger); background: var(--danger-pale); color: var(--danger);
  font-size: 12.5px; line-height: 1.5;
}
.feedback.is-ok { border-color: var(--ok); background: var(--ok-pale); color: var(--ok); }

/* ---------- Экран входа ---------- */
.auth {
  min-height: 100dvh;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
}
.auth-aside {
  padding: clamp(36px, 6vw, 84px); display: grid; align-content: center; gap: 20px;
  background: #1c2621; color: #eef2ec;
}
.auth-aside .brand, .auth-aside .brand { color: #fff; }
.auth-aside .brand-mark { background: #2f8f72; }
.auth-aside h1 { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.12; letter-spacing: -1px; max-width: 16ch; }
.auth-aside p { max-width: 46ch; color: #c4cfc6; line-height: 1.6; }
.auth-points { display: grid; gap: 9px; margin-top: 8px; }
.auth-points li { position: relative; padding-left: 20px; color: #dbe4dc; font-size: 13.5px; }
.auth-points li::before { content: ""; position: absolute; left: 0; top: 8px; width: 7px; height: 7px; border-radius: 2px; background: #57b394; }
.auth-panel { padding: clamp(28px, 4vw, 56px); display: grid; align-content: center; background: var(--surface); }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 22px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.auth-tab {
  flex: 1; min-height: 38px; border: 0; border-radius: 6px; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
.auth-tab.is-active { background: var(--surface); color: var(--accent-dark); box-shadow: 0 1px 2px rgba(25,29,28,.08); }
.auth-panel h2 { font-size: 22px; letter-spacing: -.4px; }
.auth-state { display: grid; align-content: start; gap: 14px; }
.auth-state h2 { font-size: 22px; line-height: 1.25; letter-spacing: -.4px; }
.auth-state-copy { color: var(--ink-2); line-height: 1.6; }
.email-address { padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--accent-dark); font-weight: 600; overflow-wrap: anywhere; }
.auth-actions { display: grid; gap: 9px; margin-top: 4px; }
.mail-illustration { display: grid; place-items: center; width: 96px; height: 72px; margin-bottom: 2px; }
.mail-illustration svg { display: block; width: 96px; height: 72px; }
#pending-status, #limited-status, #verify-feedback { margin-top: 0; }

/* ---------- Оболочка ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.masthead {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 12px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
}
.app-nav { display: flex; align-items: center; gap: 3px; margin-left: 10px; }
.app-nav a {
  padding: 9px 13px; border-radius: 7px; text-decoration: none;
  color: var(--muted); font-size: 13.5px; font-weight: 600;
}
.app-nav a:hover { color: var(--ink); background: var(--surface-2); }
.app-nav a.is-active { color: var(--accent-dark); background: var(--accent-pale); }
.account-chip { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.account-name { font-size: 13px; font-weight: 600; text-decoration: none; color: var(--ink-2); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name:hover { color: var(--accent-dark); }

.demo-band {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 9px clamp(16px, 4vw, 40px);
  background: var(--signal-pale); border-bottom: 1px solid #e6d8ae; color: #6c4a08;
  font-size: 12.5px;
}
.demo-band strong { font-weight: 700; }
.demo-band span { color: #7d5a15; }

.main { flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 30px clamp(16px, 4vw, 40px) 40px; }
.view { animation: view-in .22s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.view-head h1 { font-size: 27px; line-height: 1.15; letter-spacing: -.9px; }
.view-head p { margin-top: 7px; max-width: 64ch; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.page-foot {
  display: flex; flex-wrap: wrap; gap: 6px 22px; justify-content: space-between;
  max-width: var(--maxw); width: 100%; margin: 0 auto; padding: 18px clamp(16px, 4vw, 40px) 34px;
  /* --faint даёт контраст 2.7:1 — недостаточно для текста футера; берём --ink-2. */
  color: var(--ink-2); font-size: 12px;
}
.page-foot a { color: var(--accent-dark); text-underline-offset: 3px; }

/* ---------- Состояния ---------- */
.view-state { padding: 22px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--muted); font-size: 13px; }
.view-state.inline { padding: 0; border: 0; background: transparent; }
.view-state.is-error { border-color: var(--danger); background: var(--danger-pale); color: var(--danger); }
.view-state.is-empty { border-style: dashed; }
.loading-line { display: inline-flex; align-items: center; gap: 9px; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Каталог модулей ---------- */
.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 16px; }
.module-card {
  position: relative; display: flex; flex-direction: column; gap: 16px;
  padding: 22px 22px 20px 26px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.module-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--line-strong); border-radius: var(--radius) 0 0 var(--radius); }
.module-card.is-active::before { background: var(--ok); }
.module-card.is-locked::before { background: var(--accent); }
.module-card.is-pending::before { background: var(--signal); }
.module-card.is-expired::before { background: var(--muted); }
.module-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.module-status-group { display: inline-flex; align-items: center; gap: 8px; }
.module-lock-indicator { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; background: var(--accent-pale); color: var(--accent-dark); font-size: 15px; cursor: pointer; }
.module-lock-indicator:hover { border-color: var(--accent-dark); }
.module-lock-indicator:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
.module-name { font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.module-market { margin-top: 4px; color: var(--faint); font-size: 12px; font-family: var(--mono); }
.module-desc { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }
.module-terms { display: flex; flex-wrap: wrap; gap: 6px; }
.term-chip { display: inline-flex; align-items: center; padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.price-line { display: flex; align-items: baseline; gap: 8px; }
.price-value { font-family: var(--mono); font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.price-period { color: var(--muted); font-size: 12.5px; }
.module-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: auto; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active { background: var(--ok-pale); color: var(--ok); }
.badge-locked { background: var(--accent-pale); color: var(--accent-dark); }
.badge-pending { background: var(--signal-pale); color: var(--signal); }
.badge-expired, .badge-cancelled { background: #eceee8; color: var(--muted); }
.badge-soon { background: #e9e6f2; color: #55467a; }
.badge-demo { background: var(--signal-pale); color: var(--signal); }
.module-meta { color: var(--muted); font-size: 12px; }
.module-meta strong { color: var(--ink-2); font-weight: 600; }

.coming { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.coming h2 { font-size: 15px; letter-spacing: -.2px; }
.coming .muted { margin-top: 6px; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.coming-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.coming-list li { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.coming-list .coming-name { font-weight: 600; }
.coming-list .coming-desc { color: var(--muted); font-size: 12.5px; }
.muted { color: var(--muted); }

/* ---------- Кабинеты / две колонки ---------- */
.two-col { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel.narrow { max-width: 520px; }
.panel h2 { margin-bottom: 14px; font-size: 15.5px; letter-spacing: -.2px; }
.panel + .panel { margin-top: 0; }
.limit-note { margin-top: 16px; color: var(--muted); font-size: 12.5px; }
.limit-note summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
.limit-note ul { margin-top: 10px; display: grid; gap: 8px; padding-left: 18px; list-style: disc; }
.limit-note li { line-height: 1.5; }

.store-list { display: grid; gap: 10px; margin-top: 14px; }
.store-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
.store-item .store-name { font-weight: 600; }
.store-item .store-meta { margin-top: 4px; color: var(--muted); font-size: 12px; font-family: var(--mono); }
.store-item .store-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Заказы ---------- */
.order-list { display: grid; gap: 10px; margin-top: 14px; }
.order-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center;
  padding: 15px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.order-item .order-title { font-weight: 600; }
.order-item .order-meta { margin-top: 4px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.order-item .order-side { display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.order-amount { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------- Партнёрам ---------- */
.partner-body { display: grid; gap: 16px; }
.link-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.link-value { flex: 1 1 260px; min-height: 42px; display: flex; align-items: center; padding: 0 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 18px; }
.stat { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { margin-top: 6px; font-family: var(--mono); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.balance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.balance { padding: 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.balance .balance-value { font-family: var(--mono); font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.balance .balance-label { margin-top: 6px; color: var(--muted); font-size: 12px; }
.term-list { display: grid; gap: 0; }
.term-list > div, .term-list dt, .term-list dd { }
.term-list .term { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.term-list .term:last-child { border-bottom: 0; }
.term-list dt { color: var(--muted); font-size: 13px; }
.term-list dd { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

.promotions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Таблицы ---------- */
.table-scroll { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th {
  height: 40px; padding: 0 12px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num, .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .mono { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.empty-cell { padding: 20px !important; color: var(--muted); text-align: center; }
.product-name { display: block; font-weight: 600; }
.product-code { display: block; margin-top: 3px; color: var(--faint); font-family: var(--mono); font-size: 11.5px; }

/* ---------- Рабочее пространство ---------- */
.workspace-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--muted); font-size: 12.5px; text-decoration: none; }
.back-link:hover { color: var(--accent-dark); }
#workspace-title { font-size: 24px; letter-spacing: -.7px; }
.workspace-sub { margin-top: 6px; color: var(--muted); font-size: 13px; }
.workspace-body { display: grid; gap: 16px; }

.control-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 15px 18px; border-left: 4px solid var(--accent); border-radius: var(--radius-sm); background: var(--accent-pale);
}
.control-strip.is-off { border-left-color: var(--line-strong); background: var(--surface-2); }
.control-copy { display: grid; gap: 5px; }
.control-copy strong { font-size: 14px; }
.control-copy span { color: var(--ink-2); font-size: 12.5px; }
.control-actions, .toolbar-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 4px; }
.selection-copy { display: grid; gap: 4px; }
.selection-copy strong { font-size: 13.5px; }
.selection-copy span { color: var(--muted); font-size: 12px; }
.notice { display: flex; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--signal-pale); color: #6c4a08; font-size: 12.5px; line-height: 1.5; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.table-foot { padding: 10px 13px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11.5px; }

.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--faint); }
.status-ok, .status-success { color: var(--ok); }
.status-ok::before, .status-success::before { background: var(--ok); }
.status-drift, .status-warning { color: var(--signal); }
.status-drift::before, .status-warning::before { background: var(--signal); }
.status-error, .status-missing { color: var(--danger); }
.status-error::before, .status-missing::before { background: var(--danger); }
.status-pending { color: var(--accent); }
.status-pending::before { background: var(--accent); animation: pulse 1.3s ease-in-out infinite; }
.status-unconfigured::before { background: var(--line-strong); }
@keyframes pulse { 50% { opacity: .3; } }

.discount-input, .target-input, .min-input {
  width: 84px; min-height: 34px; padding: 0 9px;
  border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface);
  font-family: var(--mono); font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums;
}
.target-input:disabled, .min-input:disabled, .discount-input:disabled { background: var(--surface-2); color: var(--faint); }
.input-suffix { display: inline-flex; align-items: center; gap: 6px; }
.input-suffix span { color: var(--muted); font-size: 12px; }

.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.section-heading h2 { font-size: 16px; letter-spacing: -.2px; }
.section-heading p { margin-top: 5px; color: var(--muted); font-size: 12.5px; }
.history-section { margin-top: 8px; }
.history { display: grid; margin-top: 12px; border-top: 1px solid var(--line); }
.history-item { display: grid; grid-template-columns: 120px 9px minmax(0, 1fr); gap: 10px; padding: 11px 2px; border-bottom: 1px solid var(--line); font-size: 12.5px; line-height: 1.5; }
.history-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.history-marker { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--faint); }
.history-marker.success { background: var(--ok); }
.history-marker.warning { background: var(--signal); }
.history-marker.error { background: var(--danger); }
.history-empty { padding: 15px 2px; color: var(--muted); font-size: 12.5px; }

.import-grid { display: grid; grid-template-columns: minmax(280px, .85fr) minmax(340px, 1.15fr); gap: 22px; align-items: start; }
.import-editor { display: grid; gap: 10px; justify-items: start; }
.import-errors { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--danger); border-radius: var(--radius-sm); background: var(--danger-pale); color: var(--danger); font-size: 12.5px; line-height: 1.5; }
.import-errors ul { margin-top: 6px; padding-left: 18px; list-style: disc; }
.preview-table { max-height: 360px; }

/* ---------- Checkout ---------- */
.checkout-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 18px; align-items: start; }
.checkout-summary { display: grid; gap: 0; }
.checkout-summary .term { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.checkout-summary .term:last-child { border-bottom: 0; }
.checkout-summary dt { color: var(--muted); }
.checkout-summary dd { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.outcome-grid { display: grid; gap: 9px; }
.refund-row { display: flex; align-items: flex-end; gap: 10px; margin-top: 6px; }
.refund-row .field { margin-bottom: 0; flex: 1; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  max-width: min(440px, calc(100vw - 32px)); padding: 13px 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: 0 12px 34px -18px rgba(25,29,28,.6);
  font-size: 13px; line-height: 1.45;
}
.toast.is-error { border-color: var(--danger); color: var(--danger); }
.toast.is-ok { border-color: var(--ok); color: var(--ok); }

/* ---------- Адаптив ---------- */
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { padding: 34px 24px; }
  .auth-points { display: none; }
  .two-col, .checkout-body { grid-template-columns: 1fr; }
  .import-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .masthead { flex-wrap: wrap; gap: 10px 14px; }
  .brand-name { display: none; }
  .app-nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; }
  .app-nav a { white-space: nowrap; }
  .account-chip { margin-left: auto; }
  .account-name { max-width: 130px; }
  .main { padding-top: 22px; }
  .view-head { flex-direction: column; }
  .view-head h1 { font-size: 23px; }
  .module-actions .btn { flex: 1 1 auto; }
  .workspace-head { flex-direction: column; align-items: flex-start; }
  .control-strip { flex-direction: column; align-items: flex-start; }
  .control-actions { width: 100%; }
  .control-actions .btn { flex: 1 1 auto; }
  .history-item { grid-template-columns: 92px 8px minmax(0, 1fr); }
  .link-value { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Публичная информация о услугах на экране входа: нужна проверяющим платёжных сервисов. Стоит на тёмной панели, поэтому цвета берутся из её палитры, а не из светлых токенов. */
.auth-terms { display: grid; gap: 7px; margin: 16px 0 0; }
.auth-aside .auth-terms div { display: flex; gap: 12px; justify-content: space-between; border-bottom: 1px solid rgba(255, 255, 255, .14); padding-bottom: 7px; }
.auth-aside .auth-terms dt { color: #a9b6ac; font-size: 13px; }
.auth-aside .auth-terms dd { margin: 0; color: #eef2ec; font-size: 13px; font-weight: 600; text-align: right; white-space: nowrap; }
.auth-legal { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0 0; font-size: 13px; }
.auth-aside .auth-legal a { color: #7fd0b4; text-underline-offset: 3px; }
.auth-aside .auth-legal a:hover { color: #a8e6cf; }

/* Уведомление о неподключённом платёжном сервисе: спокойное, не ошибка. */
.notice-wide { display: block; margin: 0 0 18px; padding: 13px 16px; font-size: 14px; border-left: 3px solid var(--signal); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* Услуги с ценами на экране входа: на узком экране цены переносятся,
   чтобы не появлялось горизонтального переполнения. Идёт после базовых правил
   намеренно: при равной специфичности побеждает последнее правило. */
@media (max-width: 720px) {
  /* Специфичность как у базовых правил (.auth-aside .auth-terms ...), иначе
     nowrap продолжает выигрывать и появляется горизонтальное переполнение. */
  .auth-aside .auth-terms div { display: block; }
  .auth-aside .auth-terms dd { margin-top: 2px; text-align: left; white-space: normal; }
}
