/* Приведение калькулятора антенн к виду остального сайта.

   Файл подключается ПОСЛЕ styles.css и не правит его разметку — только
   переопределяет переменные темы. Так обновление из апстрима не конфликтует:
   там меняются правила, здесь только палитра.

   У приложения тема была одна, тёмная. Наш сайт умеет обе и хранит выбор в
   localStorage['rf-theme'] — тот же ключ читает и эта страница, поэтому
   переключение темы переносится между разделами.

   Соответствие токенов: их --green это акцент интерфейса (активная вкладка,
   значения), а не «успех», поэтому он становится нашим синим акцентом. */

:root {
  color-scheme: light;
  --bg:        #f5f5f3;
  --surface:   #fcfcfb;
  --surface-2: #f0efec;
  --surface-3: #e9e8e3;
  --field:     #ffffff;
  --line:      #dedcd6;
  --line-soft: rgba(11, 11, 11, .08);
  --text:      #0b0b0b;
  --muted:     #52514e;
  --subtle:    #76746e;
  --green:      #2a78d6;
  --green-dark: #e8f0fc;
  --amber:      #9a6400;
  --amber-dark: #fbf0d9;
  --red:   #b3312f;
  --blue:  #2a78d6;
  --cyan:  #1baf7a;
  --shadow: 0 1px 2px rgba(11, 11, 11, .06), 0 4px 16px rgba(11, 11, 11, .04);
  --inner-shadow: none;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg:        #121211;
    --surface:   #1a1a19;
    --surface-2: #232322;
    --surface-3: #2b2b29;
    --field:     #141413;
    --line:      #34342f;
    --line-soft: rgba(255, 255, 255, .07);
    --text:      #ffffff;
    --muted:     #c3c2b7;
    --subtle:    #98968c;
    --green:      #3987e5;
    --green-dark: #16263c;
    --amber:      #d9a534;
    --amber-dark: #2b2412;
    --red:   #e66767;
    --blue:  #3987e5;
    --cyan:  #199e70;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:        #121211;
  --surface:   #1a1a19;
  --surface-2: #232322;
  --surface-3: #2b2b29;
  --field:     #141413;
  --line:      #34342f;
  --line-soft: rgba(255, 255, 255, .07);
  --text:      #ffffff;
  --muted:     #c3c2b7;
  --subtle:    #98968c;
  --green:      #3987e5;
  --green-dark: #16263c;
  --amber:      #d9a534;
  --amber-dark: #2b2412;
  --red:   #e66767;
  --blue:  #3987e5;
  --cyan:  #199e70;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
}

/* Фон у приложения был из четырёх градиентов и сетки — на светлой теме это
   мусор, да и на тёмной отличается от остального сайта. */
body {
  background: var(--bg) !important;
  font-family: var(--sans);
}

/* Карточки и панели — как .card на сайте: тонкая рамка, мягкая тень. */
.control-panel, .workspace, .result-card, .pattern-panel, .formula-panel,
.reference-strip > div, .tool-visual {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.workspace-head { border-bottom: 1px solid var(--line); }

/* Кнопки категорий и калькуляторов: заливка акцентом только у выбранного. */
.category-tabs button.active, .tool-list button.active,
.category-tabs .active, .tool-list .active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

input, select, textarea {
  background: var(--field);
  border-color: var(--line);
  color: var(--text);
  border-radius: 8px;
}
input:focus, select:focus {
  outline: 2px solid var(--green);
  outline-offset: -1px;
}

.eyebrow, .type-pill { letter-spacing: .04em; }

/* Полоса навигации: те же размеры, что в шапке сайта. */
.rf-topbar { box-shadow: var(--shadow); }
.rf-theme {
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--muted); border-radius: 8px; height: 30px; width: 34px;
  cursor: pointer; font-size: 14px; line-height: 1; margin-left: 10px;
}
.rf-theme:hover { border-color: var(--green); color: var(--text); }

/* Часть цветов в styles.css задана литералами, мимо переменных, — их
   переопределяем поимённо. Иначе на светлой теме остаются тёмные панели и
   ядовито-зелёные числа. */
.controls, .workspace, .reference-strip {
  background: var(--surface);
  backdrop-filter: none;
}

.value, .pattern-metric .value { color: var(--green); }

.category-btn.active, .tool-btn.active {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.type-pill {
  color: var(--green);
  background: var(--green-dark);
  border-color: var(--line);
}

.band-badge { background: var(--green-dark); color: var(--green); }
.band-badge.invalid { color: var(--red); background: var(--amber-dark); }
.notes-panel p { color: var(--muted); }
.slider { background: var(--surface-3); }
.switch input:checked + .slider { background: var(--green); }
.slider::before, .slider:before { background: var(--surface); }
.install-btn { color: #fff; background: var(--green); }

/* Поля ввода на светлой теме были почти невидимы: тёмная заливка из темы
   приложения поверх светлой карточки. */
input[type="number"], input[type="text"], select {
  background: var(--field);
  color: var(--text);
}
