:root {
  color-scheme: light;
  --ink: #172127;
  --muted: #66747b;
  --soft: #89969c;
  --line: #d7dee1;
  --line-strong: #bfc9cd;
  --paper: #ffffff;
  --canvas: #eef2f2;
  --panel: #f7f9f8;
  --header: #11191d;
  --header-2: #1b252a;
  --teal: #0d7b72;
  --teal-dark: #075e58;
  --teal-soft: #dff1ed;
  --coral: #d85a47;
  --coral-soft: #fae8e4;
  --amber: #b67808;
  --amber-soft: #fff3d7;
  --green: #2e7d52;
  --red: #b83f36;
  --shadow: 0 16px 38px rgba(21, 30, 34, 0.14);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  color: var(--ink);
  background: var(--canvas);
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(13, 123, 114, 0.26);
  outline-offset: 1px;
}

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

[hidden] {
  display: none !important;
}

svg {
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 38px;
  height: 38px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 6px;
}

.brand-mark span {
  display: block;
  width: 4px;
  border-radius: 1px;
  background: #47c6b9;
}

.brand-mark span:nth-child(1) { height: 9px; }
.brand-mark span:nth-child(2) { height: 20px; }
.brand-mark span:nth-child(3) { height: 14px; }

.brand-mark.small {
  width: 32px;
  height: 32px;
  padding: 7px;
}

.brand-mark.small span:nth-child(1) { height: 7px; }
.brand-mark.small span:nth-child(2) { height: 16px; }
.brand-mark.small span:nth-child(3) { height: 11px; }

.button,
.icon-button,
.seg-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 650;
  white-space: nowrap;
}

.button:hover,
.icon-button:hover,
.seg-button:hover {
  background: #f0f5f3;
  border-color: #9eabae;
}

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

.button-primary:hover {
  border-color: var(--teal-dark);
  background: var(--teal-dark);
}

.button-danger {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.button-large {
  width: 100%;
  min-height: 44px;
}

.button-block {
  width: 100%;
}

.icon-button {
  width: 34px;
  padding: 0;
}

.auth-screen {
  display: grid;
  grid-template-columns: minmax(420px, 0.82fr) minmax(520px, 1.18fr);
  width: 100vw;
  min-height: 100vh;
  background: var(--header);
}

.auth-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 620px;
  min-height: 100vh;
  padding: 54px clamp(40px, 5vw, 86px);
  background: #f8faf9;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-brand {
  position: absolute;
  top: 34px;
  left: clamp(40px, 5vw, 86px);
  display: flex;
  align-items: center;
  gap: 11px;
}

.auth-brand .brand-mark {
  border-color: #a8bab9;
  background: var(--header);
}

.auth-brand strong,
.auth-brand small {
  display: block;
}

.auth-brand strong {
  font-size: 17px;
}

.auth-brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.auth-copy h1 {
  max-width: 500px;
  margin: 0;
  font-size: 38px;
  line-height: 1.12;
  font-weight: 680;
}

.auth-copy {
  margin-top: 28px;
}

.auth-copy > p:last-child {
  max-width: 480px;
  margin: 18px 0 26px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.auth-tab {
  position: relative;
  padding: 11px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}

.auth-tab::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: transparent;
  content: "";
}

.auth-tab.is-active {
  color: var(--ink);
}

.auth-tab.is-active::after {
  background: var(--teal);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label,
.team-form label,
.inspector label,
.estimate-editor label {
  display: grid;
  gap: 6px;
  color: #344148;
  font-size: 12px;
  font-weight: 650;
}

.auth-form input,
.team-form input,
.team-form select,
.inspector input,
.inspector select,
.inspector textarea,
.estimate-editor input,
.estimate-editor select,
.estimate-editor textarea {
  width: 100%;
  min-height: 39px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  font-weight: 500;
}

.auth-form input:focus,
.team-form input:focus,
.team-form select:focus,
.inspector input:focus,
.inspector select:focus,
.inspector textarea:focus,
.estimate-editor input:focus,
.estimate-editor select:focus,
.estimate-editor textarea:focus {
  border-color: var(--teal);
}

.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-error {
  min-height: 17px;
  margin: -3px 0;
  color: var(--red);
  font-size: 12px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--soft);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  flex: 1;
  height: 1px;
  background: var(--line);
  content: "";
}

.local-access-button {
  border-color: #8ca5a3;
  background: #edf5f3;
  color: #124e4a;
}

.local-access-button:hover {
  border-color: var(--teal);
  background: #e0efec;
}

.auth-footnote {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 20px 0 0;
  color: var(--soft);
  font-size: 11px;
}

.auth-visual {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #141e22;
}

.auth-visual canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.auth-visual-label {
  position: absolute;
  right: 32px;
  bottom: 32px;
  width: min(360px, calc(100% - 64px));
  padding: 18px 20px;
  border-left: 3px solid #47c6b9;
  background: rgba(17, 25, 29, 0.9);
  color: #fff;
}

.auth-visual-label span,
.auth-visual-label strong,
.auth-visual-label small {
  display: block;
}

.auth-visual-label span {
  color: #9fb2b8;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.auth-visual-label strong {
  margin: 7px 0;
  font-size: 25px;
}

.auth-visual-label small {
  color: #becbd0;
}

.app-shell {
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  background: var(--canvas);
}

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 172px minmax(200px, 1fr) auto minmax(360px, 1fr);
  align-items: center;
  height: 58px;
  background: var(--header);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand-button {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 58px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: #fff;
  text-align: left;
}

.brand-button:hover {
  background: rgba(255, 255, 255, 0.05);
}

.brand-button > span:last-child {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.brand-button strong {
  font-size: 14px;
}

.brand-button small {
  color: #47c6b9;
  font-size: 9px;
  font-weight: 800;
}

.project-identity {
  min-width: 0;
  padding: 0 18px;
}

.project-identity > span {
  display: block;
  overflow: hidden;
  color: #8fa2aa;
  font-size: 9px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-identity button {
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 2px 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-tabs {
  align-self: stretch;
  display: flex;
  align-items: stretch;
}

.view-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: #9fb0b7;
  font-size: 12px;
  font-weight: 650;
}

.view-tab::after {
  position: absolute;
  right: 11px;
  bottom: 0;
  left: 11px;
  height: 2px;
  background: transparent;
  content: "";
}

.view-tab:hover,
.view-tab.is-active {
  color: #fff;
}

.view-tab.is-active::after {
  background: #47c6b9;
}

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

.topbar .button {
  min-height: 32px;
  border-color: rgba(255, 255, 255, 0.18);
  background: var(--header-2);
  color: #e7edef;
  font-size: 11px;
}

.topbar .button:hover {
  background: #28353a;
}

.topbar .button-primary {
  border-color: #47c6b9;
  background: #0f766e;
  color: #fff;
}

.avatar-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: #3a4a50;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.workspace-view {
  min-height: 0;
}

.plan-view {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 328px;
  min-height: 0;
}

.tool-rail {
  position: relative;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  min-height: 0;
  padding: 8px 6px;
  border-right: 1px solid var(--line);
  background: var(--paper);
}

.tool-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 46px;
  height: 49px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #69767c;
  font-size: 9px;
  font-weight: 650;
}

.tool-button:hover {
  background: #edf3f1;
  color: var(--ink);
}

.tool-button.is-active {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.tool-button svg {
  width: 19px;
  height: 19px;
}

.tool-divider {
  width: 34px;
  height: 1px;
  margin: 4px auto;
  background: var(--line);
}

.plan-main {
  display: grid;
  grid-template-rows: 70px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.metrics-band {
  display: grid;
  grid-template-columns: 146px repeat(4, minmax(105px, 1fr)) 174px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.metric-primary,
.metric-item,
.scenario-control {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 8px 14px;
  border-right: 1px solid #e5eaec;
}

.metric-primary {
  background: #eef8f5;
}

.metric-primary > span,
.metric-item > span,
.scenario-control label {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.metric-primary strong {
  margin: 1px 0;
  color: var(--teal-dark);
  font-size: 23px;
  line-height: 1;
}

.metric-item strong {
  margin: 3px 0 1px;
  font-size: 17px;
  line-height: 1;
}

.metric-primary small,
.metric-item small {
  overflow: hidden;
  color: var(--soft);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenario-control {
  gap: 5px;
  border-right: 0;
}

.scenario-control select {
  width: 100%;
  min-height: 30px;
  padding: 4px 26px 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  font-size: 11px;
  font-weight: 650;
}

.canvas-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background-color: #e9eeee;
  background-image: linear-gradient(#dde4e4 1px, transparent 1px), linear-gradient(90deg, #dde4e4 1px, transparent 1px);
  background-size: 24px 24px;
}

#planCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.canvas-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(440px, calc(100% - 48px));
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(24, 34, 38, 0.1);
  transform: translate(-50%, -50%);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 13px;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
}

.empty-icon svg {
  width: 23px;
  height: 23px;
}

.canvas-empty strong {
  font-size: 16px;
}

.canvas-empty > span {
  margin: 7px 0 17px;
  color: var(--muted);
  line-height: 1.45;
}

.canvas-empty > div:last-child {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.canvas-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 5px 14px rgba(26, 37, 41, 0.1);
}

.canvas-toolbar > .canvas-divider {
  width: 1px;
  height: 22px;
  margin: 0 3px;
  background: var(--line);
}

.canvas-toolbar .icon-button,
.canvas-toolbar .seg-button {
  min-height: 30px;
  border: 0;
  background: transparent;
}

.canvas-toolbar .seg-button {
  padding: 0 8px;
  color: var(--muted);
  font-size: 10px;
}

.canvas-toolbar .seg-button.is-active {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

#spillValue {
  min-width: 48px;
  color: inherit;
  font-size: 10px;
  font-weight: 800;
  text-align: right;
}

.heat-legend {
  position: absolute;
  right: 12px;
  bottom: 38px;
  width: 250px;
  padding: 8px 10px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 12px rgba(26, 37, 41, 0.08);
}

.legend-gradient {
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(90deg, #384964 0%, #197a9b 22%, #20a383 43%, #b7c939 62%, #f5b43b 78%, #d74f42 100%);
}

.heat-legend > div:last-child {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: #65747a;
  font-size: 8px;
}

.canvas-status {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  height: 28px;
  padding: 0 12px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  color: #65747a;
  font-size: 9px;
  line-height: 28px;
}

.canvas-status span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#modelStatus {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.probe-card {
  position: absolute;
  top: 57px;
  left: 12px;
  width: 290px;
  max-height: calc(100% - 110px);
  overflow: auto;
  padding: 13px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
  font-size: 11px;
}

.probe-card h3 {
  margin: 0 0 3px;
  font-size: 13px;
}

.probe-card > p {
  margin: 0 0 11px;
  color: var(--muted);
}

.probe-ray {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 8px 0;
  border-top: 1px solid #e6eaec;
}

.probe-ray strong:last-child {
  color: var(--teal-dark);
}

.probe-ray span {
  color: var(--muted);
  font-size: 10px;
}

.inspector {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
}

.inspector-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 68px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.inspector-header span {
  color: var(--teal);
  font-size: 9px;
  font-weight: 800;
}

.inspector-header h2 {
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.2;
}

.inspector-content {
  min-height: 0;
  overflow: auto;
  padding: 0 14px 18px;
}

.inspector-footer {
  display: grid;
  gap: 7px;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.inspector-section {
  padding: 15px 0;
  border-bottom: 1px solid #dce3e4;
}

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

.inspector-section h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 11px;
  color: #344148;
  font-size: 11px;
  text-transform: uppercase;
}

.inspector-section h3 small {
  color: var(--soft);
  font-size: 9px;
  font-weight: 600;
  text-transform: none;
}

.inspector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.inspector-stack {
  display: grid;
  gap: 10px;
}

.inspector textarea,
.estimate-editor textarea {
  min-height: 76px;
  resize: vertical;
  line-height: 1.45;
}

.field-unit {
  position: relative;
}

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

.field-unit span {
  position: absolute;
  right: 9px;
  bottom: 11px;
  color: var(--soft);
  font-size: 10px;
  font-weight: 600;
}

.range-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 5px 10px;
}

.range-field input[type="range"] {
  grid-column: 1 / -1;
  min-height: 20px;
  padding: 0;
  accent-color: var(--teal);
}

.range-field output {
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 750;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
}

.toggle-row > span {
  color: #344148;
  font-size: 11px;
  font-weight: 650;
}

.toggle {
  position: relative;
  width: 36px;
  height: 20px;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle span {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: #b8c2c5;
  transition: background 140ms ease;
}

.toggle span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: transform 140ms ease;
}

.toggle input:checked + span {
  background: var(--teal);
}

.toggle input:checked + span::after {
  transform: translateX(16px);
}

.model-note {
  display: flex;
  gap: 8px;
  margin: 10px 0 0;
  padding: 9px;
  border-left: 2px solid var(--amber);
  background: var(--amber-soft);
  color: #6e531b;
  font-size: 10px;
  line-height: 1.45;
}

.object-actions {
  display: flex;
  gap: 7px;
  margin-top: 12px;
}

.object-actions .button {
  flex: 1;
  min-width: 0;
  font-size: 10px;
}

.object-actions .delete-button {
  color: var(--red);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.choice-chip {
  min-height: 27px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}

.choice-chip.is-active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.evidence-view,
.estimate-view {
  height: calc(100vh - 58px);
  overflow: auto;
  background: #f4f6f5;
}

.evidence-heading,
.estimate-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  padding: 42px max(42px, calc((100vw - 1220px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.evidence-heading h1,
.estimate-heading h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

.evidence-heading > p {
  max-width: 500px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.evidence-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 38px;
  width: min(1220px, calc(100% - 84px));
  margin: 0 auto;
  padding: 36px 0 70px;
}

.evidence-main {
  background: var(--paper);
  border: 1px solid var(--line);
}

.evidence-section {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 17px;
  padding: 28px 32px 30px;
  border-bottom: 1px solid var(--line);
}

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

.section-index {
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.evidence-section h2,
.benchmark-panel h2,
.estimate-editor h2 {
  margin: 0 0 9px;
  font-size: 18px;
}

.evidence-section p {
  margin: 0 0 12px;
  color: #4d5b61;
  line-height: 1.65;
}

.evidence-section a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.evidence-section a:hover {
  text-decoration: underline;
}

.formula {
  margin: 15px 0;
  padding: 12px 14px;
  border-left: 3px solid var(--teal);
  background: #eef5f3;
  color: #213137;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.evidence-table {
  margin: 15px 0 8px;
  border-top: 1px solid var(--line);
}

.evidence-table-row {
  display: grid;
  grid-template-columns: 1.15fr 0.7fr 1.6fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #e3e8e9;
  font-size: 11px;
}

.evidence-table-row.header {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.benchmark-panel {
  align-self: start;
  position: sticky;
  top: 24px;
  padding: 26px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.benchmark-list {
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.benchmark-list > div {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.benchmark-list strong,
.benchmark-list span {
  display: block;
}

.benchmark-list strong {
  margin-bottom: 5px;
  font-size: 12px;
}

.benchmark-list span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.benchmark-conclusion {
  margin: 20px 0 0;
  padding: 13px;
  border-left: 3px solid var(--coral);
  background: var(--coral-soft);
  color: #6d3a32;
  font-size: 11px;
  line-height: 1.5;
}

.estimate-heading {
  align-items: center;
}

.estimate-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(420px, 1.1fr);
  gap: 30px;
  width: min(1120px, calc(100% - 84px));
  margin: 0 auto;
  padding: 36px 0 70px;
}

.estimate-editor,
.estimate-summary {
  align-self: start;
  padding: 28px;
  border: 1px solid var(--line);
  background: var(--paper);
}

#estimateForm {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.estimate-total {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.estimate-total span,
.estimate-total strong,
.estimate-total small {
  display: block;
}

.estimate-total span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.estimate-total strong {
  margin: 6px 0 2px;
  color: var(--teal-dark);
  font-size: 34px;
}

.estimate-total small {
  color: var(--soft);
}

.line-items {
  padding: 14px 0;
}

.line-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  padding: 11px 0;
  border-bottom: 1px solid #e5e9ea;
}

.line-item strong:last-child {
  text-align: right;
}

.line-item span {
  color: var(--muted);
  font-size: 10px;
}

.proposal-callout {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  padding: 16px;
  border-left: 3px solid var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.proposal-callout strong,
.proposal-callout span {
  display: block;
}

.proposal-callout span {
  margin-top: 4px;
  color: #46625f;
  font-size: 11px;
  line-height: 1.5;
}

.app-dialog {
  width: min(720px, calc(100vw - 36px));
  max-height: min(760px, calc(100vh - 36px));
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.app-dialog::backdrop {
  background: rgba(12, 19, 22, 0.54);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 19px 22px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin: 0;
  font-size: 20px;
}

.dialog-header > div > span {
  color: var(--muted);
  font-size: 11px;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.project-list {
  min-height: 220px;
  padding: 8px 22px 22px;
}

.project-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.project-row > button:first-child {
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

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

.project-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.project-row time {
  color: var(--soft);
  font-size: 9px;
}

.empty-list {
  display: grid;
  place-items: center;
  min-height: 210px;
  color: var(--muted);
  text-align: center;
}

.account-dialog {
  width: min(430px, calc(100vw - 36px));
}

.account-actions {
  padding: 8px 22px 20px;
}

.menu-action {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 13px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.menu-action:hover {
  color: var(--teal-dark);
}

.menu-action > svg:first-child {
  width: 18px;
  height: 18px;
}

.menu-action strong,
.menu-action small {
  display: block;
}

.menu-action small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.menu-action.danger {
  color: var(--red);
}

.team-dialog {
  width: min(760px, calc(100vw - 36px));
}

.team-list {
  padding: 8px 22px;
}

.team-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 13px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.team-row strong,
.team-row span {
  display: block;
}

.team-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.role-badge {
  padding: 4px 7px;
  border-radius: 3px;
  background: #edf1f1;
  color: #546268;
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.team-form {
  display: grid;
  gap: 12px;
  padding: 20px 22px 24px;
  background: var(--panel);
}

.team-form h3 {
  margin: 0;
  font-size: 14px;
}

.confirm-dialog {
  width: min(440px, calc(100vw - 36px));
}

.confirm-dialog > p {
  margin: 0;
  padding: 22px;
  color: var(--muted);
  line-height: 1.55;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.control-help-wrap {
  position: relative;
  display: inline-flex;
  min-width: 0;
  vertical-align: middle;
}

.control-help-wrap > :first-child {
  min-width: 0;
}

.control-help-wrap:has(> [hidden]) {
  display: none;
}

.control-help-block {
  width: 100%;
}

.control-help-block > .button,
.control-help-block > .menu-action {
  width: 100%;
}

.field-help-wrap {
  position: relative;
  display: grid;
  min-width: 0;
}

.field-help-wrap > label {
  min-width: 0;
  padding-right: 18px;
}

.help-trigger {
  position: absolute;
  z-index: 6;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  border: 1px solid #a9b6ba;
  border-radius: 50%;
  background: #fff;
  color: #53666d;
  box-shadow: 0 1px 3px rgba(18, 28, 32, 0.14);
  font-family: Georgia, serif;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.help-trigger:hover,
.help-trigger[aria-expanded="true"] {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.help-trigger:focus-visible {
  outline: 2px solid rgba(13, 123, 114, 0.32);
  outline-offset: 1px;
}

.field-help-wrap > .help-trigger {
  top: -1px;
  right: 0;
  box-shadow: none;
}

.help-trigger-inline {
  position: static;
  margin-left: auto;
  box-shadow: none;
}

.auth-tabs .control-help-wrap {
  width: 100%;
}

.auth-tabs .auth-tab {
  width: 100%;
}

.auth-form > .control-help-wrap {
  width: 100%;
}

.team-form > .control-help-wrap {
  width: max-content;
  justify-self: start;
}

.view-tabs .control-help-wrap {
  align-self: stretch;
}

.view-tabs .view-tab {
  height: 100%;
}

.topbar .control-help-wrap > .help-trigger {
  top: 3px;
  right: 1px;
}

.tool-rail .control-help-wrap {
  width: 46px;
  height: 49px;
}

.tool-rail .control-help-wrap .tool-button {
  width: 100%;
  height: 100%;
}

.tool-rail .control-help-wrap .help-trigger {
  top: 1px;
  right: 1px;
  width: 14px;
  min-width: 14px;
  height: 14px;
  min-height: 14px;
  font-size: 9px;
  box-shadow: none;
}

.scenario-control .field-help-wrap,
.inspector-footer .control-help-wrap {
  width: 100%;
}

.canvas-toolbar .control-help-wrap {
  margin-right: 5px;
}

.canvas-toolbar .control-help-wrap .help-trigger {
  top: 7px;
  right: -6px;
  width: 14px;
  min-width: 14px;
  height: 14px;
  min-height: 14px;
  font-size: 9px;
  box-shadow: none;
}

.object-actions .control-help-wrap {
  flex: 1;
}

.object-actions .control-help-wrap .button {
  width: 100%;
}

.dialog-actions .control-help-wrap,
.dialog-footer .control-help-wrap {
  flex: 0 0 auto;
}

.account-actions .control-help-wrap {
  width: 100%;
}

.project-row > .control-help-wrap:first-child {
  min-width: 0;
}

.project-row > .control-help-wrap:first-child > button {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.control-help-popover {
  position: fixed;
  z-index: 130;
  max-height: min(520px, calc(100vh - 24px));
  padding: 0;
  overflow: auto;
  border: 1px solid #9eacb0;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(15, 24, 28, 0.24);
  color: var(--ink);
}

.control-help-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: #f7f9f8;
}

.control-help-heading p {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 9px;
  font-weight: 800;
}

.control-help-heading h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.help-popover-close {
  display: grid;
  place-items: center;
  width: 26px;
  min-width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.help-popover-close:hover {
  background: #e9eeee;
  color: var(--ink);
}

.control-help-section {
  padding: 11px 16px 0;
}

.control-help-section:last-child {
  padding-bottom: 15px;
}

.control-help-section strong {
  display: block;
  margin-bottom: 3px;
  color: #3e4d53;
  font-size: 10px;
  text-transform: uppercase;
}

.control-help-section p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.control-help-section.implications {
  margin: 11px 12px 0;
  padding: 10px 10px 11px;
  border-left: 2px solid var(--amber);
  background: var(--amber-soft);
}

.control-help-section.implications strong,
.control-help-section.implications p {
  color: #6e531b;
}

.toast-host {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 14px;
  border-left: 3px solid var(--teal);
  border-radius: 4px;
  background: var(--header);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 11px;
  line-height: 1.45;
  animation: toast-in 160ms ease-out;
}

.toast.error {
  border-left-color: #ed6a5a;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  position: absolute;
  z-index: 80;
  top: calc(100% + 7px);
  left: 50%;
  padding: 5px 7px;
  border-radius: 3px;
  background: var(--header);
  color: #fff;
  content: attr(data-tooltip);
  font-size: 9px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -2px);
  transition: opacity 100ms ease, transform 100ms ease;
  white-space: nowrap;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.tool-rail [data-tooltip]::after {
  top: 50%;
  left: calc(100% + 8px);
  transform: translate(0, -50%);
}

.tool-rail [data-tooltip]:hover::after {
  transform: translate(0, -50%);
}

@media (max-width: 1250px) {
  .topbar {
    grid-template-columns: 164px minmax(160px, 1fr) auto minmax(320px, auto);
  }

  .topbar-actions > .control-help-wrap:first-child .button {
    width: 34px;
    padding: 0;
    font-size: 0;
  }

  .plan-view {
    grid-template-columns: 56px minmax(0, 1fr) 292px;
  }

  .metrics-band {
    grid-template-columns: 132px repeat(3, minmax(96px, 1fr)) 164px;
  }

  .metric-item:nth-child(5) {
    display: none;
  }
}

@media (max-width: 980px) {
  .auth-screen {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    max-width: none;
  }

  .auth-visual {
    display: none;
  }

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

  .view-tabs {
    display: none;
  }

  .topbar-actions {
    grid-column: 3;
  }

  .plan-view {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .inspector {
    position: absolute;
    z-index: 15;
    top: 58px;
    right: 0;
    bottom: 0;
    width: 300px;
    box-shadow: -8px 0 22px rgba(25, 34, 37, 0.14);
  }

  .plan-main {
    grid-column: 2;
  }

  .metrics-band {
    grid-template-columns: 125px repeat(2, minmax(92px, 1fr)) 155px;
    padding-right: 300px;
  }

  .metric-item:nth-child(4),
  .metric-item:nth-child(5) {
    display: none;
  }

  .evidence-layout,
  .estimate-grid {
    grid-template-columns: 1fr;
  }

  .benchmark-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .auth-panel {
    padding: 84px 24px 36px;
  }

  .auth-brand {
    left: 24px;
  }

  .auth-copy h1 {
    font-size: 30px;
  }

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

  .app-shell {
    min-width: 720px;
  }
}

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