:root {
  --navy: #07111f;
  --navy-2: #0d1c30;
  --navy-3: #122844;
  --paper: #fffdf8;
  --cream: #f6f0e3;
  --gold: #efc469;
  --gold-2: #c99535;
  --ink: #16253a;
  --muted: #6a7789;
  --teal: #49aaa4;
  --line: rgba(17, 39, 66, 0.14);
  --shadow: 0 24px 70px rgba(4, 15, 29, 0.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img, video { display: block; max-width: 100%; }
a { color: inherit; }
.skip-link { position: fixed; left: 12px; top: 12px; z-index: 999; padding: 10px 14px; transform: translateY(-180%); background: white; border-radius: 10px; }
.skip-link:focus { transform: none; }
.eyebrow { margin: 0 0 10px; color: var(--gold-2); font-size: 0.72rem; font-weight: 900; letter-spacing: 0.18em; text-transform: uppercase; }
h1, h2, h3 { margin-top: 0; font-family: Georgia, "Times New Roman", serif; line-height: 1.04; letter-spacing: -0.035em; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 4vw, 3.3rem); }
h2 { margin-bottom: 16px; font-size: clamp(2.1rem, 4vw, 4.3rem); }
h3 { margin-bottom: 10px; font-size: 1.45rem; }
.primary-button, .quiet-button, .plan-grid button, .plan-grid a { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 17px; border: 1px solid transparent; border-radius: 999px; font-weight: 800; text-decoration: none; cursor: pointer; }
.primary-button { background: var(--gold); color: var(--navy); box-shadow: 0 10px 26px rgba(201, 149, 53, .18); }
.quiet-button { border-color: var(--line); background: rgba(255,255,255,.7); color: var(--ink); }
.button-row, .header-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.preview-gate { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 75% 15%, rgba(239,196,105,.18), transparent 30%), var(--navy); color: white; }
.preview-gate[hidden] { display: none; }
.gate-card { width: min(100%, 520px); padding: clamp(28px, 7vw, 54px); border: 1px solid rgba(255,255,255,.13); border-radius: 30px; background: rgba(15, 33, 56, .82); box-shadow: var(--shadow); backdrop-filter: blur(22px); }
.gate-card p:not(.eyebrow) { color: rgba(255,255,255,.68); }
.gate-card label { display: grid; gap: 8px; margin: 18px 0 14px; color: rgba(255,255,255,.78); font-size: .86rem; font-weight: 750; }
.gate-card input { width: 100%; min-height: 50px; padding: 0 16px; border: 1px solid rgba(255,255,255,.17); border-radius: 13px; background: rgba(255,255,255,.08); color: white; }
.gate-card .primary-button { width: 100%; }
.gate-card > a { display: block; margin-top: 18px; color: rgba(255,255,255,.55); text-align: center; font-size: .82rem; }
.gate-status { min-height: 20px; margin: 4px 0 14px !important; color: rgba(255,255,255,.58) !important; font-size: .76rem; }
.gate-mark, .brand-mark { display: grid; place-items: center; border: 1px solid rgba(239,196,105,.55); color: var(--gold); font-family: Georgia, serif; }
.gate-mark { width: 58px; aspect-ratio: 1; margin-bottom: 24px; border-radius: 50%; font-size: 1.5rem; }
.app-shell { min-width: 0; min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar { min-width: 0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; overflow: hidden; padding: 28px 20px 20px; background: var(--navy); color: white; }
.app-brand { display: flex; align-items: center; gap: 12px; color: white; text-decoration: none; }
.brand-mark { width: 42px; aspect-ratio: 1; border-radius: 50%; }
.app-brand b, .app-brand small { display: block; }
.app-brand small { color: rgba(255,255,255,.48); font-size: .7rem; letter-spacing: .11em; text-transform: uppercase; }
.sidebar nav { width: 100%; min-width: 0; max-width: 100%; display: grid; gap: 5px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; border: 0; border-radius: 13px; background: transparent; color: rgba(255,255,255,.62); text-align: left; cursor: pointer; }
.nav-item span { width: 26px; color: var(--gold); font-size: .65rem; font-weight: 900; }
.nav-item:hover, .nav-item:focus-visible, .nav-item.is-active { background: rgba(255,255,255,.08); color: white; }
.sidebar-note { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(255,255,255,.04); }
.sidebar-note b, .sidebar-note small { display: block; }
.sidebar-note b { font-size: .78rem; }
.sidebar-note small { color: rgba(255,255,255,.5); font-size: .65rem; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #69d1a8; box-shadow: 0 0 0 5px rgba(105,209,168,.12); }
.sidebar > .quiet-button { border-color: rgba(255,255,255,.12); background: transparent; color: rgba(255,255,255,.65); }
.workspace { min-width: 0; padding: 34px clamp(22px, 4vw, 64px) 80px; }
.workspace-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.workspace-header h1 { font-size: clamp(2rem, 3vw, 3rem); }
.truth-banner { margin-bottom: 28px; padding: 14px 17px; border: 1px solid rgba(201,149,53,.27); border-radius: 14px; background: #fff8e7; color: #6d5427; font-size: .82rem; }
.panel { display: none; }
.panel.is-active { display: block; animation: panel-in 220ms ease both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } }
.hero-grid { display: grid; grid-template-columns: 1.03fr .97fr; gap: 20px; }
.hero-card, .visual-card, .generator-card, .queue-card { border: 1px solid var(--line); border-radius: 28px; background: white; overflow: hidden; box-shadow: 0 1px 0 rgba(7,17,31,.03); }
.hero-card { min-height: 450px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: clamp(30px, 5vw, 66px); background: radial-gradient(circle at 95% 10%, rgba(239,196,105,.16), transparent 36%), white; }
.hero-card h2 { max-width: 640px; }
.hero-card p:not(.eyebrow) { max-width: 610px; color: var(--muted); font-size: 1.04rem; }
.hero-card .button-row { margin-top: 18px; }
.visual-card { position: relative; min-height: 450px; background: var(--navy-2); }
.visual-card img { width: 100%; height: 100%; object-fit: cover; }
.visual-card span { position: absolute; left: 16px; bottom: 16px; padding: 8px 11px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(7,17,31,.74); color: white; font-size: .7rem; backdrop-filter: blur(10px); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0 80px; }
.metric-grid article { padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.82); }
.metric-grid span, .metric-grid small { display: block; color: var(--muted); }
.metric-grid span { font-size: .72rem; font-weight: 850; text-transform: uppercase; letter-spacing: .11em; }
.metric-grid strong { display: block; margin: 4px 0; font-family: Georgia, serif; font-size: 2.3rem; }
.section-heading { max-width: 790px; margin: 0 0 32px; }
.section-heading > p:not(.eyebrow) { color: var(--muted); }
.loop-grid, .model-grid, .engine-grid, .plan-grid, .experiment-grid { display: grid; gap: 16px; }
.loop-grid { grid-template-columns: repeat(4, 1fr); }
.loop-grid article, .model-card, .engine-grid article, .plan-grid article, .experiment-grid article { padding: 26px; border: 1px solid var(--line); border-radius: 22px; background: white; }
.loop-grid article > b { color: var(--gold-2); font-size: .72rem; letter-spacing: .16em; }
.loop-grid p, .model-card p, .engine-grid p, .plan-grid li, .experiment-grid p { color: var(--muted); font-size: .9rem; }
.generation-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr); gap: 18px; }
.generator-card, .queue-card { padding: clamp(24px, 4vw, 40px); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.generator-card label { display: grid; gap: 7px; margin-bottom: 15px; color: #405069; font-size: .8rem; font-weight: 850; }
.generator-card select, .generator-card textarea { width: 100%; border: 1px solid var(--line); border-radius: 13px; background: #fbfaf6; color: var(--ink); }
.generator-card select { min-height: 48px; padding: 0 13px; }
.generator-card textarea { padding: 13px; resize: vertical; }
.generator-card .check-row { display: flex; align-items: flex-start; gap: 9px; font-weight: 650; }
.generator-card .check-row input { margin-top: 3px; }
.queue-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.queue-head h3 { margin: 0; }
.job-list { display: grid; gap: 10px; margin-top: 20px; }
.job-card, .empty-state { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: #fbfaf6; }
.job-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.job-card b { font-size: .84rem; }
.job-card span { padding: 4px 7px; border-radius: 999px; background: #e9f6f1; color: #2f715b; font-size: .64rem; font-weight: 900; text-transform: uppercase; }
.job-card p, .job-card small, .empty-state { color: var(--muted); font-size: .76rem; }
.job-card p { margin: 9px 0; }
.asset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.asset-grid a { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: white; text-decoration: none; }
.asset-grid img, .asset-grid video { width: 100%; aspect-ratio: 16/10; object-fit: cover; background: var(--navy); }
.asset-grid span { display: block; padding: 16px; }
.asset-grid b, .asset-grid small { display: block; }
.asset-grid small { margin-top: 4px; color: var(--muted); }
.model-grid { grid-template-columns: repeat(4, 1fr); }
.live-badge, .preview-badge { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: .65rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.live-badge { background: #e8f6f0; color: #2d6e58; }
.preview-badge { background: #fff4d8; color: #785a22; }
.model-card h3 { margin-top: 26px; }
.model-card dl { margin: 24px 0 0; padding-top: 15px; border-top: 1px solid var(--line); }
.model-card dl div { display: flex; justify-content: space-between; gap: 12px; margin-top: 7px; font-size: .72rem; }
.model-card dt { color: var(--muted); }
.model-card dd { margin: 0; font-weight: 800; text-align: right; }
.model-card.is-preview { border-style: dashed; }
.engine-grid { grid-template-columns: repeat(3, 1fr); }
.engine-grid article { min-height: 210px; }
.engine-grid span, .experiment-grid span, .plan-grid > article > span { color: var(--gold-2); font-size: .67rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.plan-grid { grid-template-columns: repeat(4, 1fr); align-items: stretch; }
.plan-grid article { display: flex; flex-direction: column; }
.plan-grid article.featured { background: var(--navy-2); color: white; transform: translateY(-7px); box-shadow: var(--shadow); }
.plan-grid article.featured li { color: rgba(255,255,255,.64); }
.plan-price { font-family: Georgia, serif; font-size: 2rem; }
.plan-price small { display: block; color: var(--muted); font-family: Inter, sans-serif; font-size: .72rem; }
.plan-grid ul { padding-left: 18px; }
.plan-grid button, .plan-grid a { margin-top: auto; border-color: var(--line); background: #f4f1e9; color: var(--ink); font-size: .78rem; }
.plan-grid button:disabled { cursor: not-allowed; opacity: .68; }
.experiment-grid { grid-template-columns: repeat(4, 1fr); }
.experiment-grid b, .experiment-grid small { display: block; }
.experiment-grid small { margin-top: 5px; color: var(--teal); font-weight: 800; }
.agent-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.agent-toolbar label { display: grid; gap: 5px; color: var(--muted); font-size: .72rem; font-weight: 850; }
.agent-toolbar select { min-width: 190px; min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: #fbfaf6; }
.agent-toolbar .quiet-button { margin-left: auto; }
.agent-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.agent-card { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.agent-card span, .agent-card small { display: block; }
.agent-card span { color: var(--gold-2); font-size: .62rem; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.agent-card b { display: block; margin: 8px 0 4px; font-family: Georgia, serif; font-size: 1.05rem; }
.agent-card small { color: var(--muted); }
.wallet-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.wallet-card { min-height: 300px; padding: 38px; border-radius: 28px; background: radial-gradient(circle at 90% 10%, rgba(239,196,105,.3), transparent 35%), var(--navy-2); color: white; box-shadow: var(--shadow); }
.wallet-card span, .wallet-card small { display: block; color: rgba(255,255,255,.6); }
.wallet-card strong { display: block; margin: 14px 0 4px; font-family: Georgia, serif; font-size: 4.5rem; }
.wallet-card p { max-width: 590px; color: rgba(255,255,255,.62); font-size: .85rem; }
.wallet-rail { height: 1px; margin: 28px 0; background: linear-gradient(90deg, var(--gold), transparent); }
.credit-stack { display: grid; gap: 12px; }
.credit-stack article { padding: 25px; border: 1px solid var(--line); border-radius: 20px; background: white; }
.credit-stack b, .credit-stack span, .credit-stack small { display: block; }
.credit-stack span { margin-top: 5px; color: var(--gold-2); font-weight: 850; }
.credit-stack small { margin-top: 5px; color: var(--muted); }
.compact-heading { margin-top: 70px; }
.factory-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.factory-grid article { padding: 24px; border: 1px solid var(--line); border-radius: 19px; background: white; }
.factory-grid strong, .factory-grid span { display: block; }
.factory-grid strong { font-family: Georgia, serif; font-size: 2.5rem; }
.factory-grid span { color: var(--muted); font-size: .76rem; }
.factory-grid .factory-total { background: var(--navy-2); color: white; }
.factory-grid .factory-total span { color: rgba(255,255,255,.6); }
.capital-preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.capital-preview article { display: flex; min-height: 260px; flex-direction: column; padding: 28px; border: 1px solid var(--line); border-radius: 22px; background: white; }
.capital-preview article > span { color: var(--gold-2); font-size: .67rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.capital-preview h3 { margin-top: 28px; }
.capital-preview p { color: var(--muted); }
.capital-preview .capital-action { background: radial-gradient(circle at 90% 10%, rgba(239,196,105,.25), transparent 34%), var(--navy-2); color: white; }
.capital-preview .capital-action p { color: rgba(255,255,255,.66); }
.capital-preview .primary-button { margin-top: auto; }
.capital-notice { margin-top: 18px; }

@media (max-width: 1180px) {
  .model-grid, .plan-grid { grid-template-columns: repeat(2, 1fr); }
  .asset-grid, .engine-grid { grid-template-columns: repeat(2, 1fr); }
  .agent-grid { grid-template-columns: repeat(3, 1fr); }
  .factory-grid { grid-template-columns: repeat(3, 1fr); }
  .capital-preview { grid-template-columns: 1fr 1fr; }
  .capital-preview .capital-action { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 16px; }
  .sidebar nav { grid-template-columns: repeat(4, 1fr); overflow-x: auto; }
  .nav-item { min-width: 120px; }
  .sidebar-note, .sidebar > .quiet-button { display: none; }
  .workspace { padding: 24px 18px 60px; }
  .workspace-header { align-items: flex-start; flex-direction: column; }
  .hero-grid, .generation-layout { grid-template-columns: 1fr; }
  .metric-grid, .loop-grid, .experiment-grid { grid-template-columns: repeat(2, 1fr); }
  .agent-grid { grid-template-columns: repeat(2, 1fr); }
  .wallet-layout { grid-template-columns: 1fr; }
  .capital-preview { grid-template-columns: 1fr; }
  .capital-preview .capital-action { grid-column: auto; }
}

@media (max-width: 620px) {
  .sidebar nav { grid-template-columns: repeat(10, minmax(118px, 1fr)); }
  .header-actions { width: 100%; }
  .header-actions a { flex: 1; }
  .form-grid, .metric-grid, .loop-grid, .model-grid, .engine-grid, .asset-grid, .plan-grid, .experiment-grid { grid-template-columns: 1fr; }
  .agent-grid, .factory-grid { grid-template-columns: 1fr; }
  .agent-toolbar { align-items: stretch; }
  .agent-toolbar label, .agent-toolbar select, .agent-toolbar .quiet-button { width: 100%; min-width: 0; }
  .visual-card, .hero-card { min-height: 360px; }
  .plan-grid article.featured { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
