
:root {
  /* Карточка инструмента (рынок): свечи и осцилляторы в долях вьюпорта — одинаковые пропорции на телефонах.
     Свечи: width = … * chart-width-vw%, height = vh * candle-pane-vh%. Каждый осциллятор: vh * osc-each-vh%. */
  --market-card-chart-width-vw: 100;
  --market-card-candle-pane-vh: 36;
  --market-card-candle-min-px: 200;
  --market-card-candle-max-vh: 52;
  /* Один подграфик осциллятора: высота = vh * osc-each-vh%, clamp min/max. */
  --market-card-osc-each-vh: 14;
  --market-card-osc-each-min-px: 50;
  --market-card-osc-each-max-vh: 22;

  /* —— Базовая палитра —— */
  --bg-page: #000000;
  --surface: #000000;
  --text: #f2f4f8;
  --text-muted: #b5bfce;
  --text-muted-soft: #aab4c3;
  --border: #393939;
  --blue: #4b8dff;
  --blue-pressed: #3f7ae3;
  --text-on-accent: #ffffff;

  --control-focus-ring: rgba(75, 141, 255, 0.45);
  --control-active-overlay: rgba(255, 255, 255, 0.06);
  --shadow-top: rgba(255, 255, 255, 0.02);
  --shadow-drop: rgba(0, 0, 0, 0.22);
  --shadow: 0 1px 0 var(--shadow-top), 0 8px 22px var(--shadow-drop);
  --shadow-card: rgba(0, 0, 0, 0.24);
  --shadow-tabbar: rgba(17, 24, 39, 0.14);

  /* —— Сегменты, поиск —— */
  --surface-segmented-track: #191919;
  --text-segmented: #a5adba;
  --surface-ui-strong: #393939;
  --text-segmented-active: #f3f6ff;
  --text-search-icon: #9ca3af;
  --surface-search-input: #2f333b;
  --surface-search-clear: #454b56;
  --text-search-clear: #d1d5db;
  --surface-search-input-focus: #3b414b;
  /* Сегменты «пилюля»: единая внутренняя высота кнопки + паддинг трека */
  --segmented-track-pad: 3px;
  --segmented-subtab-min-h: 31px;
  --segmented-pill-outer-h: calc(
    var(--segmented-subtab-min-h) + 2 * var(--segmented-track-pad)
  );
  --market-row-control-h: var(--segmented-pill-outer-h);

  /* —— Карточки, списки —— */
  --surface-raised: #000000;
  --text-empty-icon: #7e8694;
  --scrollbar-thumb: rgba(255, 255, 255, 0.22);
  --focus-subtab-locked-outline: rgba(251, 191, 36, 0.9);
  --focus-subtab-locked-glow: rgba(251, 191, 36, 0.25);
  --surface-avatar-placeholder: #2c3139;
  --ticker-row-border-bottom: rgba(255, 255, 255, 0.1);

  /* —— Котировки —— */
  --color-quote-up: #16a34a;
  --color-quote-down: #dc2626;

  /* —— График: шапка и легенда —— */
  --market-chart-name: #ffffff;
  --surface-market-legend-chip: rgba(255, 255, 255, 0.06);
  --text-market-legend: #d0d7de;
  --text-market-legend-value: #f0f6fc;

  /* —— Курсор на графике —— */
  --chart-cursor-line: rgba(255, 255, 255, 0.36);
  --chart-cursor-bg: rgba(12, 16, 24, 0.42);
  --chart-cursor-text: rgba(240, 246, 252, 0.88);
  --chart-cursor-text-muted: rgba(208, 215, 222, 0.62);
  --text-chart-loading: #8b949e;
  --chart-legend-close-dot: rgba(147, 197, 253, 0.95);

  /* —— Кнопки индикаторов —— */
  --border-market-ind: rgba(255, 255, 255, 0.06);
  --surface-market-ind: #191919;
  --text-market-ind: #dbe3f1;
  --border-market-ind-active: rgba(170, 189, 219, 0.72);
  --surface-market-ind-active: #393939;
  --text-market-ind-active: #f8fbff;
  --highlight-inset-soft: rgba(255, 255, 255, 0.14);
  --focus-market-ind-outline: rgba(179, 213, 255, 0.92);
  --border-market-select: rgba(255, 255, 255, 0.08);

  /* —— Поля и кнопки форм —— */
  --surface-input-round: #3a3f49;
  --surface-btn-secondary: #3a404b;

  /* —— Профиль —— */
  --surface-profile-avatar: #2d3b56;
  --text-profile-avatar: #8db6ff;
  --text-warning: #b45309;
  --surface-plan-badge: rgba(75, 141, 255, 0.16);
  --text-plan-badge: #9fc1ff;
  --surface-plan-card: #000000;
  --text-btn-disabled: #d5d9e2;
  --link-accent: #9fc1ff;

  /* —— Tabbar —— */
  --surface-tabbar: #191919;
  --surface-tabbar-item-active: #393939;
  --text-tabbar: #8e97a7;
  --text-tabbar-active: #9fc1ff;

  /* —— Сообщения форм —— */
  --surface-input-readonly: rgba(255, 255, 255, 0.04);
  --text-form-success: #059669;
  --form-msg-error: #dc2626;
  --form-msg-warn: #b45309;

  /* —— Telegram / фолбэк фона графика —— */
  --tg-chrome-bg: #000000;

  /* —— Тема lightweight-charts (читает app.js) —— */
  --chart-fallback-bg: #262a31;
  --chart-grid-muted: rgba(255, 255, 255, 0.07);
  --chart-text: #a1a1a6;
  --chart-crosshair: rgba(255, 255, 255, 0.2);
  --chart-crosshair-label-bg: #2c2c2e;
  --candle-up: #22c55e;
  --futures-overlay: #f59e0b;
  --candle-down: #ef4444;
  --ind-color-default: rgba(251, 191, 36, 0.95);
  --ind-color-sma: rgba(147, 197, 253, 0.95);
  --ind-color-ema: rgba(251, 191, 36, 0.95);
  --ind-color-dema: rgba(129, 140, 248, 0.95);
  --ind-color-tema: rgba(192, 132, 252, 0.95);
  --ind-color-wma: rgba(250, 204, 21, 0.95);
  --ind-color-vwap: rgba(34, 197, 94, 0.95);
  --ind-color-rma: rgba(52, 211, 153, 0.95);
  --ind-color-rsi: rgba(248, 113, 113, 0.95);
  --ind-color-rsi_extreme_high: rgba(34, 197, 94, 1);
  --ind-color-rsi_extreme_low: rgba(239, 68, 68, 1);
  --ind-color-rsi_smooth: rgba(239, 68, 68, 0.95);
  --ind-color-cci: rgba(244, 114, 182, 0.95);
  --ind-color-cci_extreme_high: rgba(34, 197, 94, 1);
  --ind-color-cci_extreme_low: rgba(239, 68, 68, 1);
  --ind-color-cci_smooth: rgba(219, 39, 119, 0.95);
  --ind-color-momentum: rgba(96, 165, 250, 0.95);
  --ind-color-roc: rgba(59, 130, 246, 0.95);
  --ind-color-trix: rgba(167, 139, 250, 0.95);
  --ind-color-smio: rgba(125, 211, 252, 0.95);
  --ind-color-stoch: rgba(253, 224, 71, 0.95);
  --ind-color-williams_r: rgba(139, 92, 246, 0.95);
  --ind-color-williams_r_extreme_high: rgba(34, 197, 94, 1);
  --ind-color-williams_r_extreme_low: rgba(239, 68, 68, 1);
  --ind-color-slow_stoch: rgba(252, 211, 77, 0.95);
  --ind-color-tsi: rgba(56, 189, 248, 0.95);
  --ind-color-macd: rgba(94, 234, 212, 0.95);
  --ind-color-dmi: rgba(249, 168, 212, 0.95);
  --ind-color-ichimoku: rgba(171, 235, 198, 0.95);
  --ind-color-didi: rgba(253, 186, 116, 0.95);
  --ind-color-vwma: rgba(41, 98, 255, 0.95);
  --ind-color-volume: rgba(74, 158, 255, 0.85);
  --ind-color-volume_delta: rgba(45, 212, 191, 0.9);
  --ind-color-bbands: rgba(186, 230, 253, 0.95);
  --ind-color-bbands_upper: rgba(125, 211, 252, 0.9);
  --ind-color-bbands_lower: rgba(147, 197, 253, 0.9);
  --ind-color-bb_trends: rgba(165, 180, 252, 0.95);
  --ind-color-atr: rgba(183, 28, 28, 0.95);
  --ind-color-adr: rgba(251, 146, 60, 0.95);

  --radius-lg: 14px;
  --radius: 10px;
  --tabbar-h: 58px;
  --screen-bottom-safe: calc(
    var(--tabbar-h) + 8px + 12px + env(safe-area-inset-bottom, 0px)
  );
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background: var(--bg-page);
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}

:where(
  button,
  [role="button"],
  input,
  select,
  textarea
) {
  transition:
    box-shadow 0.15s ease,
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
}

:where(
  button,
  [role="button"],
  input,
  select,
  textarea
):focus {
  outline: none;
}

:where(
  button,
  [role="button"],
  input,
  select,
  textarea
):focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--control-focus-ring);
}

:where(
  .subtab,
  .search-clear-btn,
  .alert-card,
  .ticker-row,
  .btn-primary,
  .btn-secondary,
  .support-method-btn,
  .tabbar-btn
):not(:disabled):not([aria-disabled="true"]):active {
  box-shadow: inset 0 0 0 999px var(--control-active-overlay);
  transform: translateY(1px);
}

.app-root {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: var(--screen-bottom-safe);
  background: var(--bg-page);
}

.screen.is-hidden,
.screen[hidden] {
  display: none !important;
}

/* —— Алерты —— */
.screen-alerts {
  background: var(--bg-page);
}

.sheet {
  flex: 1;
  background: var(--bg-page);
  margin-top: 0;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 24px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.section-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 0px 12px 0px;
  box-shadow: var(--shadow);
}

.section-block + .section-block {
  margin-top: 12px;
}

.section-block--market {
  margin-top: 4px;
  border: none;
  padding-top: 0;
  padding-bottom: 0;
}

/* Список алертов: без рамки (не зависит от прямого ребёнка .sheet) */
#screen-alerts section.section-block {
  border: none;
}

.section-block--tight {
  padding: 14px;
}

/* Панель выбора индикаторов под графиком: без рамки */
.market-form-wrap.section-block {
  border: none;
}

.market-create-panel.section-block {
  border: none;
  padding-left: 0;
}

.market-create-block {
  margin-top: 10px;
}

.market-create-chart-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 10px 0;
  box-sizing: border-box;
}

.market-create-chart-indicators[hidden] {
  display: none !important;
}

.market-create-chart-indicators__empty {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-muted-soft);
  line-height: 1.35;
}

.market-create-backtest-wrap {
  margin-top: 10px;
}

.market-create-backtest-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

.market-create-backtest {
  margin: 8px 0 0;
  padding: 0;
  font-size: 0.84rem;
  font-style: italic;
  color: var(--text-muted-soft);
  line-height: 1.45;
  white-space: pre-line;
}

.market-create-backtest[hidden] {
  display: none !important;
}

.market-create-chart-indicators .market-legend-item {
  max-width: 100%;
}

.market-create-chart-indicators .market-legend-item__label {
  color: var(--text-market-legend-value);
  font-weight: 500;
}

/* Сегментированный переключатель (трек + белая плашка) */
.subtabs--segmented {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  padding: var(--segmented-track-pad);
  background: var(--surface-segmented-track);
  border-radius: 999px;
}

.subtabs--segmented .subtab {
  flex: 1;
  border: none;
  border-radius: 999px;
  min-height: var(--segmented-subtab-min-h);
  padding: 8px 10px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-segmented);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.subtabs--segmented .subtab:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.subtabs--segmented .subtab:disabled.is-active {
  opacity: 1;
  cursor: default;
}

.subtabs--segmented .subtab.is-active {
  background: var(--surface-ui-strong);
  color: var(--text-segmented-active);
  box-shadow: 0 1px 4px var(--shadow-card);
}

/* Группы индикаторов под графиком; отступы снизу задаёт .subtabs--segmented */
.market-ind-subtabs.subtabs--segmented {
  height: var(--market-row-control-h);
  min-height: var(--market-row-control-h);
  padding: var(--segmented-track-pad);
  align-items: stretch;
}

.market-ind-subtabs.subtabs--segmented .subtab {
  min-height: 0;
  padding: 0 8px;
  font-size: 0.82rem;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-wrap {
  position: relative;
  margin-bottom: 0;
}

.search-ic {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-search-icon);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 40px 10px 40px;
  border: none;
  border-radius: 999px;
  background: var(--surface-segmented-track);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--surface-search-clear);
  color: var(--text-search-clear);
  font-size: 0.95rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.search-clear-btn[hidden] {
  display: none;
}

.search-clear-btn:focus-visible {
  outline-offset: 1px;
}

.search-input:focus {
  background: var(--surface-search-input-focus);
}

input.search-input:is(:focus, :focus-visible) {
  outline: none;
  box-shadow: none;
  border: none;
}

.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.alert-card {
  background: var(--surface-raised);
  border: none;
  border-bottom: 1px solid var(--ticker-row-border-bottom);
  border-radius: 0;
  min-height: 80px;
  padding: 12px 0px 12px 0px;
  text-align: left;
  cursor: pointer;
  width: 100%;
  font: inherit;
  color: inherit;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

#alerts-list > button.alert-card:last-of-type {
  border-bottom: none;
}

.alert-card:active {
  background: var(--surface-raised);
}

.alert-card:focus-visible {
  outline-offset: -2px;
  box-shadow: 0 0 0 3px var(--control-focus-ring);
}

.alert-card-top {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.alert-card-top-main {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.alert-date {
  flex-shrink: 0;
  margin-left: auto;
  font-size: 0.82rem;
  line-height: 1.25;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.alert-ticker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.alert-ticker {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.alert-strategy-kind-ic,
.alert-kind-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}

.alert-strategy-kind-ic svg,
.alert-kind-ic svg {
  display: block;
}

.alert-pause-badge {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.16);
  color: #fbbf24;
  white-space: nowrap;
}

.alert-name {
  font-size: 0.88rem;
  color: var(--text-muted-soft);
  margin-top: 2px;
}

.alert-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.alert-meta strong {
  color: var(--text);
  font-weight: 600;
}

.alerts-empty {
  text-align: center;
  padding: 28px 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.alerts-empty.hidden {
  display: none;
}

.empty-ic {
  display: flex;
  justify-content: center;
  color: var(--text-empty-icon);
}

.empty-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(280px, 100%);
}

.empty-action-btn {
  width: 100%;
  margin-top: 0;
}

.screen-alert-card {
  padding-top: calc(env(safe-area-inset-top, 0px));
  padding-bottom: var(--screen-bottom-safe);
  background: var(--bg-page);
}

.alert-detail-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 12px 16px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.alert-detail-body {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 8px 14px;
  line-height: 1.35;
}

.alert-detail-body .detail-row {
  border-bottom: none;
  gap: 8px;
  padding: 3px 0;
}

.alert-detail-close-btn {
  margin-top: 10px;
}

.alert-detail-delete-btn {
  margin-top: 10px;
}

.alert-detail-chart-btn {
  margin-top: 10px;
}

/* —— Рынок —— */
.screen-market {
  padding: calc(12px + env(safe-area-inset-top, 0px)) 0 0;
  min-height: 0;
  flex: 1;
  background: var(--bg-page);
}

/* tabbar position: fixed — резервируем место снизу, иначе полезная высота = viewport − tabbar без padding */
.screen-market-card {
  width: 100%;
  min-height: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  transform: none;
  transition: none;
  overflow: hidden;
  padding-top: calc(env(safe-area-inset-top, 0px));
  padding-bottom: var(--screen-bottom-safe);
  background: var(--bg-page);
  box-sizing: border-box;
}

.market-inner {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  padding: 0 16px 75px;
}

.search-wrap--market {
  flex-shrink: 0;
}

.market-subtabs,
.market-ind-subtabs {
  flex-wrap: nowrap;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.market-subtabs {
  overflow-x: auto;
  touch-action: pan-x;
  margin-bottom: 12px;
}

/* Категории рынка: равная ширина колонок, без горизонтального скролла */
.market-subtabs.subtabs--segmented {
  width: 100%;
  overflow-x: hidden;
  touch-action: manipulation;
}

.market-subtabs.subtabs--segmented .subtab {
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--segmented-subtab-min-h);
  padding: 6px 4px;
  font-size: 0.74rem;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}

.market-ind-subtabs {
  width: 100%;
  overflow-x: hidden;
  touch-action: pan-x;
}

.market-subtabs::-webkit-scrollbar,
.market-ind-subtabs::-webkit-scrollbar {
  height: 4px;
}

.market-subtabs::-webkit-scrollbar-thumb,
.market-ind-subtabs::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

.market-subtabs .subtab {
  flex: 0 0 auto;
}

.market-ind-subtabs .subtab {
  flex: 1 1 0;
  min-width: 0;
}

.market-subtabs .subtab.is-locked,
.market-ind-subtabs .subtab.is-locked {
  opacity: 1;
  cursor: not-allowed;
}

.subtab.is-locked:focus-visible {
  outline: 2px solid var(--focus-subtab-locked-outline);
  outline-offset: -1px;
  box-shadow: 0 0 0 3px var(--focus-subtab-locked-glow);
}

.ticker-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 0 0 auto;
  align-self: stretch;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.ticker-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 0px 0px;
  min-height: 68px;
}

.ticker-row__icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--surface-avatar-placeholder);
}

.ticker-row__img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  flex-shrink: 0;
}

.ticker-row__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.ticker-row__name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

.ticker-row__ticker {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.ticker-row__quote {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  text-align: right;
}

.ticker-row__price {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ticker-row__pct {
  font-size: 0.86rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ticker-row__pct.is-up {
  color: var(--color-quote-up);
}

.ticker-row__pct.is-down {
  color: var(--color-quote-down);
}

button.ticker-row {
  border: none;
  border-bottom: 1px solid var(--ticker-row-border-bottom);
  width: 100%;
  cursor: pointer;
  background: var(--surface-raised);
  font: inherit;
  color: inherit;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}

#market-ticker-list > button.ticker-row:last-of-type,
#favorites-ticker-list > button.ticker-row:last-of-type {
  border-bottom: none;
}

button.ticker-row:focus-visible {
  outline-offset: -2px;
  box-shadow: 0 0 0 3px var(--control-focus-ring);
}

button.ticker-row.is-open {
  box-shadow: inset 0 0 0 2px var(--blue);
}

.market-sber-panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

/* Как .market-inner + отступы между «карточками» — как .section-block + .section-block */
.screen-market-card .market-sber-panel-scroll {
  padding: 0 16px 16px;
  gap: 0;
  box-sizing: border-box;
}

.screen-market-card .market-chart-head-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
}

.screen-market-card .market-chart-head-row .market-chart-header {
  flex: 1;
  min-width: 0;
  padding: 12px 0 8px;
}

.market-favorite-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  margin: 12px 0 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.market-favorite-btn:active {
  opacity: 0.85;
}

.market-favorite-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.market-favorite-btn.is-favorite {
  color: #ef4444;
}

.market-favorite-btn.is-favorite .market-favorite-btn__icon {
  fill: currentColor;
}

.market-favorite-btn__icon {
  display: block;
  pointer-events: none;
}

.screen-market-card .market-chart {
  margin: 0 0 12px;
  /* базовый min-height графика не нужен — высоту задаёт панель свечей (JS + #market-chart-main) */
  min-height: 0;
}

/* График в колонке с padding 16px — как шапка и кнопки под ним. */
.screen-market-card .market-sber-panel-scroll #market-chart {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  transition: none;
  max-height: none;
  min-width: 0;
  box-sizing: border-box;
}

/* На карточке инструмента не фиксируем aspect-ratio панели свечей — высоту выставляет JS */
.screen-market-card .market-chart.market-chart-stack .market-chart-pane--main {
  aspect-ratio: unset;
  flex: 0 0 auto;
  width: 100%;
  min-height: 0;
}

/* Свечи выравниваются по шкале времени без доп. margin (иначе пустота справа и сдвиг курсора). */
.screen-market-card #market-chart [class*="tv-lightweight"] table tr:first-child td:nth-child(2) > div {
  margin-left: 0;
}

/* Кнопка «Создать алерт» и группы индикаторов под графиком */
.market-ind-subtabs-wrap,
.market-create-alert-wrap {
  width: 100%;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

.screen-market-card .market-create-alert-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 16px;
}

.screen-favorites .favorites-create-alert-wrap {
  display: flex;
  align-items: stretch;
  margin-top: 12px;
}

.market-create-alert-wrap .market-open-create-action-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 37px;
  padding: 7px 18px;
}

.screen-market-card .market-sber-panel-scroll .market-form-wrap {
  overflow: visible;
  transition: none;
  max-height: none;
}

.screen-market-card .market-sber-panel-scroll.is-chart-ui-collapsed #market-chart {
  max-height: 0;
  min-height: 0 !important;
  height: 0 !important;
  opacity: 0;
  margin: 0 !important;
  margin-bottom: 0 !important;
  pointer-events: none;
}

.screen-market-card .market-sber-panel-scroll.is-chart-ui-collapsed .market-chart-head-row {
  gap: 0;
}

.screen-market-card .market-sber-panel-scroll.is-chart-ui-collapsed .market-ind-subtabs-wrap,
.screen-market-card .market-sber-panel-scroll.is-chart-ui-collapsed .market-create-alert-wrap {
  max-height: 0;
  opacity: 0;
  margin: 0 !important;
  pointer-events: none;
}

.screen-market-card .market-sber-panel-scroll.is-chart-ui-collapsed .market-form-wrap {
  max-height: 0;
  opacity: 0;
  margin: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  pointer-events: none;
}

.market-chart-header {
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.market-chart-header__icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--surface-avatar-placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
}

.market-chart-header__img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.market-chart-header__text {
  flex: 1;
  min-width: 0;
}

.market-chart-titles {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.market-chart-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--market-chart-name);
}

.market-chart-ticker {
  font-size: 0.86rem;
  color: var(--text-muted-soft);
}

.market-chart-quote {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35em;
}

.market-chart-timeframe {
  flex-shrink: 0;
}

.market-chart-quote__sep {
  flex-shrink: 0;
}

.market-chart-quote.is-empty .market-chart-quote__sep,
.market-chart-quote.is-empty .market-chart-timeframe {
  display: none;
}

.market-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--surface-market-legend-chip);
  color: var(--text-market-legend);
  font-size: 0.84rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.market-legend-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.market-legend-item__label {
  color: var(--text-muted-soft);
}

.market-legend-item__value {
  color: var(--text-market-legend-value);
  font-weight: 600;
}

.market-legend-item__dot--close {
  background: var(--chart-legend-close-dot);
}

.market-chart {
  /* Пропорции панели свечей 685×280 → 137:56; JS MARKET_MAIN_ASPECT_* должен совпадать */
  --market-chart-aspect-w: 137;
  --market-chart-aspect-h: 56;
  position: relative;
  width: 100%;
  height: auto;
  min-height: 240px;
  background: var(--bg-page);
  border-radius: 10px;
  overflow: hidden;
  border: none;
  margin: 0 0 24px;
}

.market-chart-cursor-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.market-chart-cursor-overlay[hidden] {
  display: none;
}

.market-chart-cursor-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--chart-cursor-line);
}

.market-chart-cursor-values {
  position: absolute;
  top: 8px;
  min-width: 170px;
  max-width: min(320px, calc(100% - 12px));
  padding: 8px 10px;
  border-radius: 10px;
  border: none;
  background: var(--chart-cursor-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.market-chart-cursor-date {
  font-size: 0.78rem;
  color: var(--chart-cursor-text-muted);
  line-height: 1.2;
  margin-bottom: 2px;
}

.market-chart-cursor-values .market-legend-item {
  background: transparent;
  padding: 1px 0;
  border-radius: 0;
  color: var(--chart-cursor-text);
  gap: 6px;
}

.market-chart-cursor-values .market-legend-item__label {
  color: var(--chart-cursor-text-muted);
}

.market-chart-cursor-values .market-legend-item__value {
  color: var(--chart-cursor-text);
  font-weight: 500;
}

/* Верх: свечи + шкала цены; низ: осцилляторы / объём и т.п. с автомасштабом */
.market-chart.market-chart-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-sizing: border-box;
}

/* Подграфики под свечами — высота блока свечей задаётся aspect-ratio у main; min-height добивает JS */
.market-chart.market-chart-stack.market-chart--has-osc {
  height: auto;
  min-height: 0;
}

.market-chart-pane {
  width: 100%;
  overflow: hidden;
  position: relative;
}

.market-chart-pane--main {
  flex: 1 1 auto;
  min-height: 140px;
}

/* Панель свечей: фиксированное соотношение сторон; ширина = колонка, высина из aspect-ratio */
.market-chart.market-chart-stack .market-chart-pane--main {
  flex: 0 0 auto;
  align-self: stretch;
  width: 100%;
  min-height: 0;
  aspect-ratio: var(--market-chart-aspect-w) / var(--market-chart-aspect-h);
}

/* Контейнер под несколько осцилляторных подграфиков */
.market-chart-pane--osc-stack {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.market-chart-pane--osc-stack[hidden] {
  display: none !important;
}

.market-chart-pane--osc-item {
  flex: 0 0 auto;
  width: 100%;
  min-height: 48px;
  overflow: hidden;
  position: relative;
}

.market-chart canvas {
  pointer-events: none;
}

.market-chart__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 220px;
  height: 100%;
  width: 100%;
  background: var(--bg-page);
  color: var(--text-chart-loading);
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  text-align: center;
  padding: 16px;
}

.market-form-wrap {
  padding: 0 4px;
  background: var(--surface);
  color: var(--text);
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  align-self: stretch;
}

.market-indicator-panels {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.market-indicator-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

/* Author `display:flex` overrides UA `[hidden]`; force-hide inactive indicator groups */
.market-indicator-panel[hidden] {
  display: none !important;
}

.market-futures-hint {
  margin: 0 0 8px;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--text-muted, rgba(255, 255, 255, 0.55));
}

.market-futures-status {
  margin: 0 0 8px;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text-muted, rgba(255, 255, 255, 0.55));
}

.market-futures-status--error {
  color: var(--danger, #f87171);
}

.market-futures-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.market-futures-list .market-ind-btn {
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
}

/* Группы индикаторов: без внутреннего скролла — все ряды видны, при необходимости скроллит вся колонка .market-sber-panel-scroll */
.screen-market-card .market-form-wrap .market-indicator-panels > .market-indicator-panel {
  max-height: none;
  overflow: visible;
}

.market-ind-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 0;
  box-sizing: content-box;
  height: 35px;
}

.market-ind-row .market-ind-btn {
  flex: 0 0 5.75rem;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-ind-btn {
  position: relative;
  border: 1px solid var(--border-market-ind);
  background: var(--surface-market-ind);
  color: var(--text-market-ind);
  border-radius: 10px;
  min-height: 35px;
  padding: 7px 10px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-align: left;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.1s ease;
}

.market-ind-btn.is-active {
  border-color: var(--border-market-ind-active);
  background: var(--surface-market-ind-active);
  color: var(--text-market-ind-active);
  box-shadow: inset 0 1px 0 var(--highlight-inset-soft);
}

.market-ind-btn.is-active:focus-visible {
  outline: 2px solid var(--focus-market-ind-outline);
  outline-offset: 2px;
}

.market-ind-btn:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.market-ind-row .market-ind-slider {
  flex: 1;
  min-width: 0;
  width: auto;
}

.market-ind-row .market-ind-param-value {
  flex-shrink: 0;
  min-width: 2.25rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.market-ind-slider {
  width: 100%;
}

.market-ind-slider:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.market-ind-row .market-ind-select {
  flex: 0 0 auto;
  max-width: 5.75rem;
  min-height: 35px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-market-select);
  background: var(--surface-market-ind);
  color: var(--text-market-ind);
  font-size: 0.82rem;
  font-weight: 600;
}

.market-ind-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.market-ind-row .market-ind-help {
  flex: 0 0 18px;
  align-self: center;
  margin-left: -4px;
  margin-right: 2px;
}

.market-ind-help {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--border-market-ind);
  border-radius: 50%;
  background: var(--surface-market-ind);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.market-ind-help:focus-visible {
  outline: 2px solid var(--focus-market-ind-outline);
  outline-offset: 1px;
}

.market-ind-help-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

.market-ind-help-overlay[hidden] {
  display: none !important;
}

body.market-ind-help-open {
  overflow: hidden;
}

.market-ind-help-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  margin: 0;
  padding: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.market-ind-help-sheet {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(70vh, 420px);
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 16px 16px 18px;
  box-shadow: var(--shadow);
}

.market-ind-help-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.market-ind-help-title {
  margin: 0 36px 12px 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.market-ind-help-block {
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.market-ind-help-block:last-child {
  margin-bottom: 0;
}

.market-ind-help-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.market-ind-help-text {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
}

.input-round {
  border: 1px solid var(--border);
  border-radius: 9px;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 0.9rem;
  background: var(--surface-input-round);
  color: var(--text);
}

/* —— Стратегии —— */
.screen-strategies {
  padding: calc(20px + env(safe-area-inset-top, 0px)) 16px var(--screen-bottom-safe);
  background: var(--bg-page);
}

.strategies-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.strategies-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.strategies-intro {
  margin: 0;
}

/* —— Профиль —— */
.screen-profile {
  padding: calc(20px + env(safe-area-inset-top, 0px)) 16px
    var(--screen-bottom-safe);
  background: var(--bg-page);
}

.profile-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-card {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--surface-profile-avatar);
  color: var(--text-profile-avatar);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.profile-avatar__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-avatar__fallback {
  opacity: 0.9;
}

.profile-user-meta {
  min-width: 0;
  flex: 1;
}

.user-line {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
}

.user-handle {
  margin: 2px 0 0;
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.warn-line {
  margin: -2px 2px 0;
  font-size: 0.88rem;
  color: var(--text-warning);
  line-height: 1.4;
}

.plan-badge {
  display: inline-flex;
  margin-top: 0;
  margin-left: auto;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--surface-plan-badge);
  color: var(--text-plan-badge);
  white-space: nowrap;
}

.profile-section {
  padding: 14px;
}

#screen-profile section.profile-section.section-block,
#screen-profile article.profile-section.section-block {
  border: none;
  box-shadow: none;
}

.profile-section-title {
  margin: 0 0 8px 2px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.profile-plan-subtabs {
  margin-bottom: 12px;
}

.profile-stack > .profile-plan-subtabs {
  margin-bottom: 0;
}

.profile-muted {
  margin: 0 0 10px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.plan-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-plan-card);
}

.profile-stack > article.plan-card {
  padding: 12px;
  margin: 0;
}

.plan-card.is-current {
  box-shadow: none;
}

#screen-profile .profile-stack > article.plan-card {
  border: none;
  box-shadow: none;
}

.plan-card__list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text);
}

.plan-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.35;
}

.plan-feature-item > span {
  min-width: 0;
}

.plan-feature-mark {
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-muted-soft);
  opacity: 0.75;
}

.plan-upgrade-btn {
  margin-top: 10px;
}

.plan-upgrade-btn[disabled],
.plan-upgrade-btn[aria-disabled="true"] {
  opacity: 1;
  cursor: not-allowed;
  background: var(--surface-ui-strong);
  color: var(--text-btn-disabled);
}

.support-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.support-method-btn {
  min-height: 42px;
  padding: 10px 12px;
  background: var(--surface-ui-strong);
  color: var(--text-btn-disabled);
}

.profile-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -2px 2px 0;
  color: var(--link-accent);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.profile-link__icon {
  flex-shrink: 0;
}

.profile-link:hover {
  text-decoration: underline;
}

/* —— Tabbar —— */
.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  width: min(420px, calc(100% - 24px));
  min-height: var(--tabbar-h);
  padding: 0;
  background: var(--surface-tabbar);
  border: 1px solid transparent;
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px var(--shadow-tabbar);
  z-index: 150;
  overflow: hidden;
}

.tabbar-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--text-tabbar);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 4px 10px;
}

.tabbar-btn.is-active {
  background: var(--surface-tabbar-item-active);
  color: var(--text-tabbar-active);
  border-radius: 999px;
}

.tabbar-ic {
  display: flex;
}

.form-row {
  margin-bottom: 14px;
}

.form-row > label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-row.form-row--condition {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-market-legend-chip);
}

.form-row.form-row--condition .form-row--condition__row--pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 168px);
  column-gap: 10px;
}

.form-row.form-row--condition .form-row--condition__row--value {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-row.form-row--condition .form-row--condition__cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-row.form-row--condition .form-row--condition__label {
  display: block;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1.2;
  color: var(--text-muted);
  white-space: nowrap;
}

.form-row.form-row--condition .form-row--condition__select,
.form-row.form-row--condition .form-row--condition__value-select,
.form-row.form-row--condition .form-row--condition__value-input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 0;
  min-height: 40px;
}

.form-row.form-row--condition .form-row--condition__value {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
  min-width: 0;
}

.form-row.form-row--condition .form-row--condition__value-input:read-only {
  color: var(--text-muted);
  cursor: default;
  background: var(--surface-input-readonly);
}

.form-msg {
  min-height: 1.2em;
  font-size: 0.9rem;
  margin: 8px 0 0;
  color: var(--text-form-success);
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.form-actions__end {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.form-actions__conditions {
  display: flex;
  gap: 8px;
}

.btn-condition-step {
  font-size: 1.05rem;
  line-height: 1;
  padding: 8px 14px;
  min-width: 42px;
}

.btn-condition-step:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary,
.btn-secondary {
  border: none;
  border-radius: 9px;
  min-height: 42px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-secondary {
  background: var(--surface-btn-secondary);
  color: var(--text);
}

.btn-primary {
  background: var(--blue);
  color: var(--text-on-accent);
}

.btn-primary:active {
  background: var(--blue-pressed);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
  margin-top: 16px;
}

.detail-body {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 8px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-k {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.form-condition-and {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 4px 0 8px;
}

.alert-conditions-list .alert-condition-block + .alert-condition-block,
.alert-conditions-list .form-condition-and + .alert-condition-block {
  margin-top: 4px;
}

.browser-login-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
}

.browser-login-gate[hidden] {
  display: none !important;
}

.browser-login-card {
  width: min(100%, 360px);
  padding: 28px 24px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  text-align: center;
}

.browser-login-title {
  margin: 0 0 12px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

.browser-login-text,
.browser-login-hint {
  margin: 0 0 16px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.browser-login-hint {
  margin-bottom: 0;
  font-size: 0.82rem;
}

.browser-login-err {
  margin: 0 0 12px;
  font-size: 0.88rem;
  color: var(--color-quote-down);
}

.btn-browser-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-bottom: 16px;
  padding: 10px 16px;
  border: none;
  border-radius: 12px;
  background: var(--blue);
  color: var(--text-on-accent);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-browser-login:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn-browser-login:not(:disabled):active {
  background: var(--blue-pressed);
}
