:root {
  --bg: #f5f1ea;
  --panel: #fffaf2;
  --ink: #1f1b16;
  --muted: #6d6257;
  --accent: #d86b3d;
  --accent-2: #2c5d63;
  --border: #e2d8ca;
  --shadow: 0 18px 40px rgba(30, 20, 10, 0.1);
  --radius: 18px;
  --font-display: "Cabinet Grotesk", "Poppins", "Trebuchet MS", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: radial-gradient(circle at top, #fff4df, #f0e6d7 55%, #ebe0d1 100%);
}

.app {
  min-height: 100vh;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 18px 22px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(130deg, var(--accent), #f2b27a);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 10px;
}

h1 {
  font-family: var(--font-display);
  margin: 0 0 4px 0;
  font-size: 28px;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 10px;
}

.btn {
  border: 1px solid var(--border);
  background: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.btn.small {
  padding: 6px 12px;
  font-size: 13px;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 10px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
}

.panel-body {
  padding: 16px 18px 18px 18px;
}

.panel-footer {
  padding: 10px 18px 16px 18px;
  border-top: 1px solid var(--border);
}

.panel-actions {
  display: flex;
  gap: 8px;
}

.inline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 14px;
  color: var(--ink);
}

textarea {
  min-height: 70px;
  resize: vertical;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
}

.steps-flow {
  display: flex;
  align-items: stretch;
  gap: 22px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.step-card {
  min-width: 320px;
  max-width: 360px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.step-connector {
  display: flex;
  align-items: center;
  color: var(--accent-2);
  font-weight: 700;
}

.step-connector::before {
  content: "";
  width: 40px;
  height: 2px;
  background: var(--accent-2);
  margin-right: 8px;
}

.step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.step-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
}

.step-actions {
  display: flex;
  gap: 6px;
}

.badge {
  background: #f8e5d3;
  color: #7b3c1a;
  font-weight: 600;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
}

.phase {
  border: 1px dashed #e4c8b3;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff8ef;
}

.phase-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.phase-header h4 {
  margin: 0;
  font-size: 14px;
}

.section-title {
  margin: 12px 0 6px;
  font-size: 15px;
  font-family: var(--font-display);
}

.subsection {
  border: 1px solid rgba(216, 107, 61, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subsection-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.conditional-card {
  border: 1px solid #ead2bf;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.connection-preview {
  margin-top: 14px;
  border: 1px solid rgba(44, 93, 99, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.readonly-field input {
  color: var(--muted);
  background: #f7efe5;
}

.import-textarea {
  min-height: 220px;
}

.import-status {
  border-radius: 12px;
  padding: 10px 12px;
  background: #f0e7d9;
  color: var(--muted);
  font-size: 13px;
}

.import-status.ok {
  background: #e3f0eb;
  color: #215047;
}

.import-status.error {
  background: #fbe6df;
  color: #8a3820;
}

.ops-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.op-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.op-top {
  display: flex;
  gap: 8px;
  align-items: center;
}

.op-fields {
  display: grid;
  gap: 6px;
}

.op-fields.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.array-editor {
  display: grid;
  gap: 6px;
}

.array-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)) auto;
  gap: 6px;
  align-items: center;
}

.array-row button {
  border: none;
  background: #f5e1d1;
  color: #7b3c1a;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
}

.array-actions {
  display: flex;
  justify-content: flex-end;
}

.code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.status-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #f0e7d9;
  color: var(--muted);
}

.validation-item {
  border-left: 4px solid #c74d2a;
  padding: 10px 12px;
  background: #fff;
  border-radius: 10px;
  margin-bottom: 8px;
}

.validation-item.ok {
  border-color: #2c5d63;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .steps-flow {
    flex-direction: column;
  }
  .step-connector {
    display: none;
  }
}
