:root {
  color-scheme: light;
  --bg: #f6f2ea;
  --bg2: #edf3f8;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: rgba(255, 255, 255, 0.97);
  --stroke: rgba(15, 23, 42, 0.08);
  --stroke-strong: rgba(15, 23, 42, 0.12);
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0f766e;
  --accent2: #2563eb;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.14), transparent 26%),
    radial-gradient(circle at right center, rgba(37, 99, 235, 0.12), transparent 24%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.22), transparent 88%);
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 10%, rgba(15, 118, 110, 0.14), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(37, 99, 235, 0.12), transparent 26%);
}

.shell {
  position: relative;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  padding: 28px 20px;
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid var(--stroke);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(37, 99, 235, 0.12));
  font-weight: 800;
  letter-spacing: 0.08em;
}

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand-name {
  margin-top: 4px;
  font-size: 1.08rem;
  font-weight: 800;
}

.nav {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 12px;
  border-radius: 14px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.nav a:hover,
.nav a.is-active {
  color: var(--text);
  border-color: rgba(15, 118, 110, 0.14);
  background: rgba(15, 118, 110, 0.08);
  transform: translateY(-1px);
}

.sidebar-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.sidebar-card.subtle {
  background: rgba(255, 255, 255, 0.64);
}

.sidebar-card p,
.panel p,
.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.workspace {
  padding: 28px;
  display: grid;
  gap: 22px;
}

.page {
  display: none;
  gap: 20px;
}

.page.is-active {
  display: grid;
}

.page-hero,
.panel {
  border: 1px solid var(--stroke);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.page-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 28px;
  border-radius: 28px;
}

.page-hero.compact {
  padding: 20px 24px;
}

.page-hero-copy {
  display: grid;
  gap: 10px;
}

.page-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
  max-width: 16ch;
}

.page-hero p {
  margin: 0;
  color: var(--muted);
  max-width: 66ch;
}

.page-hero-meta {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-metric {
  min-width: 180px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: rgba(15, 23, 42, 0.03);
}

.hero-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
}

.panel {
  padding: 22px;
  border-radius: 24px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.02rem;
}

.panel-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.panel-link:hover {
  text-decoration: underline;
}

.grid {
  display: grid;
  gap: 20px;
}

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

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

.metric-card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.9);
}

.metric-label {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 10px;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.metric-hint {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.4;
}

.action-grid,
.template-grid,
.inbox-list {
  display: grid;
  gap: 12px;
}

.action-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.action-card {
  padding: 18px;
  border: 1px solid var(--stroke);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 252, 0.94));
  text-align: left;
  display: grid;
  gap: 10px;
  color: var(--text);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.04);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.action-card:hover,
.template-card:hover,
.template-pill:hover,
.inbox-item:hover,
.choice-card:hover,
.primary:hover,
.secondary:hover,
.ghost-chip:hover {
  transform: translateY(-1px);
}

.action-card.primary {
  border-color: rgba(15, 118, 110, 0.22);
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.98));
}

.action-eyebrow,
.tiny-label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.action-title {
  font-size: 1.06rem;
  font-weight: 800;
}

.action-copy {
  color: var(--muted);
  line-height: 1.5;
}

.summary-chip,
.pill,
.template-pill,
.ghost-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
}

.summary-chip {
  margin-right: 8px;
  margin-bottom: 8px;
}

.wizard-summary {
  margin-bottom: 12px;
}

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

.step {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.72);
}

.step span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  font-size: 0.82rem;
  font-weight: 800;
}

.step.active {
  border-color: rgba(15, 118, 110, 0.22);
  background: rgba(15, 118, 110, 0.06);
}

.step.done span {
  background: rgba(15, 118, 110, 0.14);
}

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

.choice-card {
  text-align: left;
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
}

.choice-card.is-selected,
.template-card.is-selected,
.inbox-item.is-selected {
  border-color: rgba(15, 118, 110, 0.24);
  box-shadow: 0 16px 34px rgba(15, 118, 110, 0.08);
}

.choice-title,
.template-name {
  font-size: 1rem;
  font-weight: 800;
}

.choice-desc,
.choice-hint,
.template-desc,
.template-columns p,
.draft-card p,
.preview-copy,
.preview-grid p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.choice-hint {
  font-size: 0.92rem;
}

.wizard-form,
.settings-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.settings-form label {
  font-weight: 700;
}

textarea,
select {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--stroke-strong);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}

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

.suggestion-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ghost-chip {
  cursor: pointer;
  background: rgba(255, 255, 255, 0.72);
}

.template-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-pill {
  cursor: pointer;
  background: rgba(255, 255, 255, 0.82);
}

.inbox {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 20px;
}

.inbox-item {
  width: 100%;
  text-align: left;
  padding: 16px;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  display: grid;
  gap: 10px;
  color: var(--text);
}

.inbox-preview-panel {
  min-height: 100%;
}

.preview-card,
.empty-state,
.draft-card,
.result-card {
  border: 1px solid var(--stroke);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  padding: 18px;
}

.empty-state {
  text-align: center;
  padding: 34px 18px;
}

.draft-card-head,
.preview-grid,
.template-metas,
.template-columns,
.action-row {
  display: flex;
  gap: 10px;
}

.draft-card-head,
.action-row {
  align-items: center;
  justify-content: space-between;
}

.preview-grid,
.template-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.template-card {
  width: 100%;
  text-align: left;
  padding: 18px;
  border: 1px solid var(--stroke);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  display: grid;
  gap: 10px;
}

.template-metas {
  flex-wrap: wrap;
}

.template-cta {
  color: var(--accent);
  font-weight: 800;
}

.results-feed {
  display: grid;
  gap: 12px;
}

.result-card {
  display: grid;
  gap: 10px;
}

.settings-form {
  gap: 16px;
}

.settings-form.compact {
  gap: 12px;
  margin-top: 12px;
}

.advanced-block {
  padding: 16px 0 0;
}

.advanced-block summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
}

.action-row.right {
  justify-content: flex-end;
}

.action-row.space-between {
  justify-content: space-between;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

button.primary,
button.secondary,
button.danger-btn {
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 800;
}

button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 16px 32px rgba(15, 118, 110, 0.22);
}

button.secondary,
button.ghost-chip {
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--stroke);
}

button.danger-btn {
  color: var(--danger);
  background: rgba(180, 35, 24, 0.12);
  border: 1px solid rgba(180, 35, 24, 0.18);
}

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

.pill.success {
  border-color: rgba(20, 153, 110, 0.2);
  background: rgba(20, 153, 110, 0.08);
}

.pill.warn {
  border-color: rgba(217, 119, 6, 0.2);
  background: rgba(217, 119, 6, 0.08);
}

.pill.danger {
  border-color: rgba(180, 35, 24, 0.2);
  background: rgba(180, 35, 24, 0.08);
}

.tiny-label {
  margin-bottom: 4px;
}

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

.action-row,
.preview-grid,
.template-columns,
.template-metas {
  flex-wrap: wrap;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--stroke);
  }

  .action-grid,
  .metrics,
  .two-up,
  .stage-grid,
  .preview-grid,
  .template-columns,
  .inbox {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .workspace {
    padding: 18px;
  }

  .page-hero,
  .page-hero.compact,
  .panel {
    padding: 18px;
  }

  .page-hero,
  .page-hero-meta,
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

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