:root {
  --bg: #f2ede4;
  --bg-soft: #f7f2ea;
  --card: rgba(255, 251, 246, 0.9);
  --card-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(33, 40, 48, 0.1);
  --ink: #152028;
  --muted: #5f6b75;
  --accent: #cb5a2f;
  --accent-deep: #963a17;
  --teal: #156d67;
  --teal-deep: #0f5752;
  --danger: #9a2c31;
  --cream: #fff5e7;
  --shadow: 0 24px 60px rgba(21, 32, 40, 0.12);
  --shadow-soft: 0 18px 34px rgba(21, 32, 40, 0.08);
  --radius: 26px;
  --radius-lg: 32px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(203, 90, 47, 0.18), transparent 24rem),
    radial-gradient(circle at top right, rgba(21, 109, 103, 0.18), transparent 20rem),
    linear-gradient(180deg, #fcf8f1 0%, var(--bg) 100%);
}

a {
  color: inherit;
}

.page-shell {
  width: min(1380px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.6rem 0 3rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.95fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.hero-copy,
.hero-panel,
.panel,
.flash {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-copy {
  position: relative;
  overflow: hidden;
  min-height: 280px;
  padding: 2.2rem;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.12), transparent 14rem),
    linear-gradient(145deg, #17252e 0%, #24343f 56%, #314756 100%);
  color: #f7f5f0;
}

.hero-copy::after {
  content: "";
  position: absolute;
  inset: auto -5rem -7rem auto;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(203, 90, 47, 0.38), transparent 70%);
  pointer-events: none;
}

.eyebrow,
.section-label {
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.77rem;
  font-family: "IBM Plex Mono", monospace;
}

.eyebrow {
  color: #ffd6ba;
}

.section-label {
  color: var(--accent);
}

.hero-copy h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 12ch;
  font-size: clamp(2.5rem, 4.8vw, 4.8rem);
  line-height: 0.94;
}

.hero-text {
  position: relative;
  z-index: 1;
  max-width: 42rem;
  margin: 1rem 0 0;
  color: rgba(247, 245, 240, 0.82);
  font-size: 1.03rem;
}

.hero-badge-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.3rem;
}

.hero-badge,
.builder-highlight,
.chart-stamp {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  font-size: 0.88rem;
}

.hero-badge {
  color: #fff6ed;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.hero-panel {
  padding: 1.35rem;
  background: linear-gradient(180deg, rgba(255, 251, 246, 0.96), rgba(245, 239, 228, 0.92));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.hero-stat {
  padding: 1rem;
  border-radius: 22px;
  border: 1px solid rgba(21, 32, 40, 0.08);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-soft);
}

.hero-stat-icon,
.alert-icon,
.channel-icon {
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
}

.hero-stat-icon {
  width: 2.4rem;
  height: 2.4rem;
  margin-bottom: 0.7rem;
  background: rgba(203, 90, 47, 0.12);
  color: var(--accent);
}

.hero-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.87rem;
}

.hero-stat strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.18rem;
}

.hero-note {
  grid-column: 1 / -1;
  padding: 1rem 1.1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(21, 32, 40, 0.08);
  display: grid;
  gap: 0.7rem;
}

.hero-note-head p:last-child {
  margin: -0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.channel-row {
  display: grid;
  grid-template-columns: auto auto auto 1fr;
  gap: 0.7rem;
  align-items: center;
}

.channel-icon {
  width: 2rem;
  height: 2rem;
  background: rgba(21, 109, 103, 0.1);
  color: var(--teal);
}

.channel-name {
  font-weight: 700;
}

.channel-row small {
  color: var(--muted);
}

.flash-stack {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.flash {
  padding: 1rem 1.15rem;
  background: var(--card-strong);
  font-size: 0.96rem;
}

.flash-success {
  border-left: 5px solid var(--teal);
}

.flash-error {
  border-left: 5px solid var(--danger);
}

.panel {
  padding: 1.3rem;
  background: var(--card);
}

.panel + .panel {
  margin-top: 1rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-head h2,
.section-head h3,
.builder-banner h3 {
  margin: 0;
}

.panel-head p,
.section-head p,
.builder-banner p,
.chart-row-copy p,
.alert-card p,
.empty-state,
.muted {
  color: var(--muted);
}

.panel-head p {
  margin: 0;
}

.panel-head-rich {
  align-items: center;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.chart-stamp {
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  background: rgba(21, 32, 40, 0.06);
}

.chart-wrap,
.alert-list,
.results-grid {
  display: grid;
  gap: 0.9rem;
}

.chart-row-card {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr) minmax(220px, 320px);
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--card-strong);
  box-shadow: var(--shadow-soft);
}

.chart-thumb,
.result-image {
  position: relative;
  overflow: hidden;
  display: block;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(203, 90, 47, 0.14), rgba(21, 109, 103, 0.14));
}

.chart-thumb {
  height: 118px;
}

.chart-thumb img,
.result-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chart-thumb-fallback,
.result-image-fallback {
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  font-weight: 500;
}

.chart-thumb-fallback span,
.result-image-fallback span {
  display: inline-grid;
  gap: 0.35rem;
}

.chart-row-copy {
  display: grid;
  gap: 0.55rem;
}

.chart-row-top,
.result-topline,
.button-row,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.chart-title,
.result-body h3 a,
.text-link {
  font-weight: 700;
  text-decoration: none;
}

.chart-title {
  font-size: 1.1rem;
}

.chart-title:hover,
.result-body h3 a:hover,
.text-link:hover {
  text-decoration: underline;
}

.chart-row-copy p,
.result-body h3,
.alert-card h3 {
  margin: 0;
}

.chart-row-meta,
.alert-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.chart-row-meta span,
.alert-meta span,
.result-image-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.72rem;
  border-radius: 999px;
  font-size: 0.84rem;
}

.chart-row-meta span {
  background: rgba(21, 32, 40, 0.06);
  color: var(--ink);
}

.category-chip {
  background: rgba(21, 109, 103, 0.08) !important;
  color: var(--teal) !important;
}

.chart-row-visual {
  display: grid;
  gap: 0.6rem;
}

.bar-caption {
  color: var(--muted);
  font-size: 0.88rem;
}

.chart-bar-track {
  height: 2.2rem;
  border-radius: 999px;
  background: rgba(21, 32, 40, 0.08);
  overflow: hidden;
}

.chart-bar-fill {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 4rem;
  height: 100%;
  padding-right: 0.75rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #f39661);
  color: #fff;
  font-family: "IBM Plex Mono", monospace;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.95fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.builder-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.05rem;
  margin-bottom: 1rem;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(21, 109, 103, 0.1), rgba(203, 90, 47, 0.09)),
    var(--card-strong);
  border: 1px solid rgba(21, 32, 40, 0.08);
}

.builder-banner h3 {
  font-size: 1.25rem;
}

.builder-banner p {
  margin: 0.45rem 0 0;
}

.builder-highlights {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
}

.builder-highlight {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(21, 32, 40, 0.08);
  color: var(--ink);
}

.strategy-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.strategy-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  align-items: start;
  padding: 0.95rem 1rem;
  border-radius: 22px;
  border: 1px solid rgba(21, 32, 40, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.strategy-card h3 {
  margin: 0;
  font-size: 1rem;
}

.strategy-card p {
  margin: 0.35rem 0 0;
  font-size: 0.93rem;
  color: var(--muted);
}

.strategy-icon {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 16px;
  background: rgba(203, 90, 47, 0.1);
  color: var(--accent);
}

.control-form {
  display: grid;
  gap: 1rem;
}

.builder-section {
  padding: 1rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(21, 32, 40, 0.08);
}

.builder-section-alert {
  background:
    linear-gradient(135deg, rgba(255, 245, 231, 0.95), rgba(242, 248, 247, 0.9));
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head p {
  max-width: 29rem;
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
}

.alert-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-grid label {
  display: grid;
  gap: 0.45rem;
}

.full {
  grid-column: 1 / -1;
}

.field-label,
.alert-stats dt,
.result-stats dt {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(21, 32, 40, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  padding: 0.82rem 0.95rem;
  font: inherit;
  box-shadow: none;
}

.form-control,
.form-select {
  border-radius: 18px;
  border-color: rgba(21, 32, 40, 0.12);
  background-color: rgba(255, 255, 255, 0.94);
  color: var(--ink);
}

textarea {
  resize: vertical;
  min-height: 5.5rem;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus,
.form-select:focus {
  border-color: rgba(203, 90, 47, 0.36);
  box-shadow: 0 0 0 0.24rem rgba(203, 90, 47, 0.12);
  outline: none;
}

.inline-input {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

.inline-addon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0 0.8rem;
  border-radius: 16px;
  background: rgba(21, 32, 40, 0.06);
  color: var(--muted);
  white-space: nowrap;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #f38c55);
  color: #fff;
  box-shadow: 0 14px 28px rgba(203, 90, 47, 0.24);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--teal), #22938b);
  color: #fff;
  box-shadow: 0 14px 28px rgba(21, 109, 103, 0.18);
}

.btn-ghost {
  background: rgba(21, 32, 40, 0.06);
  color: var(--ink);
}

.btn-danger {
  background: rgba(154, 44, 49, 0.12);
  color: var(--danger);
}

.alert-card,
.result-card {
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--card-strong);
  box-shadow: var(--shadow-soft);
}

.alert-card {
  padding: 1rem;
}

.alert-card-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
}

.alert-title-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.alert-icon {
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(203, 90, 47, 0.12);
  color: var(--accent);
  flex: 0 0 auto;
}

.pill,
.score-chip,
.time-chip,
.channel-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.35rem 0.72rem;
  border-radius: 999px;
  font-size: 0.84rem;
  font-family: "IBM Plex Mono", monospace;
}

.pill-live {
  background: rgba(21, 109, 103, 0.1);
  color: var(--teal);
}

.pill-muted {
  background: rgba(21, 32, 40, 0.08);
  color: var(--muted);
}

.alert-meta span {
  background: rgba(255, 245, 231, 0.88);
  color: #654329;
}

.alert-stats,
.result-stats {
  display: grid;
  gap: 0.8rem;
  margin: 0;
}

.alert-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.95rem;
}

.alert-stats div,
.result-stats div {
  display: grid;
  gap: 0.18rem;
}

.alert-stats dd,
.alert-stats dt,
.result-stats dd,
.result-stats dt {
  margin: 0;
}

.alert-error {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.9rem 0 0;
  padding: 0.75rem 0.85rem;
  border-radius: 16px;
  background: rgba(154, 44, 49, 0.08);
  color: var(--danger);
}

.panel-results .results-grid {
  grid-template-columns: repeat(auto-fit, minmax(295px, 1fr));
}

.result-card {
  overflow: hidden;
  display: grid;
  grid-template-rows: 220px 1fr;
}

.result-image {
  height: 100%;
}

.result-image::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 55%;
  background: linear-gradient(180deg, transparent 0%, rgba(21, 32, 40, 0.72) 100%);
  pointer-events: none;
}

.result-image-fallback::after {
  display: none;
}

.result-image-pill {
  position: absolute;
  left: 0.9rem;
  bottom: 0.9rem;
  z-index: 1;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-weight: 700;
}

.result-body {
  padding: 1rem;
}

.score-chip {
  background: rgba(203, 90, 47, 0.1);
  color: var(--accent-deep);
}

.time-chip {
  background: rgba(21, 109, 103, 0.1);
  color: var(--teal);
}

.result-body h3 {
  font-size: 1.14rem;
}

.result-stats {
  margin: 1rem 0;
}

.text-link {
  color: var(--accent-deep);
}

code {
  padding: 0.14rem 0.35rem;
  border-radius: 8px;
  background: rgba(21, 32, 40, 0.06);
  color: var(--accent-deep);
}

.empty-state {
  padding: 1.4rem;
  border: 1px dashed rgba(21, 32, 40, 0.16);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
}

@media (max-width: 1180px) {
  .hero,
  .dashboard-grid,
  .builder-banner,
  .strategy-strip,
  .chart-row-card {
    grid-template-columns: 1fr;
  }

  .chart-row-card {
    align-items: stretch;
  }

  .chart-thumb {
    height: 180px;
  }

  .builder-highlights {
    justify-content: flex-start;
  }
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100vw - 1rem, 100%);
    padding-top: 1rem;
  }

  .hero-copy,
  .hero-panel,
  .panel {
    padding: 1rem;
  }

  .hero-panel,
  .alert-stats,
  .channel-row {
    grid-template-columns: 1fr;
  }

  .channel-row {
    justify-items: flex-start;
  }

  .panel-head,
  .panel-actions,
  .section-head,
  .alert-card-top,
  .result-topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .inline-input {
    grid-template-columns: 1fr;
  }

  .inline-addon {
    justify-content: flex-start;
  }
}
