th {
  font-weight: normal;
}

.bb-1 {
  border-bottom-width: 1px;
}

.tr-hover {
  cursor: pointer;
}

.tr-hover:hover {
  border-color: #463a9a;
}

.input-full input {
  width: 100% !important;
}

/* SQL Database Configuration Styles */
#sql-fields-section {
  border-color: #3b82f6 !important;
  background-color: #f8fafc;
}

#sql-fields-section .section-header {
  color: #1e40af;
  font-weight: 500;
}

.sql-field {
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
}

.sql-field:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
  outline: none;
}

/* Form field styling for SQL configuration */
#sql-fields .form-group {
  margin-bottom: 1rem;
}

#sql-fields label {
  color: #374151;
  font-weight: 500;
  margin-bottom: 0.5rem;
  display: block;
}

#sql-fields .help-text {
  color: #6b7280;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Form validation styles for SQL fields */
.sql-field.is-invalid {
  border-color: #dc3545;
  background-color: #f8d7da;
}

.sql-field.is-invalid:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 1px #dc3545;
}

.sql-field.is-valid {
  border-color: #28a745;
  background-color: #d4edda;
}

.sql-field.is-valid:focus {
  border-color: #28a745;
  box-shadow: 0 0 0 1px #28a745;
}

/* Error message styling */
.field-error {
  color: #dc3545;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  display: block;
}

.field-error::before {
  content: '⚠ ';
  font-weight: bold;
}

/* Required field indicator */
.sql-field[required] + label::after {
  content: ' *';
  color: #dc3545;
  font-weight: bold;
}

/* Form submission disabled state */
form.submitting .sql-field {
  opacity: 0.6;
  pointer-events: none;
}


/* ──────────────────────────────────────────────
   Toggle Switch (replaces plain checkboxes)
   ────────────────────────────────────────────── */

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

/* Hide the native checkbox but keep it accessible */
.toggle-switch input[type="checkbox"] {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

/* Track */
.toggle-switch__track {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
  background: #d1d5db;
  border-radius: 12px;
  transition: background 0.25s ease, box-shadow 0.25s ease;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Knob (thumb) */
.toggle-switch__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Checked state */
.toggle-switch input[type="checkbox"]:checked + .toggle-switch__track {
  background: #4f46e5;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-switch__track::after {
  transform: translateX(20px);
}

/* Focus ring (keyboard accessibility) */
.toggle-switch input[type="checkbox"]:focus-visible + .toggle-switch__track {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

/* Hover states */
.toggle-switch:hover .toggle-switch__track {
  background: #b8bcc4;
}

.toggle-switch:hover input[type="checkbox"]:checked + .toggle-switch__track {
  background: #4338ca;
}

/* Disabled state */
.toggle-switch input[type="checkbox"]:disabled + .toggle-switch__track {
  opacity: 0.5;
  cursor: not-allowed;
}

.toggle-switch input[type="checkbox"]:disabled ~ .toggle-switch__label {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Label text */
.toggle-switch__label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  line-height: 1.4;
}

/* Help text under toggle */
.toggle-switch__help {
  margin-top: 6px;
  margin-left: 56px;    /* align with label text (44px track + 12px gap) */
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
}


/* ──────────────────────────────────────────────
   Radio Card Group (replaces plain radio buttons)
   ────────────────────────────────────────────── */

.radio-card-group > div.scenario-type-radio,
.radio-card-group > .scenario-type-radio {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Each option wrapper */
.radio-card-group > div.scenario-type-radio > div,
.radio-card-group > .scenario-type-radio > div {
  flex: 1;
  min-width: 120px;
}

/* The label becomes the card */
.radio-card-group > div.scenario-type-radio > div > label,
.radio-card-group > .scenario-type-radio > div > label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s ease, background 0.2s ease,
              box-shadow 0.2s ease, transform 0.1s ease;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.radio-card-group > div.scenario-type-radio > div > label:hover,
.radio-card-group > .scenario-type-radio > div > label:hover {
  border-color: #c7d2fe;
  background: #f5f3ff;
}

.radio-card-group > div.scenario-type-radio > div > label:active,
.radio-card-group > .scenario-type-radio > div > label:active {
  transform: scale(0.98);
}

/* Hide the native radio and replace with a custom dot */
.radio-card-group input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  margin: 0;
  padding: 0;
}

.radio-card-group input[type="radio"]::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4f46e5;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Checked card */
.radio-card-group input[type="radio"]:checked {
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px #4f46e5;
}

.radio-card-group input[type="radio"]:checked::after {
  transform: translate(-50%, -50%) scale(1);
}

/* Style the parent label when radio is checked */
.radio-card-group input[type="radio"]:checked + span,
.radio-card-group > div.scenario-type-radio > div:has(input:checked) > label,
.radio-card-group > .scenario-type-radio > div:has(input:checked) > label {
  border-color: #4f46e5;
  background: #eef2ff;
  color: #312e81;
  box-shadow: 0 0 0 1px #4f46e5, 0 2px 8px rgba(79, 70, 229, 0.10);
}

/* Focus ring (keyboard accessibility) */
.radio-card-group input[type="radio"]:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

/* Help text under radio group */
.radio-card-group__help {
  margin-top: 8px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
}

/* Guardrail blocked-type pill checkboxes */
.guardrail-type-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border: 1px solid #d1d5db;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
}

.guardrail-type-pill:hover {
  border-color: #a5b4fc;
  background: #f5f3ff;
}

.guardrail-type-pill:has(input:checked) {
  border-color: #6366f1;
  background: #eef2ff;
  color: #4338ca;
}

.guardrail-type-pill input[type="checkbox"] {
  display: none;
}

/* ──────────────────────────────────────────────
   Agent config form — friendlier layout
   Shared by scenario_form.html (create) and
   scenario_detail.html (edit).
   ────────────────────────────────────────────── */

/* Intro banner at the top of the form */
.agent-form-intro {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  margin-bottom: 28px;
  border: 1px solid #e0e7ff;
  border-radius: 12px;
  background: linear-gradient(135deg, #f5f3ff 0%, #eef2ff 100%);
}

.agent-form-intro__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #4f46e5;
  color: #fff;
}

.agent-form-intro__title {
  font-size: 15px;
  font-weight: 600;
  color: #312e81;
  margin: 0 0 2px;
}

.agent-form-intro__text {
  font-size: 13px;
  line-height: 1.5;
  color: #4338ca;
  margin: 0;
}

/* "What are you building?" type picker */
.agent-type-picker {
  margin-bottom: 28px;
}

.agent-type-picker__label {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 12px;
}

.agent-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.agent-type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s,
    transform 0.1s;
}

.agent-type-card:hover {
  border-color: #c7d2fe;
  background: #f5f3ff;
}

.agent-type-card:active {
  transform: scale(0.99);
}

.agent-type-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.agent-type-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.agent-type-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4f46e5;
  line-height: 1;
}

.agent-type-card__icon svg {
  width: 20px;
  height: 20px;
}

.agent-type-card__desc {
  font-size: 12.5px;
  line-height: 1.45;
  color: #6b7280;
}

.agent-type-card:has(input:checked) {
  border-color: #4f46e5;
  background: #eef2ff;
  box-shadow: 0 0 0 1px #4f46e5;
}

.agent-type-card:has(input:checked) .agent-type-card__desc {
  color: #4338ca;
}

/* A small check badge appears on the selected card */
.agent-type-card__check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #4f46e5;
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
}

.agent-type-card:has(input:checked) .agent-type-card__check {
  display: flex;
}

/* Group separators: Essentials vs Advanced */
.agent-section-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 8px 0 14px;
}

.agent-section-group__title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4f46e5;
}

.agent-section-group--advanced .agent-section-group__title {
  color: #6b7280;
}

.agent-section-group__hint {
  font-size: 12.5px;
  color: #9ca3af;
}

.agent-section-group__rule {
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

/* Section header: title + description + chevron */
.agent-section-header {
  align-items: center !important;
}

.agent-section-header__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.agent-section-header__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  line-height: 1.4;
  color: #111827;
}

.agent-section-header__desc {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: #6b7280;
}

.agent-section-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.agent-section-badge--optional {
  background: #f3f4f6;
  color: #6b7280;
}

.agent-section-badge--required {
  background: #eef2ff;
  color: #4338ca;
}

.agent-section-chevron {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: #9ca3af;
  transition: transform 0.2s ease;
}

/* Soft hover for the whole section card */
.agent-config-form .border.rounded-md {
  transition: box-shadow 0.15s, border-color 0.15s;
}

.agent-config-form .border.rounded-md:hover {
  border-color: #d1d5db;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* "Advanced settings live on the detail page" note on the lean create form */
.agent-create-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 4px;
  padding: 14px 16px;
  border: 1px dashed #d1d5db;
  border-radius: 12px;
  background: #f9fafb;
  font-size: 13px;
  line-height: 1.5;
  color: #6b7280;
}

.agent-create-note svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: #9ca3af;
}

/* ──────────────────────────────────────────────
   Config tabs (agent detail page): Налаштування / Розширені
   ────────────────────────────────────────────── */
.agent-tabs {
  display: flex;
  gap: 4px;
  margin: 4px 0 24px;
  border-bottom: 1px solid #e5e7eb;
}

.agent-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  margin-bottom: -1px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.agent-tab svg {
  width: 18px;
  height: 18px;
}

.agent-tab:hover {
  color: #4f46e5;
}

.agent-tab--active {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
}

.agent-tab__hint {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9ca3af;
  background: #f3f4f6;
  padding: 1px 7px;
  border-radius: 9999px;
}

.agent-tab--active .agent-tab__hint {
  color: #6b7280;
}

.agent-tab-panel__intro {
  margin-bottom: 18px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f9fafb;
  border: 1px solid #f3f4f6;
  font-size: 13px;
  color: #6b7280;
}
