:root {
  color-scheme: light;
  --bg: #eee4d2;
  --bg-top: #fbf3e4;
  --bg-bottom: #e7dbc5;
  --paper: rgba(255, 250, 242, 0.84);
  --paper-strong: rgba(255, 252, 247, 0.95);
  --ink: #1a1712;
  --muted: #6b6257;
  --line: rgba(112, 90, 52, 0.16);
  --line-strong: rgba(112, 90, 52, 0.26);
  --accent: #875f16;
  --accent-soft: rgba(243, 230, 197, 0.9);
  --teal: #0f766e;
  --teal-soft: rgba(212, 242, 238, 0.9);
  --live: #166534;
  --live-soft: rgba(220, 252, 231, 0.9);
  --warn: #b45309;
  --warn-soft: rgba(254, 243, 199, 0.92);
  --weak: #991b1b;
  --weak-soft: rgba(254, 226, 226, 0.92);
  --risk: #b44b1c;
  --risk-soft: rgba(255, 228, 216, 0.94);
  --shadow: 0 22px 80px rgba(37, 28, 12, 0.11);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 246, 219, 0.96), transparent 38%),
    radial-gradient(circle at top right, rgba(213, 239, 228, 0.68), transparent 32%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 42%, var(--bg-bottom) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.1), transparent 72%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.shell,
.login-shell {
  width: min(1520px, 100%);
  margin: 0 auto;
  padding: 24px 24px 40px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-card,
.surface,
.panel {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--paper);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.login-card::before,
.surface::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, rgba(135, 95, 22, 0.9), rgba(213, 183, 104, 0.85), rgba(15, 118, 110, 0.7));
}

.surface--metals::before {
  background: linear-gradient(90deg, rgba(150, 118, 48, 0.95), rgba(235, 214, 156, 0.88), rgba(169, 146, 81, 0.8));
}

.surface--risk::before {
  background: linear-gradient(90deg, rgba(180, 75, 28, 0.95), rgba(244, 161, 119, 0.88), rgba(176, 59, 40, 0.84));
}

.panel--trace::before {
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.92), rgba(86, 173, 165, 0.86), rgba(135, 95, 22, 0.72));
}

.login-card {
  width: min(460px, 100%);
  padding: 28px;
}

.login-card h1,
.toolbar h1,
.surface__title,
.panel h2 {
  margin: 0;
}

.stack-form,
.toolbar-actions,
.capability-strip,
.meta-strip,
.stats-row,
.card-badges,
.idea-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.stack-form {
  flex-direction: column;
}

.stack-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack-form input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 10px 15px;
  color: #fffdf8;
  background: linear-gradient(180deg, rgba(27, 23, 18, 0.98), rgba(44, 37, 30, 0.96));
  box-shadow: 0 10px 28px rgba(24, 19, 12, 0.18);
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(24, 19, 12, 0.22);
}

button.ghost {
  color: var(--ink);
  background: rgba(255, 251, 244, 0.68);
  border: 1px solid var(--line);
  box-shadow: none;
}

button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(112, 90, 52, 0.12);
}

.toolbar__brand {
  min-width: 0;
}

.eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.toolbar__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.toolbar h1 {
  font-size: clamp(1.5rem, 2.2vw, 1.95rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.toolbar__subtitle,
.hero-subtitle {
  margin: 6px 0 0;
  max-width: 680px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.toolbar-actions {
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.toolbar-actions form {
  flex: 0 0 auto;
}

.capability-pill,
.stats-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.74);
  line-height: 1;
}

.capability-pill__label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.capability-pill__value,
.stats-row span {
  font-size: 14px;
  font-weight: 600;
}

.capability-pill--main {
  border-color: rgba(135, 95, 22, 0.22);
  background: rgba(247, 236, 208, 0.72);
}

.capability-pill--metals {
  border-color: rgba(150, 118, 48, 0.24);
  background: rgba(248, 239, 214, 0.78);
}

.capability-pill--risk {
  border-color: rgba(180, 75, 28, 0.24);
  background: rgba(255, 236, 224, 0.82);
}

.capability-pill--muted {
  background: rgba(255, 252, 247, 0.56);
}

.capability-pill--warn {
  border-color: rgba(180, 83, 9, 0.22);
  background: rgba(254, 243, 199, 0.84);
}

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

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.workspace-main,
.surface-stack,
.surface-grid {
  display: grid;
  gap: 16px;
}

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

.surface,
.panel {
  padding: 22px;
}

.surface--risk {
  background: color-mix(in srgb, var(--paper) 88%, rgba(255, 232, 221, 0.92) 12%);
}

.surface__kicker,
.panel__kicker {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.surface__title-row,
.panel__title-row,
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.surface__title {
  font-size: clamp(1.3rem, 1.9vw, 1.7rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.surface--secondary .surface__title,
.panel h2 {
  font-size: clamp(1.18rem, 1.5vw, 1.4rem);
  letter-spacing: -0.03em;
}

.surface__meta,
.card-meta,
.muted,
.trace-live__meta,
.trace-live__symbols--muted,
.idea-level-label {
  color: var(--muted);
}

.surface__meta,
.card-meta,
.card-headline,
.error-text,
.surface__headline,
.surface__description {
  margin: 0 0 8px;
}

.surface__headline {
  max-width: 64ch;
  font-size: 0.96rem;
  line-height: 1.48;
  font-weight: 550;
}

.surface__description {
  max-width: 70ch;
  line-height: 1.72;
}

.empty-state {
  margin: 0;
  padding: 16px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  background: rgba(255, 252, 246, 0.56);
  color: var(--muted);
  line-height: 1.5;
}

.stats-row {
  gap: 8px;
  margin-bottom: 14px;
}

.stats-row span {
  color: var(--ink);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.badge--warn {
  color: var(--warn);
  background: var(--warn-soft);
}

.badge--live {
  color: var(--live);
  background: var(--live-soft);
}

.badge--weak {
  color: var(--weak);
  background: var(--weak-soft);
}

.badge--provisional {
  color: var(--teal);
  background: var(--teal-soft);
}

.badge--muted {
  color: var(--muted);
  background: rgba(255, 252, 247, 0.72);
  border: 1px solid rgba(112, 90, 52, 0.12);
}

.badge--tier,
.badge--direction {
  margin-right: 2px;
}

.badge--direction-buy {
  color: var(--live);
  background: color-mix(in srgb, var(--live-soft) 74%, white 26%);
}

.badge--direction-sell {
  color: #9f1239;
  background: color-mix(in srgb, var(--risk-soft) 78%, white 22%);
}

.badge--tier-strong {
  color: var(--live);
  background: color-mix(in srgb, var(--live-soft) 82%, white 18%);
}

.badge--tier-workable {
  color: var(--teal);
  background: color-mix(in srgb, var(--teal-soft) 78%, white 22%);
}

.badge--tier-weak {
  color: var(--warn);
  background: var(--warn-soft);
}

.card-badges {
  justify-content: flex-end;
}

.idea-strip-list {
  display: grid;
  gap: 12px;
}

.idea-strip {
  display: grid;
  grid-template-columns: minmax(120px, 0.58fr) minmax(0, 1.6fr) minmax(210px, 0.9fr);
  gap: 16px;
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(112, 90, 52, 0.1);
  background: rgba(255, 252, 247, 0.76);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.54);
}

.idea-strip--risk {
  background: rgba(255, 245, 239, 0.84);
}

.idea-strip--metals {
  background: rgba(250, 245, 232, 0.82);
}

.idea-strip__identity {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.idea-strip__rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(28, 24, 19, 0.08);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.idea-strip__identity-copy {
  min-width: 0;
}

.idea-strip__symbol-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.idea-strip__symbol {
  margin: 0;
  font-size: clamp(1.12rem, 1.6vw, 1.35rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.idea-strip__prob {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.idea-strip__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.idea-strip__thesis {
  min-width: 0;
}

.idea-strip__headline {
  margin: 0;
  max-width: 56ch;
  font-size: 0.95rem;
  line-height: 1.48;
  font-weight: 600;
}

.idea-strip__details {
  margin-top: 10px;
}

.idea-strip__details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  list-style: none;
}

.idea-strip__details summary::-webkit-details-marker {
  display: none;
}

.idea-strip__detail-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(112, 90, 52, 0.18);
}

.idea-strip__detail {
  display: grid;
  gap: 4px;
}

.idea-strip__detail-label,
.idea-strip__metric-label,
.idea-strip__support-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.idea-strip__detail-value {
  margin: 0;
  line-height: 1.6;
}

.idea-strip__plan {
  display: grid;
  gap: 8px;
  align-content: start;
}

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

.idea-strip__metric {
  padding: 10px 11px;
  border-radius: 14px;
  border: 1px solid rgba(112, 90, 52, 0.1);
  background: rgba(255, 255, 255, 0.5);
}

.idea-strip__metric-value,
.trace-time {
  display: block;
  margin-top: 4px;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.84rem;
  font-weight: 600;
}

.idea-strip__support {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.idea-strip__support-item {
  display: inline-grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.48);
}

.idea-strip__support-value {
  font-weight: 600;
}

.status-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed rgba(112, 90, 52, 0.16);
}

.status-line {
  display: grid;
  gap: 4px;
}

.status-line__label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-line__value {
  line-height: 1.55;
}

.trace-live {
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.48);
}

.trace-live--heartbeat {
  border-color: rgba(15, 118, 110, 0.3);
  background: rgba(222, 246, 240, 0.6);
}

.trace-live__title-row,
.trace-live__summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.trace-live__title {
  margin: 0;
  font-size: 15px;
}

.trace-live__progress {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.trace-live__text,
.trace-live__symbols {
  font-size: 13px;
}

.trace-live__symbols {
  margin-top: 8px;
}

.trace-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 72vh;
  overflow-y: auto;
}

.trace-row {
  display: grid;
  grid-template-columns: 74px 100px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(112, 90, 52, 0.1);
}

.trace-phase {
  color: var(--teal);
  font-weight: 700;
}

.trace-row--warn .trace-phase,
.trace-row--warn .trace-text {
  color: var(--warn);
}

.trace-row--error .trace-phase,
.trace-row--error .trace-text {
  color: var(--weak);
}

.trace-row--kind-ticker_started .trace-text,
.trace-row--kind-queue .trace-text,
.trace-row--kind-counts .trace-text {
  color: var(--muted);
}

.trace-footer {
  margin: 12px 0 0;
}

.error-text {
  color: var(--weak);
}

@media (max-width: 1180px) {
  .idea-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .idea-strip__headline {
    max-width: none;
  }

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

@media (max-width: 760px) {
  .shell,
  .login-shell {
    padding: 18px 14px 28px;
  }

  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions form {
    flex: 1 1 calc(50% - 12px);
  }

  .toolbar-actions button {
    width: 100%;
  }

  .surface,
  .panel,
  .login-card {
    border-radius: 24px;
  }

  .surface,
  .panel {
    padding: 18px;
  }

  .surface__title {
    font-size: 1.45rem;
  }

  .surface--secondary .surface__title,
  .panel h2 {
    font-size: 1.22rem;
  }

  .surface__title-row,
  .panel__title-row,
  .card-head {
    flex-direction: column;
  }

  .card-badges {
    justify-content: flex-start;
  }

  .idea-strip {
    gap: 14px;
    padding: 16px 14px;
  }

  .idea-strip__plan-grid {
    grid-template-columns: 1fr 1fr;
  }

  .trace-list {
    max-height: none;
  }

  .trace-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 540px) {
  .toolbar h1 {
    font-size: 1.35rem;
  }

  .toolbar__subtitle,
  .hero-subtitle {
    font-size: 0.88rem;
  }

  .idea-strip__symbol-row {
    align-items: flex-start;
  }

  .idea-strip__plan-grid {
    grid-template-columns: 1fr;
  }
}
