.aicfg-subtitle {
  max-width: 72ch;
}

.aicfg-link {
  align-self: center;
  text-decoration: none;
  color: var(--brand, #2563eb);
  font-weight: 600;
}

.aicfg-link:hover {
  color: var(--brand-dark, #1d4ed8);
  text-decoration: underline;
}

.aicfg-card {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1rem;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius, 10px);
  box-shadow: var(--shadow-sm, 0 4px 14px rgb(15 23 42 / .05));
}

.aicfg-card__title {
  margin: 0;
  font-size: 1rem;
  color: var(--text, #0f172a);
}

.aicfg-tabs {
  display: flex;
  gap: .35rem;
  margin-bottom: 1.25rem;
  padding-bottom: .25rem;
  border-bottom: 1px solid var(--line, #e2e8f0);
  overflow-x: auto;
}

.aicfg-tab {
  border: 0;
  background: transparent;
  color: var(--text-muted, #64748b);
  font: inherit;
  font-weight: 600;
  padding: .65rem .95rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.aicfg-tab.is-active {
  background: var(--brand-soft, #eff6ff);
  color: var(--brand-dark, #1d4ed8);
}

.aicfg-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.aicfg-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.aicfg-panel__header--compact {
  margin-bottom: .25rem;
}

.aicfg-panel__title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text, #0f172a);
}

.aicfg-panel__subtitle {
  margin: .25rem 0 0;
  font-size: .9rem;
  color: var(--text-muted, #64748b);
}

.aicfg-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .9rem;
}

.aicfg-metric {
  padding: 1rem;
  background: linear-gradient(180deg, var(--surface, #fff), #f8fbff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius, 10px);
}

.aicfg-metric__label {
  margin: 0 0 .3rem;
  font-size: .8rem;
  color: var(--text-muted, #64748b);
}

.aicfg-metric__value {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text, #0f172a);
}

.aicfg-label {
  margin-top: .25rem;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text, #0f172a);
}

.aicfg-input,
.aicfg-textarea {
  width: 100%;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius, 8px);
  background: var(--surface, #fff);
  color: var(--text, #0f172a);
  box-sizing: border-box;
  font: inherit;
}

.aicfg-input {
  min-height: 2.625rem;
  padding: .5rem .75rem;
}

.aicfg-textarea {
  padding: .75rem;
  resize: vertical;
}

.aicfg-input:focus,
.aicfg-textarea:focus {
  outline: none;
  border-color: var(--brand, #2563eb);
  box-shadow: 0 0 0 3px rgb(37 99 235 / .12);
}

.aicfg-counter {
  margin: 0;
  text-align: right;
  font-size: .8125rem;
  color: var(--text-muted, #64748b);
}

.aicfg-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: .5rem;
}

.aicfg-btn {
  border: 0;
  border-radius: var(--radius, 8px);
  background: var(--brand, #2563eb);
  color: #fff;
  padding: .625rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

.aicfg-btn:hover {
  background: var(--brand-dark, #1d4ed8);
}

.aicfg-btn:disabled {
  opacity: .65;
  cursor: not-allowed;
}

.aicfg-btn--ghost {
  background: var(--bg, #f8fafc);
  color: var(--text, #0f172a);
  border: 1px solid var(--line, #e2e8f0);
}

.aicfg-btn--ghost:hover {
  background: #eef2f7;
}

.aicfg-status {
  margin: 0;
  font-size: .875rem;
  color: var(--text-muted, #64748b);
}

.aicfg-status--ok {
  color: var(--success, #16a34a);
}

.aicfg-status--error {
  color: var(--danger, #dc2626);
}

.aicfg-hint {
  margin: -.15rem 0 0;
  font-size: .8125rem;
  color: var(--text-muted, #64748b);
}

.aicfg-table-wrap {
  overflow-x: auto;
}

.aicfg-table {
  width: 100%;
  border-collapse: collapse;
}

.aicfg-table th,
.aicfg-table td {
  padding: .8rem .75rem;
  border-bottom: 1px solid var(--line, #e2e8f0);
  text-align: left;
  font-size: .9rem;
}

.aicfg-table th {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted, #64748b);
}

.aicfg-script-list {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.aicfg-script-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius-md, 8px);
  background: var(--bg, #f8fafc);
}

.aicfg-script-card__title {
  margin: 0;
  font-size: .98rem;
}

.aicfg-script-card__desc {
  margin: .3rem 0 .2rem;
  color: var(--text-muted, #64748b);
}

.aicfg-script-card__key {
  margin: 0;
  font-size: .76rem;
  color: var(--text-muted, #64748b);
}

.aicfg-script-card__actions {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.aicfg-output {
  margin: 0;
  padding: 1rem;
  border-radius: var(--radius-md, 8px);
  background: #0f172a;
  color: #e2e8f0;
  font: .8125rem/1.5 monospace;
  white-space: pre-wrap;
}

.aicfg-empty {
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--line, #e2e8f0);
  border-radius: var(--radius-md, 8px);
  color: var(--text-muted, #64748b);
}

@media (max-width: 720px) {
  .aicfg-hero {
    flex-direction: column;
  }

  .aicfg-link {
    align-self: flex-start;
  }

  .aicfg-script-card {
    flex-direction: column;
  }

  .aicfg-script-card__actions {
    width: 100%;
    justify-content: flex-start;
  }
}
