/* ---------- Design tokens (from Loyalty series) ---------- */

:root {
  --bg: #0b0c0f;
  --bg-elevated: #151821;
  --border-subtle: #2b2f3b;
  --accent: #f4a7b9;
  --accent-soft: rgba(244, 167, 185, 0.18);
  --text-main: #f8f9fb;
  --text-muted: #a5adbf;
  --danger: #ff6b81;
  --danger-soft: rgba(255, 107, 129, 0.12);
  --success: #32d296;
  --success-soft: rgba(50, 210, 150, 0.12);
  --radius-lg: 18px;
  --radius-md: 10px;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.55);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

/* ---------- Global ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: radial-gradient(circle at top, #0b0c0f 0, #05060a 48%, #05060a 100%);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */

.page-header {
  padding: 32px 24px 12px;
}

.page-header-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.page-header h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: 0.02em;
}

.tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

.main {
  max-width: 1100px;
  margin: 0 auto 32px;
  padding: 0 24px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr);
  gap: 20px;
}

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

/* ---------- Footer ---------- */

.page-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 12px 24px 22px;
  text-align: center; /* center the series line */
  color: var(--text-muted);
  font-size: 13px;
}

.page-footer a {
  color: var(--accent);
  text-decoration: none;
}

.page-footer a:hover {
  text-decoration: underline;
}

/* ---------- Panels ---------- */

.panel {
  background: linear-gradient(135deg, rgba(20, 24, 35, 0.98), rgba(8, 10, 16, 0.98));
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  padding: 18px 18px 16px;
}

.panel-input {
  min-height: 360px;
}

.panel-results {
  min-height: 360px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-header h2 {
  margin: 0;
  font-size: 18px;
}

/* ---------- Controls / fields (from sandbox, recolored) ---------- */

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.help-text {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.field-group {
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

.field-help {
  margin: 2px 0 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.text-input {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: #05060b;
  color: var(--text-main);
  font-size: 13px;
  font-family: var(--font-mono);
  padding: 8px 10px;
  resize: vertical;
  outline: none;
}

.text-input::placeholder {
  color: #6b7280;
}

.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

/* Scenario select */

.scenario-label {
  font-size: 12px;
  color: var(--text-muted);
}

.scenario-select {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: #05060b;
  color: var(--text-main);
  font-size: 13px;
  padding: 5px 10px;
  outline: none;
}

.scenario-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

/* Optional inline checkbox row */

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

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-main);
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
}

/* ---------- Buttons (from loyalty) ---------- */

.btn {
  border-radius: 999px;
  border: none;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.06s ease, box-shadow 0.06s ease, background 0.08s ease;
}

.btn-primary {
  background: var(--accent);
  color: #130c12;
  box-shadow: 0 8px 20px rgba(244, 167, 185, 0.38);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(244, 167, 185, 0.52);
}

.btn-secondary {
  background: rgba(34, 39, 54, 0.9);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(43, 49, 66, 0.95);
}

.panel-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.parse-status {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- Behavior summary (right panel) ---------- */

.summary {
  margin-bottom: 14px;
}

.summary-badge {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.summary-badge-idle {
  background: rgba(26, 30, 42, 0.9);
  color: var(--text-muted);
}

.summary-badge-ok {
  background: var(--success-soft);
  color: var(--success);
}

.summary-badge-drifted {
  background: var(--danger-soft);
  color: var(--danger);
}

.summary-badge .count {
  font-weight: 600;
}

/* Sections inside the summary panel */

.summary-section {
  margin-bottom: 10px;
}

.summary-section h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.summary-section p,
.summary-section ul {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.summary-section ul {
  padding-left: 18px;
}

/* Execution trace block */

.raw-output {
  margin-top: 12px;
}

#raw-trace {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: #05060b;
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: pre-wrap;
}

/* ---------- Responsive tweaks ---------- */

@media (max-width: 640px) {
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}
