/* Ayant Business — токены, сброс, типографика, кнопки и поля.
   CSP: style-src 'self' — в разметке нет style="…", всё через классы.
   Тема: системная (prefers-color-scheme). Бренд: оранжевый градиент #FF5722 → #FFA700. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: light dark;
  --brand-a: #FF5722; --brand-b: #FFA700;
  --grad: linear-gradient(135deg, var(--brand-a), var(--brand-b));
  --accent-text: #c43c0b;             /* оранжевый для текста/ссылок: контраст ≥ 4.5 на белом */
  --on-grad: #2a1306;                 /* тёмный текст на градиенте (контраст ≥ 6) */
  --bg: #faf7f5; --surface: #ffffff; --surface-2: #f4efec;
  --border: #e8e1dc; --border-strong: #d4c9c2;
  --text: #1c1714; --muted: #6d625b;
  --ok: #1a8a4b; --warn: #b86400; --bad: #d32f2f; --info: #2563eb;
  --ok-soft: #e6f6ec; --warn-soft: #fff1dc; --bad-soft: #fdecea; --info-soft: #e8f0fe;
  --overlay: rgba(20, 12, 8, .5);
  --shadow-1: 0 1px 2px rgba(40, 20, 10, .06), 0 1px 1px rgba(40, 20, 10, .04);
  --shadow-2: 0 12px 36px rgba(40, 20, 10, .18);
  /* серии графиков (различимы и в тёмной теме) */
  --c0: #FF5722; --c1: #2f7de1; --c2: #1fa971; --c3: #a05bd6; --c4: #e0a100; --c5: #6b7785;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --topbar-h: 56px; --nav-w: 232px; --bottom-nav-h: 60px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent-text: #ff8a5c;
    --bg: #14100e; --surface: #1d1815; --surface-2: #27211d;
    --border: #322a25; --border-strong: #463b34;
    --text: #f3ece7; --muted: #a39489;
    --ok: #46c27f; --warn: #f0a04b; --bad: #ff7b72; --info: #7aa8ff;
    --ok-soft: #12301f; --warn-soft: #3a2a10; --bad-soft: #3b1816; --info-soft: #172a4d;
    --overlay: rgba(0, 0, 0, .65);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-2: 0 12px 36px rgba(0, 0, 0, .6);
    --c1: #6ea2ff; --c2: #46c27f; --c3: #c58cf0; --c4: #f0c24a; --c5: #93a0ad;
  }
}

html { -webkit-text-size-adjust: 100%; }
body { font: 15px/1.5 var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }
h1 { font-size: 22px; line-height: 1.25; font-weight: 700; }
h2 { font-size: 16px; line-height: 1.3; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand-a); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.ico { flex: none; vertical-align: middle; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--r-sm); cursor: pointer; font-weight: 600; text-decoration: none; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--grad); border-color: transparent; color: var(--on-grad); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.05); background: var(--grad); }
.btn.danger { background: var(--bad); border-color: transparent; color: #fff; }
.btn.danger:hover:not(:disabled) { background: var(--bad); filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.sm { min-height: 34px; padding: 4px 12px; font-size: 13.5px; }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; padding: 6px 0; color: var(--accent-text); cursor: pointer; font-weight: 600; }
.link-btn:disabled { opacity: .55; cursor: not-allowed; }

/* Поля */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13.5px; font-weight: 600; }
.input { width: 100%; min-height: 42px; padding: 9px 12px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm); }
textarea.input { resize: vertical; min-height: 88px; }
.input:focus { outline: 2px solid var(--brand-a); outline-offset: 0; border-color: transparent; }
.input[aria-invalid="true"] { border-color: var(--bad); }
.field-msg { min-height: 0; font-size: 12.5px; color: var(--muted); }
.field-msg:empty { display: none; }
.field-msg.err { color: var(--bad); }
.time-range { display: flex; align-items: center; gap: 8px; }
.time-range .input { width: auto; flex: 1; }
.field-switch .switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 42px; height: 24px; border-radius: 12px; background: var(--border-strong); transition: background .15s; flex: none; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: var(--shadow-1); }
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brand-a); outline-offset: 2px; }

/* Сегменты (язык, период) */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 2px; gap: 2px; }
.seg-btn { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--muted); min-height: 32px; }
.seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.seg-sm .seg-btn { padding: 4px 9px; font-size: 12.5px; min-height: 28px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.stack > .field, form.stack .field { margin-bottom: 0; }
