.settings-page-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  height: 100%;
  padding: 0;
  overflow: hidden;
}

.settings-page-shell {
  --settings-control-height: 44px;
  --settings-control-radius: 16px;
  --settings-card-radius: 24px;
  --settings-control-padding-x: 14px;
  --settings-control-border: rgba(167, 183, 224, 0.88);
  --settings-control-border-strong: rgba(129, 150, 205, 0.92);
  --settings-control-background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 248, 255, 0.92) 100%);
  --settings-focus-outline: rgba(59, 130, 246, 0.16);
  --settings-focus-shadow: 0 0 0 4px rgba(96, 165, 250, 0.14);
  --settings-secondary-shadow: 0 10px 22px rgba(35, 52, 82, 0.08);
}

.settings-console-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.settings-tabs-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.settings-tabs-toolbar {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-tabs-row {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.settings-tabs-row::-webkit-scrollbar {
  display: none;
}

.settings-tabs {
  width: max-content;
  max-width: none;
}

.settings-config-source-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: var(--settings-control-height);
  padding: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(229, 239, 235, 0.94), rgba(216, 231, 224, 0.9));
  box-shadow: inset 0 0 0 1px rgba(170, 191, 182, 0.18);
}

.settings-config-source-option {
  min-width: 94px;
  min-height: calc(var(--settings-control-height) - 8px);
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #557062;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: none;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.settings-config-source-option.active {
  background: #ffffff;
  color: #176046;
  box-shadow: 0 8px 18px rgba(36, 84, 64, 0.12), inset 0 0 0 1px rgba(168, 189, 179, 0.22);
}

.settings-panel-basic-config {
  grid-area: basic-config;
}

.settings-panel-connection {
  grid-area: connection;
}

.settings-panel-diagnostics {
  grid-area: diagnostics;
}

.settings-panel-xhs-feishu {
  grid-area: xhs-feishu;
}

.settings-panel-xhs-feishu .settings-section-card-compact {
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 7px;
  padding: 8px;
}

.settings-panel-xhs-feishu .settings-section-kicker {
  min-height: 22px;
  padding-inline: 9px;
}

.settings-panel-models {
  grid-area: models;
}

.settings-runtime-hint {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 16px;
  border: 1px solid rgba(173, 192, 245, 0.75);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(245, 248, 255, 0.72));
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 28px rgba(109, 124, 255, 0.08);
}

.settings-panel {
  flex: 1 1 auto;
  min-height: 0;
  padding: 8px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(157, 180, 255, 0.45);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.5));
  box-shadow: 0 10px 22px rgba(109, 124, 255, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
}

.settings-panel-body {
  min-height: 0;
  height: 100%;
  padding: 0;
}

.settings-panel-modern {
  background:
    radial-gradient(circle at top right, rgba(94, 203, 255, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(248, 250, 255, 0.62));
}

.settings-panel-secondary {
  background:
    radial-gradient(circle at top left, rgba(139, 125, 255, 0.18), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(248, 246, 255, 0.66));
}

.settings-panel-models {
  background:
    radial-gradient(circle at top center, rgba(109, 124, 255, 0.18), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 249, 255, 0.66));
}

.settings-section-card {
  display: grid;
  min-height: 0;
  height: 100%;
  gap: 10px;
  padding: 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.settings-section-card-compact {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.settings-section-card-compact-body-actions {
  grid-template-rows: minmax(0, 1fr) auto;
}

.settings-section-card-models {
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.settings-tabs-layout .settings-section-card-models {
  grid-template-rows: minmax(0, 1fr);
}

.settings-section-headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.settings-section-headline > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.settings-section-headline-minimal {
  justify-content: flex-start;
  gap: 0;
}

.settings-section-headline h4 {
  margin: 2px 0 0;
  color: #1a2e52;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.settings-section-headline p {
  margin-top: 4px;
  color: #64779a;
  font-size: 11px;
  line-height: 1.5;
}

.settings-section-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(109, 124, 255, 0.14), rgba(94, 203, 255, 0.16));
  color: #5166d6;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(125, 143, 255, 0.16);
}

.settings-field-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-field-grid.single {
  grid-template-columns: 1fr;
}

.settings-inline-key-row {
  display: grid;
  grid-template-columns: minmax(0, 520px) auto;
  align-items: end;
  gap: 10px;
}

.settings-inline-key-row .settings-input-label {
  display: grid;
}

.settings-basic-config-card {
  grid-template-rows: minmax(0, 1fr);
  gap: 8px;
}

.settings-basic-config-form {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 14px;
}

.settings-basic-config-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 560px) auto;
  align-items: end;
  gap: 12px;
}

.settings-basic-config-row-key {
  grid-template-columns: minmax(0, 560px) auto;
}

.settings-basic-config-row-directory {
  align-items: end;
}

.settings-basic-config-field {
  width: 100%;
}

.settings-basic-directory-card {
  gap: 0;
}

.settings-basic-directory-actions {
  align-self: end;
  justify-self: start;
  flex-direction: column;
  align-items: stretch;
}

.settings-inline-save-button,
.settings-basic-directory-actions .settings-action-button {
  width: 96px;
  min-width: 96px;
}

.settings-input-label {
  min-width: 0;
  gap: 6px;
}

.settings-input-label-text {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #60729b;
}

.settings-input-label input,
.settings-input-label textarea,
.settings-input-label select {
  min-height: var(--settings-control-height);
  height: var(--settings-control-height);
  padding: 0 var(--settings-control-padding-x);
  border: 1px solid var(--settings-control-border);
  border-radius: var(--settings-control-radius);
  background: var(--settings-control-background);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
  color: #163152;
  font-size: 13px;
  line-height: 1.35;
}

.settings-truncated-input {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-input-label input:focus-visible,
.settings-input-label textarea:focus-visible,
.settings-input-label select:focus-visible {
  outline: 2px solid var(--settings-focus-outline);
  outline-offset: 0;
  border-color: var(--settings-control-border-strong);
  box-shadow: var(--settings-focus-shadow);
}

.settings-secret-input-row {
  position: relative;
  min-width: 0;
}

.settings-secret-input-row input {
  width: 100%;
  min-width: 0;
}

.settings-secret-input-row.has-reveal input {
  padding-right: calc(var(--settings-control-height) + 8px);
}

.settings-secret-value-input {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-secret-reveal-button {
  position: absolute;
  top: 50%;
  right: 4px;
  width: calc(var(--settings-control-height) - 8px);
  height: calc(var(--settings-control-height) - 8px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  padding: 0;
  z-index: 1;
  background: transparent;
  color: #60729b;
  box-shadow: none;
  cursor: pointer;
}

.shell.openclaw-theme .settings-secret-reveal-button {
  transform: translateY(-50%);
  box-shadow: none;
}

.settings-secret-reveal-button:hover:not(:disabled) {
  color: #1f3f6d;
  background: rgba(31, 63, 109, 0.08);
  transform: translateY(-50%);
  box-shadow: none;
}

.shell.openclaw-theme .settings-secret-reveal-button:hover:not(:disabled) {
  transform: translateY(-50%);
  box-shadow: none;
}

.settings-secret-reveal-button:focus-visible,
.settings-secret-reveal-button:active {
  outline: none;
  transform: translateY(-50%);
  box-shadow: none;
}

.shell.openclaw-theme .settings-secret-reveal-button:focus-visible,
.shell.openclaw-theme .settings-secret-reveal-button:active {
  transform: translateY(-50%);
  box-shadow: none;
}

.settings-secret-reveal-button:disabled {
  cursor: default;
  opacity: 0.58;
}

.settings-secret-reveal-button svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.settings-readonly-config-field {
  min-width: 0;
}

.settings-readonly-config-value {
  min-height: var(--settings-control-height);
  height: var(--settings-control-height);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 var(--settings-control-padding-x);
  border: 1px solid var(--settings-control-border);
  border-radius: var(--settings-control-radius);
  background: rgba(246, 249, 255, 0.82);
  color: #405679;
  font-size: 13px;
  line-height: var(--settings-control-height);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.settings-readonly-config-text {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-readonly-config-copy-feedback {
  flex: 0 0 auto;
  min-width: 42px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

.settings-readonly-config-value[role="button"] {
  cursor: copy;
}

.settings-readonly-config-value[aria-disabled="true"] {
  cursor: default;
}

.settings-readonly-config-value[role="button"]:hover:not([aria-disabled="true"]) {
  border-color: var(--settings-control-border-strong);
  color: #1f3f6d;
  background: rgba(255, 255, 255, 0.92);
}

.settings-readonly-config-value:focus-visible {
  outline: 2px solid var(--settings-focus-outline);
  outline-offset: 0;
  border-color: var(--settings-control-border-strong);
  box-shadow: var(--settings-focus-shadow);
}

.model-config-grid {
  display: grid;
  min-height: 0;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.model-config-grid-four {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(214px, auto);
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(125, 143, 255, 0.34) transparent;
}

.model-config-grid-single {
  min-height: 0;
  height: 100%;
  grid-template-columns: minmax(0, 560px);
  align-content: start;
}

.model-config-grid-four::-webkit-scrollbar {
  width: 8px;
}

.model-config-grid-four::-webkit-scrollbar-track {
  background: transparent;
}

.model-config-grid-four::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(125, 143, 255, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.model-config-grid-four::-webkit-scrollbar-thumb:hover {
  background: rgba(125, 143, 255, 0.44);
}

.model-config-card {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border-radius: var(--settings-card-radius);
  border: 1px solid rgba(178, 194, 255, 0.62);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 249, 255, 0.84));
  box-shadow: 0 10px 22px rgba(109, 124, 255, 0.08);
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.settings-actions-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
  margin-top: 2px;
}

.settings-actions-row-inline-save {
  justify-self: start;
}

.settings-action-button {
  min-width: 92px;
  min-height: var(--settings-control-height);
  height: var(--settings-control-height);
  padding: 0 16px;
  border-radius: var(--settings-control-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(179, 194, 228, 0.9);
  background: rgba(255, 255, 255, 0.94);
  color: #2b426d;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--settings-secondary-shadow);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

.settings-action-button:hover:not(:disabled) {
  border-color: rgba(150, 171, 223, 0.96);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 24px rgba(35, 52, 82, 0.1);
}

.settings-action-button:focus-visible {
  outline: 2px solid var(--settings-focus-outline);
  outline-offset: 0;
  box-shadow: var(--settings-focus-shadow);
}

.settings-action-button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  box-shadow: none;
}

.settings-action-button-primary {
  border-color: transparent;
  background: linear-gradient(135deg, #3b82f6, #1e40af);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.24);
}

.settings-action-button-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #4c8dff, #2148bd);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28);
}

.settings-action-button-primary:focus-visible {
  outline-color: rgba(37, 99, 235, 0.22);
}

.settings-action-button-secondary {
  background: rgba(255, 255, 255, 0.94);
  color: #2b426d;
}

.model-config-card:hover {
  transform: translateY(-1px);
  border-color: rgba(109, 124, 255, 0.36);
  box-shadow: 0 14px 26px rgba(109, 124, 255, 0.12);
}

.settings-panel-models .model-config-grid-single .model-config-card {
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
}

.settings-panel-models .model-config-grid-single .model-config-card:hover {
  transform: none;
  border-color: transparent !important;
  box-shadow: none !important;
}

.model-config-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
}

.model-config-card-head > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.model-config-card-head strong {
  display: block;
  color: #1a2e52;
  font-size: 14px;
  line-height: 1.4;
}

.model-config-card-head p {
  margin-top: 0;
  color: #62759a;
  font-size: 11px;
  line-height: 1.5;
}

.model-config-card-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 1px;
}

.model-config-card-body .settings-field-grid {
  min-height: 100%;
  align-content: start;
}

.model-config-card-body-digital-human {
  overflow: visible;
  padding-right: 0;
}

.settings-field-grid-digital-human {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-field-grid-xhs-feishu {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  align-content: start;
}

.settings-field-grid-xhs-feishu .settings-input-label {
  gap: 6px;
}

.settings-field-grid-xhs-feishu .settings-input-label input {
  min-height: var(--settings-control-height);
  height: var(--settings-control-height);
  padding: 0 var(--settings-control-padding-x);
}

.settings-xhs-feishu-form {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
}

.settings-xhs-feishu-actions {
  justify-content: flex-end;
  margin-top: 0;
}

.settings-page-shell .settings-basic-directory-actions .settings-action-button {
  width: 100%;
  min-width: 96px;
}

.settings-panel .workspace-directory-card {
  min-height: 0;
  gap: 8px;
}

.settings-panel .workspace-directory-panel {
  min-height: 0;
  height: 100%;
  padding: 0 var(--settings-control-padding-x);
  border-radius: var(--settings-control-radius);
  border: 1px solid var(--settings-control-border);
  background: var(--settings-control-background);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 18px rgba(109, 124, 255, 0.06);
}

.settings-panel-connection .settings-section-card,
.settings-panel-diagnostics .settings-section-card {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.settings-panel-basic-config .settings-section-card {
  grid-template-rows: auto minmax(0, 1fr);
}

.settings-panel-basic-config .workspace-directory-card {
  gap: 6px;
}

.settings-panel-basic-config .settings-input-label input,
.settings-panel-basic-config .workspace-directory-panel {
  width: 100%;
  min-height: var(--settings-control-height);
  height: var(--settings-control-height);
  padding: 0 var(--settings-control-padding-x);
  border-radius: var(--settings-control-radius);
  border: 1px solid var(--settings-control-border);
  background: var(--settings-control-background);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 18px rgba(109, 124, 255, 0.06);
}

.settings-panel-basic-config .workspace-directory-panel {
  display: flex;
  align-items: center;
}

.settings-readonly-field {
  display: flex;
  align-items: center;
}

.settings-basic-directory-panel .workspace-directory-path {
  display: block;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
}

.workspace-directory-eyebrow {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #6c7da0;
}

.workspace-directory-path {
  color: #173056;
  font-size: 12px;
  line-height: 1.45;
  word-break: normal;
}

.workspace-directory-hint {
  color: #66789a;
  font-size: 11px;
  line-height: 1.5;
}

.workspace-directory-draft-row,
.workspace-directory-inline-actions,
.workspace-directory-actions {
  gap: 6px;
}

.model-config-grid-runtime .settings-runtime-actions-panel {
  min-height: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

.model-config-grid-runtime .settings-runtime-actions {
  width: 100%;
  justify-content: flex-end;
}

@media (max-width: 1180px) {
  .model-config-grid-four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(214px, auto);
  }
}

@media (max-width: 960px) {
  .settings-page-shell {
    height: auto;
    min-height: 100%;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .settings-page-shell::before,
  .settings-page-shell::after {
    display: none;
  }

  .settings-page-stack {
    height: auto;
    overflow: visible;
  }

  .settings-console-grid {
    flex: 0 0 auto;
    height: auto;
    overflow: visible;
  }

  .settings-tabs-layout {
    height: auto;
    overflow: visible;
  }

  .settings-field-grid,
  .model-config-grid,
  .model-config-grid-four {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(0, auto);
  }

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

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

  .settings-basic-config-form {
    padding-top: 0;
  }

  .settings-basic-config-field {
    width: 100%;
  }

  .settings-inline-save-button,
  .settings-actions-row-inline-save,
  .settings-basic-directory-actions {
    justify-self: stretch;
  }

  .settings-basic-directory-actions {
    width: 100%;
  }

  .model-config-grid-runtime .settings-runtime-actions-panel {
    height: auto;
    align-items: stretch;
  }

  .settings-field-grid-digital-human {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .settings-tabs-toolbar {
    align-items: stretch;
    gap: 8px;
  }

  .settings-config-source-toggle {
    align-self: flex-start;
  }

  .settings-config-source-option {
    padding-inline: 9px;
  }

  .plugin-page-topbar,
  .settings-page-topbar {
    padding: 0;
    align-items: stretch;
  }

  .plugin-page,
  .settings-panel {
    padding: 10px;
  }

  .plugin-flat-grid {
    grid-template-columns: 1fr;
  }

  .plugin-flat-card,
  .settings-section-card,
  .model-config-card {
    min-height: 0;
    padding: 14px;
  }

  .settings-section-headline,
  .model-config-card-head {
    flex-direction: column;
  }

  .settings-actions-row .settings-action-button,
  .workspace-directory-actions .settings-action-button {
    width: 100%;
  }

  .settings-basic-directory-actions .settings-action-button {
    min-width: 0;
  }
}
