:root {
  --bg: #070b12;
  --panel: #0f1724;
  --panel-soft: #121d2c;
  --ink: #edf5ff;
  --navy: #0d1321;
  --slate: #1b263b;
  --muted: #93a4ba;
  --line: #243247;
  --line-strong: #3a4c65;
  --teal: #14b8a6;
  --mint: #34d399;
  --accent: #14b8a6;
  --accent-2: #8b5cf6;
  --accent-dark: #0f9f91;
  --gold: #fbbf24;
  --warn: #b7791f;
  --bad: #b42318;
  --good: #059669;
  --nav: #080d17;
  --nav-soft: #101a2a;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 14px 34px rgba(0, 0, 0, 0.28);
  --sticky-offset: 125px;
  --font-ui: "Trebuchet MS", "Segoe UI", Verdana, Arial, sans-serif;
  --font-brand: "Trebuchet MS", "Segoe UI", Verdana, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(20, 184, 166, 0.74) rgba(8, 13, 23, 0.72);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: rgba(8, 13, 23, 0.72);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid rgba(8, 13, 23, 0.72);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(20, 184, 166, 0.86), rgba(52, 211, 153, 0.72));
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--teal), var(--mint));
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% -8%, rgba(20, 184, 166, 0.18), transparent 34%),
    radial-gradient(circle at 86% 0%, rgba(139, 92, 246, 0.14), transparent 30%),
    linear-gradient(180deg, #080d16, #070b12 420px),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: 1.35;
}

html,
body {
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--accent);
  background: linear-gradient(135deg, var(--teal), var(--mint));
  color: var(--navy);
  min-height: 38px;
  border-radius: 7px;
  padding: 0 13px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(20, 184, 166, 0.18);
}

button:hover {
  background: linear-gradient(135deg, var(--accent-dark), #22c98d);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(20, 184, 166, 0.09), transparent 42%),
    rgba(7, 11, 18, 0.93);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.4vw, 30px);
  min-width: 0;
  flex: 1 1 auto;
}

.brand-banner {
  display: block;
  width: clamp(230px, 31vw, 430px);
  height: auto;
  max-height: 76px;
  object-fit: contain;
  flex: 0 1 auto;
}

.brand-copy {
  display: grid;
  gap: 5px;
  min-width: 190px;
  padding-left: clamp(14px, 2vw, 26px);
  border-left: 1px solid rgba(20, 184, 166, 0.34);
  font-family: var(--font-brand);
}

.brand-copy strong {
  color: var(--ink);
  font-size: clamp(16px, 1.35vw, 22px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-copy span {
  color: #34d399;
  font-size: clamp(12px, 0.95vw, 14px);
  font-weight: 600;
  letter-spacing: 0;
}

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

.auth-status {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 10px;
  border: 1px solid rgba(36, 50, 71, 0.9);
  border-radius: 7px;
  background: rgba(15, 23, 36, 0.86);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.auth-status.is-active {
  border-color: rgba(20, 184, 166, 0.5);
  color: #a7f3d0;
}

.auth-status.is-blocked {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

.save-status {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 10px;
  border: 1px solid rgba(36, 50, 71, 0.75);
  border-radius: 7px;
  background: rgba(15, 23, 36, 0.62);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.save-status.is-saving {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

.save-status.is-saved,
.save-status.is-local {
  border-color: rgba(20, 184, 166, 0.45);
  color: #a7f3d0;
}

.save-status.is-error {
  border-color: rgba(180, 35, 24, 0.55);
  color: #fecaca;
}

.header-actions button {
  background: rgba(15, 23, 36, 0.86);
  color: var(--ink);
  border-color: rgba(20, 184, 166, 0.55);
  box-shadow: none;
}

.header-actions button:hover {
  background: rgba(20, 184, 166, 0.16);
}

button.upgrade-required {
  border-color: rgba(52, 211, 153, 0.72);
  color: #a7f3d0;
  box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.18), 0 0 18px rgba(20, 184, 166, 0.14);
}

button.upgrade-required:hover {
  background: rgba(20, 184, 166, 0.18);
}

.danger-button,
.header-actions .danger-button {
  border-color: rgba(180, 35, 24, 0.65);
  color: #fecaca;
}

.danger-button:hover,
.header-actions .danger-button:hover {
  background: rgba(180, 35, 24, 0.18);
}

.app-footer {
  display: grid;
  grid-template-columns: minmax(0, 860px);
  gap: 14px;
  align-items: start;
  justify-content: start;
  padding: 28px clamp(18px, 3vw, 38px) 34px;
  padding-right: min(460px, 36vw);
  border-top: 1px solid rgba(36, 50, 71, 0.9);
  background:
    linear-gradient(90deg, rgba(20, 184, 166, 0.08), transparent 45%),
    rgba(7, 11, 18, 0.88);
  color: var(--muted);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.footer-brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

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

.footer-brand strong {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.1;
}

.footer-brand span {
  color: #a7f3d0;
  font-size: 12px;
  font-weight: 700;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px 16px;
}

.footer-links a {
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--mint);
}

.footer-note,
.footer-copy {
  margin: 0;
  font-size: 12px;
}

.footer-note {
  max-width: 860px;
}

.footer-copy {
  justify-self: start;
  white-space: nowrap;
}

.account-danger-zone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-top: 28px;
  padding: 18px;
  border: 1px solid rgba(180, 35, 24, 0.45);
  border-radius: 9px;
  background:
    linear-gradient(90deg, rgba(180, 35, 24, 0.12), transparent 58%),
    rgba(15, 23, 36, 0.78);
}

.account-danger-zone h3 {
  margin: 0 0 6px;
  color: #fecaca;
}

.account-danger-zone p {
  margin: 0;
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.5;
}

.legal-page .app-header {
  position: static;
}

.legal-brand-link,
.legal-header-link {
  color: inherit;
  text-decoration: none;
}

.legal-header-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(20, 184, 166, 0.55);
  border-radius: 7px;
  background: rgba(15, 23, 36, 0.86);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.legal-header-link:hover,
.legal-header-link:focus-visible {
  background: rgba(20, 184, 166, 0.16);
  color: #a7f3d0;
}

.legal-document {
  width: min(960px, calc(100vw - 36px));
  margin: 34px auto 46px;
  padding: clamp(22px, 4vw, 46px);
  border: 1px solid rgba(36, 50, 71, 0.86);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(18, 29, 44, 0.94), rgba(10, 16, 26, 0.96)),
    var(--panel);
  box-shadow: var(--shadow-soft);
}

.legal-document h1 {
  margin: 6px 0 8px;
  color: var(--ink);
  font-family: var(--font-brand);
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.02;
}

.legal-updated {
  margin: 0 0 24px;
  color: #a7f3d0;
  font-size: 13px;
  font-weight: 800;
}

.legal-document section {
  margin-top: 26px;
}

.legal-document h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 20px;
}

.legal-document p {
  margin: 0 0 12px;
  color: #c6d4e5;
  font-size: 15px;
  line-height: 1.65;
}

.legal-document a {
  color: #5eead4;
  font-weight: 800;
}

.branch-change-prompt {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 45;
  width: min(720px, calc(100vw - 32px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(20, 184, 166, 0.42);
  border-radius: 9px;
  background: rgba(8, 24, 28, 0.96);
  box-shadow: var(--shadow-soft);
}

.branch-change-prompt[hidden] {
  display: none;
}

.branch-change-prompt div {
  display: grid;
  gap: 2px;
  min-width: 0;
  margin-right: auto;
}

.branch-change-prompt strong {
  color: var(--ink);
  font-size: 13px;
}

.branch-change-prompt span {
  color: #a7f3d0;
  font-size: 12px;
}

.branch-change-prompt button {
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow);
}

.app-layout > *,
.panel,
.chart-panel,
.results,
.inputs-panel {
  min-width: 0;
}

.inputs-panel {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: var(--sticky-offset);
  align-self: start;
  display: block;
  min-width: 0;
  z-index: 5;
}

.app-layout.drawer-open .inputs-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 190px minmax(720px, 1fr);
  gap: 0;
  align-items: start;
}

.tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background:
    linear-gradient(180deg, rgba(20, 184, 166, 0.08), transparent 42%),
    var(--nav);
  padding: 14px 10px;
  min-height: 520px;
  border: 1px solid rgba(219, 228, 238, 0.16);
  border-radius: 9px;
  box-shadow: var(--shadow);
}

.app-layout.drawer-open .tabs {
  border-radius: 9px 0 0 9px;
}

.nav-label {
  color: #95a3b9;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px 8px;
}

.tab {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #cbd5e1;
  min-height: 38px;
  padding: 0 10px;
  font-weight: 650;
}

.tab:hover {
  background: var(--nav-soft);
  color: #fff;
}

.tab.active {
  background: rgba(20, 184, 166, 0.18);
  color: #2dd4bf;
  box-shadow: inset 3px 0 0 var(--teal);
}

#plannerForm {
  min-width: 0;
  overflow: auto;
  max-height: calc(100vh - var(--sticky-offset) - 20px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 9px 9px 0;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateX(-28px);
  pointer-events: none;
  transition: opacity 420ms ease, transform 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

.app-layout.drawer-open #plannerForm {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.app-layout.drawer-opening #plannerForm {
  animation: drawerSlideOut 620ms cubic-bezier(0.16, 1, 0.3, 1);
}

.app-layout.drawer-closing #plannerForm {
  animation: drawerSlideIn 460ms cubic-bezier(0.4, 0, 0.2, 1);
}

.app-layout:not(.drawer-open) #plannerForm {
  display: none;
}

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 23, 36, 0.92);
  backdrop-filter: blur(10px);
}

.drawer-header span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.drawer-header button {
  min-height: 30px;
  padding: 0 10px;
  background: rgba(8, 13, 23, 0.8);
  color: var(--muted);
  border-color: var(--line);
  box-shadow: none;
  font-size: 12px;
}

.drawer-header button:hover {
  color: var(--ink);
  background: rgba(20, 184, 166, 0.16);
  border-color: rgba(20, 184, 166, 0.45);
}

.tab-panel {
  display: none;
  padding: 22px;
}

.tab-panel.active {
  display: block;
}

.tab-panel.entering {
  animation: panelContentIn 360ms ease;
}

.overview-panel {
  padding: 0;
  background:
    linear-gradient(180deg, rgba(20, 184, 166, 0.07), transparent 260px),
    rgba(15, 23, 36, 0.28);
}

.overview-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 0.32fr);
  gap: 28px;
  align-items: end;
  padding: 34px;
  border-bottom: 1px solid rgba(36, 50, 71, 0.78);
}

.overview-kicker {
  margin: 0 0 12px;
  color: #34d399;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.overview-hero h2 {
  max-width: 780px;
  margin: 0;
  font-family: var(--font-brand);
  font-size: clamp(34px, 4.2vw, 62px);
  line-height: 1.03;
  font-weight: 700;
  letter-spacing: 0;
}

.overview-hero p {
  max-width: 740px;
  margin: 18px 0 0;
  color: #b7c7d9;
  font-size: clamp(15px, 1.25vw, 19px);
  line-height: 1.55;
}

.overview-signal {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid rgba(20, 184, 166, 0.36);
  border-radius: 8px;
  background: rgba(8, 13, 23, 0.72);
}

.overview-signal span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.overview-signal strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1.08;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 24px 34px 12px;
}

.overview-grid article {
  min-height: 172px;
  padding: 18px;
  border: 1px solid rgba(36, 50, 71, 0.92);
  border-radius: 8px;
  background: rgba(8, 13, 23, 0.58);
}

.overview-grid article span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-bottom: 16px;
  border: 1px solid rgba(20, 184, 166, 0.42);
  border-radius: 999px;
  color: #34d399;
  font-size: 11px;
  font-weight: 850;
}

.overview-grid h3 {
  margin: 0 0 9px;
  color: var(--ink);
  font-size: 16px;
}

.overview-grid p,
.overview-note p,
.overview-strip span {
  margin: 0;
  color: #a9b9cc;
  font-size: 13px;
  line-height: 1.45;
}

.overview-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 12px 34px 0;
  overflow: hidden;
  border: 1px solid rgba(36, 50, 71, 0.92);
  border-radius: 8px;
  background: rgba(36, 50, 71, 0.92);
}

.overview-strip div {
  display: grid;
  gap: 7px;
  padding: 16px;
  background: rgba(15, 23, 36, 0.92);
}

.overview-strip strong {
  color: var(--ink);
  font-size: 14px;
}

.overview-note {
  margin: 18px 34px 34px;
  padding: 16px;
  border: 1px solid rgba(251, 191, 36, 0.24);
  border-radius: 8px;
  background: rgba(251, 191, 36, 0.07);
}

.overview-note strong {
  display: block;
  margin-bottom: 6px;
  color: #fde68a;
  font-size: 13px;
}

.panel-intro {
  max-width: 820px;
  margin: -6px 0 18px;
  color: #a9b9cc;
  font-size: 14px;
  line-height: 1.5;
}

.branch-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.branch-analytics-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1.7fr) minmax(112px, 0.55fr) minmax(112px, 0.55fr) minmax(220px, 1.1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.branch-analytics-controls label {
  min-width: 0;
}

.branch-analytics-status {
  min-height: 18px;
  margin: -6px 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.branch-analytics-progress {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid rgba(20, 184, 166, 0.28);
  border-radius: 8px;
  background: rgba(20, 184, 166, 0.08);
}

.branch-analytics-progress[hidden] {
  display: none;
}

#branchAnalyticsProgressLabel {
  color: #d8e7f6;
  font-size: 12px;
  font-weight: 800;
}

.branch-analytics-progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #09111d;
}

#branchAnalyticsProgressBar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--mint));
  transition: width 160ms ease;
}

.branch-active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.branch-active > div {
  padding: 16px;
  border: 1px solid rgba(20, 184, 166, 0.28);
  border-radius: 8px;
  background: rgba(20, 184, 166, 0.08);
}

.branch-active span,
.branch-active small,
.branch-table small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.branch-active strong {
  display: block;
  margin: 5px 0;
  color: var(--ink);
  font-size: 22px;
}

.branch-compare-wrap {
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(8, 13, 23, 1), rgba(8, 13, 23, 0)) left / 18px 100% no-repeat,
    linear-gradient(270deg, rgba(8, 13, 23, 1), rgba(8, 13, 23, 0)) right / 18px 100% no-repeat,
    rgba(8, 13, 23, 0.5);
}

.branch-table {
  width: 100%;
  min-width: 940px;
  table-layout: fixed;
  border-collapse: collapse;
  background: transparent;
}

.branch-table th,
.branch-table td {
  padding: 11px 10px;
  border-bottom: 1px solid rgba(36, 50, 71, 0.78);
  text-align: left;
  vertical-align: top;
  white-space: normal;
}

.branch-table th {
  color: #b7c7d9;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(15, 23, 36, 0.92);
}

.branch-col-plan { width: 20%; }
.branch-col-timing { width: 13%; }
.branch-col-money { width: 10%; }
.branch-col-delta { width: 8%; }
.branch-col-status { width: 12%; }
.branch-col-risk { width: 17%; }

.branch-table tr.is-active {
  background: rgba(20, 184, 166, 0.09);
}

.branch-table tbody tr {
  box-shadow: inset 0 1px 0 rgba(20, 184, 166, 0.06);
}

.branch-table td > strong {
  display: block;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.branch-table td {
  color: #d8e7f6;
  font-size: 12px;
  line-height: 1.35;
}

.branch-cell-label {
  display: block;
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.branch-cell-label + small {
  margin-bottom: 6px;
}

.strategy-lab {
  margin-top: 26px;
  padding: 16px;
  border: 1px solid rgba(20, 184, 166, 0.22);
  border-radius: 8px;
  background: rgba(8, 13, 23, 0.44);
}

.strategy-lab .section-title {
  align-items: flex-start;
  gap: 16px;
}

.strategy-lab .section-title h3 {
  margin-top: 0;
}

.strategy-lab .panel-intro {
  margin: 4px 0 0;
}

.strategy-lab-controls {
  display: grid;
  grid-template-columns: minmax(220px, 360px);
  gap: 12px;
  margin: 0 0 14px;
}

.strategy-lab-gate {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(20, 184, 166, 0.24);
  border-radius: 8px;
  background: rgba(20, 184, 166, 0.08);
  color: #cfe0f2;
  font-size: 12px;
}

.strategy-lab-gate strong {
  color: var(--mint);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.strategy-lab-gate.is-locked {
  border-color: rgba(251, 191, 36, 0.28);
  background: rgba(251, 191, 36, 0.07);
}

.strategy-lab-gate.is-locked strong {
  color: #fde68a;
}

.strategy-lab-gate.is-stale,
.strategy-lab-stale {
  border-color: rgba(251, 191, 36, 0.34);
  background: rgba(251, 191, 36, 0.08);
}

.strategy-lab-gate.is-stale strong,
.strategy-lab-stale strong {
  color: #fde68a;
}

.strategy-lab-stale {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(251, 191, 36, 0.34);
  border-radius: 8px;
  color: #cfe0f2;
  font-size: 12px;
}

.strategy-lab-stale strong {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.strategy-lab-progress {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid rgba(20, 184, 166, 0.28);
  border-radius: 8px;
  background: rgba(20, 184, 166, 0.08);
}

.strategy-lab-progress[hidden] {
  display: none;
}

#strategyLabProgressLabel,
#strategyLabStartProgressLabel {
  color: #d8e7f6;
  font-size: 12px;
  font-weight: 800;
}

.strategy-lab-progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #09111d;
}

#strategyLabProgressBar,
#strategyLabStartProgressBar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--mint));
  transition: width 160ms ease;
}

#strategyLabStartProgressBar {
  background: linear-gradient(90deg, #60a5fa, #34d399);
}

.strategy-lab-results .empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.strategy-lab-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 13, 23, 0.5);
}

.strategy-lab-table {
  width: 100%;
  min-width: 820px;
  table-layout: fixed;
  border-collapse: collapse;
  background: transparent;
}

.strategy-col-rank { width: 7%; }
.strategy-col-path { width: 32%; }
.strategy-col-money { width: 12%; }
.strategy-col-success { width: 9%; }
.strategy-col-depletion { width: 12%; }
.strategy-col-branch { width: 6%; }

.strategy-lab-table th,
.strategy-lab-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(36, 50, 71, 0.78);
  color: #d8e7f6;
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
}

.strategy-lab-table th {
  color: #b7c7d9;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(15, 23, 36, 0.92);
}

.strategy-lab-table th.is-center,
.strategy-lab-table td.is-center {
  text-align: center;
}

.strategy-lab-table td:first-child {
  color: var(--mint);
  font-weight: 900;
}

.strategy-lab-table th.is-money,
.strategy-lab-table td.is-money {
  text-align: right;
}

.strategy-lab-table th.is-text,
.strategy-lab-table td.is-text {
  text-align: left;
}

.branch-risk-list {
  display: grid;
  gap: 5px;
}

.branch-risk-list span {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 6px;
  align-items: baseline;
  color: #cbd8e7;
}

.branch-risk-list b {
  color: var(--mint);
  font-size: 10px;
}

.branch-plan-cell {
  display: grid;
  gap: 7px;
}

.branch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(36, 50, 71, 0.72);
}

.branch-actions .branch-action-icon {
  display: inline-grid;
  place-items: center;
  width: 27px;
  min-width: 27px;
  height: 27px;
  min-height: 27px;
  padding: 0;
  border-radius: 7px;
  border-color: rgba(20, 184, 166, 0.5);
  background: rgba(20, 184, 166, 0.1);
  color: var(--mint);
  box-shadow: none;
  font-size: 14px;
  line-height: 1;
}

.branch-actions .branch-action-icon:hover {
  background: rgba(20, 184, 166, 0.2);
  color: var(--ink);
}

.branch-actions .branch-action-icon.danger-button {
  border-color: rgba(180, 35, 24, 0.52);
  background: rgba(180, 35, 24, 0.1);
  color: #fca5a5;
}

.branch-actions .branch-action-icon.danger-button:hover {
  background: rgba(180, 35, 24, 0.2);
  color: #fee2e2;
}

h2 {
  margin: 0 0 16px;
  font-size: 20px;
  color: var(--ink);
  font-weight: 750;
}

h3 {
  margin: 26px 0 12px;
  font-size: 15px;
  color: #d8e7f6;
  font-weight: 700;
}

.grid {
  display: grid;
  gap: 13px;
}

.tab-panel > .grid,
.market-preview {
  padding: 16px;
  margin-bottom: 18px;
  border: 1px solid rgba(36, 50, 71, 0.92);
  border-radius: 9px;
  background: rgba(18, 29, 44, 0.72);
}

.tab-panel > h3 {
  padding-top: 8px;
  border-top: 1px solid rgba(36, 50, 71, 0.78);
}

.tab-panel > h3:first-of-type {
  margin-top: 4px;
  padding-top: 0;
  border-top: 0;
}

.college-section,
.housing-section {
  margin-top: 18px;
}

.housing-section {
  padding-top: 14px;
  border-top: 1px solid rgba(36, 50, 71, 0.72);
}

.housing-section:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.housing-section h3 {
  margin: 0 0 12px;
  color: #d8e7f6;
}

.housing-section.is-hidden,
[data-housing-field].is-hidden {
  display: none;
}

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

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

label {
  display: grid;
  gap: 6px;
  color: #b7c7d9;
  font-size: 12px;
  font-weight: 600;
  position: relative;
}

label.has-field-help {
  padding-right: 30px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #09111d;
  color: var(--ink);
}

input.month-picker-source {
  position: absolute;
  width: 1px;
  min-height: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.month-picker {
  display: grid;
  grid-template-columns: minmax(112px, 1.25fr) minmax(88px, 0.75fr);
  gap: 8px;
}

.month-picker select {
  min-width: 0;
}

textarea {
  min-height: 48px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(20, 184, 166, 0.16);
  border-color: var(--teal);
}

.field-help-button {
  position: absolute;
  top: 0;
  right: 0;
  width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  border-radius: 50%;
  border-color: rgba(20, 184, 166, 0.5);
  background: rgba(20, 184, 166, 0.12);
  color: #7dd3fc;
  box-shadow: none;
  font-size: 12px;
  line-height: 1;
}

.expense-row,
.college-row,
.housing-row,
.rsu-row {
  padding: 14px;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(18, 29, 44, 0.86);
}

.expense-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

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

.college-row-header,
.housing-row-header,
.rsu-row-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
}

.expense-row button,
.college-row button,
.housing-row button,
.rsu-row button {
  background: rgba(8, 13, 23, 0.85);
  color: var(--bad);
  border-color: #efb4ae;
  box-shadow: none;
}

.expense-row .field-help-button,
.college-row .field-help-button,
.housing-row .field-help-button,
.rsu-row .field-help-button,
.field-help-button {
  border-color: rgba(20, 184, 166, 0.5);
  background: rgba(20, 184, 166, 0.12);
  color: #7dd3fc;
  box-shadow: none;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--ink);
  font-size: 13px;
  grid-column: 1 / -1;
}

.checkbox-label input {
  width: auto;
  min-height: auto;
}

.results {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  gap: 18px;
  min-width: 0;
  will-change: transform;
}

.app-layout.drawer-open .results {
  grid-column: 1 / -1;
  grid-row: 2;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  background:
    linear-gradient(180deg, rgba(18, 29, 44, 0.94), rgba(12, 19, 31, 0.96)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 15px 16px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}

.metric strong {
  display: block;
  font-size: 22px;
  color: var(--ink);
}

.metric small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.optionality-metric {
  border-color: rgba(20, 184, 166, 0.32);
  background:
    radial-gradient(circle at 92% 18%, rgba(52, 211, 153, 0.22), transparent 38%),
    linear-gradient(180deg, rgba(13, 37, 41, 0.94), rgba(12, 19, 31, 0.96));
}

.optionality-metric strong {
  color: var(--teal);
}

.optionality-metric small {
  color: #b7c7d9;
  font-size: 11.5px;
  line-height: 1.35;
}

.score-action {
  cursor: pointer;
}

.score-action:hover,
.score-action:focus-visible {
  border-color: rgba(52, 211, 153, 0.72);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.18), var(--shadow-soft);
  outline: none;
}

.chart-panel {
  padding: 16px;
  overflow: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h2,
.section-title h3 {
  margin: 0;
  white-space: nowrap;
}

.chart-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex: 1;
}

.chart-controls input,
.chart-controls select {
  width: auto;
}

.chart-controls .month-picker {
  grid-template-columns: minmax(92px, auto) minmax(78px, auto);
}

#chartMetric {
  min-width: 210px;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1320;
}

.projection-chart-wrap {
  position: relative;
}

.scenario-chart-overlay {
  position: absolute;
  inset: 1px 1px 11px;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 8px;
  background: rgba(7, 11, 18, 0.46);
  backdrop-filter: blur(2px);
}

.scenario-chart-overlay[hidden] {
  display: none;
}

.scenario-chart-card {
  width: min(430px, 100%);
  padding: 16px;
  border: 1px solid rgba(20, 184, 166, 0.42);
  border-radius: 9px;
  background: rgba(8, 13, 23, 0.96);
  box-shadow: var(--shadow);
  text-align: center;
}

.scenario-chart-card strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
}

.scenario-chart-card p {
  margin: 8px 0 13px;
  color: #b7c7d9;
  font-size: 13px;
}

#projectionChart {
  margin-bottom: 10px;
}

.market-preview {
  margin-top: 18px;
}

#marketPreviewRange,
#scenarioRunSummary {
  color: var(--muted);
  font-size: 12px;
}

#scenarioRunSummary {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.scenario-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1.7fr) minmax(112px, 0.55fr) minmax(112px, 0.55fr) minmax(220px, 1.1fr) minmax(220px, auto);
  align-items: end;
  justify-content: stretch;
  gap: 12px;
}

.scenario-controls label {
  min-width: 0;
  max-width: none;
}

.scenario-controls button {
  min-width: 220px;
  height: 40px;
  white-space: normal;
  line-height: 1.15;
}

.scenario-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(20, 184, 166, 0.28);
  border-radius: 8px;
  background: rgba(20, 184, 166, 0.08);
}

.scenario-progress-body {
  display: grid;
  gap: 7px;
}

#scenarioProgressLabel {
  color: #d8e7f6;
  font-size: 13px;
  font-weight: 750;
}

.scenario-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(8, 13, 23, 0.9);
}

#scenarioProgressBar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--mint));
  transition: width 180ms ease;
}

.scenario-diagnostics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.scenario-diagnostic {
  padding: 11px 12px;
  border: 1px solid rgba(36, 50, 71, 0.92);
  border-radius: 8px;
  background: rgba(8, 13, 23, 0.62);
}

.scenario-diagnostic span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}

.scenario-diagnostic strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.scenario-diagnostic small {
  display: block;
  margin-top: 4px;
  color: #b7c7d9;
  font-size: 11px;
}

.scenario-diagnostics[hidden] {
  display: none;
}

.table-wrap {
  overflow: auto;
  max-height: 360px;
}

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

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  background: #111c2c;
  z-index: 1;
}

.panel:not(.chart-panel) {
  padding: 16px;
}

.ai-assistant {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  width: min(410px, calc(100vw - 36px));
  height: min(580px, calc(100vh - 110px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 2px solid rgba(45, 212, 191, 0.74);
  border-radius: 10px;
  background: rgba(8, 13, 23, 0.96);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(237, 245, 255, 0.12),
    0 0 42px rgba(20, 184, 166, 0.38),
    0 0 86px rgba(139, 92, 246, 0.18);
  overflow: hidden;
}

.ai-assistant.is-minimized {
  height: auto;
}

.ai-assistant.is-minimized .ai-messages,
.ai-assistant.is-minimized .ai-compose {
  display: none;
}

.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.14), rgba(139, 92, 246, 0.1));
}

.ai-header span {
  display: block;
  color: var(--ink);
  font-weight: 850;
}

.ai-header small {
  color: var(--muted);
  font-size: 12px;
}

.ai-header button {
  width: 30px;
  min-height: 30px;
  padding: 0;
  background: rgba(8, 13, 23, 0.75);
  color: var(--ink);
  border-color: rgba(20, 184, 166, 0.45);
  box-shadow: none;
}

.ai-messages {
  padding: 12px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-message {
  max-width: 92%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(18, 29, 44, 0.86);
  color: #d8e7f6;
  font-size: 13px;
  white-space: pre-wrap;
}

.ai-message.user {
  align-self: flex-end;
  background: rgba(20, 184, 166, 0.15);
  border-color: rgba(20, 184, 166, 0.34);
}

.ai-message.assistant {
  align-self: flex-start;
}

.ai-message.actions {
  border-color: rgba(52, 211, 153, 0.38);
  color: #a7f3d0;
}

.ai-signin-gate {
  display: grid;
  gap: 10px;
  max-width: 100%;
  border-color: rgba(20, 184, 166, 0.44);
  background:
    linear-gradient(180deg, rgba(20, 184, 166, 0.13), rgba(15, 23, 36, 0.92)),
    rgba(18, 29, 44, 0.92);
}

.ai-signin-gate strong {
  color: var(--ink);
  font-size: 16px;
}

.ai-signin-gate p {
  margin: 0;
  color: #cbd5e1;
  line-height: 1.45;
  white-space: normal;
}

.ai-signin-gate span {
  color: #a7f3d0;
  font-weight: 800;
}

.ai-signin-gate button {
  width: 100%;
  margin-top: 2px;
  min-height: 42px;
}

.ai-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(15, 23, 36, 0.94);
}

.ai-compose button {
  align-self: end;
}

.field-helper-popover {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.field-helper-card {
  position: absolute;
  right: 440px;
  bottom: 118px;
  width: min(340px, calc(100vw - 36px));
  padding: 14px;
  border: 1px solid rgba(20, 184, 166, 0.36);
  border-radius: 9px;
  background: rgba(8, 13, 23, 0.98);
  box-shadow: var(--shadow);
  color: #d8e7f6;
  pointer-events: auto;
}

.field-helper-card strong {
  display: block;
  padding-right: 28px;
  color: var(--ink);
}

.field-helper-card p {
  margin: 8px 0 12px;
  color: #b7c7d9;
  font-size: 13px;
}

.field-helper-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  min-height: 24px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
  box-shadow: none;
}

.flags {
  margin: 0;
  padding-left: 20px;
}

.flags li {
  margin: 7px 0;
}

.ok {
  color: var(--good);
}

.warn {
  color: var(--warn);
}

.bad {
  color: var(--bad);
}

@keyframes drawerSlideOut {
  from {
    opacity: 0;
    transform: translateX(-42px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes drawerSlideIn {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-30px);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .app-layout.drawer-opening #plannerForm,
  .app-layout.drawer-closing #plannerForm,
  .tab-panel.entering {
    animation: none;
  }
}

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

  .inputs-panel {
    position: static;
    max-height: none;
  }

  .app-layout.drawer-open .inputs-panel {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  #plannerForm {
    max-height: none;
  }

  .results,
  .app-layout.drawer-open .results {
    grid-column: 1;
    grid-row: auto;
  }

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

  .overview-hero,
  .overview-grid,
  .overview-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .branch-analytics-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .scenario-controls button {
    min-width: 0;
  }
}

@media (max-width: 700px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
    position: static;
    padding: 16px;
  }

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

  .auth-status {
    flex: 1 0 100%;
    max-width: none;
  }

  .brand,
  .brand-banner {
    width: 100%;
  }

  .brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .brand-banner {
    width: min(360px, 100%);
    max-height: 74px;
  }

  .brand-copy {
    width: 100%;
    min-width: 0;
    padding-left: 0;
    padding-top: 10px;
    border-left: 0;
    border-top: 1px solid rgba(20, 184, 166, 0.34);
  }

  .header-actions button {
    flex: 1;
  }

  .app-footer {
    grid-template-columns: 1fr;
    padding: 24px 18px 118px;
  }

  .branch-change-prompt {
    align-items: stretch;
    flex-direction: column;
    padding: 12px 16px;
  }

  .branch-change-prompt button {
    width: 100%;
  }

  .app-layout {
    padding: 12px;
  }

  .inputs-panel {
    grid-template-columns: 1fr;
  }

  .app-layout.drawer-open .inputs-panel {
    grid-template-columns: 1fr;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-radius: 10px 10px 0 0;
    min-height: auto;
  }

  .app-layout.drawer-open .tabs {
    border-radius: 10px 10px 0 0;
  }

  #plannerForm {
    border-left: 1px solid var(--line);
    border-radius: 0 0 10px 10px;
  }

  .nav-label {
    grid-column: 1 / -1;
  }

  .tab {
    text-align: center;
    justify-content: center;
  }

  .two,
  .three,
  .summary-grid,
  .overview-hero,
  .overview-grid,
  .overview-strip,
  .account-danger-zone,
  .branch-active,
  .branch-analytics-controls,
  .expense-row,
  .college-row-header,
  .housing-row-header,
  .rsu-row-header {
    grid-template-columns: 1fr;
  }

  .overview-hero,
  .overview-grid {
    padding-left: 18px;
    padding-right: 18px;
  }

  .overview-hero {
    padding-top: 24px;
    padding-bottom: 22px;
  }

  .overview-grid {
    gap: 10px;
  }

  .overview-strip,
  .overview-note {
    margin-left: 18px;
    margin-right: 18px;
  }

  .overview-note {
    padding-left: 18px;
    padding-right: 18px;
  }

  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .section-title h2,
  .section-title h3 {
    white-space: normal;
  }

  .chart-controls {
    justify-content: stretch;
    flex: initial;
  }

  .chart-controls input,
  .chart-controls select,
  .chart-controls button {
    width: 100%;
  }

  .scenario-controls {
    grid-template-columns: 1fr;
  }

  #scenarioRunSummary {
    text-align: left;
  }

  .chart-panel {
    padding: 12px;
  }

  .ai-assistant {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
    height: 46vh;
  }

  .field-helper-card {
    right: 10px;
    bottom: calc(46vh + 24px);
  }
}
