:root {
  --st-background: #eef3f6;
  --st-surface: #ffffff;
  --st-surface-muted: #f4f7f9;
  --st-surface-dark: #232c36;
  --st-surface-dark-2: #12181f;
  --st-text: #12181f;
  --st-text-muted: #5f6b76;
  --st-border: #d9e1e8;
  --st-border-strong: #c6d1da;
  --st-primary: #1e5faf;
  --st-secondary: #0f7a75;
  --st-data-highlight: #27a7b8;
  --st-warning: #b97a17;
  --st-danger: #b74e3c;
  --st-success: #1b7b60;
  --st-radius-sm: 12px;
  --st-radius-md: 16px;
  --st-radius-lg: 24px;
  --st-space-1: 4px;
  --st-space-2: 8px;
  --st-space-3: 12px;
  --st-space-4: 16px;
  --st-space-5: 20px;
  --st-space-6: 24px;
  --st-space-8: 32px;
  --st-space-10: 40px;
  --st-space-12: 48px;
  --st-space-16: 64px;
  --st-shadow-1: 0 8px 24px rgba(18, 24, 31, 0.06);
  --st-shadow-2: 0 18px 40px rgba(18, 24, 31, 0.1);
  --st-font-sans: "Inter", system-ui, sans-serif;
  --st-font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --st-text-xs: 0.75rem;
  --st-text-sm: 0.8125rem;
  --st-text-base: 0.875rem;
  --st-text-md: 1rem;
  --st-text-lg: 1.125rem;
  --st-text-xl: 1.5rem;
  --st-text-2xl: 2rem;
  --st-text-3xl: 3rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100%;
  overflow-x: clip;
  background: var(--st-background);
  color: var(--st-text);
  font-family: var(--st-font-sans);
  font-size: var(--st-text-base);
  line-height: 1.6;
}

::selection {
  background: rgba(30, 95, 175, 0.15);
  color: var(--st-text);
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

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

a,
button,
summary,
input,
select,
textarea {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(30, 95, 175, 0.12);
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(30, 95, 175, 0.18);
}

a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
summary:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
[tabindex]:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--st-text);
  font-weight: 600;
  text-wrap: balance;
}

.app-body {
  min-height: 100vh;
}

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

.app-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--st-space-6);
  padding: var(--st-space-6) var(--st-space-5);
  background: linear-gradient(180deg, var(--st-surface-dark-2) 0%, var(--st-surface-dark) 100%);
  color: #f3f7fa;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--st-space-3);
  min-width: 0;
}

.sidebar-brand > div,
.topbar-heading > div:last-child {
  min-width: 0;
}

.brand-mark,
.brand-seal {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: var(--st-radius-md);
}

.brand-mark {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.sidebar-brand-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.brand-seal {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--st-primary), var(--st-data-highlight));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.sidebar-brand h1 {
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: #f3f7fa;
}

.sidebar-kicker,
.page-kicker,
.section-kicker,
.nav-group-label,
.metric-label {
  margin: 0 0 var(--st-space-1);
  font-size: var(--st-text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar-kicker,
.nav-group-label {
  color: rgba(243, 247, 250, 0.54);
}

.page-kicker,
.section-kicker,
.metric-label {
  color: var(--st-text-muted);
}

.nav-group {
  display: grid;
  gap: var(--st-space-2);
}

.nav-item,
.settings-nav-item,
.record-row,
.mini-record.linked,
.tier-card,
.addon-card,
.button {
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    color 150ms ease,
    filter 150ms ease,
    transform 150ms ease;
}

.nav-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: var(--st-space-3) var(--st-space-4);
  border: 1px solid transparent;
  border-left-width: 3px;
  border-radius: var(--st-radius-sm);
  background: rgba(255, 255, 255, 0.01);
  color: rgba(243, 247, 250, 0.84);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(39, 167, 184, 0.2);
}

.nav-item.is-active {
  border-left: 3px solid var(--st-data-highlight);
  border-color: rgba(39, 167, 184, 0.24);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-item-label {
  font-weight: 600;
}

.nav-item-meta {
  font-size: var(--st-text-sm);
  color: rgba(243, 247, 250, 0.62);
  overflow-wrap: anywhere;
}

.sidebar-foot {
  margin-top: auto;
}

.sidebar-status {
  display: flex;
  align-items: flex-start;
  gap: var(--st-space-3);
  padding: var(--st-space-4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--st-radius-md);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-status strong {
  display: block;
  margin-bottom: var(--st-space-1);
  font-size: var(--st-text-base);
  font-weight: 600;
}

.sidebar-status p,
.copy,
.rail-copy,
.helper-copy,
.summary-card p,
.mini-record p,
.record-row p,
.field-help,
.form-help,
.field-impact {
  margin: 0;
  max-width: 65ch;
  color: var(--st-text-muted);
}

.sidebar-status p {
  color: rgba(243, 247, 250, 0.7);
  font-size: var(--st-text-sm);
  line-height: 1.45;
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--st-warning);
  box-shadow: 0 0 0 4px rgba(185, 122, 23, 0.14);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(185, 122, 23, 0.14);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(185, 122, 23, 0.06);
  }
}

.app-main {
  min-width: 0;
  padding: var(--st-space-6) var(--st-space-8) var(--st-space-8);
}

.app-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--st-space-4);
  margin-bottom: var(--st-space-6);
  padding-bottom: var(--st-space-4);
  border-bottom: 1px solid rgba(18, 24, 31, 0.06);
}

.topbar-heading {
  display: flex;
  align-items: flex-start;
  gap: var(--st-space-4);
  min-width: 0;
}

.app-topbar h2 {
  font-size: var(--st-text-xl);
  line-height: 1.33;
  letter-spacing: -0.02em;
}

.topbar-actions,
.panel-actions,
.panel-header,
.record-meta,
.detail-list li {
  flex-wrap: wrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--st-space-3);
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: var(--st-space-3);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--st-space-2);
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-sm);
  background: var(--st-surface);
  color: var(--st-text-muted);
  font-size: var(--st-text-sm);
  font-weight: 600;
}

.user-identity-chip {
  display: grid;
  gap: 2px;
  align-items: start;
  min-height: auto;
  padding: 10px 12px;
}

.user-chip-label {
  color: var(--st-text-muted);
  font-size: var(--st-text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.user-chip-value,
.user-chip-role {
  color: var(--st-text);
  font-weight: 600;
}

.page-shell {
  display: grid;
  gap: var(--st-space-5);
  min-width: 0;
}

.flash-stack {
  display: grid;
  gap: var(--st-space-3);
  margin-bottom: var(--st-space-4);
}

.flash-message {
  padding: var(--st-space-3) var(--st-space-4);
  border: 1px solid rgba(30, 95, 175, 0.18);
  border-radius: var(--st-radius-sm);
  background: #f7fbff;
  color: var(--st-text);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--st-space-2);
  min-height: 42px;
  padding: 0 var(--st-space-4);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-sm);
  background: var(--st-surface);
  color: var(--st-text);
  font-size: var(--st-text-base);
  font-weight: 600;
  cursor: pointer;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: var(--st-shadow-1);
}

.button:active {
  transform: translateY(0) scale(0.98);
  box-shadow: none;
}

.button.button-primary {
  border-color: var(--st-primary);
  background: var(--st-primary);
  color: #fff;
}

.button.button-primary:hover {
  filter: brightness(0.92);
}

.button.button-secondary {
  background: var(--st-surface);
  color: var(--st-text);
}

.metric-strip,
.workspace-grid,
.workspace-grid.secondary,
.workbench-grid,
.stack-grid,
.field-grid,
.tier-grid,
.addon-grid,
.workbench-main,
.workbench-rail,
.record-stack,
.question-stack,
.stack-form,
.system-grid {
  display: grid;
}

.metric-strip,
.workspace-grid,
.workspace-grid.secondary,
.workbench-grid,
.stack-grid,
.field-grid,
.tier-grid,
.addon-grid,
.workbench-main,
.workbench-rail {
  gap: var(--st-space-4);
}

.record-stack,
.question-stack,
.system-grid {
  gap: var(--st-space-3);
}

.metric-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workspace-grid {
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr);
}

.workspace-grid.secondary {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.75fr);
}

.workbench-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.9fr);
  align-items: start;
}

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

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

.field-grid.four-col {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.two-col-copy {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--st-space-4);
}

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

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

.panel,
.login-panel {
  min-width: 0;
  padding: var(--st-space-6);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-md);
  background: var(--st-surface);
  box-shadow: var(--st-shadow-1);
}

.login-panel {
  border-radius: var(--st-radius-lg);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--st-space-4);
  margin-bottom: var(--st-space-4);
}

.panel-header h3,
.proposal-section h3 {
  font-size: var(--st-text-lg);
  line-height: 1.44;
  letter-spacing: -0.01em;
}

.record-table {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-md);
  background: var(--st-surface);
  min-width: 0;
}

.record-row,
.mini-record,
.summary-card,
.question-card,
.tier-card,
.addon-card {
  min-width: 0;
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-sm);
  background: var(--st-surface);
}

.record-table .record-row,
.record-table .empty-state {
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--st-border);
  border-radius: 0;
}

.record-table .record-row:last-child,
.record-table .empty-state:last-child {
  border-bottom: 0;
}

.record-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--st-space-4);
  padding: var(--st-space-3) var(--st-space-4);
}

.record-row:hover,
.mini-record.linked:hover,
.settings-nav-item:hover,
.tier-card:hover,
.addon-card:hover {
  background: var(--st-surface-muted);
  border-color: var(--st-border-strong);
}

.record-row strong,
.mini-record strong,
.summary-card strong,
.detail-list strong {
  display: block;
  margin-bottom: 2px;
  overflow-wrap: anywhere;
}

.record-row p,
.mini-record p {
  margin-top: 4px;
}

.record-row.empty,
.mini-record.empty,
.question-card.empty {
  color: var(--st-text-muted);
  font-style: italic;
  text-align: center;
  justify-content: center;
}

.record-check {
  display: flex;
  align-items: center;
}

.record-grow {
  min-width: 0;
  flex: 1 1 auto;
}

.record-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  column-gap: var(--st-space-2);
  row-gap: var(--st-space-2);
}

.mini-record {
  display: grid;
  gap: var(--st-space-2);
  padding: var(--st-space-3) var(--st-space-4);
}

.mini-record.linked.is-active,
.tier-card.is-selected,
.settings-nav-item.is-active {
  border-color: var(--st-primary);
  box-shadow: 0 0 0 2px rgba(30, 95, 175, 0.12);
  background: rgba(30, 95, 175, 0.03);
}

.summary-card {
  padding: var(--st-space-4);
}

.summary-card span,
.proposal-price-card span {
  display: block;
  margin-bottom: var(--st-space-2);
  color: var(--st-text-muted);
  font-size: var(--st-text-sm);
}

.summary-card strong {
  font-size: var(--st-text-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
}

.metric-tile {
  padding: var(--st-space-4) var(--st-space-4) var(--st-space-4) 13px;
  border: 1px solid var(--st-border);
  border-left-width: 3px;
  border-radius: var(--st-radius-md);
  background: var(--st-surface);
}

.metric-tile strong {
  display: block;
  margin: var(--st-space-2) 0 var(--st-space-1);
  font-size: var(--st-text-2xl);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
}

.metric-tile span {
  color: var(--st-text-muted);
  font-size: var(--st-text-sm);
}

.metric-tile.tone-neutral {
  border-left-color: var(--st-border-strong);
}

.metric-tile.tone-positive {
  border-left-color: var(--st-success);
}

.metric-tile.tone-warning {
  border-left-color: var(--st-warning);
}

.metric-tile.tone-accent {
  border-left-color: var(--st-data-highlight);
}

.field-block {
  display: grid;
  gap: var(--st-space-2);
  min-width: 0;
}

.field-block.full-span {
  grid-column: 1 / -1;
}

.field-block label,
.question-card label,
.login-form label {
  font-size: var(--st-text-base);
  font-weight: 600;
  overflow-wrap: anywhere;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="file"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px var(--st-space-3);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-sm);
  background: var(--st-surface);
  color: var(--st-text);
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

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

input:hover,
select:hover,
textarea:hover {
  border-color: var(--st-border-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--st-primary);
  box-shadow: 0 0 0 3px rgba(30, 95, 175, 0.12);
  background: var(--st-surface);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--st-surface-muted);
  color: var(--st-text-muted);
  border-color: var(--st-border);
  cursor: not-allowed;
  opacity: 1;
}

.input-error,
.select-error,
.textarea-error,
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"],
input:invalid:not(:placeholder-shown),
select:invalid,
textarea:invalid:not(:placeholder-shown) {
  border-color: rgba(183, 78, 60, 0.6);
  box-shadow: 0 0 0 3px rgba(183, 78, 60, 0.12);
}

.copy,
.rail-copy,
.helper-copy,
.field-help,
.form-help,
.field-impact,
.settings-group-copy,
.settings-sidebar-copy,
.compact-copy {
  font-size: var(--st-text-base);
  line-height: 1.55;
}

.field-help,
.form-help,
.field-impact {
  margin-top: var(--st-space-1);
}

.field-impact strong {
  color: var(--st-text);
  font-weight: 600;
}

.page-heading-copy {
  min-width: 0;
}

.page-heading-copy h2 {
  margin: 0;
}

.page-heading-copy p {
  margin-bottom: var(--st-space-1);
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--st-border);
  border-radius: 6px;
  background: var(--st-surface-muted);
  color: var(--st-text);
  font-size: var(--st-text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.question-card,
.tier-card,
.addon-card {
  gap: var(--st-space-3);
}

.question-card {
  display: grid;
  align-content: start;
  padding: var(--st-space-4);
}

.tier-card,
.addon-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: flex-start;
  padding: var(--st-space-4);
  cursor: pointer;
}

.tier-card input,
.addon-card input {
  margin-top: 3px;
}

.tier-card span,
.addon-card span {
  display: block;
  margin-bottom: var(--st-space-1);
  color: var(--st-text-muted);
  font-size: var(--st-text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tier-card strong,
.addon-card strong {
  display: block;
  margin-bottom: var(--st-space-2);
  font-size: var(--st-text-lg);
  line-height: 1.3;
}

.tier-card p,
.addon-card p {
  margin: 0;
  color: var(--st-text-muted);
}

.panel-actions,
.table-actions {
  display: flex;
  align-items: center;
  gap: var(--st-space-3);
  margin-top: var(--st-space-4);
}

.content-block {
  margin-top: var(--st-space-4);
  padding-top: var(--st-space-4);
  border-top: 1px solid var(--st-border);
}

.content-block h4 {
  margin: 0 0 var(--st-space-2);
  font-size: var(--st-text-md);
  font-weight: 600;
}

.brand-preview {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: var(--st-space-4);
  border: 1px dashed var(--st-border);
  border-radius: var(--st-radius-md);
  background: var(--st-surface-muted);
}

.brand-preview-image {
  max-height: 84px;
  width: auto;
  object-fit: contain;
}

.governance-form,
.inline-form {
  gap: var(--st-space-3);
}

.governance-form {
  display: grid;
  gap: var(--st-space-4);
}

.inline-form {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
}

.inline-action-form {
  display: inline;
}

.rail-panel {
  position: relative;
}

.detail-list,
.bullet-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-list {
  display: grid;
  gap: var(--st-space-3);
}

.detail-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--st-space-3);
  padding-bottom: var(--st-space-3);
  border-bottom: 1px solid var(--st-border);
}

.detail-list li:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.detail-list span {
  color: var(--st-text-muted);
}

.bullet-list {
  display: grid;
  gap: var(--st-space-2);
}

.bullet-list li {
  position: relative;
  padding-left: var(--st-space-4);
  color: var(--st-text-muted);
}

.bullet-list li::before {
  content: "";
  position: absolute;
  top: 0.6em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--st-data-highlight);
}

.benchmark-widget {
  display: grid;
  gap: var(--st-space-3);
  margin-top: var(--st-space-4);
  padding: var(--st-space-4);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-md);
  background: var(--st-surface-muted);
}

.benchmark-scale {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--st-space-2);
  font-size: var(--st-text-xs);
  color: var(--st-text-muted);
  font-variant-numeric: tabular-nums lining-nums;
}

.benchmark-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(185, 122, 23, 0.22), rgba(39, 167, 184, 0.22), rgba(27, 123, 96, 0.22));
}

.benchmark-marker {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  border: 3px solid var(--st-surface);
  border-radius: 999px;
  background: var(--st-primary);
  box-shadow: var(--st-shadow-1);
  transform: translate(-50%, -50%);
}

.benchmark-note {
  color: var(--st-text);
  font-size: var(--st-text-sm);
  font-variant-numeric: tabular-nums lining-nums;
}

.alert-note {
  margin: 0;
  color: var(--st-warning);
  font-size: var(--st-text-sm);
  font-weight: 600;
}

.proposal-shell {
  display: grid;
  gap: var(--st-space-6);
}

.proposal-hero {
  display: grid;
  gap: var(--st-space-6);
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, 0.9fr);
  align-items: stretch;
  padding: var(--st-space-8);
  border-radius: var(--st-radius-lg);
  background: linear-gradient(135deg, var(--st-primary), var(--st-secondary));
  color: #fff;
  box-shadow: var(--st-shadow-2);
}

.proposal-hero .section-kicker,
.proposal-hero p,
.proposal-hero li,
.proposal-hero span {
  color: rgba(255, 255, 255, 0.82);
}

.proposal-price-card {
  padding: var(--st-space-5);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--st-radius-md);
  background: rgba(18, 24, 31, 0.16);
  backdrop-filter: blur(10px);
}

.proposal-section + .proposal-section {
  margin-top: var(--st-space-4);
}

.proposal-section p,
.proposal-section li {
  max-width: 65ch;
}

.proposal-tiers {
  display: grid;
  gap: var(--st-space-4);
}

.json-block,
textarea.json-block.editor-block {
  width: 100%;
  min-width: 0;
  padding: var(--st-space-4);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-md);
  background: #f8fafc;
  color: var(--st-text);
  font-family: var(--st-font-mono);
  font-size: var(--st-text-sm);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow: auto;
}

.comparison-table-wrap {
  overflow: auto;
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-md);
  background: var(--st-surface);
}

.comparison-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.comparison-table th,
.comparison-table td {
  padding: var(--st-space-4);
  border-bottom: 1px solid var(--st-border);
  text-align: left;
  vertical-align: top;
}

.comparison-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--st-surface-muted);
  color: var(--st-text-muted);
  font-size: var(--st-text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--st-border-strong);
}

.comparison-table tbody th {
  color: var(--st-text);
  font-size: var(--st-text-md);
  font-weight: 600;
}

.comparison-table td {
  font-variant-numeric: tabular-nums lining-nums;
}

.comparison-table tbody tr:hover td,
.comparison-table tbody tr:hover th {
  background: var(--st-surface-muted);
}

.comparison-table input[type="number"],
.comparison-table input[type="text"],
.comparison-table input[type="email"],
.comparison-table select {
  min-width: 88px;
}

.pricing-table-wrap .comparison-table {
  min-width: 980px;
}

.pricing-table-wrap .comparison-table th:first-child,
.pricing-table-wrap .comparison-table td:first-child {
  min-width: 220px;
}

.pricing-table-wrap .comparison-table th:nth-child(2),
.pricing-table-wrap .comparison-table td:nth-child(2) {
  min-width: 116px;
}

.pricing-table-wrap .comparison-table th:nth-child(n + 3),
.pricing-table-wrap .comparison-table td:nth-child(n + 3) {
  min-width: 132px;
}

.empty-state {
  padding: var(--st-space-8);
  border: 1px dashed var(--st-border);
  border-radius: var(--st-radius-md);
  background: var(--st-surface);
  text-align: center;
  color: var(--st-text-muted);
}

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--st-space-8);
}

.login-shell {
  width: min(100%, 480px);
}

.login-panel {
  padding: var(--st-space-8);
  border-radius: var(--st-radius-lg);
  box-shadow: var(--st-shadow-1);
}

.login-form {
  display: grid;
  gap: var(--st-space-4);
  margin-top: var(--st-space-6);
}

.login-form p {
  margin: 0;
}

.login-form .helptext {
  display: block;
  margin-top: var(--st-space-1);
  color: var(--st-text-muted);
  font-size: var(--st-text-sm);
}

.login-form ul.errorlist {
  margin: var(--st-space-1) 0 0;
  padding-left: var(--st-space-4);
  color: var(--st-danger);
  font-size: var(--st-text-sm);
}

.checkbox-field {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: var(--st-space-3);
}

.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 3px;
}

.full {
  width: 100%;
}

.compact-secret-field {
  align-items: start;
}

.compact-secret-meta {
  display: flex;
  align-items: center;
  gap: var(--st-space-2);
  flex-wrap: wrap;
}

.secret-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--st-border);
  border-radius: 999px;
  background: var(--st-surface-muted);
  color: var(--st-text);
  font-family: var(--st-font-mono);
  font-size: var(--st-text-xs);
}

.record-toolbar,
.record-toolbar-group {
  display: flex;
  align-items: center;
  gap: var(--st-space-3);
  flex-wrap: wrap;
}

.record-toolbar input[type="search"],
.record-toolbar input[type="text"] {
  min-width: min(100%, 260px);
}

.crm-inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--st-space-3);
  margin-top: var(--st-space-2);
}

.crm-inline-links a {
  color: var(--st-primary);
  font-weight: 500;
}

.crm-preload-panel,
.crm-context-card,
.import-preview-card {
  position: relative;
}

.crm-warning-list li::before {
  background: var(--st-warning);
}

.settings-shell {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  gap: var(--st-space-6);
  min-width: 0;
}

.settings-sidebar,
.settings-main {
  min-width: 0;
}

.settings-sidebar-panel {
  position: sticky;
  top: var(--st-space-6);
  max-height: calc(100vh - (2 * var(--st-space-6)));
  overflow: auto;
  overscroll-behavior: contain;
}

.settings-page-intro .copy {
  margin: 0;
}

.settings-nav-list {
  display: grid;
  gap: var(--st-space-2);
}

.settings-nav-item {
  display: grid;
  gap: var(--st-space-1);
  padding: var(--st-space-3) var(--st-space-4);
  border: 1px solid transparent;
  border-radius: var(--st-radius-sm);
  background: transparent;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.settings-nav-item:hover {
  background: var(--st-surface-muted);
  border-color: rgba(18, 24, 31, 0.06);
  text-decoration: none;
}

.settings-nav-title {
  color: var(--st-text);
  font-weight: 600;
}

.settings-nav-meta {
  color: var(--st-text-muted);
  font-size: var(--st-text-sm);
}

.settings-main {
  display: grid;
  gap: var(--st-space-4);
}

.settings-main > form.workbench-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--st-space-4);
}

.settings-main > form.workbench-grid .workbench-main,
.settings-main > form.workbench-grid .workbench-rail {
  display: grid;
  gap: var(--st-space-4);
}

.settings-main > form.workbench-grid .workbench-rail {
  position: sticky;
  top: var(--st-space-6);
  align-self: start;
  max-height: calc(100vh - (2 * var(--st-space-6)));
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.settings-card-grid,
.settings-guidance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--st-space-4);
}

.settings-overview-card {
  display: grid;
  gap: var(--st-space-2);
  text-decoration: none;
}

.settings-overview-card p {
  margin: 0;
  color: var(--st-text-muted);
}

.settings-overview-value {
  color: var(--st-text);
  font-size: var(--st-text-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.settings-group {
  display: grid;
  gap: var(--st-space-4);
}

.pricing-settings-grid {
  gap: var(--st-space-4);
}

.mobile-nav-shell,
.mobile-tabbar {
  display: none;
}

.mobile-nav-toggle {
  list-style: none;
}

.mobile-nav-toggle::-webkit-details-marker {
  display: none;
}

.mobile-nav-panel {
  min-width: 0;
}

.mobile-user-meta {
  display: flex;
  align-items: center;
  gap: var(--st-space-3);
  flex-wrap: wrap;
}

.mobile-tab-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-shell,
.settings-card-grid,
.settings-guidance-grid,
.comparison-table-wrap,
.proposal-shell,
.proposal-hero,
.crm-preload-panel,
.record-table,
.record-row,
.mini-record,
.summary-card,
.question-card,
.tier-card,
.addon-card,
.field-grid,
.metric-strip,
.workspace-grid,
.stack-grid,
.workbench-grid,
.record-toolbar,
.panel-actions,
.table-actions {
  min-width: 0;
}

.panel h3,
.panel strong,
.panel span,
.panel p,
.record-row,
.mini-record,
.summary-card,
.question-card,
.tier-card,
.addon-card,
.settings-nav-title,
.settings-nav-meta {
  overflow-wrap: anywhere;
}

@page {
  size: A4;
  margin: 2.54cm;
}

@media print {
  .app-sidebar,
  .app-topbar,
  .topbar-actions,
  .flash-stack,
  .nav-group,
  .mobile-tabbar,
  .mobile-nav-shell,
  button,
  a.button {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .app-main {
    padding: 0;
  }

  body {
    background: #fff;
    font-size: 10.5pt;
    line-height: 1.25;
    color: #12181f;
  }

  .panel,
  .proposal-hero,
  .tier-card {
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid var(--st-border);
  }

  .proposal-hero {
    background: var(--st-primary) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  h1,
  h2,
  h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  p,
  li {
    orphans: 3;
    widows: 3;
  }

  .proposal-section h3 {
    font-size: 12pt;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0ms !important;
    transition-duration: 0ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 1500px) {
  .workbench-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.95fr);
  }
}

@media (max-width: 1440px) {
  .settings-main > form.workbench-grid {
    gap: var(--st-space-4);
  }
}

@media (max-width: 1360px) {
  .metric-strip,
  .tier-grid,
  .addon-grid,
  .field-grid.three-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1280px) {
  .settings-shell {
    grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
  }

  .settings-sidebar-panel {
    top: var(--st-space-4);
  }
}

@media (max-width: 1200px) {
  .field-grid.four-col,
  .settings-card-grid,
  .settings-guidance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .workbench-grid,
  .proposal-hero,
  .settings-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .workbench-rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--st-space-4);
  }

  .settings-sidebar-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .settings-main > form.workbench-grid .workbench-rail {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 900px) {
  body {
    font-size: 1rem;
    line-height: 1.5;
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-sidebar {
    display: none;
  }

  .app-main {
    padding: calc(10px + env(safe-area-inset-top)) 16px calc(72px + env(safe-area-inset-bottom));
  }

  .app-topbar {
    position: sticky;
    top: 0;
    z-index: 52;
    align-items: flex-start;
    margin-inline: -16px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 12px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--st-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: none;
  }

  .topbar-heading {
    width: 100%;
    justify-content: space-between;
  }

  .page-kicker {
    margin-bottom: 2px;
    font-size: 0.6875rem;
  }

  .app-topbar h2,
  .page-heading-copy h2 {
    font-size: 1.25rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
  }

  .topbar-actions .auth-actions {
    display: none;
  }

  .topbar-actions .button {
    min-height: 44px;
    padding: 0 14px;
    background: var(--st-surface);
    border-color: var(--st-border);
    box-shadow: none;
  }

  .topbar-actions .button:hover,
  .topbar-actions .button:active,
  .mobile-nav-toggle:hover,
  .mobile-nav-toggle:active {
    transform: none;
    box-shadow: none;
  }

  .mobile-nav-shell {
    position: relative;
    display: block;
  }

  .mobile-nav-shell[open]::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(18, 24, 31, 0.36);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .mobile-nav-toggle {
    position: relative;
    z-index: 57;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid var(--st-border);
    border-radius: 8px;
    background: var(--st-surface);
    box-shadow: none;
    cursor: pointer;
  }

  .mobile-nav-shell[open] .mobile-nav-toggle {
    background: rgba(30, 95, 175, 0.06);
    border-color: rgba(30, 95, 175, 0.15);
    color: var(--st-primary);
    box-shadow: none;
  }

  .mobile-nav-toggle-bars,
  .mobile-nav-toggle-bars::before,
  .mobile-nav-toggle-bars::after {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform 150ms ease, opacity 150ms ease;
    content: "";
  }

  .mobile-nav-toggle-bars {
    position: relative;
    color: inherit;
  }

  .mobile-nav-toggle-bars::before {
    position: absolute;
    top: -6px;
    left: 0;
  }

  .mobile-nav-toggle-bars::after {
    position: absolute;
    top: 6px;
    left: 0;
  }

  .mobile-nav-shell[open] .mobile-nav-toggle-bars {
    transform: rotate(45deg);
  }

  .mobile-nav-shell[open] .mobile-nav-toggle-bars::before {
    opacity: 0;
  }

  .mobile-nav-shell[open] .mobile-nav-toggle-bars::after {
    transform: translateY(-6px) rotate(-90deg);
  }

  .mobile-nav-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 56;
    width: min(320px, calc(100vw - 56px));
    max-height: none;
    overflow: auto;
    padding: 16px 0 24px;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0;
    background: var(--st-surface-dark);
    box-shadow: var(--st-shadow-2);
  }

  .mobile-nav-panel-head {
    display: grid;
    gap: var(--st-space-4);
    padding: 0 16px 16px;
    margin-bottom: var(--st-space-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .mobile-nav-panel .sidebar-brand {
    padding-inline: 0;
  }

  .mobile-nav-panel .nav-group {
    gap: var(--st-space-2);
    padding: 0 8px;
  }

  .mobile-nav-panel .nav-group-label,
  .mobile-nav-panel .sidebar-kicker,
  .mobile-nav-panel .nav-item-meta,
  .mobile-nav-panel .sidebar-status p {
    color: rgba(243, 247, 250, 0.68);
  }

  .mobile-nav-panel .nav-item-label,
  .mobile-nav-panel .brand-seal,
  .mobile-nav-panel .sidebar-brand h1,
  .mobile-nav-panel .sidebar-status strong {
    color: #fff;
  }

  .mobile-nav-panel .nav-item {
    margin: 0;
    padding: 12px 16px;
    border-radius: 8px;
    background: transparent;
    border-color: transparent;
  }

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

  .mobile-nav-panel .nav-item.is-active {
    border-left: 3px solid var(--st-data-highlight);
    padding-left: 13px;
    border-color: transparent;
    box-shadow: none;
  }

  .mobile-user-meta {
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    margin: 0 8px 16px;
  }

  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--st-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .mobile-tab {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    min-height: 56px;
    padding: 6px 4px;
    color: var(--st-text-muted);
    background: transparent;
    border: none;
    border-radius: 0;
  }

  .mobile-tab.is-active {
    color: var(--st-primary);
    background: transparent;
    box-shadow: none;
  }

  .mobile-tab.is-active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 2px;
    border-radius: 0 0 2px 2px;
    background: var(--st-primary);
  }

  .mobile-tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
  }

  .mobile-tab-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-tab-label {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--st-space-3);
  }

  .workspace-grid,
  .workspace-grid.secondary,
  .workbench-rail,
  .settings-card-grid,
  .settings-guidance-grid,
  .field-grid.two-col,
  .field-grid.three-col,
  .field-grid.four-col,
  .tier-grid,
  .addon-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel,
  .login-panel,
  .proposal-hero {
    padding: 16px;
    border-radius: var(--st-radius-sm);
    box-shadow: none;
    border: 1px solid var(--st-border);
  }

  .proposal-hero {
    box-shadow: 0 4px 12px rgba(18, 24, 31, 0.08);
  }

  .record-row,
  .mini-record,
  .summary-card,
  .question-card,
  .tier-card,
  .addon-card {
    padding: var(--st-space-4);
    border-radius: 8px;
  }

  .record-table,
  .metric-tile {
    border-radius: var(--st-radius-sm);
  }

  .field-block {
    gap: var(--st-space-2);
  }

  .settings-nav-list {
    display: grid;
    grid-auto-flow: row;
    grid-auto-columns: unset;
    grid-template-columns: 1fr;
    overflow-x: visible;
    overflow-y: visible;
    scroll-snap-type: none;
    padding-bottom: 0;
  }

  .settings-nav-item {
    min-height: auto;
    scroll-snap-align: unset;
    padding: 12px 16px;
  }

  .comparison-table-wrap {
    position: relative;
  }

  .comparison-table-wrap::before {
    display: none;
  }

  .comparison-table-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 14px;
    height: 100%;
    background: linear-gradient(270deg, rgba(238, 243, 246, 0.96), rgba(238, 243, 246, 0));
    pointer-events: none;
  }
}

@media (max-width: 640px) {
  .login-body {
    padding: var(--st-space-4);
  }

  .stack-grid,
  .two-col-copy {
    grid-template-columns: 1fr;
  }

  .metric-tile {
    padding: 12px;
  }

  .metric-tile strong {
    font-size: 1.25rem;
  }

  .panel-actions,
  .table-actions,
  .record-toolbar,
  .record-toolbar-group,
  .auth-actions,
  .crm-inline-links {
    flex-direction: column;
    align-items: stretch;
  }

  .button,
  .panel-actions .button,
  .table-actions .button,
  .record-toolbar .button {
    width: 100%;
    justify-content: center;
  }
}

.text-right {
  text-align: right;
}

.tabular-nums {
  font-variant-numeric: tabular-nums lining-nums;
}

.text-sm {
  font-size: var(--st-text-base);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
