/* =========================================================
   SETTINGS V1
   Settings shell + Connections provider cards/panels.
   Builds on connector-workspace-v2.css; DayOps default,
   NightOps overrides at the bottom.
   ========================================================= */

.settings-page {
  display: grid;
  gap: 20px;
}

.settings-connections {
  gap: 24px;
}

.settings-page__header h1 {
  margin: 2px 0 0;
  color: #121722;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 880;
}

.settings-page__eyebrow {
  margin: 0;
  font-family: "IBM Plex Mono", "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

/* Section tabs */
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(31, 41, 55, 0.10);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
}

.settings-tabs__item {
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(43, 52, 67, 0.72);
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

.settings-tabs__item:hover {
  color: #121722;
}

.settings-tabs__item--active {
  background: #fff;
  color: #1d7a4b;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* Provider cards: three equal first-class integrations */
.settings-provider-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.settings-provider-card {
  text-align: left;
  font: inherit;
  cursor: pointer;
  align-content: start;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.settings-provider-card:hover {
  border-color: rgba(45, 126, 87, 0.35);
}

.settings-provider-card:focus-visible {
  outline: 2px solid #2d7e57;
  outline-offset: 2px;
}

.settings-provider-card--selected {
  border-color: #2d7e57;
  box-shadow:
    0 0 0 1px #2d7e57,
    0 12px 28px rgba(45, 126, 87, 0.12);
}

.settings-provider-card__action {
  margin-top: 4px;
  color: #1d7a4b;
  font-size: 13px;
  font-weight: 800;
}

/* Status pills */
.settings-pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: "IBM Plex Mono", "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.settings-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.settings-pill--ok {
  background: rgba(47, 158, 99, 0.12);
  color: #1d7a4b;
}

.settings-pill--warn {
  background: rgba(196, 128, 32, 0.14);
  color: #8a5a12;
}

.settings-pill--idle {
  background: rgba(43, 52, 67, 0.07);
  color: rgba(43, 52, 67, 0.62);
}

/* Provider panel */
.settings-provider-panel__body {
  display: grid;
  gap: 24px;
}

.settings-provider-flow {
  display: grid;
  gap: 22px;
}

.settings-preview-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  padding: 10px 14px;
  border: 1px dashed rgba(138, 90, 18, 0.45);
  border-radius: 12px;
  background: rgba(196, 128, 32, 0.07);
  color: rgba(43, 52, 67, 0.82);
  font-size: 13px;
  font-weight: 640;
}

.settings-preview-banner strong {
  font-family: "IBM Plex Mono", "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8a5a12;
}

.settings-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.settings-steps__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 12px;
  color: rgba(43, 52, 67, 0.56);
  font-size: 13px;
  font-weight: 700;
}

.settings-steps__item span {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 11px;
  font-weight: 800;
}

.settings-steps__item--current {
  border-color: #2d7e57;
  color: #121722;
}

.settings-steps__item--current span {
  border-color: #2d7e57;
  background: #2d7e57;
  color: #fff;
}

.settings-steps__item--done {
  color: #1d7a4b;
}

.settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 24px;
  max-width: 760px;
}

.settings-field {
  display: grid;
  gap: 8px;
  align-content: start;
}

.settings-field__label {
  color: #121722;
  font-size: 13px;
  font-weight: 800;
}

.settings-field__input {
  height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(31, 41, 55, 0.16);
  border-radius: 10px;
  background: #fff;
  color: #121722;
  font: inherit;
  font-size: 14px;
}

.settings-field__input:focus {
  outline: none;
  border-color: #2d7e57;
  box-shadow: 0 0 0 3px rgba(45, 126, 87, 0.16);
}

.settings-field__value {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  overflow-wrap: anywhere;
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 10px;
  background: rgba(43, 52, 67, 0.04);
  color: rgba(43, 52, 67, 0.82);
  font-family: "IBM Plex Mono", "JetBrains Mono", monospace;
  font-size: 13px;
}

.settings-field__hint,
.settings-footnote {
  margin: 0;
  color: rgba(43, 52, 67, 0.6);
  font-size: 12px;
  font-weight: 560;
  line-height: 1.4;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
}

.settings-actions .ui-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.settings-link-button {
  border: 0;
  background: transparent;
  color: rgba(43, 52, 67, 0.66);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.settings-feedback {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}

.settings-feedback--error {
  border: 1px solid rgba(143, 63, 45, 0.25);
  background: rgba(143, 63, 45, 0.07);
  color: #8f3f2d;
}

.settings-feedback--preview {
  border: 1px dashed rgba(138, 90, 18, 0.45);
  background: rgba(196, 128, 32, 0.07);
  color: #6f4a10;
}

.settings-subsection {
  display: grid;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid rgba(31, 41, 55, 0.08);
}

.settings-connection-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 14px;
}

.settings-connection-row strong,
.settings-connection-row em {
  display: block;
}

.settings-connection-row em {
  color: rgba(43, 52, 67, 0.6);
  font-size: 12px;
  font-style: normal;
}

.settings-legacy {
  border-top: 1px solid rgba(31, 41, 55, 0.08);
  padding-top: 16px;
}

.settings-disclosure summary {
  cursor: pointer;
  width: fit-content;
  color: #1d7a4b;
  font-size: 13px;
  font-weight: 760;
}

.settings-disclosure p {
  margin: 8px 0 0;
  color: rgba(43, 52, 67, 0.7);
  font-size: 13px;
  line-height: 1.5;
}

.settings-code {
  margin: 8px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(43, 52, 67, 0.05);
  font-family: "IBM Plex Mono", "JetBrains Mono", monospace;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.settings-disclosure + .settings-disclosure {
  margin-top: -12px;
}

.settings-legacy summary {
  cursor: pointer;
  color: rgba(43, 52, 67, 0.7);
  font-size: 13px;
  font-weight: 760;
}

.settings-legacy[open] summary {
  margin-bottom: 12px;
}

@media (max-width: 900px) {
  .settings-provider-grid,
  .settings-form,
  .settings-steps {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-connection-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* NightOps parity */
body[data-theme="night"] .settings-page__header h1,
body[data-theme="night"] .settings-field__label,
body[data-theme="night"] .settings-tabs__item:hover {
  color: rgba(238, 247, 240, 0.95);
}

body[data-theme="night"] .settings-tabs {
  border-color: rgba(122, 171, 145, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

body[data-theme="night"] .settings-tabs__item {
  color: rgba(212, 229, 218, 0.68);
}

body[data-theme="night"] .settings-tabs__item--active {
  background: rgba(92, 255, 157, 0.10);
  color: #5cff9d;
  box-shadow: none;
}

body[data-theme="night"] .settings-provider-card:hover {
  border-color: rgba(92, 255, 157, 0.28);
}

body[data-theme="night"] .settings-provider-card--selected {
  border-color: rgba(92, 255, 157, 0.55);
  box-shadow: 0 0 0 1px rgba(92, 255, 157, 0.45);
}

body[data-theme="night"] .settings-provider-card:focus-visible {
  outline-color: #5cff9d;
}

body[data-theme="night"] .settings-provider-card__action,
body[data-theme="night"] .settings-disclosure summary,
body[data-theme="night"] .settings-steps__item--done {
  color: #5cff9d;
}

body[data-theme="night"] .settings-pill--ok {
  background: rgba(92, 255, 157, 0.12);
  color: #5cff9d;
}

body[data-theme="night"] .settings-pill--warn {
  background: rgba(240, 180, 90, 0.14);
  color: #f0b45a;
}

body[data-theme="night"] .settings-pill--idle {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(212, 229, 218, 0.62);
}

body[data-theme="night"] .settings-preview-banner,
body[data-theme="night"] .settings-feedback--preview {
  border-color: rgba(240, 180, 90, 0.4);
  background: rgba(240, 180, 90, 0.07);
  color: rgba(246, 226, 196, 0.9);
}

body[data-theme="night"] .settings-preview-banner strong {
  color: #f0b45a;
}

body[data-theme="night"] .settings-steps__item,
body[data-theme="night"] .settings-connection-row,
body[data-theme="night"] .settings-subsection,
body[data-theme="night"] .settings-legacy {
  border-color: rgba(122, 171, 145, 0.14);
  color: rgba(212, 229, 218, 0.56);
}

body[data-theme="night"] .settings-steps__item--current {
  border-color: rgba(92, 255, 157, 0.55);
  color: rgba(238, 247, 240, 0.95);
}

body[data-theme="night"] .settings-steps__item--current span {
  border-color: #5cff9d;
  background: #5cff9d;
  color: #071311;
}

body[data-theme="night"] .settings-field__input {
  border-color: rgba(122, 171, 145, 0.22);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(238, 247, 240, 0.95);
}

body[data-theme="night"] .settings-field__input:focus {
  border-color: #5cff9d;
  box-shadow: 0 0 0 3px rgba(92, 255, 157, 0.14);
}

body[data-theme="night"] .settings-field__value,
body[data-theme="night"] .settings-code {
  border-color: rgba(122, 171, 145, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(212, 229, 218, 0.82);
}

body[data-theme="night"] .settings-field__hint,
body[data-theme="night"] .settings-disclosure p,
body[data-theme="night"] .settings-footnote,
body[data-theme="night"] .settings-connection-row em,
body[data-theme="night"] .settings-link-button,
body[data-theme="night"] .settings-legacy summary {
  color: rgba(212, 229, 218, 0.6);
}

body[data-theme="night"] .settings-connection-row strong {
  color: rgba(238, 247, 240, 0.95);
}

body[data-theme="night"] .settings-feedback--error {
  border-color: rgba(255, 140, 120, 0.3);
  background: rgba(255, 140, 120, 0.07);
  color: #ffb4a6;
}

/* Inventory uses display:grid; preserve the HTML hidden contract. */
.connector-v2-inventory[hidden] { display: none !important; }
