:root {
  --green-900: #0E2B27;
  --green-800: #153F3A;
  --green-700: #1C5248;
  --gold: #C9A15A;
  --gold-soft: #E3C987;
  --ivory: #F7F5F1;
  --paper: #FFFDF8;
  --gray: #E6E2DC;
  --ink: #10211E;
  --muted: #52645F;
  --danger: #9B4C3B;
  --warning: #8C6424;
  --ok: #2F7F68;
  --radius: 8px;
  --shadow: 0 24px 70px rgba(14, 43, 39, 0.14);
}

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

html {
  background: var(--green-900);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--ivory);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

button {
  cursor: pointer;
}

.site-shell {
  min-height: 100vh;
  background:
    linear-gradient(rgba(247, 245, 241, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(247, 245, 241, 0.045) 1px, transparent 1px),
    var(--green-900);
  background-size: 96px 96px, 96px 96px, auto;
}

.portal-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 16px clamp(18px, 4vw, 48px);
  color: var(--ivory);
  background: rgba(14, 43, 39, 0.9);
  border-bottom: 1px solid rgba(247, 245, 241, 0.1);
  backdrop-filter: blur(16px);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  min-width: 152px;
}

.brand-link img {
  width: clamp(156px, 18vw, 228px);
  height: auto;
  display: block;
}

.portal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(247, 245, 241, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.portal-nav a,
.header-action {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 999px;
  color: #D6E1DB;
  font-size: 13px;
  font-weight: 700;
}

.portal-nav a.is-active,
.portal-nav a:hover,
.header-action {
  color: var(--green-900);
  background: var(--gold);
}

body[data-route="portal"] .portal-header {
  display: none;
}

body[data-route="request"] .portal-header,
body[data-route="measure"] .portal-header {
  display: none;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.hero-grid,
.workspace-grid,
.request-builder,
.measure-grid {
  width: min(1180px, calc(100vw - 36px));
  margin: 0 auto;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(340px, 1.12fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  min-height: calc(100vh - 76px);
  padding: 54px 0;
  color: var(--ivory);
}

.hero-copy h1,
.workspace-sidebar h1,
.builder-copy h1,
.measure-grid h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 0.97;
}

.hero-copy h1 {
  max-width: 640px;
  font-size: clamp(46px, 7vw, 82px);
}

.hero-copy p,
.workspace-sidebar p,
.builder-copy p,
.measure-grid p {
  max-width: 620px;
  margin: 22px 0 0;
  color: #D6E1DB;
  font-size: 16px;
  line-height: 1.72;
}

.section-label {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.action-row,
.builder-actions,
.export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 28px;
}

.button,
.export-row button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  transition: transform 150ms ease, background 150ms ease, border 150ms ease;
}

.button:hover,
.export-row button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: var(--green-900);
  background: var(--gold);
}

.button-secondary,
.export-row button {
  color: var(--ivory);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(247, 245, 241, 0.18);
}

.button-warning {
  color: var(--green-900) !important;
  background: var(--gold-soft) !important;
}

.button[disabled] {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
}

.portal-preview,
.panel {
  border: 1px solid rgba(14, 43, 39, 0.12);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.portal-preview {
  padding: clamp(18px, 3vw, 28px);
  color: var(--ink);
}

.preview-topline,
.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.preview-topline span,
.preview-topline strong {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.preview-topline span {
  color: var(--muted);
}

.preview-topline strong {
  color: var(--green-900);
}

.workflow-rail {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.workflow-rail div {
  position: relative;
  min-height: 76px;
  padding: 16px 16px 16px 52px;
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  background: var(--ivory);
}

.workflow-rail strong,
.measurement-row strong {
  display: block;
  color: var(--green-900);
  font-size: 15px;
}

.workflow-rail small,
.measurement-row small,
.body-reference p,
.phone-caption,
.invite-preview {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.rail-dot {
  position: absolute;
  left: 18px;
  top: 20px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid var(--gold);
}

.rail-dot.is-active {
  background: var(--gold);
  box-shadow: 0 0 0 6px rgba(201, 161, 90, 0.17);
}

.workspace-dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  color: var(--ink);
  background: #F2EFE8;
}

.workspace-rail {
  position: sticky;
  top: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  padding: 22px 18px;
  color: var(--ivory);
  background: rgba(7, 29, 25, 0.78);
  border-right: 1px solid rgba(247, 245, 241, 0.1);
}

.rail-brand {
  display: block;
  padding: 8px 6px 18px;
  border-bottom: 1px solid rgba(247, 245, 241, 0.1);
}

.rail-brand img {
  display: block;
  width: 188px;
  max-width: 100%;
  height: auto;
}

.rail-nav {
  display: grid;
  align-content: start;
  gap: 6px;
}

.rail-nav a {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: #D6E1DB;
  font-size: 13px;
  font-weight: 800;
}

.rail-nav a.is-active,
.rail-nav a:hover {
  color: var(--green-900);
  background: var(--gold);
}

.rail-account {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(247, 245, 241, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.rail-account span,
.dashboard-metrics span,
.empty-state span,
.handoff-state span,
.measurement-empty span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.rail-account span {
  color: #B8C9C1;
}

.rail-account strong {
  font-size: 13px;
}

.workspace-main {
  min-width: 0;
  padding: 24px;
  background:
    linear-gradient(rgba(14, 43, 39, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 43, 39, 0.028) 1px, transparent 1px),
    #F2EFE8;
  background-size: 96px 96px, 96px 96px, auto;
}

.dashboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  color: var(--green-900);
}

.dashboard-topbar h1,
.workspace-page-header h1 {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 26px;
  font-weight: 850;
  line-height: 1.15;
  letter-spacing: 0;
}

.workspace-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.workspace-page-header p:not(.section-label) {
  max-width: 720px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

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

.dashboard-metrics div {
  min-height: 66px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  background: var(--paper);
}

.dashboard-metrics span {
  color: var(--muted);
  font-weight: 750;
}

.dashboard-metrics strong {
  color: var(--green-900);
  font-size: 20px;
  line-height: 1;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.68fr) minmax(560px, 1.32fr);
  grid-template-areas:
    "queue report"
    "timeline report"
    "capture report";
  gap: 14px;
  align-items: start;
}

.dashboard-grid > .panel {
  min-width: 0;
}

.dashboard-grid .request-list {
  grid-area: queue;
}

.dashboard-grid .timeline-panel {
  grid-area: timeline;
}

.dashboard-grid .capture-panel {
  grid-area: capture;
}

.dashboard-grid .report-panel {
  grid-area: report;
}

.report-panel {
  min-width: 0;
  overflow: hidden;
  container-type: inline-size;
}

.builder-copy h1,
.measure-grid h1 {
  font-size: clamp(38px, 5vw, 66px);
}

.panel {
  padding: 18px;
}

.panel h2,
.term-groups h3 {
  margin: 0;
  color: var(--green-900);
}

.panel h2 {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 19px;
  font-weight: 850;
  line-height: 1.15;
}

.workspace-dashboard .panel {
  box-shadow: none;
}

.workspace-dashboard .button,
.workspace-dashboard .export-row button {
  min-height: 36px;
  border-radius: var(--radius);
  font-size: 13px;
}

.workspace-dashboard .button-secondary,
.workspace-dashboard .export-row button {
  color: var(--green-900);
  background: var(--ivory);
  border-color: var(--gray);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--warning);
  background: rgba(201, 161, 90, 0.16);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-ready {
  color: var(--ok);
  background: rgba(47, 127, 104, 0.14);
}

.status-blocked {
  color: var(--danger);
  background: rgba(155, 76, 59, 0.12);
}

.request-index {
  display: block;
  margin-top: 14px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  background: #FBFAF6;
}

.request-index-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.25fr) minmax(96px, 0.8fr) minmax(128px, 1fr) minmax(92px, 0.72fr) minmax(96px, 0.72fr);
  gap: 12px;
  align-items: center;
  min-width: 620px;
  padding: 11px 12px;
  border-top: 1px solid var(--gray);
}

.request-index-row:first-child {
  border-top: 0;
}

.request-index-head {
  min-height: 34px;
  color: var(--muted);
  background: var(--ivory);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.request-index-row:not(.request-index-head) {
  color: var(--green-900);
}

.request-index-row:not(.request-index-head):hover,
.request-index-row.is-selected {
  background: rgba(201, 161, 90, 0.11);
}

.request-index-row.is-selected {
  box-shadow: inset 3px 0 0 var(--gold);
}

.request-index-row strong,
.request-index-row small {
  display: block;
}

.request-index-row strong {
  font-size: 13px;
  font-weight: 850;
}

.request-index-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.timeline {
  display: grid;
  gap: 12px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.timeline span {
  width: 12px;
  height: 12px;
  border: 2px solid var(--gray);
  border-radius: 999px;
}

.timeline .is-done span,
.timeline .is-current span {
  border-color: var(--gold);
  background: var(--gold);
}

.timeline .is-current {
  color: var(--green-900);
}

.request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.audit-metadata {
  margin-top: 16px;
  border-top: 1px solid var(--gray);
  color: var(--muted);
}

.audit-metadata summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--green-900);
  font-size: 12px;
  font-weight: 850;
}

.audit-metadata dl {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 0 2px;
}

.audit-metadata dl div {
  display: grid;
  grid-template-columns: minmax(96px, 0.62fr) minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}

.audit-metadata dt,
.audit-metadata dd {
  min-width: 0;
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
}

.audit-metadata dt {
  color: var(--muted);
  font-weight: 800;
}

.audit-metadata dd {
  overflow-wrap: anywhere;
  color: var(--green-900);
  font-weight: 750;
}

.empty-state,
.handoff-state,
.measurement-empty {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed rgba(14, 43, 39, 0.22);
  border-radius: var(--radius);
  background: var(--ivory);
}

.measurement-empty {
  min-height: 88px;
  align-content: center;
}

.empty-state strong,
.handoff-state strong,
.measurement-empty strong {
  color: var(--green-900);
  font-size: 14px;
}

.inline-link {
  width: fit-content;
  color: var(--green-700);
  font-size: 12px;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.invite-preview .inline-link {
  display: inline;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
  margin-top: 16px;
}

.body-reference {
  display: grid;
  align-content: start;
  justify-items: stretch;
  min-width: 0;
  min-height: 0;
  padding: 16px;
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  color: var(--green-900);
  background: #FBFAF6;
}

.body-reference-3d {
  align-content: stretch;
  gap: 12px;
  width: 100%;
  border-color: rgba(227, 201, 135, 0.26);
  color: var(--ivory);
  background: #0C211D;
}

.body3d-toolbar {
  display: flex;
  align-items: center;
  justify-self: stretch;
  gap: 4px;
  min-width: 0;
  padding: 4px;
  border: 1px solid rgba(227, 201, 135, 0.24);
  border-radius: var(--radius);
  background: rgba(10, 31, 27, 0.78);
}

.body3d-toolbar button {
  min-height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  color: #CFE0D8;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.body3d-toolbar button.is-active {
  color: var(--green-900);
  background: var(--gold);
}

.body3d-asset-badge {
  display: inline-flex;
  align-items: center;
  flex: 1 1 auto;
  min-height: 30px;
  min-width: 0;
  max-width: none;
  padding: 0 9px;
  overflow: hidden;
  border-left: 1px solid rgba(227, 201, 135, 0.24);
  color: #8AA79D;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.body3d-stage {
  position: relative;
  width: 100%;
  height: clamp(280px, 31vh, 360px);
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(227, 201, 135, 0.2);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 12%, rgba(201, 161, 90, 0.18), transparent 31%),
    linear-gradient(rgba(247, 245, 241, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(247, 245, 241, 0.055) 1px, transparent 1px),
    #0C211D;
  background-size: auto, 48px 48px, 48px 48px, auto;
}

.body3d-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.body3d-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.body3d-label {
  position: absolute;
  left: 0;
  top: 0;
  min-width: 112px;
  max-width: min(168px, 44vw);
  padding: 7px 9px;
  border: 1px solid rgba(227, 201, 135, 0.42);
  border-radius: var(--radius);
  color: var(--ivory);
  background: rgba(10, 33, 29, 0.82);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
  transform: translate(-999px, -999px);
  translate: -50% -120%;
  transition: opacity 140ms ease;
}

.body3d-label strong,
.body3d-label span {
  display: block;
}

.body3d-label strong {
  color: var(--gold-soft);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.body3d-label span {
  margin-top: 2px;
  font-size: 16px;
  font-weight: 850;
}

.body3d-status {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: #D6E1DB;
  background: rgba(10, 31, 27, 0.84);
  border: 1px solid rgba(227, 201, 135, 0.18);
  box-shadow: 0 10px 24px rgba(14, 43, 39, 0.12);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.body3d-stage[data-loaded="true"] .body3d-status {
  opacity: 0.82;
}

.body-reference svg {
  width: min(100%, 250px);
  height: auto;
}

.body-outline {
  fill: rgba(21, 63, 58, 0.82);
  stroke: rgba(227, 201, 135, 0.42);
  stroke-width: 2;
}

.measure-line {
  stroke: var(--gold-soft);
  stroke-width: 3;
  stroke-linecap: round;
}

.measure-line.muted {
  stroke: rgba(227, 201, 135, 0.34);
  stroke-dasharray: 6 7;
}

.anchor-dot {
  fill: var(--gold-soft);
  stroke: var(--green-900);
  stroke-width: 2;
}

.anchor-dot.muted {
  fill: transparent;
  stroke: rgba(227, 201, 135, 0.72);
}

.body-reference p {
  max-width: none;
  margin: 0;
  color: #B8C9C1;
  text-align: left;
}

.measurement-table {
  display: grid;
  gap: 10px;
  min-width: 0;
  align-content: start;
}

.measurement-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  background: #FBFAF6;
}

.report-panel[data-report-state="loaded"] .measurement-table {
  max-height: min(55vh, 560px);
  overflow: auto;
  padding-right: 2px;
}

.measurement-value {
  color: var(--green-900);
  font-size: 20px;
  font-weight: 850;
}

.measurement-value.is-redacted {
  color: var(--danger);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.export-row {
  padding-top: 2px;
}

@container (min-width: 760px) {
  .report-grid {
    grid-template-columns: minmax(320px, 0.86fr) minmax(360px, 1.14fr);
  }

  .body3d-stage {
    height: clamp(380px, 44vh, 520px);
  }

  .report-panel[data-report-state="empty"] .report-grid {
    grid-template-columns: minmax(360px, 0.94fr) minmax(280px, 0.76fr);
  }

  .report-panel[data-report-state="empty"] .measurement-empty {
    min-height: 0;
    align-self: start;
  }
}

.report-panel .export-row button:not(.button-warning) {
  color: var(--green-900);
  background: var(--ivory);
  border-color: var(--gray);
}

.export-status {
  flex: 1 1 220px;
  min-width: 0;
  color: var(--green-700);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.export-status.is-blocked {
  color: var(--danger);
}

.recapture-panel {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(201, 161, 90, 0.34);
  border-radius: var(--radius);
  background: #FBFAF6;
}

.recapture-panel[hidden] {
  display: none;
}

.recapture-panel h3 {
  margin: 0;
  color: var(--green-900);
  font-size: 20px;
  line-height: 1.1;
}

.recapture-options {
  display: grid;
  gap: 8px;
}

.recapture-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  background: var(--ivory);
}

.recapture-option input,
.recapture-views input {
  width: auto;
  margin: 3px 0 0;
}

.recapture-option strong,
.recapture-option span {
  display: block;
}

.recapture-option strong {
  color: var(--green-900);
  font-size: 13px;
}

.recapture-option span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.recapture-views {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--gray);
  border-radius: var(--radius);
}

.recapture-views legend {
  padding: 0 4px;
  color: var(--green-900);
  font-size: 12px;
  font-weight: 850;
}

.recapture-views label {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--green-900);
  background: rgba(47, 127, 104, 0.1);
  font-size: 12px;
  font-weight: 800;
}

.recapture-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.request-builder {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(340px, 0.54fr);
  gap: 14px;
  align-items: start;
  width: 100%;
  margin: 0;
  padding: 0;
}

.builder-copy {
  color: var(--ivory);
  padding-top: 8px;
}

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

label {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--green-900);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.04em;
}

label:first-child,
.form-grid label {
  margin-top: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  color: var(--ink);
  background: #FBFAF6;
  padding: 12px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 161, 90, 0.18);
}

.request-presets {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  background: #FBFAF6;
}

.preset-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preset-heading span,
.preset-heading strong {
  color: var(--green-900);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preset-heading strong {
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: none;
}

.preset-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(76px, 1fr));
  gap: 8px;
}

.preset-button {
  min-width: 0;
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 9px 8px;
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  color: var(--green-900);
  background: var(--ivory);
  text-align: left;
}

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

.preset-button strong {
  font-size: 12px;
  font-weight: 850;
}

.preset-button span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.preset-button.is-active {
  border-color: rgba(201, 161, 90, 0.72);
  background: rgba(201, 161, 90, 0.15);
}

.term-groups {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.term-groups h3 {
  font-size: 15px;
}

.term-table-container {
  min-width: 0;
  min-height: 44px;
  margin-top: 10px;
}

.term-table {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  background: #FBFAF6;
}

.term-table-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(116px, 0.9fr) minmax(88px, auto);
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--gray);
}

.term-table-row:first-child {
  border-top: 0;
}

.term-table-head {
  min-height: 32px;
  color: var(--muted);
  background: var(--ivory);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.term-table-row:not(.term-table-head) {
  color: var(--green-900);
  font-size: 12px;
  font-weight: 750;
}

.term-table-row strong,
.term-table-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.term-table-row strong {
  font-size: 12px;
  font-weight: 850;
}

.term-table-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.term-table-empty {
  display: grid;
  gap: 4px;
  min-height: 54px;
  align-content: center;
  padding: 12px;
  border: 1px dashed rgba(155, 76, 59, 0.26);
  border-radius: var(--radius);
  color: var(--danger);
  background: rgba(155, 76, 59, 0.08);
}

.term-table-empty.is-clear {
  color: var(--green-900);
  border-color: rgba(47, 127, 104, 0.18);
  background: rgba(47, 127, 104, 0.08);
}

.term-table-empty strong,
.term-table-empty span {
  display: block;
}

.term-table-empty strong {
  font-size: 13px;
  font-weight: 850;
}

.term-table-empty span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.invite-preview {
  min-height: 74px;
  margin-top: 20px;
  padding: 14px;
  border: 1px dashed rgba(14, 43, 39, 0.2);
  border-radius: var(--radius);
  background: var(--ivory);
}

.measure-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(300px, 420px);
  gap: 14px;
  align-items: start;
  width: 100%;
  margin: 0;
  padding: 0;
  color: var(--ink);
}

.phone-panel {
  background: var(--green-800);
  border-color: rgba(247, 245, 241, 0.12);
}

.phone-frame {
  width: min(100%, 290px);
  aspect-ratio: 0.52;
  margin: 0 auto;
  padding: 14px;
  border: 1px solid rgba(247, 245, 241, 0.2);
  border-radius: 32px;
  background: #091F1B;
}

.phone-screen {
  height: 100%;
  display: grid;
  align-content: end;
  gap: 12px;
  padding: 24px 18px;
  border-radius: 22px;
  color: var(--ivory);
  background:
    linear-gradient(rgba(247, 245, 241, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(247, 245, 241, 0.06) 1px, transparent 1px),
    radial-gradient(circle at 50% 22%, rgba(201, 161, 90, 0.16), transparent 24%),
    var(--green-900);
  background-size: 54px 54px, 54px 54px, auto, auto;
}

.phone-status,
.phone-cta {
  display: inline-flex;
  width: max-content;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}

.phone-status {
  color: var(--gold-soft);
  background: rgba(201, 161, 90, 0.12);
}

.phone-screen strong {
  max-width: 190px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  line-height: 0.98;
}

.phone-screen p {
  margin: 0;
  color: #D6E1DB;
  font-size: 13px;
  line-height: 1.5;
}

.phone-cta {
  color: var(--green-900);
  background: var(--gold);
}

.phone-caption {
  max-width: 360px;
  margin: 14px 0 0;
  color: var(--muted);
  text-align: left;
}

@media (max-width: 980px) {
  .portal-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .portal-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .hero-grid,
  .measure-grid,
  .request-builder {
    grid-template-columns: 1fr;
  }

  .workspace-dashboard {
    grid-template-columns: 1fr;
  }

  .workspace-rail {
    position: static;
    min-height: auto;
    grid-template-rows: auto auto;
    padding: 16px;
  }

  .rail-account {
    display: none;
  }

  .rail-nav {
    display: flex;
    overflow-x: auto;
  }

  .workspace-main {
    padding: 18px;
  }

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

  .dashboard-actions {
    justify-content: flex-start;
  }

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

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "queue"
      "timeline"
      "capture"
      "report";
  }

  .report-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .hero-grid,
  .measure-grid {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .hero-grid,
  .request-builder,
  .measure-grid {
    width: min(100vw - 28px, 1180px);
  }

  .portal-header {
    padding: 14px;
  }

  .brand-link {
    min-width: 0;
  }

  .brand-link img {
    width: 150px;
  }

  .header-action {
    padding: 0 12px;
  }

  .hero-copy h1,
  .builder-copy h1,
  .measure-grid h1 {
    font-size: 42px;
  }

  .workspace-main {
    padding: 14px;
  }

  .dashboard-topbar h1 {
    font-size: 28px;
  }

  .dashboard-metrics {
    grid-template-columns: 1fr;
  }

  .portal-preview,
  .panel {
    padding: 14px;
  }

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

  .term-table-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .term-table-head {
    display: none;
  }

  .term-table-row strong,
  .term-table-row small {
    white-space: normal;
  }

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

  .body3d-stage {
    min-height: 300px;
  }

  .body3d-label {
    min-width: 96px;
    padding: 6px 8px;
  }

  .preview-topline,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
