/*
 * Токены, шрифты, сброс и база. ТЗ — docs/design/DESIGN_SYSTEM.md.
 * Все файлы app/assets/stylesheets подключает stylesheet_link_tag :app по алфавиту: application, components,
 * deals, forms, goods, home, layout, money, palette, payments. Поэтому файл раздела перекрывает компонент при равной
 * специфичности. Цвета задаются только здесь, в остальных файлах — var(--…).
 */

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/manrope-cyrillic-wght-normal-41075bee.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/manrope-latin-wght-normal-8a556d91.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Знак рубля живет в latin-ext */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/manrope-latin-ext-wght-normal-2d7da881.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+A720-A7FF;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/jetbrains-mono-cyrillic-500-normal-8f60c941.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/jetbrains-mono-latin-500-normal-d7551f45.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;

  /* Цвет: таблица «Токены» ТЗ */
  --ground: #fafaf7;
  --panel: #ffffff;
  --side: #f3f3ee;
  --line: #e6e6df;
  --line-2: #efefe9;
  --ink: #1c2220;
  --ink-2: #59625d;
  --ink-3: #6f7772;
  --acc: #2b5a4a;
  --acc-2: #e4ede8;
  --neg: #a8372b;
  --neg-2: #fbe8e4;
  --warn: #946400;
  --warn-2: #fbf0d6;
  --pos: #2a7549;
  --pos-2: #e2f1e7;
  --stripe-r: #d4574a;
  --stripe-y: #d9a21b;

  /* Оттенки из прототипа: рамка контролов, наведение, подложки */
  --edge: #d9dbd3;
  --edge-2: #bfc3b9;
  --acc-hover: #224a3c;
  --on-acc: #ffffff;
  --hover: #eaeae4;
  --tint: #fbfbf8;
  --hatch: #f6f6f1;
  --column: #f2f2ed;
  --ev-deal: #e9e6f5;
  --ev-milestone: #eef1ec;

  /* Группы удержаний на Главной */
  --grp-deals: #6e8f80;
  --grp-tax: #c8a55a;
  --grp-pay: #9aa7c4;
  --grp-held: #c9cbc3;

  /* Тени: только у всплывающего и карточек доски */
  --sh-1: 0 1px 2px rgb(0 0 0 / 6%);
  --sh-card: 0 1px 2px rgb(0 0 0 / 4%);
  --sh-card-hover: 0 4px 14px rgb(0 0 0 / 7%);
  --sh-pop: 0 10px 30px rgb(0 0 0 / 14%);
  --sh-drawer: -12px 0 40px rgb(0 0 0 / 12%);
  --sh-drawer-left: 12px 0 40px rgb(0 0 0 / 12%);
  --sh-dialog: 0 24px 60px rgb(0 0 0 / 25%);
  --backdrop: rgb(20 25 22 / 25%);

  /* Типографика */
  --sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  /* Отступы, радиусы */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
}

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

/* Касание на телефоне подсвечивается акцентом, а не системным серым */
html {
  -webkit-tap-highlight-color: var(--acc-2);
  -webkit-text-size-adjust: 100%;
}

/* tabular-nums на всём: суммы, даты и колонки чисел не прыгают без отдельного класса */
body {
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 20px;
  font-weight: 700;
}

h3 {
  font-size: 17px;
  font-weight: 700;
}

h4 {
  font-size: 15px;
  font-weight: 700;
}

small {
  font-size: 13px;
}

a {
  color: var(--acc);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* :where — без специфичности, чтобы шрифт кнопок из components.css не перебивался */
:where(button, input, select, textarea) {
  color: inherit;
  font: inherit;
}

button,
summary {
  cursor: pointer;
}

summary {
  font-weight: 600;
}

:where(a, button, summary, input, select, textarea, label) {
  touch-action: manipulation;
}

:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}

code,
kbd {
  background: var(--line-2);
  border-radius: 5px;
  color: var(--ink-2);
  font: 500 0.85em var(--mono);
  padding: 1px 5px;
}

kbd {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 11px;
}

/* Метка нужна скринридеру, но на экране дублирует видимый контекст */
.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* Мелкая подпись: заголовки показателей и колонок */
.lbl {
  color: var(--ink-3);
  font: 500 11px/1.3 var(--mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
