:root {
  --bg: #f1f4f4;
  --surface: #ffffff;
  --surface-2: #f7f8f8;
  --ink: #182126;
  --muted: #68767c;
  --line: #e0e5e6;
  --line-strong: #cbd4d6;
  --teal: #0f6b71;
  --teal-2: #084a4f;
  --mint: #dff1ec;
  --coral: #c45f45;
  --gold: #b8892c;
  --green: #278455;
  --red: #b64646;
  --blue: #4267a6;
  --accent-fill: #084a4f;
  --topbar-bg: rgba(255, 255, 255, 0.96);
  --field-bg: #fbfcfc;
  --table-head: #f7f9f9;
  --output-bg: #fafbfb;
  --chart-bg: #ffffff;
  --chart-grid: #dbe2e4;
  --chart-text: #68767c;
  --danger-bg: #fff7f6;
  --shadow: 0 1px 2px rgba(24, 33, 38, 0.05), 0 6px 18px rgba(24, 33, 38, 0.05);
  --radius: 4px;
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0f1518;
  --surface: #182126;
  --surface-2: #202b30;
  --ink: #edf3f4;
  --muted: #9dabb0;
  --line: #334147;
  --line-strong: #46575e;
  --teal: #21858b;
  --teal-2: #78c2be;
  --mint: #193631;
  --coral: #e07b60;
  --gold: #d3a64c;
  --green: #55b57f;
  --red: #ef8585;
  --blue: #78a4df;
  --accent-fill: #176d73;
  --topbar-bg: rgba(20, 29, 33, 0.97);
  --field-bg: #11191d;
  --table-head: #202b30;
  --output-bg: #121a1e;
  --chart-bg: #182126;
  --chart-grid: #334147;
  --chart-text: #aab6ba;
  --danger-bg: #2d1d1e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px rgba(0, 0, 0, 0.22);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

button,
input,
select,
textarea {
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.standalone-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.standalone-shell > .auth-shell {
  flex: 1;
  min-height: 0;
  width: 100%;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 34px;
  padding: 7px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

.app-footer strong {
  color: var(--ink);
  font-weight: 750;
}

.app-footer a {
  color: var(--teal-2);
  font-weight: 800;
  text-decoration: none;
}

.app-footer a:hover,
.app-footer a:focus-visible {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  box-shadow: 0 1px 0 rgba(24, 33, 38, 0.02);
  backdrop-filter: blur(14px);
}

.topbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

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

.mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent-fill);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
}

.brand-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.1;
  white-space: nowrap;
}

.brand-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.platform-brand {
  gap: 10px;
}

.platform-navigation {
  display: flex;
  align-self: stretch;
  align-items: center;
  gap: 2px;
  min-width: 0;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.platform-navigation button {
  position: relative;
  min-height: 34px;
  padding: 0 11px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.platform-navigation button:hover,
.platform-navigation button:focus-visible {
  background: var(--surface-2);
  color: var(--ink);
}

.platform-navigation button.active {
  background: var(--mint);
  color: var(--teal-2);
}

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

.platform-release {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.scenario-control-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.scenario-adjust-button {
  min-height: 32px;
  padding: 0 9px;
}

.control-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.segmented button {
  min-height: 27px;
  padding: 0 9px;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.segmented button.active {
  background: var(--teal);
  color: #fff;
}

.segmented button:not(.active):hover {
  background: var(--surface-2);
  color: var(--ink);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-left: 2px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--teal);
}

.action-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: var(--accent-fill);
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.action-button:hover {
  background: var(--teal);
}

.compact-button {
  min-height: 32px;
}

.action-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.text-button {
  justify-self: center;
  padding: 4px 7px;
  background: transparent;
  color: var(--teal);
  font-size: 12px;
  font-weight: 750;
}

.ghost-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.ghost-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.danger-button {
  border-color: rgba(180, 71, 71, 0.35);
  color: var(--red);
}

.danger-button:hover {
  border-color: rgba(180, 71, 71, 0.55);
  background: var(--danger-bg);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(350px, 440px) minmax(560px, 1fr);
  gap: 22px;
  align-items: center;
  justify-content: center;
  width: min(1320px, 100%);
  min-height: calc(100vh - 34px);
  margin: 0 auto;
  padding: 28px 22px;
}

.auth-shell.auth-single {
  grid-template-columns: minmax(320px, 620px);
  align-items: center;
}

.auth-card,
.auth-aside {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.auth-card {
  padding: 26px 28px;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.auth-brand h1,
.auth-aside h2 {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.08;
}

.auth-copy,
.auth-aside p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.auth-theme {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.auth-mode {
  display: flex;
  width: 100%;
  margin-top: 18px;
}

.auth-mode button {
  flex: 1;
}

.auth-submit {
  min-height: 44px;
}

.auth-reassurance {
  margin: -1px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.auth-network {
  margin-top: 20px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.auth-network-label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-network-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.auth-network-links a {
  color: var(--teal-2);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.auth-network-links a:hover,
.auth-network-links a:focus-visible {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-aside {
  display: grid;
  align-content: center;
  gap: 18px;
  min-width: 0;
  overflow: hidden;
  padding: 24px;
  background: var(--surface);
}

.auth-preview-copy {
  display: grid;
  gap: 5px;
}

.auth-preview-kicker {
  color: var(--teal);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-preview-copy h2 {
  max-width: 620px;
  margin: 0;
  font-size: 28px;
}

.auth-preview-copy p {
  max-width: 680px;
  margin: 0;
}

.auth-product-preview {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: 0 12px 30px rgba(24, 33, 38, 0.12);
}

.auth-product-preview img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top left;
}

.auth-product-preview figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 13px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.auth-product-preview figcaption span {
  color: var(--teal);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.auth-product-preview figcaption strong {
  min-width: 0;
  font-size: 11px;
  text-align: right;
}

.auth-outcomes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.auth-outcomes span {
  min-width: 0;
  padding: 11px 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.auth-outcomes span + span {
  border-left: 1px solid var(--line);
}

.auth-outcomes strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 13px;
}

.form-error {
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.form-notice {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(45, 139, 87, 0.28);
  border-radius: var(--radius);
  background: var(--mint);
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.loading-card,
.setup-card {
  min-height: 240px;
}

.setup-card code {
  color: var(--teal-2);
  font-weight: 800;
}

.setup-status {
  display: grid;
  gap: 5px;
  margin-top: 22px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.setup-status span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.project-bar {
  display: grid;
  grid-template-columns: minmax(440px, 1fr) auto minmax(150px, auto);
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.project-context {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 780px;
}

.rename-model-button {
  justify-self: start;
}

.project-account,
.project-control {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.project-account {
  position: relative;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.project-account strong,
.project-account small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-account strong {
  font-size: 12px;
}

.project-account small,
.project-control span,
.save-status {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.project-control span {
  letter-spacing: 0;
  text-transform: uppercase;
}

.project-control input,
.project-control select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--ink);
  padding: 6px 8px;
}

.new-project-group {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.project-modal {
  width: min(480px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
}

.project-dialog-form {
  display: grid;
  gap: 18px;
}

.model-start-fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.model-start-fieldset legend {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.model-start-switch {
  display: flex;
  width: 100%;
}

.model-start-switch button {
  flex: 1;
}

.model-start-fieldset p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.project-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.project-save {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.project-status-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
}

.access-badge,
.read-only-badge {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}

.access-badge.owner,
.access-badge.editor {
  border-color: rgba(39, 132, 85, 0.3);
  background: var(--mint);
  color: var(--green);
}

.realtime-badge {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.realtime-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--muted);
}

.realtime-badge.live {
  color: var(--green);
}

.realtime-badge.live::before {
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 16%, transparent);
}

.realtime-badge.connecting {
  color: var(--gold);
}

.realtime-badge.connecting::before {
  background: var(--gold);
}

.project-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.save-status {
  white-space: nowrap;
}

.save-status::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--green);
  vertical-align: 1px;
}

.billing-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  min-height: 20px;
  margin-top: 2px;
  padding: 0 7px;
  border: 1px solid rgba(18, 106, 115, 0.18);
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-2);
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}

.account-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.admin-entry-button {
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--teal);
  border-radius: 4px;
  background: var(--teal);
  color: #fff;
  font-size: 10px;
  font-weight: 850;
}

.admin-entry-button:hover {
  background: var(--teal-2);
}

.theme-switch {
  gap: 1px;
  padding: 2px;
}

.theme-switch button {
  min-height: 20px;
  padding: 0 6px;
  font-size: 10px;
}

.admin-topbar {
  grid-template-columns: minmax(240px, 1fr) auto;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.admin-access-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(184, 137, 44, 0.35);
  border-radius: 4px;
  background: rgba(184, 137, 44, 0.12);
  color: var(--gold);
  font-size: 11px;
  font-weight: 850;
}

.admin-shell {
  flex: 1;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.admin-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 6px 0 20px;
  border-bottom: 1px solid var(--line-strong);
}

.admin-page-head h2 {
  margin: 0;
  font-size: 24px;
}

.admin-page-head p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-page-actions > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.admin-page-actions .ghost-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.admin-error {
  margin: 14px 0 0;
  padding: 11px 13px;
  border: 1px solid rgba(180, 71, 71, 0.35);
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.admin-metric {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 98px;
  align-content: center;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}

.admin-metric:last-child {
  border-right: 0;
}

.admin-metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--teal);
}

.admin-metric:nth-child(2)::before {
  background: var(--green);
}

.admin-metric:nth-child(3)::before {
  background: var(--blue);
}

.admin-metric:nth-child(4)::before {
  background: var(--gold);
}

.admin-metric span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.admin-metric strong {
  font-size: 28px;
  line-height: 1;
}

.admin-directory {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(24, 33, 38, 0.04);
}

.admin-directory-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.admin-directory-head h3 {
  margin: 0;
  font-size: 16px;
}

.admin-directory-head > div:first-child > span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.admin-filters {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(140px, 170px);
  gap: 9px;
}

.admin-filter {
  display: grid;
  gap: 5px;
}

.admin-filter > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.admin-filter input,
.admin-filter select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--field-bg);
  color: var(--ink);
  padding: 7px 9px;
  font-size: 12px;
}

.admin-filter input:focus,
.admin-filter select:focus {
  outline: 2px solid rgba(15, 107, 113, 0.16);
  border-color: var(--teal);
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.admin-table th {
  background: var(--table-head);
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.admin-table td {
  color: var(--muted);
  font-size: 12px;
}

.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-table tbody tr:hover td {
  background: var(--surface-2);
}

.admin-table td:nth-child(5),
.admin-table th:nth-child(5) {
  text-align: right;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-avatar {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 4px;
  background: var(--mint);
  color: var(--teal-2);
  font-size: 11px;
  font-weight: 900;
}

.admin-user-copy {
  display: grid;
  gap: 3px;
}

.admin-user-copy strong {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
}

.admin-user-copy small {
  color: var(--muted);
  font-size: 11px;
}

.admin-role,
.account-status {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 850;
}

.admin-role {
  border: 1px solid rgba(184, 137, 44, 0.3);
  background: rgba(184, 137, 44, 0.1);
  color: var(--gold);
}

.account-status.confirmed {
  background: var(--mint);
  color: var(--green);
}

.account-status.pending {
  background: var(--danger-bg);
  color: var(--coral);
}

.admin-empty {
  height: 150px;
  color: var(--muted);
  text-align: center !important;
  white-space: normal !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(31, 37, 40, 0.34);
}

.team-modal {
  width: min(780px, 100%);
  max-height: min(780px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
}

.team-modal-head {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.team-modal-head .modal-copy {
  max-width: 590px;
  margin: 6px 0 0;
}

.team-invite-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px auto;
  align-items: end;
  gap: 9px;
  padding-bottom: 16px;
}

.team-invite-form .action-button {
  min-height: 38px;
}

.team-message {
  margin: 0 0 12px;
}

.team-permission-note,
.team-setup-required {
  margin-bottom: 14px;
  padding: 11px 12px;
  border-left: 3px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.team-setup-required strong {
  color: var(--ink);
}

.team-setup-required p {
  margin: 5px 0 0;
}

.team-directory {
  border-top: 1px solid var(--line);
}

.team-directory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0 9px;
}

.team-directory-head strong {
  font-size: 12px;
}

.team-directory-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.team-list {
  border-bottom: 1px solid var(--line);
}

.team-member {
  display: grid;
  grid-template-columns: 34px minmax(150px, 1fr) auto 116px 32px;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.team-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--mint);
  color: var(--teal-2);
  font-size: 10px;
  font-weight: 900;
}

.team-member-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.team-member-copy strong,
.team-member-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-member-copy strong {
  font-size: 12px;
}

.team-member-copy small {
  color: var(--muted);
  font-size: 11px;
}

.team-status,
.team-owner-role {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.team-status.pending {
  color: var(--gold);
}

.team-owner-role {
  justify-self: end;
  color: var(--green);
}

.team-role-select {
  width: 116px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--ink);
  padding: 5px 7px;
  font-size: 11px;
  font-weight: 750;
}

.team-remove {
  width: 30px;
  height: 30px;
}

.team-empty {
  min-height: 90px;
  padding: 30px 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.share-link-panel {
  display: grid;
  gap: 8px;
  padding-top: 15px;
}

.share-link-panel > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.share-link-panel strong {
  font-size: 12px;
}

.share-link-panel span,
.share-link-panel p {
  color: var(--muted);
  font-size: 11px;
}

.share-link-panel p {
  margin: 0;
  line-height: 1.4;
}

.share-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.share-link-row input {
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  padding: 7px 9px;
  font-size: 11px;
}

.scenario-modal {
  width: min(900px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
}

.scenario-modal-head {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.scenario-modal-copy {
  max-width: 620px;
  margin: 6px 0 0;
}

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

.scenario-case {
  min-width: 0;
  padding: 2px 20px 0 0;
}

.scenario-case + .scenario-case {
  padding: 2px 0 0 20px;
  border-left: 1px solid var(--line);
}

.scenario-case-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.scenario-case-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.scenario-case-head strong {
  font-size: 13px;
}

.scenario-include-toggle {
  flex: 0 0 auto;
  color: var(--ink);
}

.scenario-case.excluded .scenario-case-head {
  margin-bottom: 0;
}

.scenario-case.excluded .scenario-case-title {
  opacity: 0.72;
}

.scenario-excluded-copy {
  margin: 14px 0 0;
  padding: 11px 12px;
  border-left: 3px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.scenario-case-badge {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--teal);
  border-radius: 4px;
  background: var(--mint);
  color: var(--teal-2);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.scenario-case.downside .scenario-case-badge {
  border-color: var(--coral);
  background: var(--danger-bg);
  color: var(--red);
}

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

.scenario-field .input-with-unit input {
  padding-right: 72px;
}

.scenario-field .input-unit {
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenario-impact {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.scenario-impact > div {
  min-width: 0;
  padding: 11px 9px;
  border-right: 1px solid var(--line);
}

.scenario-impact > div:last-child {
  border-right: 0;
}

.scenario-impact span,
.scenario-impact strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenario-impact span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.scenario-impact strong {
  font-size: 13px;
}

.scenario-dialog-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.export-modal {
  width: min(760px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal-title {
  margin: 3px 0 0;
  font-size: 18px;
}

.modal-copy {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.export-textarea {
  width: 100%;
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--ink);
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
}

.export-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.workspace-home-shell {
  flex: 1;
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  padding: 22px 24px 34px;
}

.workspace-home-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 4px 0 22px;
}

.workspace-home-head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

.workspace-home-meta {
  max-width: 620px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.workspace-primary-action {
  min-width: 132px;
}

.workspace-snapshot {
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) minmax(0, 2.3fr);
  align-items: stretch;
  border-block: 1px solid var(--line-strong);
  background: var(--surface);
}

.workspace-snapshot-title {
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}

.workspace-snapshot-title span,
.workspace-kpis dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.workspace-snapshot-title strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
}

.workspace-kpis > div {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
  padding: 16px 20px;
  border-right: 1px solid var(--line);
}

.workspace-kpis > div:last-child {
  border-right: 0;
}

.workspace-kpis dd {
  margin: 0;
  overflow: hidden;
  font-size: 21px;
  font-weight: 850;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-foundation {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(0, 2.3fr);
  align-items: center;
  gap: 30px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.workspace-foundation h3,
.module-directory-head h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

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

.workspace-foundation dl > div {
  display: grid;
  gap: 4px;
  padding-left: 12px;
  border-left: 3px solid var(--line-strong);
}

.workspace-foundation dl > div:nth-child(1) {
  border-left-color: var(--teal);
}

.workspace-foundation dl > div:nth-child(2) {
  border-left-color: var(--coral);
}

.workspace-foundation dl > div:nth-child(3) {
  border-left-color: var(--gold);
}

.workspace-foundation dl > div:nth-child(4) {
  border-left-color: var(--blue);
}

.workspace-foundation dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.workspace-foundation dd {
  margin: 0;
  font-size: 16px;
  font-weight: 850;
}

.module-directory {
  padding-top: 24px;
}

.module-directory-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}

.module-directory-head > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

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

.module-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 228px;
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.module-card:nth-child(1) {
  border-top-color: var(--teal);
}

.module-card:nth-child(2) {
  border-top-color: var(--coral);
}

.module-card:nth-child(3) {
  border-top-color: var(--gold);
}

.module-card:nth-child(4) {
  border-top-color: var(--blue);
}

.module-card.planned {
  background: var(--surface-2);
}

.module-card > header,
.module-card > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.module-sequence {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
}

.module-status {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.module-status.ready {
  border-color: rgba(39, 132, 85, 0.35);
  background: var(--mint);
  color: var(--green);
}

.module-card-body {
  align-self: center;
  padding-block: 22px;
}

.module-card h4 {
  margin: 0 0 7px;
  font-size: 17px;
  letter-spacing: 0;
}

.module-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.module-open-button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0 10px;
  border-radius: var(--radius);
  background: var(--accent-fill);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
}

.module-open-button:hover,
.module-open-button:focus-visible {
  background: var(--teal);
}

.module-roadmap-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.forecast-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(400px, 0.78fr) minmax(620px, 1.42fr);
  gap: 8px;
  padding: 8px;
}

.workspace.inputs .output-panel,
.workspace.outputs .input-panel {
  display: none;
}

.workspace.inputs .forecast-grid,
.workspace.outputs .forecast-grid {
  grid-template-columns: minmax(0, 1fr);
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
  overflow: hidden;
}

.input-panel {
  align-self: start;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-height: 56px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.input-head-status {
  display: flex;
  align-items: center;
  gap: 7px;
}

.panel-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.panel-kicker {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.output-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.output-size-control {
  min-width: 0;
}

.output-size-switch button {
  min-width: 54px;
}

.report-period-switch {
  flex: 0 0 auto;
}

.report-view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--teal);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.report-view-title {
  min-width: 0;
}

.report-view-title .panel-kicker {
  margin-bottom: 2px;
}

.report-view-title h3 {
  margin: 0;
  font-size: 14px;
}

.report-view-title > span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.report-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-control-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.setup-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.input-stepper {
  display: flex;
  gap: 2px;
  padding: 4px 8px 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  overflow-x: auto;
}

.input-stepper button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  flex: 1 1 0;
  min-height: 34px;
  min-width: 62px;
  margin-bottom: -1px;
  padding: 4px 7px 6px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-align: left;
  white-space: nowrap;
}

.input-stepper button span {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.input-stepper button.active {
  border-bottom-color: var(--teal);
  background: transparent;
  color: var(--teal-2);
}

.input-stepper button.active span {
  background: var(--teal);
  color: #fff;
}

.input-stepper button:not(.active):hover {
  background: var(--surface-2);
  color: var(--ink);
}

.input-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.input-summary div {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 1px 8px;
}

.input-summary div:first-child {
  padding-left: 0;
}

.input-summary div:last-child {
  padding-right: 0;
  border-right: 0;
}

.input-summary span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.input-summary strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  line-height: 1.1;
}

.step-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.step-intro h3 {
  margin: 1px 0 4px;
  font-size: 15px;
}

.step-intro p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.step-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.segmented.small button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 11px;
}

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--output-bg);
}

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

.section {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.section:last-child {
  border-bottom: 0;
}

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

.section-title {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

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

.field-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 5px;
}

.field span,
.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--ink);
  padding: 7px 9px;
}

.field input:hover,
.field textarea:hover,
.field select:hover,
.project-control input:hover,
.project-control select:hover,
.table-input:hover {
  border-color: var(--line-strong);
}

.field-control-row {
  display: grid;
  grid-template-columns: minmax(88px, 0.72fr) minmax(0, 1fr);
  gap: 8px;
}

.input-with-unit {
  position: relative;
  min-width: 0;
}

.field .input-with-unit input {
  padding-right: 70px;
}

.input-unit {
  position: absolute;
  top: 50%;
  right: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  pointer-events: none;
  transform: translateY(-50%);
}

.field textarea {
  min-height: 96px;
  line-height: 1.45;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.project-control input:focus,
.project-control select:focus,
.table-input:focus {
  outline: 3px solid rgba(18, 106, 115, 0.18);
  border-color: var(--teal);
}

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

.plan-field:first-child,
.pitch-field:first-child {
  grid-column: 1 / -1;
}

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

.sales-plan-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto 150px auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 9px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.sales-plan-toolbar.full-horizon-toolbar {
  grid-template-columns: minmax(150px, 1fr) minmax(420px, auto) auto auto;
}

.product-plan-switch {
  min-width: 430px;
}

.forecast-range-badge {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.product-layer {
  margin-top: 8px;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
}

.layer-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.layer-heading h4 {
  margin: 2px 0 0;
  font-size: 14px;
}

.layer-heading > span {
  max-width: 440px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-align: right;
}

.compact-sheet-wrap,
.channel-sheet-wrap {
  width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.compact-sheet,
.channel-sales-table,
.channel-economics-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}

.compact-sheet th,
.compact-sheet td,
.channel-sales-table th,
.channel-sales-table td,
.channel-economics-table th,
.channel-economics-table td {
  height: 36px;
  padding: 4px 5px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.compact-sheet th,
.channel-sales-table th,
.channel-economics-table th {
  background: var(--table-head);
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.compact-sheet tr:last-child td,
.channel-sales-table tr:last-child td,
.channel-economics-table tr:last-child td {
  border-bottom: 0;
}

.compact-sheet th:last-child,
.compact-sheet td:last-child,
.channel-sales-table th:last-child,
.channel-sales-table td:last-child,
.channel-economics-table th:last-child,
.channel-economics-table td:last-child {
  border-right: 0;
}

.sku-catalog-table {
  table-layout: fixed;
}

.sku-catalog-table th:first-child,
.sku-catalog-table td:first-child {
  width: 42%;
  text-align: left;
}

.sku-catalog-table th:last-child,
.sku-catalog-table td:last-child {
  width: 44px;
  text-align: center;
}

.sheet-text-input,
.table-select {
  width: 100%;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.sheet-text-input {
  padding: 0 7px;
  text-align: left;
}

.table-select {
  min-width: 92px;
  padding: 0 22px 0 6px;
}

.channel-manager-heading {
  align-items: center;
}

.channel-add-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.channel-add-control select {
  min-width: 132px;
  min-height: 32px;
  padding: 0 24px 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
}

.channel-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.channel-row {
  display: grid;
  grid-template-columns: 112px minmax(150px, 1fr) auto 34px;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
}

.channel-row:last-child {
  border-bottom: 0;
}

.channel-type {
  color: var(--teal);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.channel-row-count {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.channel-row .remove-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.channel-sheet-wrap {
  max-height: min(62vh, 620px);
}

.channel-sales-table {
  table-layout: auto;
}

.channel-sales-table th,
.channel-sales-table td {
  width: 82px;
  min-width: 82px;
}

.channel-sales-table .sticky-sku,
.channel-sales-table .sticky-channel {
  position: sticky;
  z-index: 3;
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  overflow: hidden;
  background: var(--surface);
  text-align: left;
  text-overflow: ellipsis;
}

.channel-sales-table .sticky-sku {
  left: 0;
  font-weight: 800;
}

.channel-sales-table .sticky-channel {
  left: 140px;
  color: var(--muted);
}

.channel-sales-table thead .sticky-sku,
.channel-sales-table thead .sticky-channel {
  z-index: 5;
  background: var(--table-head);
}

.channel-sales-table .year-band {
  width: auto;
  min-width: 0;
  max-width: none;
  background: var(--ink);
  color: var(--surface);
  text-align: center;
}

[data-theme="dark"] .channel-sales-table .year-band {
  background: #11191b;
  color: #e8eeee;
}

.channel-sales-table .year-start {
  border-left: 2px solid var(--teal);
}

.channel-sales-table .channel-row-total {
  width: 110px;
  min-width: 110px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 850;
}

.channel-sales-table .table-input,
.channel-economics-table .table-input {
  min-width: 0;
  height: 28px;
  padding: 0 5px;
  text-align: right;
}

.channel-sales-table .projected-value {
  border-style: dashed;
  background: var(--surface-2);
  color: var(--muted);
}

.channel-sales-table .manual-value {
  border-color: var(--teal);
  background: var(--mint);
  color: var(--ink);
}

.channel-economics-table {
  min-width: 690px;
}

.channel-economics-table.complex {
  min-width: 1480px;
}

.channel-economics-table th:first-child,
.channel-economics-table td:first-child,
.channel-economics-table th:nth-child(2),
.channel-economics-table td:nth-child(2) {
  min-width: 130px;
  text-align: left;
  font-weight: 800;
}

.channel-economics-table td:nth-child(2) {
  color: var(--muted);
}

.channel-economics-table th:not(:first-child):not(:nth-child(2)),
.channel-economics-table td:not(:first-child):not(:nth-child(2)) {
  min-width: 108px;
}

.calculated-cell {
  background: var(--surface-2);
  color: var(--teal);
  font-weight: 850;
}

.sheet-input-unit {
  position: relative;
}

.sheet-input-unit .table-input {
  padding-right: 43px;
}

.sheet-input-unit span {
  position: absolute;
  top: 50%;
  right: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  pointer-events: none;
  transform: translateY(-50%);
}

.product-plan-switch button {
  flex: 1;
  white-space: nowrap;
}

.cost-plan-reset {
  min-height: 34px;
  align-self: end;
}

.sales-plan-toolbar h3 {
  margin: 2px 0 0;
  font-size: 15px;
}

.sales-plan-year select {
  min-height: 34px;
}

.sales-source-key {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-height: 34px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.sales-source-key span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sales-source-key i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
}

.sales-source-key i.custom {
  background: var(--mint);
  border: 1px solid var(--teal);
}

.sku-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.sku-card-head {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  background: var(--table-head);
  border-bottom: 1px solid var(--line);
}

.sku-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.sales-plan-status {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  white-space: nowrap;
}

.sales-plan-status.custom {
  border-style: solid;
  border-color: var(--teal);
  background: var(--mint);
  color: var(--teal-2);
}

.reset-sales-button:disabled {
  opacity: 0.42;
  cursor: default;
}

.sku-economics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.sku-inventory-settings {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  align-items: end;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.inventory-timing-summary {
  display: grid;
  grid-column: 1 / -1;
  min-height: 56px;
  align-content: center;
  gap: 5px;
  padding: 9px 10px;
  border-left: 3px solid var(--teal);
  background: var(--surface);
}

.inventory-timing-summary span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.inventory-timing-summary strong {
  font-size: 12px;
  line-height: 1.35;
}

.listing-fee-field {
  grid-column: span 2;
}

.remove-button {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--red);
  font-size: 16px;
  font-weight: 800;
}

.units-wrap {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.sales-grid-table {
  min-width: 1280px;
}

.sales-grid-table th:first-child,
.sales-grid-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 128px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--surface);
}

.sales-grid-table th:first-child {
  z-index: 3;
  background: var(--table-head);
}

.sales-grid-table .projected-value,
.expense-grid-table .projected-value {
  border-style: dashed;
  background: var(--surface-2);
  color: var(--muted);
}

.sales-grid-table .manual-value,
.expense-grid-table .manual-value {
  border-color: var(--teal);
  background: var(--mint);
  color: var(--ink);
}

.cost-grid-table td:first-child {
  color: var(--ink);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.inventory-grid-table .inventory-purchase-row td:first-child,
.inventory-grid-table .inventory-ledger-row td:first-child {
  color: var(--ink);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.inventory-grid-table .inventory-ledger-row td {
  background: var(--surface-2);
  font-size: 11px;
}

.inventory-grid-table .inventory-money-row.cash td {
  background: var(--surface);
}

.inventory-grid-table .inventory-money-row.payable td {
  color: var(--ink);
  font-weight: 750;
}

.inventory-grid-table .inventory-ledger-row.ending td {
  border-top: 1px solid var(--line-strong);
  background: var(--table-head);
  color: var(--ink);
  font-weight: 850;
}

.inventory-grid-table .inventory-ledger-row.danger td.inventory-warning {
  background: var(--danger-bg);
  color: var(--red);
  font-weight: 900;
}

.inventory-cash-total {
  min-width: 96px;
  color: var(--teal-2);
  font-weight: 900;
}

.sales-year-total {
  min-width: 92px;
  color: var(--ink);
  font-weight: 900;
}

.units-table,
.statement-table,
.expense-table,
.quarter-table,
.schedule-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.units-table th,
.units-table td,
.statement-table th,
.statement-table td,
.expense-table th,
.expense-table td,
.quarter-table th,
.quarter-table td,
.schedule-table th,
.schedule-table td {
  border-bottom: 1px solid var(--line);
  padding: 6px 7px;
  text-align: right;
  white-space: nowrap;
}

.units-table th:first-child,
.units-table td:first-child,
.statement-table th:first-child,
.statement-table td:first-child,
.expense-table th:first-child,
.expense-table td:first-child,
.quarter-table th:first-child,
.quarter-table td:first-child,
.schedule-table th:first-child,
.schedule-table td:first-child {
  text-align: left;
}

.units-table th,
.statement-table th,
.expense-table th,
.quarter-table th,
.schedule-table th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
  background: var(--table-head);
}

.units-table tr:last-child td,
.statement-table tr:last-child td,
.expense-table tr:last-child td,
.quarter-table tr:last-child td,
.schedule-table tr:last-child td {
  border-bottom: 0;
}

.table-input {
  width: 72px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--ink);
  padding: 5px 6px;
  text-align: right;
}

.expense-table .table-input {
  width: 100%;
  min-width: 90px;
}

.expense-table .expense-name {
  min-width: 170px;
  text-align: left;
}

.expense-grid-table {
  min-width: 1260px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.expense-grid-table .table-input {
  width: 86px;
  min-width: 86px;
}

.expense-grid-table .expense-name {
  width: 190px;
  min-width: 190px;
}

.workspace input.customized-value,
.workspace select.customized-value,
.workspace textarea.customized-value {
  border-color: var(--teal);
  border-style: solid;
  background: var(--mint);
  color: var(--ink);
}

.workspace input.customized-value:focus,
.workspace select.customized-value:focus,
.workspace textarea.customized-value:focus {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--teal) 22%, transparent);
}

.expense-grid-table th:first-child,
.expense-grid-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--line);
}

.expense-grid-table thead th:first-child {
  z-index: 2;
  background: var(--table-head);
}

.expense-grid-table .expense-total,
.expense-grid-table tfoot td,
.expense-grid-table tfoot th {
  font-weight: 850;
}

.expense-grid-table tfoot th,
.expense-grid-table tfoot td {
  border-top: 1px solid var(--line-strong);
  border-bottom: 0;
  background: var(--surface-2);
}

.expense-grid-table tfoot th:first-child {
  z-index: 2;
  background: var(--surface-2);
}

.schedule-heading {
  margin-top: 14px;
}

.schedule-table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.schedule-table .schedule-name {
  min-width: 190px;
  text-align: left;
}

.schedule-table .schedule-small {
  width: 96px;
}

.workspace.split .schedule-table {
  border: 0;
  background: transparent;
}

.workspace.split .schedule-table thead {
  display: none;
}

.workspace.split .schedule-table tbody {
  display: grid;
  gap: 8px;
}

.workspace.split .schedule-table tr {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.workspace.split .schedule-table td {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 0;
  border-bottom: 0;
  text-align: left;
  white-space: normal;
}

.workspace.split .schedule-table td::before {
  content: attr(data-label);
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.workspace.split .schedule-table td[data-label="Role"],
.workspace.split .schedule-table td[data-label="Investment"] {
  grid-column: 1 / -1;
}

.workspace.split .schedule-table .schedule-action::before {
  content: "";
}

.workspace.split .schedule-table .table-input,
.workspace.split .schedule-table .schedule-small,
.workspace.split .schedule-table .schedule-name {
  width: 100%;
  min-width: 0;
  text-align: left;
}

.workspace.split .schedule-table .schedule-action {
  align-self: end;
}

.bulk-apply {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(110px, 0.45fr) minmax(110px, 0.45fr) auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.forecast-horizon {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(120px, 0.32fr) minmax(190px, 0.55fr);
  align-items: end;
  gap: 10px;
  margin-bottom: 9px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--teal);
  border-radius: var(--radius);
  background: var(--surface);
}

.forecast-horizon-copy {
  align-self: center;
}

.horizon-field input {
  font-size: 18px;
  font-weight: 850;
  text-align: center;
}

.horizon-summary {
  display: grid;
  align-content: center;
  min-height: 54px;
  padding: 9px 11px;
  border-left: 1px solid var(--line);
}

.horizon-summary strong,
.horizon-summary span {
  display: block;
}

.horizon-summary strong {
  font-size: 13px;
}

.horizon-summary span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.bulk-title {
  margin: 0;
  font-size: 14px;
  font-weight: 750;
}

.bulk-copy {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.workspace.split .bulk-apply {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace.split .forecast-horizon {
  grid-template-columns: minmax(0, 1fr) minmax(110px, 0.42fr);
}

.workspace.split .horizon-summary {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  border-left: 0;
}

.workspace.split .bulk-apply-intro,
.workspace.split .bulk-apply .action-button {
  grid-column: 1 / -1;
}

.workspace.split .bulk-apply .action-button {
  width: 100%;
}

.workspace.split .sales-plan-toolbar {
  grid-template-columns: minmax(0, 1fr) 128px;
}

.workspace.split .sales-plan-toolbar > div:first-child,
.workspace.split .sales-source-key {
  grid-column: 1 / -1;
}

.workspace.split .product-plan-switch {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

.workspace.split .sales-source-key {
  justify-content: flex-start;
}

.workspace.split .forecast-range-badge {
  grid-column: 1 / -1;
  justify-content: center;
}

.workspace.split .layer-heading,
.workspace.split .channel-manager-heading {
  align-items: stretch;
  flex-direction: column;
}

.workspace.split .layer-heading > span {
  max-width: none;
  text-align: left;
}

.workspace.split .channel-add-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.workspace.split .channel-row {
  grid-template-columns: 92px minmax(100px, 1fr) 34px;
}

.workspace.split .channel-row-count {
  display: none;
}

.workspace.split .cost-plan-toolbar .sales-plan-year {
  grid-column: 1;
}

.workspace.split .cost-plan-toolbar .cost-plan-reset {
  grid-column: 2;
  grid-row: 2;
}

.workspace.split .sku-inventory-settings {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace.split .inventory-timing-summary {
  grid-column: 1 / -1;
}

.quarter-table {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  table-layout: fixed;
}

.quarter-table th:first-child,
.quarter-table td:first-child,
.quarter-table th:nth-child(2),
.quarter-table td:nth-child(2) {
  width: 80px;
}

.quarter-table td:first-child,
.quarter-table td:nth-child(2) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.quarter-input {
  width: 96px;
}

.depreciation-grid {
  margin-top: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.pill.slow {
  background: #edf1e2;
  color: #596222;
}

.pill.steady {
  background: var(--mint);
  color: var(--teal-2);
}

.pill.aggressive {
  background: #f7e4c2;
  color: #7c5412;
}

.pill.insane {
  background: #f6d7d0;
  color: #8b3324;
}

:root[data-theme="dark"] .pill.slow {
  background: #30351f;
  color: #c6ce8d;
}

:root[data-theme="dark"] .pill.aggressive {
  background: #3b2e19;
  color: #efc97b;
}

:root[data-theme="dark"] .pill.insane {
  background: #3b2321;
  color: #f0a092;
}

.tabbar {
  display: flex;
  gap: 0;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  overflow-x: auto;
}

.tabbar button {
  min-height: 40px;
  margin-bottom: -1px;
  padding: 0 11px;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.tabbar button.active {
  border-bottom-color: var(--teal);
  background: transparent;
  color: var(--teal-2);
}

.tabbar button:not(.active):hover {
  background: var(--surface-2);
  color: var(--ink);
}

.output-content {
  padding: 12px;
  background: var(--output-bg);
}

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

.kpi {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 11px 11px;
  overflow: hidden;
}

.kpi::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--teal);
}

.kpi:nth-child(2)::before {
  background: var(--coral);
}

.kpi:nth-child(3)::before {
  background: var(--blue);
}

.kpi:nth-child(4)::before {
  background: var(--gold);
}

.kpi-negative .kpi-value {
  color: var(--red);
}

.kpi-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.kpi-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.kpi-note {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: 8px;
}

.chart-panel,
.insight-panel,
.plan-section,
.pitch-slide {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.chart-panel {
  padding: 12px;
}

.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.chart-title,
.insight-title {
  margin: 0;
  font-size: 14px;
  font-weight: 750;
}

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

canvas {
  display: block;
  width: 100%;
  height: 260px;
}

.mini-chart {
  height: 160px;
}

.insight-panel {
  padding: 12px;
  border-top: 2px solid var(--gold);
}

.insight-list {
  display: grid;
  gap: 8px;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
}

.insight-list li {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--teal);
}

.dot.coral {
  background: var(--coral);
}

.dot.gold {
  background: var(--gold);
}

.statement-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.statement-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.statement-table td,
.statement-table th {
  min-width: 94px;
}

.statement-table td {
  font-size: 12px;
}

.statement-table td:first-child,
.statement-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 214px;
  background: var(--surface);
}

.statement-label {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-height: 22px;
  text-align: left;
}

.statement-label.detail {
  padding-left: 12px;
  color: var(--muted);
  font-weight: 600;
}

.statement-disclosure,
.statement-disclosure-spacer,
.statement-detail-guide {
  width: 22px;
  height: 22px;
}

.statement-disclosure {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface);
  color: var(--teal-2);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.statement-disclosure:hover,
.statement-disclosure:focus-visible {
  border-color: var(--teal);
  background: var(--mint);
  color: var(--teal-2);
  outline: none;
}

.statement-detail-guide {
  position: relative;
  display: block;
}

.statement-detail-guide::before {
  position: absolute;
  top: -13px;
  bottom: 10px;
  left: 9px;
  width: 1px;
  background: var(--line-strong);
  content: "";
}

.statement-detail-guide::after {
  position: absolute;
  top: 10px;
  left: 9px;
  width: 8px;
  height: 1px;
  background: var(--line-strong);
  content: "";
}

.statement-table tr.statement-detail-row td {
  border-top-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
}

.statement-table tr.statement-detail-row td:first-child {
  background: var(--surface-2);
}

.statement-table tr.statement-detail-row + tr:not(.statement-detail-row) td {
  border-top-color: var(--line-strong);
}

.statement-table tr.total td {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 900;
}

.statement-table tr.danger td {
  color: var(--red);
}

.statement-table tr.section-line td {
  border-top: 2px solid var(--ink);
}

.output-size-compact .statement-table td,
.output-size-compact .statement-table th {
  min-width: 76px;
  padding: 5px 6px;
  font-size: 10px;
}

.output-size-compact .statement-table th {
  font-size: 9px;
}

.output-size-compact .statement-table td:first-child,
.output-size-compact .statement-table th:first-child {
  min-width: 184px;
}

.output-size-large .statement-table td,
.output-size-large .statement-table th {
  min-width: 112px;
  padding: 10px;
  font-size: 14px;
}

.output-size-large .statement-table th {
  font-size: 12px;
}

.output-size-large .statement-table td:first-child,
.output-size-large .statement-table th:first-child {
  min-width: 244px;
}

.plan-grid,
.pitch-grid {
  display: grid;
  gap: 12px;
}

.plan-section,
.pitch-slide {
  padding: 18px;
  border-left: 3px solid var(--teal);
}

.plan-section h3,
.pitch-slide h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.plan-section p,
.pitch-slide p,
.pitch-slide li {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.plan-section p + p {
  margin-top: 10px;
}

.pitch-slide ul {
  display: grid;
  gap: 7px;
  margin: 8px 0 0;
  padding-left: 18px;
}

.output-size-compact .plan-grid,
.output-size-compact .pitch-grid {
  gap: 8px;
}

.output-size-compact .plan-section,
.output-size-compact .pitch-slide {
  padding: 12px;
}

.output-size-compact .plan-section h3,
.output-size-compact .pitch-slide h3 {
  margin-bottom: 5px;
  font-size: 14px;
}

.output-size-compact .plan-section p,
.output-size-compact .pitch-slide p,
.output-size-compact .pitch-slide li,
.output-size-compact .insight-list li {
  font-size: 11px;
  line-height: 1.4;
}

.output-size-compact .pitch-slide ul,
.output-size-compact .insight-list {
  gap: 5px;
}

.output-size-large .plan-grid,
.output-size-large .pitch-grid {
  gap: 16px;
}

.output-size-large .plan-section,
.output-size-large .pitch-slide {
  padding: 22px;
}

.output-size-large .plan-section h3,
.output-size-large .pitch-slide h3 {
  margin-bottom: 10px;
  font-size: 18px;
}

.output-size-large .plan-section p,
.output-size-large .pitch-slide p,
.output-size-large .pitch-slide li,
.output-size-large .insight-list li {
  font-size: 15px;
  line-height: 1.65;
}

.output-size-large .pitch-slide ul,
.output-size-large .insight-list {
  gap: 9px;
}

.output-size-compact .kpi {
  padding: 12px;
}

.output-size-compact .kpi-label,
.output-size-compact .kpi-note,
.output-size-compact .chart-note,
.output-size-compact .report-view-title > span {
  font-size: 10px;
}

.output-size-compact .kpi-value {
  margin-top: 5px;
  font-size: 23px;
}

.output-size-compact .chart-panel,
.output-size-compact .insight-panel {
  padding: 12px;
}

.output-size-compact .chart-title,
.output-size-compact .insight-title,
.output-size-compact .report-view-title h3 {
  font-size: 12px;
}

.output-size-large .kpi {
  padding: 20px;
}

.output-size-large .kpi-label,
.output-size-large .kpi-note,
.output-size-large .chart-note,
.output-size-large .report-view-title > span {
  font-size: 13px;
}

.output-size-large .kpi-value {
  font-size: 32px;
}

.output-size-large .chart-title,
.output-size-large .insight-title,
.output-size-large .report-view-title h3 {
  font-size: 17px;
}

.output-size-large .chart-panel,
.output-size-large .insight-panel {
  padding: 20px;
}

.export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

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

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: center;
  }

  .topbar-controls {
    justify-content: space-between;
    flex-wrap: wrap;
  }

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

  .project-bar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .project-context {
    grid-column: 1 / -1;
  }

  .project-save {
    justify-items: start;
  }

  .project-account {
    min-width: 170px;
  }

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

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

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

  .toolbar-actions {
    justify-content: flex-end;
  }

  .admin-topbar {
    grid-template-columns: 1fr;
  }

  .admin-topbar-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 980px) {
  .auth-shell {
    grid-template-columns: minmax(320px, 720px);
    align-items: start;
    padding-block: 22px;
  }

  .auth-card,
  .auth-aside {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .auth-shell {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .auth-card,
  .auth-aside {
    padding: 18px;
  }

  .auth-brand h1,
  .auth-aside h2 {
    font-size: 24px;
  }

  .auth-product-preview figcaption {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .auth-product-preview figcaption strong {
    text-align: left;
  }

  .auth-outcomes span {
    padding-inline: 8px;
    font-size: 10px;
  }

  .topbar {
    grid-template-columns: 1fr;
    position: static;
  }

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

  .platform-brand {
    align-items: center;
    flex-wrap: wrap;
  }

  .platform-navigation {
    order: 3;
    width: 100%;
    margin-left: 0;
    padding: 7px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .platform-navigation button {
    flex: 1;
  }

  .platform-topbar-actions {
    justify-content: space-between;
  }

  .workspace-home-shell {
    padding: 16px 14px 26px;
  }

  .workspace-home-head,
  .module-directory-head {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-primary-action {
    width: 100%;
  }

  .workspace-snapshot,
  .workspace-foundation {
    grid-template-columns: 1fr;
  }

  .workspace-snapshot-title {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace-kpis,
  .workspace-foundation dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-kpis > div:nth-child(2) {
    border-right: 0;
  }

  .workspace-kpis > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

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

  .module-card {
    min-height: 190px;
  }

  .scenario-control-group {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .scenario-control-row,
  .scenario-control-row .segmented {
    min-width: 0;
    width: 100%;
  }

  .scenario-control-row .segmented button {
    flex: 1;
    padding-inline: 8px;
  }

  .project-bar,
  .project-context {
    grid-template-columns: 1fr;
  }

  .project-context {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: none;
  }

  .model-control {
    grid-column: 1 / -1;
  }

  .project-context .ghost-button,
  .project-context .text-button {
    justify-self: stretch;
  }

  .new-project-group {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .project-context {
    grid-column: auto;
  }

  .project-save {
    align-items: stretch;
    justify-items: stretch;
  }

  .project-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .project-actions .text-button {
    grid-column: 1 / -1;
  }

  .project-status-line {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .project-account {
    min-width: 0;
    padding: 12px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .admin-topbar-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .admin-topbar-actions .ghost-button,
  .admin-topbar-actions .text-button {
    justify-self: stretch;
  }

  .admin-shell {
    padding: 14px;
  }

  .scenario-modal {
    padding: 14px;
  }

  .team-modal {
    padding: 14px;
  }

  .team-invite-form {
    grid-template-columns: minmax(0, 1fr) 130px;
  }

  .team-invite-form .action-button {
    grid-column: 1 / -1;
  }

  .team-member {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .team-status {
    grid-column: 2;
    grid-row: 2;
  }

  .team-owner-role,
  .team-role-select,
  .team-remove {
    grid-column: 3;
  }

  .team-owner-role,
  .team-role-select {
    grid-row: 1;
  }

  .team-remove {
    grid-row: 2;
    justify-self: end;
  }

  .share-link-panel > div:first-child {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .share-link-row {
    grid-template-columns: 1fr;
  }

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

  .scenario-case,
  .scenario-case + .scenario-case {
    padding: 0;
    border-left: 0;
  }

  .scenario-case + .scenario-case {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
  }

  .admin-page-head,
  .admin-directory-head {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-page-actions {
    justify-content: space-between;
  }

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

  .admin-metric:nth-child(2) {
    border-right: 0;
  }

  .admin-metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .admin-filters {
    grid-template-columns: 1fr;
  }

  .forecast-grid {
    padding: 6px;
  }

  .panel-head,
  .section,
  .output-content {
    padding: 12px;
  }

  .field-grid,
  .field-grid.compact,
  .field-control-row,
  .plan-input-grid,
  .sku-economics,
  .kpi-grid,
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .bulk-apply,
  .workspace.split .bulk-apply {
    grid-template-columns: 1fr;
  }

  .forecast-horizon,
  .workspace.split .forecast-horizon {
    grid-template-columns: 1fr;
  }

  .horizon-summary,
  .workspace.split .horizon-summary {
    grid-column: auto;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .output-head-actions {
    width: 100%;
    justify-content: space-between;
  }

  .report-period-switch {
    min-width: 0;
  }

  .report-view-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .report-control {
    align-items: stretch;
    flex-direction: column;
    gap: 5px;
  }

  .bulk-apply-intro,
  .workspace.split .bulk-apply-intro,
  .workspace.split .bulk-apply .action-button {
    grid-column: auto;
  }

  .sku-card-head {
    grid-template-columns: 1fr;
  }

  .sales-plan-toolbar {
    grid-template-columns: minmax(0, 1fr) 128px;
  }

  .sales-plan-toolbar > div:first-child,
  .sales-source-key {
    grid-column: 1 / -1;
  }

  .product-plan-switch {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .sales-source-key {
    justify-content: flex-start;
  }

  .forecast-range-badge {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .layer-heading,
  .channel-manager-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .layer-heading > span {
    max-width: none;
    text-align: left;
  }

  .channel-add-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .channel-row {
    grid-template-columns: 92px minmax(100px, 1fr) 34px;
  }

  .channel-row-count {
    display: none;
  }

  .cost-plan-toolbar .sales-plan-year {
    grid-column: 1;
  }

  .cost-plan-toolbar .cost-plan-reset {
    grid-column: 2;
    grid-row: 2;
  }

  .sku-inventory-settings,
  .workspace.split .sku-inventory-settings {
    grid-template-columns: 1fr;
  }

  .workspace.split .inventory-timing-summary {
    grid-column: auto;
  }

  .sku-card-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .control-group {
    display: grid;
    align-items: stretch;
    gap: 5px;
    min-width: 0;
  }

  .control-group .segmented {
    min-width: 0;
  }

  .control-group .segmented button {
    min-width: 0;
    padding: 0 4px;
    font-size: 11px;
  }

  .toolbar-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: auto auto minmax(84px, 1fr);
    align-items: center;
  }

  .toolbar-actions .action-button {
    justify-self: stretch;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1;
  }

  .input-stepper {
    gap: 1px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .input-stepper button {
    min-width: 58px;
    padding-right: 5px;
    padding-left: 5px;
    font-size: 10px;
  }

  .schedule-table {
    border: 0;
    background: transparent;
  }

  .schedule-table thead {
    display: none;
  }

  .schedule-table tbody {
    display: grid;
    gap: 10px;
  }

  .schedule-table tr {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .schedule-table td {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 0;
    border-bottom: 0;
    text-align: left;
    white-space: normal;
  }

  .schedule-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0;
    text-transform: uppercase;
  }

  .schedule-table .schedule-action::before {
    content: "";
  }

  .schedule-table .table-input,
  .schedule-table .schedule-small,
  .schedule-table .schedule-name {
    width: 100%;
    min-width: 0;
    text-align: left;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .input-panel,
  .tabbar,
  .export-row,
  .app-footer,
  .statement-disclosure {
    display: none;
  }

  .statement-disclosure-spacer {
    display: block;
  }

  .forecast-grid {
    display: block;
    padding: 0;
  }

  .panel {
    border: 0;
    box-shadow: none;
  }
}
