/* Ещё → Работа с РД. Стили изолированы от остальных разделов CashControl. */
.rd-module {
  min-width: 0;
  padding-bottom: 28px;
}

/* Общие .primary/.secondary имеют width: 100%: отменяем только внутри РД. */
.rd-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}
.rd-module .rd-tabs > button {
  width: auto;
  min-width: 0;
  flex: 1 1 112px;
  padding: 11px 12px;
  white-space: normal;
}

.rd-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.rd-metric {
  font-weight: 700;
  font-size: 22px;
  margin: 8px 0;
  overflow-wrap: break-word;
}

.rd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
  margin: 10px 0;
}
.rd-module .rd-actions > button,
.rd-dialog .rd-actions > button {
  width: auto;
  min-width: 0;
  max-width: 100%;
  flex: 1 1 140px;
}
.rd-module .rd-actions > input:not([type="file"]),
.rd-module .rd-actions > select,
.rd-dialog .rd-actions > input:not([type="file"]) {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  flex: 1 1 190px;
  padding: 10px 12px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.rd-module .rd-actions > input[type="file"] {
  min-width: 0;
  max-width: 100%;
  flex: 1 1 220px;
}
/* «Удалить прайс» — отдельная заметная кнопка, не растягиваем на всю строку. */
.rd-module .rd-actions > #rdDeletePrice {
  flex: 0 1 auto;
  padding-left: 22px;
  padding-right: 22px;
}

/* Строка товара/истории: название использует свободное место,
   а кнопки больше не выталкивают текст в столбец по одной букве. */
.rd-product {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color, rgba(130,145,160,.3));
}
.rd-product-name {
  flex: 1 1 220px;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.45;
}
.rd-module .rd-product > button {
  width: auto;
  min-width: 0;
  max-width: 100%;
  flex: 0 0 auto;
  padding: 10px 12px;
  white-space: normal;
}
.rd-module .rd-product > button[data-rd-unlink],
.rd-module .rd-product > button[data-rd-remove] {
  width: 44px;
  min-width: 44px;
  flex: 0 0 44px;
  padding: 10px;
}
.rd-line {
  padding: 10px 0;
  min-width: 0;
  overflow-wrap: break-word;
  border-bottom: 1px solid rgba(125,138,153,.2);
}

.rd-overlay {
  position: fixed;
  inset: 0;
  z-index: 11000;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.rd-dialog {
  width: min(720px, 100%);
  min-width: 0;
  max-height: 88vh;
  overflow: auto;
}
.rd-selected-local {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-color, rgba(130,145,160,.3));
  border-radius: 12px;
  background: var(--surface-2, rgba(130,145,160,.08));
  overflow-wrap: anywhere;
}
.rd-selected-local strong { line-height: 1.45; }

.rd-remote {
  display: flex;
  flex-direction: column;
  text-align: left;
  width: 100%;
  gap: 5px;
  padding: 12px;
  background: transparent;
  border: 1px solid rgba(150,160,170,.3);
  border-radius: 10px;
  color: inherit;
  margin: 7px 0;
  white-space: normal;
  overflow-wrap: break-word;
  cursor: pointer;
}
.rd-person {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(150,160,170,.25);
}
.rd-person .meta { margin-left: auto; }

/* Телефон: сначала читаем название/дату, затем видим кнопки действий. */
@media (max-width: 640px) {
  .rd-product-name {
    flex: 1 1 100%;
    width: 100%;
  }
  .rd-module .rd-product > button[data-rd-bind],
  .rd-module .rd-product > button[data-rd-history],
  .rd-module .rd-product > button[data-rd-delete-snapshot] {
    flex: 1 1 120px;
  }
}

/* Настройка времени автоматических заданий, доступная только в обычной форме РД. */
.rd-schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
  margin: 12px 0;
}
.rd-schedule-item {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-weight: 600;
  min-width: 0;
}
.rd-schedule-item input[type="time"] {
  width: 100%;
  min-width: 0;
  color: var(--text);
  color-scheme: inherit;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 44px;
}
.rd-schedule-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  margin: 12px 0;
}
.rd-schedule-toggles label { display: inline-flex; align-items: center; gap: 8px; }
.rd-schedule-toggles input { width: 18px; height: 18px; accent-color: var(--accent, #1596b3); }
.rd-schedule-summary { display: grid; gap: 8px; margin: 12px 0; }
.rd-module #rdScheduleForm > button[type="submit"] { width: auto; max-width: 100%; }

/* RD category selection: readable in both standard tones and seasonal themes. */
.rd-categories-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:10px;margin:14px 0}
.rd-category-option{display:flex;align-items:center;gap:10px;min-width:0;padding:11px 13px;border:1px solid var(--border, #64748b);border-radius:12px;background:var(--card, transparent);cursor:pointer}
.rd-category-option input{width:18px;height:18px;flex:0 0 18px;accent-color:var(--primary, #087e8b)}
.rd-category-option span{min-width:0;overflow-wrap:anywhere}
.rd-category-summary{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}
.rd-category-tag{border:1px solid var(--border, #64748b);border-radius:99px;padding:6px 11px}

/* Добавление категории из панели РД; темы используют существующие переменные. */
.rd-add-category{border-top:1px solid var(--border, #64748b);padding-top:15px;margin-top:14px;display:flex;flex-direction:column;gap:10px}
.rd-add-category-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:12px}
.rd-add-category-fields label{display:flex;flex-direction:column;gap:6px;min-width:0}
.rd-add-category-fields input{width:100%;min-width:0;border:1px solid var(--border);border-radius:10px;background:var(--surface-2);color:var(--text);padding:10px;box-sizing:border-box}
.rd-add-category button{align-self:flex-start}
