:root {
  color-scheme: light;
  --bg: #eef2ef;
  --panel: #ffffff;
  --panel-soft: #f8faf8;
  --ink: #17211d;
  --muted: #64706b;
  --line: #d9e1dc;
  --green: #0f8f68;
  --green-dark: #0a604a;
  --coral: #db6b4c;
  --amber: #b7791f;
  --blue: #315f9c;
  --red: #b83232;
  --shadow: 0 18px 50px rgba(23, 33, 29, 0.08);
  --radius: 8px;
  --sidebar: 280px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

#codex-browser-sidebar-comments-root {
  pointer-events: none !important;
  z-index: -1 !important;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-width: 0;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
  height: 100vh;
  padding: 24px;
  background: #14241f;
  color: #f6fbf8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  overflow: hidden;
  border: 1px solid rgba(242, 193, 78, 0.55);
  border-radius: 12px;
  background:
    radial-gradient(circle at 68% 30%, rgba(255, 255, 255, 0.88), transparent 13%),
    linear-gradient(135deg, #f7d75c 0%, #13a36f 52%, #083b30 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 10px 22px rgba(0, 0, 0, 0.22);
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  box-shadow:
    inset 0 0 0 5px rgba(20, 36, 31, 0.82),
    inset 0 0 0 9px rgba(242, 193, 78, 0.92);
}

.brand-mark::after {
  content: "";
  position: absolute;
  right: 7px;
  top: 9px;
  width: 18px;
  height: 9px;
  border-bottom: 5px solid #f7d75c;
  border-left: 5px solid #f7d75c;
  border-radius: 2px;
  transform: rotate(-45deg);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.28));
}

.brand-orbit {
  position: absolute;
  inset: 6px 5px 5px 6px;
  border-bottom: 3px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  transform: rotate(-18deg);
}

.brand-hit {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(20, 36, 31, 0.42);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: #b7c7bf;
  font-size: 0.78rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: #d9e7e0;
  text-decoration: none;
}

.nav-item span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #f2c14e;
  font-weight: 700;
}

.nav-item.is-active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.09);
}

.account-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.account-card span,
.account-card strong,
.account-card small {
  display: block;
}

.account-card span {
  color: #b7c7bf;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.account-card strong {
  margin-top: 8px;
  color: #fff;
  font-size: 1.25rem;
}

.account-card small {
  margin-top: 4px;
  color: #c3d4cc;
}

.account-card .is-hidden {
  display: none;
}

.sidebar-login {
  width: 100%;
  min-height: 38px;
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 900;
}

.sidebar-upgrade {
  width: 100%;
  min-height: 40px;
  margin-top: 14px;
  border: 0;
  border-radius: 8px;
  background: #f2c14e;
  color: #17211d;
  font-weight: 900;
}

.workspace {
  width: min(100%, 1440px);
  min-width: 0;
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.sales-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 248, 232, 0.9), rgba(255, 255, 255, 0.78) 46%, rgba(231, 246, 239, 0.9)),
    #fff;
  box-shadow: var(--shadow);
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 16px;
}

.hero-copy h1 {
  max-width: 880px;
}

.hero-copy p:not(.eyebrow) {
  max-width: 760px;
  margin: 0;
  color: #42504a;
  font-size: 1.08rem;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions .primary-button,
.hero-actions .upgrade-button,
.hero-actions .outline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  text-decoration: none;
}

.pwa-install-button.is-hidden {
  display: none;
}

.hero-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-trust span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(23, 33, 29, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #42504a;
  font-size: 0.78rem;
  font-weight: 900;
}

.hero-offer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-content: center;
}

.hero-benefit,
.hero-tools {
  border: 1px solid rgba(23, 33, 29, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
}

.hero-benefit {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.hero-benefit span:first-child {
  color: var(--green-dark);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hero-benefit strong {
  font-size: 1.18rem;
  line-height: 1.15;
}

.hero-benefit small {
  color: var(--muted);
  line-height: 1.45;
}

.hero-benefit.is-secondary {
  background: rgba(248, 250, 248, 0.92);
}

.hero-tools {
  display: grid;
  grid-template-columns: minmax(92px, auto) minmax(88px, 1fr);
  gap: 8px;
  align-items: center;
  padding: 10px;
}

.copy-games-button {
  padding: 0 12px;
  white-space: nowrap;
}

.founder-invite {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #e8d9b9;
  border-radius: 8px;
  background: #fffdf6;
  color: #46381b;
}

.founder-invite.is-hidden {
  display: none;
}

.founder-invite h2 {
  font-size: 1rem;
}

.founder-invite p:not(.eyebrow) {
  margin: 4px 0 0;
  color: #6c5a32;
  font-size: 0.92rem;
  line-height: 1.45;
}

.founder-perks {
  display: none;
}

.founder-perks span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(70, 56, 27, 0.16);
  border-radius: 999px;
  background: #fff;
  color: #46381b;
  font-size: 0.78rem;
  font-weight: 900;
}

.founder-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, auto));
  gap: 8px;
}

.founder-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 138px;
  text-decoration: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1;
}

h2 {
  font-size: 1.12rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.primary-button,
.icon-button,
.upgrade-button,
.outline-button {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  min-height: 44px;
  padding: 0 18px;
  background: var(--green);
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 143, 104, 0.24);
}

.primary-button:hover {
  background: var(--green-dark);
}

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

.upgrade-button {
  min-height: 44px;
  padding: 0 16px;
  background: #17211d;
  color: #fff;
}

.outline-button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.plan-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}

.subscription-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.6fr) minmax(170px, auto);
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.subscription-copy {
  display: grid;
  gap: 4px;
}

.subscription-copy span {
  color: var(--muted);
  line-height: 1.4;
}

.subscription-details {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.subscription-details div {
  display: grid;
  gap: 6px;
  min-height: 74px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.subscription-details dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.subscription-details dd {
  margin: 0;
  align-self: end;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 900;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  max-width: 100%;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2ef;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.status-badge.is-approved {
  background: #e7f6ef;
  color: var(--green-dark);
}

.status-badge.is-pending {
  background: #fff4d9;
  color: #7c5614;
}

.status-badge.is-problem {
  background: #fde9e7;
  color: var(--red);
}

.subscription-actions {
  display: grid;
  gap: 8px;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.control-panel,
.result-panel,
.analysis-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.control-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.result-panel {
  min-width: 0;
  padding: 18px;
}

.panel-heading {
  display: grid;
  gap: 2px;
}

.control-heading {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.matrix-heading {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.control-generate-button {
  min-width: 132px;
  box-shadow: none;
}

.panel-heading.compact {
  margin-bottom: 14px;
}

.field-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-group legend,
.field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.segmented label,
.strategy-option {
  position: relative;
}

.segmented input,
.strategy-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.segmented span {
  display: grid;
  place-items: center;
  min-height: 38px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
}

.segmented input:checked + span {
  background: #17211d;
  color: #fff;
}

.field input[type="number"],
.money-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.field input[type="number"] {
  padding: 0 12px;
  color: var(--ink);
}

.money-input {
  display: flex;
  align-items: center;
  overflow: hidden;
}

.money-input span {
  display: grid;
  place-items: center;
  align-self: stretch;
  min-width: 46px;
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 900;
}

.money-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 0 12px;
  outline: none;
}

.split-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.strategy-list {
  display: grid;
  gap: 8px;
}

.strategy-option > span {
  display: grid;
  gap: 3px;
  min-height: 64px;
  padding: 10px 12px 10px 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.strategy-option > span::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 14px;
  width: 14px;
  height: 14px;
  border: 2px solid #aab7b1;
  border-radius: 999px;
}

.strategy-option input:checked + span {
  border-color: rgba(15, 143, 104, 0.55);
  background: #effaf6;
}

.strategy-option input:checked + span::before {
  border-color: var(--green);
  background: radial-gradient(circle, var(--green) 42%, transparent 46%);
}

.strategy-option small {
  color: var(--muted);
}

.strategy-option em {
  display: inline-grid;
  place-items: center;
  min-height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #17211d;
  color: #fff;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

.source-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #eef5ff;
}

.source-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.source-box-head button {
  min-height: 30px;
  border: 1px solid #c6d8f4;
  border-radius: 999px;
  padding: 0 10px;
  background: #fff;
  color: #24507d;
  font-size: 0.76rem;
  font-weight: 900;
}

.source-box span {
  color: #42566f;
  font-size: 0.9rem;
  line-height: 1.35;
}

.source-box .source-status {
  color: #244a36;
  font-weight: 800;
}

.paywall-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #f0d7a4;
  border-radius: 8px;
  background: #fff8e8;
}

.paywall-box.is-hidden {
  display: none;
}

.paywall-box span {
  color: #6c5a32;
  font-size: 0.9rem;
  line-height: 1.35;
}

.paywall-box button {
  justify-self: start;
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: var(--amber);
  color: #fff;
  font-weight: 900;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.metric span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  align-self: end;
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  line-height: 1.05;
}

.ticket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 10px;
}

.matrix-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 96px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.matrix-empty strong {
  color: var(--green-dark);
}

.matrix-empty span {
  color: var(--muted);
  font-weight: 800;
}

.closing-summary {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #cfe6dc;
  border-radius: 8px;
  background: #f1fbf7;
}

.closing-summary.is-hidden {
  display: none;
}

.closing-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 8px;
}

.closing-metrics .metric {
  min-height: 78px;
  padding: 12px;
  background: #fff;
}

.closing-metrics .metric strong {
  font-size: 1.12rem;
}

.closing-pool {
  display: grid;
  gap: 8px;
}

.closing-pool > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

#closingPoolList {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pool-ball {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--green-dark);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

.closing-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.ticket-card {
  display: grid;
  gap: 12px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ticket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ticket-header strong {
  color: var(--green-dark);
}

.ticket-header span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.number-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ball {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #17211d;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 900;
}

.ticket-card:nth-child(3n + 1) .ball {
  background: var(--green-dark);
}

.ticket-card:nth-child(3n + 2) .ball {
  background: var(--blue);
}

.ticket-card:nth-child(3n) .ball {
  background: #7c4d21;
}

.ticket-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 18px;
  margin-top: 18px;
}

.matrix-history {
  grid-column: 1 / -1;
}

.history-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.history-status {
  margin: 0 0 14px;
  color: var(--muted);
}

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}

.history-card {
  display: grid;
  gap: 12px;
  min-height: 212px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.history-stats div {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.history-stats dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.history-stats dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-weight: 900;
}

.history-open {
  justify-self: start;
}

.analysis-panel {
  padding: 18px;
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  gap: 8px;
}

.heat-cell {
  display: grid;
  gap: 6px;
  min-height: 58px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.heat-cell strong {
  font-size: 0.9rem;
}

.heat-bar {
  align-self: end;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.heat-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--coral);
}

.diagnostics {
  display: grid;
  gap: 10px;
  margin: 0;
}

.diagnostics div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.diagnostics dt {
  color: var(--muted);
  font-weight: 800;
}

.diagnostics dd {
  margin: 0;
  text-align: right;
  font-weight: 900;
}

textarea {
  width: 100%;
  min-height: 146px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  line-height: 1.4;
}

.audit-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
  margin-top: 18px;
}

.audit-helper {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.audit-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.audit-bars {
  display: grid;
  gap: 8px;
}

.audit-bar {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}

.audit-bar strong,
.audit-bar small {
  font-size: 0.84rem;
}

.audit-bar span {
  display: block;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.audit-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--amber);
}

.audit-findings {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.45;
}

.backtest-panel {
  margin-top: 18px;
}

.backtest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}

.backtest-card {
  display: grid;
  gap: 14px;
  min-height: 220px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.backtest-stats {
  display: grid;
  gap: 8px;
  margin: 0;
}

.backtest-stats div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
}

.backtest-stats dt {
  color: var(--muted);
  font-weight: 800;
}

.backtest-stats dd {
  margin: 0;
  text-align: right;
  font-weight: 900;
}

.backtest-stats small {
  color: var(--green-dark);
  font-size: 0.78rem;
}

.pricing-section {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.responsible-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) auto;
  gap: 18px;
  align-items: center;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.responsible-panel div:first-child {
  display: grid;
  gap: 8px;
}

.responsible-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.responsible-links {
  display: grid;
  gap: 8px;
}

.responsible-links .outline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.faq-section {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.faq-grid details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.faq-grid summary {
  cursor: pointer;
  padding: 14px;
  color: var(--ink);
  font-weight: 900;
}

.faq-grid p {
  margin: 0;
  padding: 0 14px 14px;
  color: var(--muted);
  line-height: 1.45;
}

.public-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 18px;
  padding: 16px 4px 4px;
  color: var(--muted);
}

.public-footer strong {
  color: var(--ink);
}

.public-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-left: auto;
}

.public-footer a,
.modal-note a {
  color: var(--green-dark);
  font-weight: 900;
}

.legal-shell {
  min-height: 100vh;
  padding: 32px;
}

.legal-page {
  width: min(920px, 100%);
  margin: 0 auto;
}

.legal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.legal-topbar .brand {
  position: static;
  color: var(--ink);
}

.legal-topbar .brand small {
  color: var(--muted);
}

.legal-topbar a:not(.brand) {
  color: var(--green-dark);
  font-weight: 900;
}

.legal-copy {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.legal-copy h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.legal-copy h2 {
  margin-top: 24px;
}

.legal-copy p,
.legal-copy li {
  color: var(--muted);
  line-height: 1.6;
}

.legal-copy a {
  color: var(--green-dark);
  font-weight: 900;
}

.legal-copy p {
  margin: 10px 0 0;
}

.legal-copy ul {
  display: grid;
  gap: 7px;
  padding-left: 20px;
}

.help-copy ol {
  padding-left: 20px;
}

.help-callout {
  display: grid;
  gap: 4px;
  margin: 22px 0;
  padding: 16px;
  border: 1px solid #e8d9b9;
  border-radius: 8px;
  background: #fff8e8;
  color: #46381b;
}

.help-callout span {
  color: #6c5a32;
  line-height: 1.45;
}

.help-callout strong,
.help-steps strong,
.help-grid h3 {
  color: var(--ink);
}

.help-steps {
  display: grid;
  gap: 12px;
  margin: 14px 0 28px;
}

.help-steps li {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

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

.help-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.help-grid h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.help-grid p {
  margin: 0;
}

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

.help-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.legal-meta {
  color: var(--green-dark);
  font-weight: 900;
}

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

.sales-assurance {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.sales-assurance article {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.sales-assurance strong {
  color: var(--ink);
}

.sales-assurance span,
.pricing-note {
  color: var(--muted);
  line-height: 1.45;
}

.pricing-note {
  margin: 14px 0 0;
}

.pricing-note a {
  color: var(--green-dark);
  font-weight: 900;
}

.price-card {
  display: grid;
  gap: 16px;
  align-content: space-between;
  min-height: 340px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.price-card.is-featured {
  border-color: rgba(15, 143, 104, 0.42);
  box-shadow: 0 18px 34px rgba(15, 143, 104, 0.12);
}

.plan-label {
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.price-card h3 {
  margin: 8px 0 8px;
  font-size: 2rem;
}

.price-card h3 span {
  color: var(--muted);
  font-size: 0.9rem;
}

.price-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.price-card ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
}

.plan-button {
  display: grid;
  place-items: center;
  text-decoration: none;
  width: 100%;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(20, 36, 31, 0.58);
}

.modal-backdrop.is-open {
  display: grid;
}

.upgrade-modal {
  position: relative;
  width: min(620px, 100%);
  padding: 20px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(23, 33, 29, 0.25);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.upgrade-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.upgrade-options.is-hidden,
.modal-support-link.is-hidden,
.auth-tabs button.is-hidden,
.auth-forgot-button.is-hidden,
.reset-dev-link.is-hidden {
  display: none;
}

.upgrade-option {
  display: grid;
  gap: 8px;
  min-height: 150px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  text-decoration: none;
  text-align: left;
}

.upgrade-option:hover {
  border-color: var(--green);
  background: #effaf6;
}

.upgrade-option.is-disabled {
  opacity: 0.55;
}

.upgrade-option strong {
  color: var(--green-dark);
  font-size: 1.2rem;
}

.upgrade-option span {
  font-weight: 900;
}

.upgrade-option small,
.modal-note {
  color: var(--muted);
  line-height: 1.4;
}

.modal-note {
  margin: 14px 0 0;
}

.modal-support-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  text-decoration: none;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 0 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.auth-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.auth-tabs button.is-active {
  background: #17211d;
  color: #fff;
}

.auth-helper {
  margin: -2px 0 14px;
  color: var(--muted);
  line-height: 1.45;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.text-button {
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--green-dark);
  font-weight: 900;
  text-align: left;
}

.auth-forgot-button {
  justify-self: start;
  padding: 0;
}

.reset-dev-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid #c6d8f4;
  border-radius: 8px;
  background: #eef5ff;
  color: #24507d;
  font-weight: 900;
  text-decoration: none;
}

.field input[type="email"],
.field input[type="password"],
.field input[type="text"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #17211d;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .nav-list {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }

  .account-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 0;
  }

  .account-card span,
  .account-card strong,
  .account-card small {
    grid-column: 1 / -1;
  }

  .account-card .sidebar-upgrade {
    margin-top: 12px;
  }

  .layout-grid,
  .analysis-grid,
  .audit-grid,
  .sales-hero,
  .founder-invite,
  .subscription-panel,
  .pricing-grid,
  .sales-assurance,
  .faq-grid,
  .help-grid,
  .closing-metrics,
  .responsible-panel {
    grid-template-columns: 1fr;
  }

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

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

  .sidebar {
    gap: 14px;
    padding: 14px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .topbar,
  .sales-hero,
  .founder-invite {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .hero-actions,
  .founder-actions,
  .control-heading,
  .matrix-heading,
  .metrics-row,
  .audit-summary,
  .subscription-details,
  .split-fields {
    grid-template-columns: 1fr;
  }

  .top-actions {
    display: grid;
  }

  .nav-list {
    display: flex;
    grid-template-columns: none;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-item {
    flex: 0 0 auto;
    min-height: 40px;
    white-space: nowrap;
  }

  .nav-item span {
    width: 22px;
    height: 22px;
  }

  .nav-item.mobile-optional,
  .subscription-panel,
  .founder-invite,
  .analysis-grid {
    display: none;
  }

  .sales-hero {
    padding: 18px;
  }

  .hero-actions {
    display: grid;
  }

  .hero-actions .primary-button,
  .hero-actions .upgrade-button,
  .hero-actions .outline-button {
    min-width: 0;
    width: 100%;
  }

  .hero-tools {
    grid-template-columns: 1fr;
  }

  .founder-actions {
    display: grid;
  }

  .founder-actions a {
    width: 100%;
  }

  .account-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
  }

  .account-card span,
  .account-card strong,
  .account-card small {
    grid-column: 1 / -1;
  }

  .account-card .sidebar-login,
  .account-card .sidebar-upgrade {
    margin-top: 8px;
  }

  .history-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .icon-button,
  .primary-button,
  .upgrade-button,
  .outline-button {
    width: 100%;
  }

  .upgrade-options {
    grid-template-columns: 1fr;
  }

  .responsible-links {
    grid-template-columns: 1fr;
  }

  .public-footer nav {
    width: 100%;
    margin-left: 0;
  }

  .legal-shell {
    padding: 16px;
  }

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

  .legal-copy {
    padding: 18px;
  }

  .auth-actions {
    grid-template-columns: 1fr;
  }

  .help-actions {
    display: grid;
  }

  .help-actions a {
    width: 100%;
  }

  .metrics-row {
    display: grid;
  }

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