:root {
  --bg: #f7f3ec;
  --panel: #fffdf8;
  --line: #ddcfbb;
  --ink: #1f1f1f;
  --muted: #665f54;
  --brand: #0d6a62;
  --brand-2: #e58f2a;
  --ok: #2f7a3f;
  --warn: #97620a;
  --bad: #b3362e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 10%, #fff2cf 0%, transparent 45%),
    radial-gradient(circle at 90% 88%, #e8f6f2 0%, transparent 45%),
    var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px 0;
}

.brand-logo {
  width: 84px;
  height: 84px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  border: 2px solid var(--line);
  padding: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-size: 0.84rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2.1vw, 2.2rem);
  line-height: 1.1;
}

.layout {
  min-height: calc(100vh - 110px);
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
  padding: 16px 20px 20px;
}

.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.06);
}

.subtitle {
  margin: 0 0 12px;
  color: var(--muted);
}

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

label {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  margin-top: 10px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 11px;
  margin-top: 6px;
  font: 500 0.94rem/1.35 "Segoe UI", Tahoma, sans-serif;
}

textarea {
  min-height: 180px;
  font-family: "Consolas", "Courier New", monospace;
}

textarea.short {
  min-height: 78px;
}

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

button {
  border: 0;
  border-radius: 11px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 100ms ease, filter 100ms ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

button.primary {
  background: var(--brand);
  color: #fff;
}

button.danger {
  background: var(--brand-2);
  color: #fff;
}

button.ghost {
  background: #efe3d2;
  color: var(--ink);
}

.status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
}

.status.idle {
  background: #efe6da;
}

.status.loading {
  background: #d9ece9;
}

.status.success {
  background: #dcf2df;
}

.status.error {
  background: #f8dfdc;
}

.result-summary {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  font-weight: 700;
}

.result-summary.empty {
  color: var(--muted);
  font-weight: 600;
}

.results {
  margin-top: 12px;
}

.results.empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 16px;
  color: var(--muted);
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.result-head h2 {
  margin: 0;
  font-size: 1rem;
}

.badge {
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  text-transform: uppercase;
}

.badge.preview {
  background: #e4f0f5;
  color: #0e5165;
}

.badge.dispatched {
  background: #ddf0de;
  color: var(--ok);
}

.badge.pending_human_review {
  background: #f9edd5;
  color: var(--warn);
}

.badge.dispatch_failed {
  background: #f7dfdd;
  color: var(--bad);
}

.muted {
  color: var(--muted);
  margin: 8px 0 0;
}

ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

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

  .topbar {
    padding: 14px 14px 0;
  }

  .layout {
    padding: 12px 14px 16px;
  }
}
