:root {
  --bg: #f5efe6;
  --bg-accent: #efe2d0;
  --ink: #18230f;
  --muted: #5d6850;
  --card: rgba(255, 251, 245, 0.88);
  --line: rgba(24, 35, 15, 0.12);
  --brand: #bc5f04;
  --brand-deep: #8d3d00;
  --success: #3d6b35;
  --shadow: 0 24px 70px rgba(64, 40, 12, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(188, 95, 4, 0.18), transparent 28%),
    radial-gradient(circle at right 20%, rgba(61, 107, 53, 0.16), transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, #f9f4ed 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(24, 35, 15, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 35, 15, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 90%);
}

.shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 22px;
  align-items: stretch;
  margin-bottom: 22px;
}

.hero__copy,
.hero__card,
.panel {
  background: var(--card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero__copy {
  padding: 38px;
  border-radius: var(--radius-xl);
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--brand-deep);
  font-size: 0.74rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  max-width: 12ch;
  font-size: clamp(2.6rem, 5vw, 4.6rem);
  font-family: "Instrument Serif", serif;
  font-weight: 400;
}

h2 {
  font-size: 1.6rem;
}

h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.hero__text,
.card__text,
.provider p,
.preview__body,
label,
.metric span {
  color: var(--muted);
}

.hero__text {
  max-width: 58ch;
  font-size: 1.02rem;
  line-height: 1.65;
  margin: 18px 0 26px;
}

.hero__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.mode-switch {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(24, 35, 15, 0.08);
  gap: 4px;
}

.mode-switch__btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
}

.mode-switch__btn.is-active {
  background: var(--ink);
  color: #fff7ec;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.editor-toolbar__btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.rich-editor {
  min-height: 260px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(24, 35, 15, 0.14);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  line-height: 1.6;
}

.rich-editor:focus {
  outline: 2px solid rgba(188, 95, 4, 0.22);
  outline-offset: 1px;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--ink);
  color: #fff7ec;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  border: 1px solid var(--line);
}

.hero__card {
  border-radius: var(--radius-xl);
  padding: 24px;
  display: grid;
  gap: 14px;
  align-content: center;
}

.metric {
  padding: 16px;
  background: rgba(255, 246, 233, 0.84);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(188, 95, 4, 0.12);
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.8rem;
  color: var(--ink);
}

.layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 22px;
}

.panel {
  border-radius: var(--radius-xl);
  padding: 26px;
}

.panel--wide {
  grid-column: 1 / -1;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 18px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(61, 107, 53, 0.12);
  color: var(--success);
  font-size: 0.9rem;
  font-weight: 700;
}

.status-pill--warm {
  background: rgba(188, 95, 4, 0.12);
  color: var(--brand-deep);
}

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

.card,
.provider,
.preview {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
  border-radius: var(--radius-lg);
}

.card,
.provider {
  padding: 20px;
}

.field-group {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.composer-panel.is-hidden {
  display: none;
}

.is-hidden-input {
  display: none;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
}

input,
select,
textarea {
  width: 100%;
  font: inherit;
  padding: 13px 14px;
  color: var(--ink);
  border: 1px solid rgba(24, 35, 15, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
}

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

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

.toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
}

.range-value {
  font-size: 0.88rem;
  color: var(--muted);
}

.preview {
  padding: 22px;
}

.preview__from,
.preview__footer,
.preview a {
  font-size: 0.92rem;
}

.preview__subject {
  font-size: 1.45rem;
  margin: 14px 0 18px;
}

.preview__body {
  line-height: 1.7;
}

.preview__footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preview a {
  color: var(--brand-deep);
  word-break: break-all;
}

.hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.actions-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.dropzone {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1.5px dashed rgba(188, 95, 4, 0.35);
  border-radius: var(--radius-lg);
  background: rgba(255, 248, 238, 0.76);
  cursor: pointer;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone__title {
  font-weight: 700;
  color: var(--ink);
}

.dropzone__text {
  color: var(--muted);
}

.dropzone.is-dragover {
  border-color: var(--brand);
  background: rgba(255, 240, 221, 0.95);
}

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.summary-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(24, 35, 15, 0.07);
  color: var(--muted);
  font-size: 0.92rem;
}

.summary-chip strong {
  color: var(--ink);
}

.log {
  margin: 0;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #fffaf2;
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.55;
  min-height: 150px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.metric-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-card strong {
  font-size: 1.8rem;
}

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

.chart-block {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.64);
}

.chart-bars {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.chart-row {
  display: grid;
  gap: 6px;
}

.chart-row__meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
  color: var(--muted);
}

.chart-row__track {
  width: 100%;
  height: 11px;
  border-radius: 999px;
  background: rgba(24, 35, 15, 0.08);
  overflow: hidden;
}

.chart-row__fill {
  height: 100%;
  border-radius: 999px;
}

.chart-row__fill--brand {
  background: linear-gradient(90deg, #bc5f04, #d58428);
}

.chart-row__fill--success {
  background: linear-gradient(90deg, #3d6b35, #67a35c);
}

.chart-row__fill--danger {
  background: linear-gradient(90deg, #8d2020, #cf5e5e);
}

.chart-row__fill--muted {
  background: linear-gradient(90deg, #7d7d6d, #a8a898);
}

.chart-row__fill--ink {
  background: linear-gradient(90deg, #18230f, #425238);
}

.auth-panel {
  max-width: 520px;
  margin: 72px auto;
}

.auth-error {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(150, 32, 32, 0.14);
  background: rgba(150, 32, 32, 0.08);
  color: #8d2020;
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.8);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.table th,
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.92rem;
}

.table th {
  background: rgba(188, 95, 4, 0.08);
  color: var(--ink);
}

select[multiple] {
  min-height: 140px;
}

.preview-html {
  margin: 14px 0;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(24, 35, 15, 0.16);
  background: rgba(255, 248, 238, 0.8);
}

.preview-html p {
  margin: 0 0 12px;
}

.stack {
  display: grid;
  gap: 14px;
}

.provider h3 {
  margin-bottom: 6px;
}

.provider p {
  margin: 0;
  line-height: 1.65;
}

.card,
.provider,
.preview,
.hero__copy,
.hero__card,
.panel {
  animation: rise 520ms ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  h1 {
    max-width: none;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 18px, 100%);
    padding-top: 16px;
  }

  .hero__copy,
  .hero__card,
  .panel {
    padding: 20px;
  }

  .split,
  .section-heading {
    grid-template-columns: 1fr;
  }

  .section-heading {
    display: grid;
  }

  .actions-row {
    display: grid;
  }
}
