:root {
  color-scheme: light;
  --canvas: #f0f3f1;
  --surface: #ffffff;
  --surface-2: #f7faf8;
  --ink: #18211d;
  --muted: #637068;
  --line: #d5ddd8;
  --line-dark: #aebbb4;
  --green: #126149;
  --green-dark: #0b4937;
  --green-soft: #e7f1ed;
  --blue: #245f80;
  --blue-soft: #eaf2f6;
  --amber: #9b5a12;
  --amber-soft: #fff3e3;
  --red: #a03838;
  --red-soft: #f9ecec;
  --shadow: 0 8px 24px rgba(25, 35, 30, 0.07);
  --shadow-subtle: 0 3px 12px rgba(25, 35, 30, 0.045);
}

* {
  box-sizing: border-box;
  scrollbar-color: #9aa9a1 #edf1ef;
  scrollbar-width: thin;
}

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

*::-webkit-scrollbar-track {
  background: #edf1ef;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid #edf1ef;
  border-radius: 8px;
  background: #9aa9a1;
}

::selection {
  background: #b9d8cc;
  color: var(--green-dark);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 68px;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

input,
select {
  caret-color: var(--green);
}

strong,
dd,
input[type="number"],
.metric-card,
.secondary-metrics,
table {
  font-variant-numeric: tabular-nums;
}

button,
input,
select {
  font: inherit;
}

button,
select,
summary {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid #cfd8d3;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 1px 10px rgba(25, 35, 30, 0.05);
}

.topbar-inner {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto;
  align-items: center;
  gap: 22px;
  width: min(1480px, calc(100% - 32px));
  min-height: 64px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  background: var(--green-dark);
  color: #fff;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 850;
}

.brand-name {
  font-size: 14px;
  font-weight: 800;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.icon-btn,
.primary-btn,
.secondary-btn,
.help-btn {
  height: 38px;
  border: 1px solid var(--line-dark);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  transition: background 140ms ease, border-color 140ms ease;
}

.icon-btn:hover,
.primary-btn:hover,
.secondary-btn:hover,
.help-btn:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.button-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:active,
.primary-btn:active,
.secondary-btn:active,
.help-btn:active {
  transform: translateY(1px);
}

.icon-btn:disabled,
.primary-btn:disabled,
.secondary-btn:disabled,
.help-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.icon-btn:focus-visible,
.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.help-btn:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(36, 95, 128, 0.25);
  outline-offset: 2px;
}

.icon-btn {
  width: 36px;
  padding: 0;
  font-size: 19px;
}

.primary-btn {
  padding: 0 13px;
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.secondary-btn {
  padding: 0 12px;
  border-color: var(--green);
  background: var(--surface);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 11px;
  border-color: #7b9c8e;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.help-btn > span {
  white-space: nowrap;
}

.primary-btn:hover {
  background: var(--green-dark);
}

.secondary-btn:hover {
  background: var(--green-soft);
}

.help-btn:hover {
  background: #d8eae2;
}

.help-dialog {
  width: min(820px, calc(100% - 28px));
  max-height: min(820px, calc(100vh - 36px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(16, 28, 22, 0.24);
}

.help-dialog::backdrop {
  background: rgba(19, 29, 24, 0.52);
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.help-header h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.dialog-close {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-dark);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
}

.dialog-close:hover {
  border-color: var(--green);
  background: var(--surface-2);
}

.help-content {
  max-height: calc(min(820px, 100vh - 36px) - 68px);
  padding: 16px 18px 20px;
  overflow-y: auto;
}

.help-intro {
  padding: 12px 13px;
  border: 1px solid #c5d9d0;
  border-top: 3px solid var(--green);
  background: var(--green-soft);
}

.help-intro strong {
  display: block;
  font-size: 12px;
  line-height: 1.4;
}

.help-intro p,
.help-copy p,
.help-note p {
  margin: 6px 0 0;
  color: #4d5b54;
  font-size: 11px;
  line-height: 1.55;
}

.quick-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 14px 0;
  padding: 0;
  border: 1px solid var(--line);
  list-style: none;
}

.quick-steps li {
  min-width: 0;
  padding: 11px;
  border-right: 1px solid var(--line);
}

.quick-steps li:last-child {
  border-right: 0;
}

.quick-steps b {
  display: grid;
  width: 22px;
  height: 22px;
  margin-bottom: 8px;
  place-items: center;
  background: var(--green-dark);
  color: #fff;
  font-size: 11px;
}

.quick-steps strong,
.quick-steps span {
  display: block;
}

.quick-steps strong {
  min-height: 45px;
  font-size: 10px;
  line-height: 1.35;
}

.quick-steps span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.help-section {
  border-top: 1px solid var(--line);
}

.help-section:last-of-type {
  border-bottom: 1px solid var(--line);
}

.help-section summary {
  padding: 11px 2px;
  color: #34433c;
  font-size: 11px;
  font-weight: 800;
}

.help-section[open] summary {
  color: var(--green-dark);
}

.glossary-list {
  display: grid;
  gap: 0;
  margin: 0 0 12px;
  border: 1px solid var(--line);
}

.glossary-list > div {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.glossary-list > div:last-child {
  border-bottom: 0;
}

.glossary-list dt {
  color: var(--ink);
  font-weight: 800;
}

.glossary-list dd {
  color: var(--muted);
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
}

.help-copy {
  padding: 0 2px 12px;
}

.decision-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding-bottom: 12px;
}

.decision-guide > div {
  padding: 9px 10px;
  border: 1px solid #c5d9d0;
  border-top: 3px solid var(--green);
  background: var(--green-soft);
}

.decision-guide .guide-review {
  border-color: #e0c59f;
  border-top-color: var(--amber);
  background: var(--amber-soft);
}

.decision-guide .guide-bad {
  border-color: #e1baba;
  border-top-color: var(--red);
  background: var(--red-soft);
}

.decision-guide strong,
.decision-guide span {
  display: block;
}

.decision-guide strong {
  font-size: 10px;
}

.decision-guide span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.help-note {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #dfc59f;
  background: var(--amber-soft);
}

.help-note > strong {
  color: #724410;
  font-size: 10px;
}

.shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 24px;
}

.dashboard,
.workbench,
.settings,
.sensitivity {
  scroll-margin-top: 72px;
}

.page-heading,
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.page-heading {
  margin-bottom: 16px;
}

.page-heading > div:first-child {
  max-width: 75ch;
}

.page-heading h1 {
  margin-bottom: 5px;
  font-size: 26px;
  line-height: 1.15;
}

.page-heading p,
.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.project-context {
  min-width: 235px;
  padding-left: 16px;
  border-left: 2px solid var(--line-dark);
  text-align: right;
}

.project-context span,
.project-context strong {
  display: block;
}

.project-context span {
  margin-bottom: 3px;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

.project-context strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.decision-bar {
  display: grid;
  grid-template-columns: 140px minmax(200px, auto) minmax(250px, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 52px;
  margin-bottom: 10px;
  padding: 9px 15px;
  border: 1px solid #b9d2c7;
  background: var(--green-soft);
  border-radius: 4px;
}

.decision-bar[data-tone="neutral"] {
  border-color: #e0c59f;
  background: var(--amber-soft);
}

.decision-bar[data-tone="bad"] {
  border-color: #e1baba;
  background: var(--red-soft);
}

.decision-bar span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.decision-bar strong {
  font-size: 18px;
}

.decision-bar p {
  margin: 0;
  color: #48564f;
  font-size: 12px;
  font-weight: 650;
  text-align: right;
}

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

.metric-card {
  min-width: 0;
  min-height: 112px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 5px;
  box-shadow: var(--shadow-subtle);
}

.metric-card-profit {
  border-color: #a9c8bc;
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.metric-card span {
  min-height: 30px;
  font-weight: 750;
}

.metric-card strong {
  display: block;
  margin: 7px 0 5px;
  overflow-wrap: anywhere;
  font-size: 25px;
  line-height: 1;
}

#residualLandValue {
  font-size: 20px;
  line-height: 1.05;
}

.secondary-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 10px 0 22px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 5px;
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
}

.secondary-metrics > div {
  min-width: 0;
  padding: 12px 15px;
  border-right: 1px solid var(--line);
}

.secondary-metrics > div:last-child {
  border-right: 0;
}

.secondary-metrics span,
.secondary-metrics strong,
.secondary-metrics small {
  display: block;
}

.secondary-metrics span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.secondary-metrics strong {
  margin: 5px 0 3px;
  overflow-wrap: anywhere;
  font-size: 17px;
}

.secondary-metrics small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 19px;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(350px, 0.72fr);
  gap: 12px;
  align-items: start;
}

.input-workspace,
.live-panel,
.settings-grid,
.sensitivity-grid {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  border-radius: 5px;
  overflow: hidden;
}

.input-group {
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
}

.input-group:last-child {
  border-bottom: 0;
}

.group-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.group-heading > span {
  display: grid;
  width: 25px;
  height: 22px;
  place-items: center;
  border-radius: 3px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 10px;
  font-weight: 850;
}

.group-heading h3 {
  margin-bottom: 0;
  font-size: 14px;
}

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

.span-2 {
  grid-column: span 2;
}

label {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
}

label span,
.computed-input span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

input,
select {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input:hover,
select:hover {
  border-color: var(--line-dark);
}

input:focus,
select:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(18, 97, 73, 0.12);
}

.computed-input {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 63px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--line-dark);
  background: var(--surface-2);
  border-radius: 3px;
}

.computed-input strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.computed-primary {
  border-color: #c5d9d0;
  border-top-color: var(--green);
  background: var(--green-soft);
}

.inline-results {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 10px;
}

.inline-results strong {
  margin-left: 4px;
  color: var(--ink);
  font-size: 11px;
}

.finance-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 9px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.finance-strip > div {
  min-width: 0;
  padding: 8px 9px;
  border-right: 1px solid var(--line);
}

.finance-strip > div:last-child {
  border-right: 0;
}

.finance-strip span,
.finance-strip strong {
  display: block;
}

.finance-strip span {
  min-height: 25px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.finance-strip strong {
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 11px;
}

.live-panel {
  position: sticky;
  top: 68px;
  box-shadow: var(--shadow);
}

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

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

.live-summary {
  border-top: 3px solid var(--green);
}

.live-summary h2 {
  margin-bottom: 8px;
  font-size: 16px;
}

.live-summary > p {
  margin-bottom: 10px;
  padding: 7px 8px;
  border: 1px solid #c5d9d0;
  background: var(--green-soft);
  color: #345449;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

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

.panel-title h3 {
  margin-bottom: 0;
  font-size: 12px;
}

.panel-title strong,
.panel-title span {
  color: var(--muted);
  font-size: 10px;
}

.detail-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.detail-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid #e9eeeb;
}

.detail-list > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

dt {
  color: var(--muted);
  font-size: 11px;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.compact-list > div {
  padding: 5px 0;
}

.cost-list {
  display: grid;
  gap: 7px;
}

.cost-row {
  display: grid;
  grid-template-columns: 128px minmax(40px, 1fr) 80px;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 10px;
}

.cost-row > span {
  line-height: 1.2;
}

.cost-row strong {
  overflow-wrap: anywhere;
  font-size: 10px;
  text-align: right;
}

.bar-track {
  height: 6px;
  overflow: hidden;
  background: #e4ebe7;
}

.bar-fill {
  height: 100%;
  background: var(--green);
}

.bar-fill.credit {
  background: var(--blue);
}

.settings,
.sensitivity {
  margin-top: 18px;
}

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

.settings-grid details {
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.settings-grid details:nth-child(2) {
  border-right: 0;
}

.settings-grid details:last-child {
  border-bottom: 0;
}

.settings-wide {
  grid-column: 1 / -1;
  border-right: 0 !important;
}

.settings-grid summary {
  padding: 11px 14px;
  color: #34433c;
  font-size: 12px;
  font-weight: 800;
}

.settings-grid details[open] summary {
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.settings-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 9px;
  padding: 12px 14px 14px;
}

.gst-fields {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.field-inactive {
  opacity: 0.42;
}

.gst-reconciliation {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  background: var(--blue-soft);
}

.gst-reconciliation span {
  padding: 9px 14px;
  border-right: 1px solid #cfdee6;
  color: #50636d;
  font-size: 10px;
}

.gst-reconciliation span:last-child {
  border-right: 0;
}

.gst-reconciliation strong {
  margin-left: 4px;
  color: var(--ink);
}

.model-checks {
  margin-top: 8px;
  padding: 10px 13px;
  border: 1px solid #e1c49b;
  background: var(--amber-soft);
}

.model-checks h3 {
  margin-bottom: 6px;
  font-size: 11px;
}

.model-checks ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 17px;
  color: #724410;
  font-size: 10px;
  line-height: 1.4;
}

.sensitivity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(380px, 0.75fr);
}

.analysis-panel {
  min-width: 0;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
}

.analysis-panel:last-child {
  border-right: 0;
}

.sensitivity-table {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 11px;
}

caption {
  padding: 0 0 7px;
  color: var(--muted);
  font-size: 10px;
  text-align: left;
}

th,
td {
  padding: 7px 6px;
  border-bottom: 1px solid #e5ebe7;
  text-align: right;
  white-space: nowrap;
}

tbody tr:hover > * {
  background: var(--surface-2);
}

.sensitivity-table tbody tr:nth-child(3) > * {
  background: var(--blue-soft);
  color: var(--ink);
  font-weight: 800;
}

th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 800;
}

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

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

.neutral {
  color: var(--amber);
}

.footer-note {
  padding: 12px 2px 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.footer-note p {
  margin: 0;
}

.footer-note .copyright {
  margin-top: 6px;
}

@media (max-width: 1240px) {
  .topbar-inner {
    grid-template-columns: auto 1fr;
    gap: 12px;
  }

  .topbar-actions > span {
    display: none;
  }

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

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

  .live-panel {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .live-section {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .live-section:last-child {
    border-right: 0;
  }

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

  .analysis-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .analysis-panel:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 900px) {
  html {
    scroll-padding-top: 68px;
  }

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

  .dashboard,
  .workbench,
  .settings,
  .sensitivity {
    scroll-margin-top: 70px;
  }

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

  .metric-card:last-child {
    grid-column: 1 / -1;
  }

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

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

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

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

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

  .live-section {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .settings-grid details,
  .settings-grid details:nth-child(2) {
    border-right: 0;
  }

  .settings-wide {
    grid-column: auto;
  }
}

@media (max-width: 760px) and (min-width: 621px) {
  .brand-name {
    display: none;
  }
}

@media (max-width: 620px) {
  html {
    scroll-padding-top: 116px;
  }

  .dashboard,
  .workbench,
  .settings,
  .sensitivity {
    scroll-margin-top: 118px;
  }

  .topbar-inner,
  .shell {
    width: min(100% - 16px, 1480px);
  }

  .topbar-inner {
    grid-template-columns: 1fr;
    gap: 7px;
    min-height: 0;
    padding: 7px 0;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 6px;
    width: 100%;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-name {
    display: block;
    font-size: 12px;
  }

  .brand {
    min-height: 44px;
  }

  .icon-btn,
  .primary-btn,
  .secondary-btn,
  .help-btn {
    height: 44px;
  }

  .icon-btn {
    width: 44px;
  }

  .primary-btn {
    padding: 0 9px;
    font-size: 10px;
    line-height: 1.1;
    white-space: normal;
  }


  .secondary-btn {
    padding: 0 8px;
    font-size: 10px;
    line-height: 1.1;
    white-space: normal;
  }

  .help-btn {
    padding: 0 8px;
    font-size: 10px;
  }

  .help-btn > span {
    white-space: normal;
  }

  .quick-steps {
    grid-template-columns: 1fr;
  }

  .quick-steps li {
    display: grid;
    grid-template-columns: 25px minmax(0, 1fr);
    gap: 9px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .quick-steps li:last-child {
    border-bottom: 0;
  }

  .quick-steps b {
    margin-bottom: 0;
  }

  .quick-steps strong {
    min-height: 0;
  }

  .glossary-list > div,
  .decision-guide {
    grid-template-columns: 1fr;
  }

  .help-dialog {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
  }

  .help-header,
  .help-content {
    padding-left: 13px;
    padding-right: 13px;
  }

  .shell {
    padding-top: 16px;
  }

  .page-heading,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .page-heading h1 {
    font-size: 23px;
    line-height: 1.12;
  }

  .project-context {
    min-width: 0;
    padding-left: 0;
    border-left: 0;
    text-align: left;
  }

  .decision-bar {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .decision-bar p {
    text-align: left;
  }

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

  .form-grid,
  .settings-fields,
  .gst-fields,
  .gst-reconciliation {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 108px;
    padding: 12px;
  }

  .metric-card strong {
    font-size: 20px;
  }

  .metric-card:last-child {
    grid-column: 1 / -1;
  }

  #residualLandValue {
    font-size: 20px;
  }

  .secondary-metrics > div,
  .secondary-metrics > div:nth-child(2) {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .secondary-metrics > div:nth-child(2n) {
    border-right: 0;
  }

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

  .secondary-metrics > div:last-child {
    border-bottom: 0;
  }

  .span-2 {
    grid-column: auto;
  }

  .input-group {
    padding: 15px 12px;
  }

  input,
  select {
    height: 44px;
  }

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

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

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

  .gst-reconciliation span {
    border-right: 0;
    border-bottom: 1px solid #cfdee6;
  }

  .gst-reconciliation span:last-child {
    border-bottom: 0;
  }

  .cost-row {
    grid-template-columns: 116px minmax(35px, 1fr) 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
