@import url("https://fonts.googleapis.com/css2?family=Audiowide&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
  --ink: #251508;
  --muted: #6f5846;
  --surface: #f9f1e6;
  --panel: #ffffff;
  --line: #e2cfba;
  --brand-1: #291206;
  --brand-2: #e58c1c;
  --brand-3: #92df2e;
  --warn: #8a4b00;
  --bad: #8f0218;
  --good: #146c43;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Space Grotesk", "Avenir Next", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(1040px 560px at -8% -4%, #ffca72 0%, transparent 56%),
    radial-gradient(980px 420px at 114% 4%, #ffd7a0 0%, transparent 50%),
    radial-gradient(1120px 560px at 50% 118%, #ffeecf 0%, transparent 52%),
    linear-gradient(145deg, #fef4e8, #fff7ec 40%, #fffefb);
}

.hidden {
  display: none !important;
}

.landing-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  background:
    radial-gradient(1200px 520px at 10% -12%, rgba(250, 153, 38, 0.46), transparent 62%),
    radial-gradient(980px 420px at 86% 4%, rgba(146, 223, 46, 0.2), transparent 58%),
    linear-gradient(145deg, #180903, #3a1505 42%, #55210b 72%, #6f2e10);
  color: #fff8ef;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.landing-noise,
.landing-grid,
.landing-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.landing-grid {
  background-image:
    linear-gradient(to right, rgba(146, 223, 46, 0.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(250, 170, 53, 0.14) 1px, transparent 1px);
  background-size: 44px 44px;
  mix-blend-mode: soft-light;
  transform: perspective(700px) rotateX(52deg) scale(1.3) translateY(16%);
  transform-origin: top center;
  opacity: 0.45;
}

.landing-noise {
  background:
    radial-gradient(circle at 25% 18%, rgba(255, 255, 255, 0.14), transparent 55%),
    radial-gradient(circle at 78% 72%, rgba(146, 223, 46, 0.2), transparent 50%);
}

.landing-glow-a {
  background: radial-gradient(560px 240px at 20% 8%, rgba(247, 169, 58, 0.52), transparent 62%);
}

.landing-glow-b {
  background: radial-gradient(580px 260px at 78% 70%, rgba(238, 193, 91, 0.4), transparent 58%);
}

.landing-content {
  position: relative;
  z-index: 2;
  width: min(1120px, calc(100% - 30px));
  padding: 34px 30px;
  border-radius: 24px;
  border: 1px solid rgba(255, 211, 141, 0.4);
  background:
    linear-gradient(140deg, rgba(20, 8, 2, 0.76), rgba(52, 20, 7, 0.74)),
    linear-gradient(120deg, rgba(250, 194, 73, 0.12), rgba(146, 223, 46, 0.08));
  backdrop-filter: blur(6px);
  box-shadow:
    0 36px 90px rgba(16, 7, 2, 0.58),
    inset 0 0 0 1px rgba(255, 223, 169, 0.18);
  display: grid;
  justify-items: center;
  text-align: center;
  overflow: hidden;
  animation: landingRise 900ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.landing-kicker {
  margin: 0;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 11px;
  color: #ffd07b;
}

.landing-title {
  margin: 8px 0 0;
  font-family: "Audiowide", "Impact", sans-serif;
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1.04;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: #ffdb88;
  text-shadow: 0 6px 24px rgba(255, 162, 35, 0.45);
}

.landing-hero {
  position: relative;
  margin: 16px auto 0;
  width: min(420px, 100%);
  aspect-ratio: 2 / 3;
  padding: 0;
  border-radius: 22px;
  border: 2px solid rgba(253, 201, 108, 0.74);
  background: linear-gradient(130deg, rgba(33, 14, 4, 0.9), rgba(72, 29, 8, 0.62));
  box-shadow:
    0 26px 70px rgba(15, 6, 2, 0.62),
    0 0 0 1px rgba(146, 223, 46, 0.24),
    inset 0 0 0 1px rgba(255, 226, 168, 0.24);
  overflow: hidden;
}

.landing-hero::before {
  content: "";
  position: absolute;
  inset: -24px 12% auto;
  height: 42%;
  border-radius: 999px;
  background: radial-gradient(closest-side, rgba(250, 178, 53, 0.42), rgba(249, 115, 22, 0) 72%);
  z-index: -1;
  animation: heroPulse 3.2s ease-in-out infinite;
}

.landing-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(24, 10, 2, 0) 56%, rgba(24, 10, 2, 0.62) 100%),
    linear-gradient(120deg, rgba(146, 223, 46, 0.1), rgba(249, 194, 71, 0.16));
  pointer-events: none;
}

.landing-hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: drop-shadow(0 20px 42px rgba(5, 2, 17, 0.48));
  animation: heroFloat 4.8s ease-in-out infinite;
}

.landing-hero figcaption {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.17em;
  color: #ffd68a;
  text-shadow: 0 2px 8px rgba(29, 12, 2, 0.8);
}

.landing-callouts {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.landing-callouts span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 208, 120, 0.5);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff6e8;
  background: linear-gradient(120deg, rgba(51, 18, 6, 0.82), rgba(225, 154, 45, 0.26));
}

.landing-callouts span::before {
  content: "";
  width: 14px;
  height: 14px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex: 0 0 auto;
}

.landing-callouts span:nth-child(1)::before {
  background-image: url("/assets/icons/icon-thesis-flame.svg");
}

.landing-callouts span:nth-child(2)::before {
  background-image: url("/assets/icons/icon-cash-vortex.svg");
}

.landing-callouts span:nth-child(3)::before {
  background-image: url("/assets/icons/icon-risk-shield.svg");
}

.landing-copy {
  margin: 14px auto 0;
  max-width: 68ch;
  color: #ffe8c8;
  font-size: 16px;
}

.login-icon {
  margin-top: 18px;
  max-width: 240px;
  border: 1px solid rgba(255, 212, 126, 0.74);
  background: linear-gradient(130deg, #f59d2f, #95df33);
  color: #2d1303;
  box-shadow: 0 12px 34px rgba(247, 156, 58, 0.34);
}

.login-card {
  position: absolute;
  z-index: 4;
  right: max(20px, 8vw);
  bottom: max(20px, 7vh);
  width: min(360px, calc(100% - 24px));
  border-radius: 16px;
  border: 1px solid rgba(255, 232, 194, 0.55);
  background: linear-gradient(150deg, #fff5e7, #fffdf7);
  color: #1f1f26;
  padding: 14px;
  box-shadow: 0 20px 60px rgba(15, 10, 8, 0.42);
  animation: loginSlide 220ms ease;
}

.login-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
  color: #3b1d0a;
}

.app-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.topbar {
  background: linear-gradient(130deg, #2b1206, #5d240a 42%, #b35c18 76%, #f2be45);
  border-radius: 14px;
  color: #fff8e8;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 10px 26px rgba(113, 38, 8, 0.28);
  position: relative;
  overflow: hidden;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("/assets/pattern-orbit-lines.svg");
  background-size: cover;
  opacity: 0.16;
  pointer-events: none;
}

.brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 1px solid rgba(255, 241, 199, 0.44);
  box-shadow: 0 8px 18px rgba(52, 20, 2, 0.32);
  background: rgba(255, 255, 255, 0.12);
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #fde7b2;
}

.topbar h1 {
  margin: 4px 0 0;
  font-family: "Audiowide", "Impact", sans-serif;
  font-size: clamp(25px, 3.7vw, 34px);
  line-height: 1.08;
}

.top-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-actions button {
  width: auto;
  min-width: 118px;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 222, 166, 0.44);
  background: rgba(39, 16, 5, 0.34);
  color: #fff1d3;
  font-size: 12px;
  font-weight: 700;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.chip {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px 8px 42px;
  box-shadow: 0 6px 16px rgba(15, 8, 3, 0.05);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.95), rgba(255, 245, 226, 0.95)),
    linear-gradient(120deg, rgba(249, 115, 22, 0.08), rgba(250, 204, 21, 0));
}

.chip::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.chip-system::before {
  background-image: url("/assets/icons/icon-regime-switch.svg");
}

.chip-mode::before {
  background-image: url("/assets/icons/icon-position-size.svg");
}

.chip-data::before {
  background-image: url("/assets/icons/icon-profit-wave.svg");
}

.chip-openai::before {
  background-image: url("/assets/icons/icon-autopilot-eye.svg");
}

.chip span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.chip strong {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
}

.good {
  color: var(--good);
  background: #dcfce7;
}

.warn {
  color: var(--warn);
  background: #fff0cf;
}

.bad {
  color: var(--bad);
  background: #ffe0e6;
}

.neutral {
  color: #334155;
  background: #e2e8f0;
}

.global-banner {
  border-radius: 10px;
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: var(--warn);
  padding: 10px 12px;
  font-size: 14px;
}

.workspace {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
}

.sidebar {
  background:
    linear-gradient(154deg, #fff4df, #ffffff),
    linear-gradient(120deg, rgba(251, 191, 36, 0.08), rgba(244, 114, 36, 0.05));
  border: 1px solid #e4d2b9;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  box-shadow: inset 0 0 0 1px rgba(255, 248, 224, 0.8);
}

.nav-btn {
  width: 100%;
  border: 1px solid #decfb8;
  border-radius: 10px;
  padding: 10px 11px;
  text-align: left;
  font-weight: 700;
  color: #3b2819;
  background: linear-gradient(150deg, #fffcf4, #fff1d5);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.nav-btn::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.nav-btn[data-tab="overview"]::before {
  background-image: url("/assets/icons/icon-profit-wave.svg");
}

.nav-btn[data-tab="news"]::before {
  background-image: url("/assets/icons/icon-alert-spike.svg");
}

.nav-btn[data-tab="proposal"]::before {
  background-image: url("/assets/icons/icon-thesis-flame.svg");
}

.nav-btn[data-tab="portfolio"]::before {
  background-image: url("/assets/icons/icon-cash-vortex.svg");
}

.nav-btn[data-tab="strategy"]::before {
  background-image: url("/assets/icons/icon-trade-bolt.svg");
}

.nav-btn[data-tab="futures"]::before {
  background-image: url("/assets/icons/icon-profit-wave.svg");
}

.nav-btn[data-tab="war-room"]::before {
  background-image: url("/assets/icons/icon-autopilot-eye.svg");
}

.nav-btn[data-tab="thesis"]::before {
  background-image: url("/assets/icons/icon-scan-chaos.svg");
}

.nav-btn[data-tab="settings"]::before {
  background-image: url("/assets/icons/icon-regime-switch.svg");
}

.nav-btn[data-tab="observability"]::before {
  background-image: url("/assets/icons/icon-alert-spike.svg");
}

.nav-btn.active {
  color: #f8fcff;
  border-color: transparent;
  background: linear-gradient(140deg, #3b1907, #8f3b0d 58%, #f0aa31);
  box-shadow: 0 10px 24px rgba(97, 40, 8, 0.34);
}

.content {
  min-height: 0;
  background:
    radial-gradient(840px 280px at 82% -10%, rgba(251, 191, 36, 0.15), transparent 55%),
    linear-gradient(180deg, #fffefb, #fff9ee);
  border: 1px solid #e7d7bf;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.stonky-brief {
  margin: 12px;
  margin-bottom: 0;
  border: 1px solid #f1c97c;
  border-radius: 12px;
  padding: 12px;
  background:
    radial-gradient(560px 170px at 2% -8%, rgba(251, 191, 36, 0.23), transparent 64%),
    linear-gradient(140deg, #fff8e8, #fff1cb);
  box-shadow: 0 10px 20px rgba(91, 45, 5, 0.08);
}

.stonky-brief-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}

.stonky-avatar {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(141, 99, 18, 0.5);
  box-shadow: 0 8px 16px rgba(112, 44, 4, 0.35);
  background: #0f2034;
}

.stonky-avatar img {
  width: 100%;
  height: 100%;
  display: block;
}

.stonky-brief h2 {
  margin: 2px 0 0;
}

.tab-view {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  align-content: start;
}

.tab-view.active {
  display: grid;
}

.panel {
  background: linear-gradient(180deg, #ffffff, #fffaf1);
  border: 1px solid #e6d8c4;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 8px 20px rgba(67, 34, 5, 0.06);
}

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

h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

h3 {
  margin: 12px 0 8px;
  font-size: 14px;
}

p {
  margin: 0;
  color: #22354d;
}

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

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #ffffff;
}

.metric span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}

.kv-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
}

.kv-grid > div {
  color: var(--muted);
}

.checklist {
  margin: 0;
  padding-left: 18px;
}

.checklist li {
  margin: 5px 0;
}

.alert {
  border-radius: 8px;
  border: 1px solid #fca5a5;
  background: #fef2f2;
  color: #991b1b;
  padding: 8px;
  margin-bottom: 10px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.action-row.three {
  grid-template-columns: 1fr 1fr 1fr;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
  align-items: end;
}

.field-grid.three {
  grid-template-columns: 1fr 1fr 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

input,
textarea,
select,
button {
  width: 100%;
  font: inherit;
  border-radius: 8px;
}

input,
textarea,
select {
  border: 1px solid #d7cdbb;
  padding: 9px 10px;
  color: #16263b;
  background: #ffffff;
}

textarea {
  min-height: 82px;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin: 9px 0 4px;
  color: #314760;
}

button {
  border: none;
  color: #fffef9;
  font-weight: 700;
  padding: 10px;
  cursor: pointer;
  background: linear-gradient(130deg, #1f2937, #9a3412 66%, #f97316);
  transition: transform 0.14s ease, filter 0.14s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:hover:enabled {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.news-source-remove-btn {
  width: auto;
  min-width: 84px;
  padding: 6px 10px;
}

button.secondary {
  background: linear-gradient(130deg, #334155, #475569);
}

button.danger {
  background: #991b1b;
}

button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

button.is-loading {
  filter: saturate(0.7);
}

:is(
  #loginIconBtn,
  #loginSubmitBtn,
  #generateProposalBtn,
  #executeBtn,
  #approveBtn,
  #overrideSellBtn,
  #setTradingModeBtn,
  #setSavingsBtn,
  #setMonitoringBtn,
  #setOpenaiModelBtn,
  #setThesisBtn,
  #recommendationBtn,
  #askBtn,
  #chatSendBtn,
  #refreshAllBtn,
  #refreshStonkyBriefBtn,
  #refreshOrdersBtn,
  #refreshPositionsBtn,
  #refreshSettlementBtn,
  #refreshCycleBtn,
  #refreshObsBtn,
  #refreshOpenaiModelsBtn,
  #testOpenaiBtn,
  #chatToggleBtn,
  #warRoomAskTradeBtn,
  #warRoomCreateTicketBtn,
  #warRoomCancelTicketBtn,
  #warRoomSubmitTicketBtn
)::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

#loginIconBtn::before,
#loginSubmitBtn::before {
  background-image: url("/assets/icons/icon-thesis-flame.svg");
}

#generateProposalBtn::before {
  background-image: url("/assets/icons/icon-scan-chaos.svg");
}

#executeBtn::before,
#approveBtn::before {
  background-image: url("/assets/icons/icon-trade-bolt.svg");
}

#overrideSellBtn::before {
  background-image: url("/assets/icons/icon-alert-spike.svg");
}

#setTradingModeBtn::before,
#setMonitoringBtn::before {
  background-image: url("/assets/icons/icon-regime-switch.svg");
}

#setSavingsBtn::before {
  background-image: url("/assets/icons/icon-lock-profit.svg");
}

#setOpenaiModelBtn::before,
#testOpenaiBtn::before,
#recommendationBtn::before,
#askBtn::before,
#chatSendBtn::before,
#chatToggleBtn::before,
#warRoomAskTradeBtn::before {
  background-image: url("/assets/icons/icon-autopilot-eye.svg");
}

#warRoomCreateTicketBtn::before {
  background-image: url("/assets/icons/icon-thesis-flame.svg");
}

#warRoomCancelTicketBtn::before,
#warRoomSubmitTicketBtn::before {
  background-image: url("/assets/icons/icon-trade-bolt.svg");
}

#setThesisBtn::before {
  background-image: url("/assets/icons/icon-thesis-flame.svg");
}

#refreshAllBtn::before,
#refreshStonkyBriefBtn::before,
#refreshOrdersBtn::before,
#refreshPositionsBtn::before,
#refreshSettlementBtn::before,
#refreshCycleBtn::before,
#refreshObsBtn::before,
#refreshOpenaiModelsBtn::before {
  background-image: url("/assets/icons/icon-profit-wave.svg");
}

.confidence-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #eaded1;
  overflow: hidden;
  margin-top: 8px;
}

.confidence-bar span {
  display: block;
  height: 100%;
  width: 0%;
  transition: width 220ms ease;
  background: linear-gradient(90deg, #f97316, #facc15);
}

.response-box {
  margin-top: 8px;
  border: 1px solid #e4d7c6;
  background: #fffdfa;
  border-radius: 8px;
  padding: 9px;
  white-space: pre-wrap;
  line-height: 1.4;
  color: #2a2730;
}

.response-box.error {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.markdown-output h1,
.markdown-output h2,
.markdown-output h3 {
  margin: 4px 0 6px;
  font-size: 14px;
}

.markdown-output p {
  margin: 0 0 6px;
}

.markdown-output ul,
.markdown-output ol {
  margin: 0 0 8px;
  padding-left: 18px;
}

.markdown-output li {
  margin: 2px 0;
}

.markdown-output code {
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
  background: #ece7dd;
  border-radius: 4px;
  padding: 1px 4px;
}

.markdown-output pre {
  margin: 6px 0;
}

.chart-stack {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.chart-card {
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
}

.chart-title {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}

.ai-chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.chart-legend-item {
  font-size: 11px;
  color: #334155;
  position: relative;
  padding-left: 12px;
}

.chart-legend-item::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--dot-color, #2563eb);
  position: absolute;
  left: 0;
  top: 4px;
}

.flow-grid {
  display: grid;
  gap: 10px;
}

.flow-step {
  border: 1px solid #e8dccd;
  border-radius: 8px;
  background: #fff9ef;
  padding: 9px 10px;
}

.flow-step-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.flow-step-num {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #92400e;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.flow-step-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

.flow-step-detail {
  margin: 0;
  color: #334155;
  font-size: 13px;
}

.lane-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  align-items: start;
}

.lane-card {
  border: 1px solid #e8dccd;
  border-radius: 8px;
  background: #fff9ef;
  padding: 9px 10px;
  min-width: 0;
}

.lane-card h3 {
  margin: 0 0 8px;
}

.lane-card .kv-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
}

.lane-card .kv-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.execution-swimlanes-panel {
  grid-column: 1 / -1;
}

.lane-card.active-lane {
  border-color: #f97316;
  box-shadow: inset 0 0 0 1px #f97316;
  background: #fff1dc;
}

.meta {
  font-size: 12px;
  color: var(--muted);
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 8px;
  border-bottom: 1px solid #ece3d8;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #fef8ee;
  color: #63462d;
  z-index: 1;
}

tr.candidate-deprioritized td {
  background: #fffbeb;
}

.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbff;
  padding: 5px 10px;
  font-size: 12px;
}

details {
  margin-top: 8px;
}

summary {
  cursor: pointer;
  color: #3b4f67;
  font-weight: 600;
}

pre {
  margin: 8px 0 0;
  max-height: 260px;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid #1f2937;
  background: #0b1220;
  color: #dbeafe;
  padding: 10px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
}

.chat-toggle {
  position: fixed;
  right: 18px;
  bottom: 16px;
  z-index: 38;
  width: auto;
  min-width: 170px;
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid rgba(246, 180, 96, 0.7);
  background: linear-gradient(120deg, #111827, #8a3b0b 62%, #f97316);
  box-shadow: 0 14px 30px rgba(111, 46, 8, 0.35);
}

.chat-drawer {
  position: fixed;
  right: 14px;
  bottom: 66px;
  width: min(420px, calc(100% - 28px));
  max-height: min(76vh, 780px);
  background: linear-gradient(150deg, #fffaf0, #fffefb);
  border: 1px solid #f0ca87;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(107, 49, 9, 0.24);
  z-index: 39;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  transform: translateY(0);
  opacity: 1;
  transition: transform 180ms ease, opacity 180ms ease;
}

.chat-drawer.collapsed {
  transform: translateY(14px);
  opacity: 0;
  pointer-events: none;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid #f1dfbf;
}

.chat-head h2 {
  margin: 0;
  font-size: 16px;
}

.chat-feed {
  padding: 10px;
  overflow: auto;
  display: grid;
  gap: 8px;
  align-content: start;
  background:
    radial-gradient(500px 200px at 85% 3%, rgba(253, 230, 138, 0.25), transparent 60%),
    #fffdf8;
}

.chat-msg {
  border-radius: 10px;
  border: 1px solid #e8dccd;
  background: #ffffff;
  padding: 9px;
}

.chat-msg.user {
  background: #fff6df;
  border-color: #f1cf8c;
}

.chat-msg.assistant {
  background: #ffffff;
}

.chat-role {
  font-size: 11px;
  color: #8a6a3e;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.chat-input-row {
  border-top: 1px solid #f1dfbf;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.chat-input-row textarea {
  min-height: 84px;
}

@keyframes landingRise {
  from {
    transform: translateY(14px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes loginSlide {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes heroFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes heroPulse {
  0%,
  100% {
    opacity: 0.65;
    transform: scale(0.98);
  }
  50% {
    opacity: 0.92;
    transform: scale(1.06);
  }
}

@media (prefers-reduced-motion: reduce) {
  .landing-content,
  .landing-hero::before,
  .landing-hero img {
    animation: none;
  }
}

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

  .sidebar {
    flex-direction: row;
    overflow-x: auto;
    padding: 6px;
  }

  .nav-btn {
    min-width: 156px;
  }

  .content {
    overflow: visible;
  }

  .tab-view {
    min-height: 64vh;
  }
}

@media (max-width: 760px) {
  .landing-gate {
    overflow-y: auto;
    align-content: start;
    place-items: start center;
    padding: 8px 0 calc(14px + env(safe-area-inset-bottom));
  }

  .status-strip {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

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

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .action-row,
  .action-row.three,
  .field-grid,
  .field-grid.three,
  .lane-grid,
  .stonky-brief-head {
    grid-template-columns: 1fr;
  }

  .login-card {
    position: relative;
    right: auto;
    left: auto;
    bottom: auto;
    width: min(420px, calc(100% - 16px));
    margin: 10px auto calc(10px + env(safe-area-inset-bottom));
    max-height: none;
    overflow: visible;
  }

  .landing-content {
    width: calc(100% - 18px);
    padding: 24px 16px;
    margin-top: 8px;
  }

  .landing-title {
    font-size: clamp(24px, 9vw, 42px);
  }

  .landing-hero {
    width: min(360px, 100%);
    margin-top: 12px;
  }

  .landing-copy {
    font-size: 15px;
  }

  .landing-callouts span {
    font-size: 10px;
  }
}

@media (max-width: 430px) {
  .login-card .action-row {
    grid-template-columns: 1fr;
  }

  .landing-content {
    width: calc(100% - 12px);
    padding: 20px 12px;
  }

  .login-icon {
    max-width: none;
  }

  .login-card input,
  .login-card select,
  .login-card textarea,
  .login-card button {
    font-size: 16px;
  }
}
