/* Rapira keeps the exact visual system of broker-walk-bot.ru.
   This file contains only exchange-specific layout additions. */

[hidden] {
  display: none !important;
}

.rapira-header-icon {
  display: grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #66758d;
  padding: 0;
  box-shadow: none;
}

.rapira-header-icon:hover,
.rapira-header-icon:focus-visible {
  background: #eef6ff;
  color: #155eef;
  outline: none;
}

.rapira-header-icon:disabled {
  cursor: default;
  opacity: 0.45;
}

.rapira-mode-status {
  flex-basis: 170px;
  min-width: 170px;
  max-width: 190px;
}

.rapira-mode-status #modeBadge[data-mode="live"] {
  color: #067647;
}

.rapira-mode-status #modeBadge[data-mode="preview"] {
  color: #b54708;
}

.rapira-bot-hint {
  color: #66758d;
  font-size: 12px;
  white-space: nowrap;
}

.own-ad-card .filter-button {
  min-width: 32px;
  padding: 0 8px;
}

.own-ad-card .filter-button.is-active {
  border-color: #9dbcf7;
  background: #eaf1ff;
  color: #155eef;
}

.own-ad-card .listing-action-button {
  min-width: 78px;
  font-weight: 500;
}

.own-ad-card .listing-action-button.is-remove {
  color: #b42318;
}

.rapira-telemetry {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.rapira-telemetry strong {
  color: #344054;
  font-size: 12px;
  font-weight: 600;
  white-space: normal;
}

.rapira-telemetry span {
  overflow: hidden;
  color: #66758d;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rapira-decision-error strong {
  color: #b42318;
}

.rapira-decision-change strong {
  color: #155eef;
}

.rapira-book-summary {
  flex-wrap: wrap;
}

.rapira-book-summary .mode-pill {
  max-width: none;
}

.orderbookPanel .ad-row.competitor {
  background: #eef6ff;
  box-shadow: inset 3px 0 0 #155eef;
}

.orderbookPanel .ad-row.own-orderbook-ad {
  background: #fffaf0;
}

.orderbookPanel .merchant-tags:empty {
  display: none;
}

.rapira-dialog {
  width: min(620px, calc(100vw - 32px));
  max-width: none;
  max-height: min(880px, calc(100vh - 32px));
  max-height: min(880px, calc(100dvh - 32px));
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: #ffffff;
  color: #111820;
  padding: 0;
  box-shadow: 0 20px 64px rgba(22, 28, 36, 0.2);
}

.rapira-dialog-wide {
  width: min(920px, calc(100vw - 32px));
}

.rapira-dialog::backdrop {
  background: rgba(23, 27, 33, 0.58);
  backdrop-filter: blur(1px);
}

.rapira-dialog-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  max-height: inherit;
  margin: 0;
}

.rapira-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-height: 70px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #eaecf0;
  background: #ffffff;
}

.rapira-dialog-header h2 {
  margin-top: 4px;
  color: #111820;
  font-size: 20px;
  font-weight: 600;
}

.rapira-dialog-eyebrow {
  color: #667085;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rapira-close {
  display: grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: #667085;
  padding: 0;
  font-size: 24px;
  font-weight: 400;
  box-shadow: none;
}

.rapira-close:hover,
.rapira-close:focus-visible {
  background: #f2f4f7;
  color: #111820;
  outline: none;
}

.rapira-dialog-body {
  display: grid;
  gap: 16px;
  overflow: auto;
  padding: 20px 22px;
}

.rapira-dialog-body > label,
.rapira-form-grid label,
.rapira-fieldset label {
  display: grid;
  gap: 7px;
  color: #52627a;
  font-size: 13px;
  font-weight: 500;
}

.rapira-dialog-body input,
.rapira-dialog-body textarea,
.rapira-dialog-body select {
  width: 100%;
  min-height: 42px;
  border-color: #d5deec;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 14px;
  outline: none;
}

.rapira-dialog-body input:focus,
.rapira-dialog-body textarea:focus,
.rapira-dialog-body select:focus {
  border-color: #b8cdf8;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.1);
}

.rapira-dialog-copy {
  color: #66758d;
  line-height: 1.5;
}

.rapira-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.rapira-switch-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  border: 1px solid #e4e9f1;
  border-radius: 8px;
  background: #f8fbff;
  padding: 11px 13px;
}

.rapira-switch-row > span:first-child {
  display: grid;
  gap: 4px;
}

.rapira-switch-row strong {
  color: #18212f;
  font-size: 13px;
}

.rapira-switch-row small {
  color: #66758d;
  font-size: 12px;
  line-height: 1.35;
}

.rapira-switch-emphasized {
  border-color: #cfe0ff;
  background: #eef6ff;
}

.rapira-fieldset {
  min-width: 0;
  margin: 0;
  border: 1px solid #e4e9f1;
  border-radius: 8px;
  padding: 13px;
}

.rapira-fieldset legend {
  color: #344054;
  padding: 0 6px;
  font-size: 13px;
  font-weight: 600;
}

.rapira-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.rapira-choice-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 38px;
  border: 1px solid #e4e9f1;
  border-radius: 8px;
  background: #ffffff;
  padding: 7px 9px;
  cursor: pointer;
}

.rapira-choice-grid input[type="checkbox"] {
  width: 15px;
  min-width: 15px;
  min-height: 15px;
  margin: 0;
  padding: 0;
  accent-color: #155eef;
}

.rapira-choice-grid span {
  overflow: hidden;
  color: #344054;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rapira-choice-tall {
  max-height: 220px;
  overflow: auto;
}

.rapira-form-error {
  margin: 0;
  border: 1px solid rgba(240, 68, 56, 0.18);
  border-radius: 9px;
  background: rgba(240, 68, 56, 0.08);
  color: #b42318;
  padding: 9px 10px;
  font-size: 13px;
}

.rapira-safety-note {
  border-left: 3px solid #f79009;
  background: #fffaf0;
  color: #7a3b00;
  padding: 10px 12px;
  line-height: 1.45;
}

.rapira-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  min-height: 66px;
  padding: 12px 22px;
  border-top: 1px solid #eaecf0;
  background: #ffffff;
}

.rapira-dialog-actions button {
  min-height: 38px;
  font-weight: 600;
}

.rapira-dialog-actions .rapira-danger {
  margin-right: auto;
  border-color: #f7b5af;
  background: #fff0ef;
  color: #b42318;
}

.rapira-toast {
  position: fixed;
  z-index: 1200;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 32px));
  border: 1px solid #b7e3cf;
  border-radius: 10px;
  background: #ecfdf3;
  color: #067647;
  padding: 12px 14px;
  box-shadow: 0 16px 36px rgba(24, 33, 47, 0.15);
  font-size: 13px;
}

.rapira-toast.error {
  border-color: #f7b5af;
  background: #fff0ef;
  color: #b42318;
}

@media (max-width: 900px) {
  .rapira-mode-status {
    min-width: 190px;
    max-width: 230px;
  }

  .rapira-form-grid,
  .rapira-choice-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .rapira-dialog,
  .rapira-dialog-wide {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .rapira-dialog-header,
  .rapira-dialog-body,
  .rapira-dialog-actions {
    padding-right: 14px;
    padding-left: 14px;
  }

  .settingsActions {
    width: 100%;
    justify-content: space-between;
  }
}
