:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-alt: #eef3ee;
  --ink: #17211d;
  --muted: #637168;
  --line: #d8ded7;
  --brand: #146a5a;
  --brand-dark: #0d493f;
  --accent: #c28a18;
  --danger: #b42318;
  --shadow: 0 12px 28px rgba(25, 41, 34, 0.08);
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 76px;
  --topbar-height: 68px;
  --control-height: 44px;
  --control-radius: 8px;
}

* {
  box-sizing: border-box;
}

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

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  align-items: center;
  background: #0f211c;
  color: #fff;
  display: flex;
  justify-content: space-between;
  left: 0;
  min-height: var(--topbar-height);
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.topbar-logo-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  height: 44px;
  justify-content: center;
  padding: 0;
  width: 44px;
}

.topbar-logo-toggle:hover {
  text-decoration: none;
}

.topbar-logo-toggle img {
  display: block;
  height: 34px;
  object-fit: contain;
  width: 34px;
}

.topbar-title {
  color: #e9f2ef;
  display: block;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand {
  align-items: center;
  color: #fff;
  display: inline-flex;
  gap: 12px;
  min-width: 0;
}

.brand:hover {
  text-decoration: none;
}

.logo-frame {
  display: block;
  width: 100%;
}

.logo-frame img {
  display: block;
  height: auto;
  max-width: 100%;
}

.logo-frame-dark {
  min-height: 86px;
}

.logo-frame-light {
  min-height: 86px;
}

.logo-missing::before {
  color: currentColor;
  content: attr(data-fallback);
  display: block;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  max-width: 240px;
}

.logo-frame-dark.logo-missing::before {
  color: #fff;
}

.logo-frame-light.logo-missing::before {
  color: var(--ink);
}

.sidebar-toggle {
  left: -9999px;
  position: fixed;
  top: -9999px;
}

.sidebar {
  background: #0f211c;
  border-right: 1px solid #263a33;
  bottom: 0;
  color: #fff;
  left: 0;
  overflow-y: auto;
  padding: 18px 10px;
  position: fixed;
  top: var(--topbar-height);
  transition: width 160ms ease, padding 160ms ease;
  width: var(--sidebar-collapsed-width);
  z-index: 15;
}

.sidebar-toggle:checked ~ .sidebar {
  padding: 18px;
  width: var(--sidebar-width);
}

.app-page {
  margin-left: var(--sidebar-collapsed-width);
}

.sidebar-toggle:checked ~ .app-page {
  margin-left: var(--sidebar-width);
}

.sidebar-brand {
  display: block;
  margin-bottom: 24px;
}

.sidebar-brand:hover {
  text-decoration: none;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.sidebar-nav a {
  align-items: center;
  color: #eaf2ee;
  display: flex;
  gap: 12px;
  font-weight: 800;
  justify-content: center;
  min-height: 48px;
  overflow: hidden;
  padding: 12px;
  position: relative;
  white-space: nowrap;
}

.sidebar-toggle:checked ~ .sidebar .sidebar-nav a {
  justify-content: flex-start;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: #18342d;
  text-decoration: none;
}

.sidebar-nav a.active::before {
  background: #88a0ff;
  bottom: 8px;
  content: "";
  left: 0;
  position: absolute;
  top: 8px;
  width: 4px;
}

.nav-icon {
  flex: 0 0 auto;
  height: 24px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 24px;
}

.nav-icon path,
.nav-icon rect {
  fill: none;
}

.nav-label {
  opacity: 0;
  transition: opacity 120ms ease;
  width: 0;
}

.sidebar-toggle:checked ~ .sidebar .nav-label {
  opacity: 1;
  width: auto;
}

.nav-actions,
.form-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.logout-form {
  margin: 0;
}

.session-user {
  align-items: center;
  color: #bfd1c9;
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
}

.session-user-text {
  display: grid;
  gap: 1px;
  line-height: 1.2;
}

.session-email {
  color: #e9f2ef;
}

.session-role {
  color: #9eb3aa;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.user-symbol {
  border: 2px solid #bfd1c9;
  border-radius: 50%;
  display: inline-block;
  height: 24px;
  position: relative;
  width: 24px;
}

.user-symbol::before {
  background: #bfd1c9;
  border-radius: 50%;
  content: "";
  height: 6px;
  left: 7px;
  position: absolute;
  top: 4px;
  width: 6px;
}

.user-symbol::after {
  background: #bfd1c9;
  border-radius: 8px 8px 0 0;
  content: "";
  height: 7px;
  left: 5px;
  position: absolute;
  top: 12px;
  width: 10px;
}

.page {
  margin: 0 auto;
  max-width: 1380px;
  padding: 28px;
  transition: margin-left 160ms ease;
}

.section-header {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 18px;
}

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

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

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

h1 {
  font-size: 34px;
  line-height: 1.15;
  margin-bottom: 0;
}

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

h3 {
  font-size: 15px;
  margin-bottom: 4px;
}

.button {
  align-items: center;
  border-radius: var(--control-radius);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  height: var(--control-height);
  justify-content: center;
  min-height: var(--control-height);
  padding: 0 16px;
}

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

.button.primary:hover {
  background: var(--brand-dark);
  text-decoration: none;
}

.button.ghost {
  background: #f5efe2;
  border-color: #d8b66a;
  color: #664b14;
}

.button.ghost:hover {
  background: #ead9b0;
  text-decoration: none;
}

.button.danger {
  background: #b42318;
  border-color: #b42318;
  color: #fff;
}

.button.danger:hover {
  background: #8f1d15;
  border-color: #8f1d15;
  text-decoration: none;
}

.button.small {
  font-size: 13px;
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
}

.topbar .button.ghost {
  background: #c28a18;
  border-color: #c28a18;
  color: #10211c;
}

.topbar .button.ghost:hover {
  background: #d9a239;
  border-color: #d9a239;
}

.metrics {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 22px;
}

.category-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-bottom: 22px;
}

.category-tile,
.selected-category-card {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  gap: 12px;
  min-height: 76px;
  padding: 14px;
}

.category-tile strong,
.selected-category-card strong {
  display: block;
  line-height: 1.2;
}

.category-tile span:last-child,
.selected-category-card span:last-child {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.category-inline {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.detail-title {
  align-items: center;
  display: flex;
  gap: 14px;
}

.detail-title h1 {
  margin-bottom: 0;
}

.challenge-icon {
  align-items: center;
  border: 1px solid rgba(15, 33, 28, 0.14);
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 900;
  height: 46px;
  justify-content: center;
  letter-spacing: 0;
  line-height: 1;
  min-width: 46px;
  padding: 0 8px;
}

.challenge-icon.small {
  font-size: 10px;
  height: 28px;
  min-width: 28px;
  padding: 0 5px;
}

.challenge-icon.large {
  font-size: 16px;
  height: 58px;
  min-width: 58px;
}

.icon-teal { background: #146a5a; }
.icon-slate { background: #46544d; }
.icon-amber { background: #9a6a13; }
.icon-rust { background: #9b3f25; }
.icon-steel { background: #55656f; }
.icon-blue { background: #2f6f9f; }
.icon-orange { background: #b85f1e; }
.icon-earth { background: #75623e; }
.icon-violet { background: #6650a4; }
.icon-ice { background: #4c8392; }
.icon-cyan { background: #168093; }
.icon-gold { background: #a68019; }
.icon-lime { background: #677d25; }
.icon-stone { background: #686057; }
.icon-indigo { background: #4556a0; }
.icon-aqua { background: #237c78; }
.icon-navy { background: #294f7a; }
.icon-purple { background: #714c82; }
.icon-green { background: #3f7742; }

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 18px;
}

.metric span,
.muted {
  color: var(--muted);
}

.metric strong {
  display: block;
  font-size: 30px;
  margin-top: 4px;
}

.panel,
.form-band,
.alert,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  padding: 22px;
}

.panel-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

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

.admin-tabs {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 6px;
  margin: -6px 0 22px;
}

.admin-tabs a {
  border: 1px solid transparent;
  border-bottom: 0;
  color: var(--muted);
  font-weight: 800;
  padding: 10px 14px;
}

.admin-tabs a:hover,
.admin-tabs a.active {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  text-decoration: none;
}

.admin-subheader {
  margin-bottom: 18px;
}

.settings-subsection {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.split-settings-table {
  margin-top: 12px;
  min-width: 980px;
}

.split-settings-table th {
  text-align: center;
  vertical-align: middle;
}

.split-settings-table tbody th {
  text-align: left;
}

.split-settings-table input {
  min-width: 72px;
  text-align: right;
}

.pep-split-wrap {
  margin-top: 16px;
  max-width: 420px;
}

.pep-split-table th {
  text-align: left;
}

.pep-split-table thead th {
  text-align: center;
}

.pep-split-table input {
  text-align: right;
}

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

.datagrid-controls {
  align-items: end;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.datagrid-search {
  flex: 1 1 320px;
  max-width: 520px;
}

.datagrid-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.datagrid-actions select {
  width: auto;
}

.datagrid-actions .button {
  min-width: 76px;
}

.datagrid-actions .icon-button {
  height: 36px;
  width: 36px;
}

.datagrid-info,
.datagrid-page {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.datagrid-page {
  color: var(--ink);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.data-table {
  border-collapse: collapse;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  min-width: 980px;
  width: 100%;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

.data-table input,
.data-table select,
.data-table textarea {
  font-family: inherit;
  font-size: inherit;
}

.data-table td.negative-value {
  color: var(--danger);
  font-weight: 800;
}

.data-table td.numeric-value {
  text-align: right;
}

.data-table th {
  background: var(--surface-alt);
  color: #3d4b43;
  font-size: 11px;
  text-align: center;
  text-transform: uppercase;
  vertical-align: middle;
}

.data-table thead th {
  text-align: center !important;
}

.column-unit {
  display: block;
  font-size: 10px;
  font-weight: 700;
  margin-top: 2px;
  text-transform: none;
}

.table-note {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 4px;
  max-width: 560px;
}

.badge {
  background: #e6eee9;
  color: #21382f;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 7px 9px;
  white-space: nowrap;
}

.badge.subtle {
  background: #f5efe2;
  color: #664b14;
}

.badge.input-kind {
  background: #e7eef6;
  color: #224966;
}

.priority-high,
.priority-critical {
  background: #f8ded9;
  color: var(--danger);
}

.priority-low {
  background: #e4edf8;
  color: #234f7d;
}

.empty-state {
  text-align: center;
}

.empty-state p {
  color: var(--muted);
}

.alert.error {
  border-color: #f0b4ad;
  color: var(--danger);
}

.alert.info {
  background: #e7eef6;
  box-shadow: none;
  color: #224966;
}

.alert ul {
  margin-bottom: 0;
}

.auth-page {
  background: #10211c;
}

.auth-shell {
  align-items: center;
  display: flex;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
  margin: 0 auto;
  max-width: 460px;
  padding: 28px;
  width: 100%;
}

.auth-brand {
  color: var(--ink);
  margin-bottom: 24px;
}

.auth-logo {
  display: block;
  max-width: 100%;
  width: 320px;
}

.auth-brand small {
  color: var(--muted);
}

.auth-card h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

.auth-card p {
  color: var(--muted);
}

.otp-countdown {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: #34443c;
  margin-top: 12px;
  padding: 10px 12px;
}

.otp-countdown strong {
  color: var(--accent);
  font-family: "Courier New", Courier, monospace;
}

.otp-countdown.expired strong {
  color: #b02a1f;
}

.auth-form,
.resend-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.form {
  margin-bottom: 36px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

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

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

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

.form-grid.six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

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

.span-three {
  grid-column: span 3;
}

label span {
  color: #34443c;
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
}

label small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 6px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid #cbd4cc;
  color: var(--ink);
  font: inherit;
  min-height: var(--control-height);
  padding: 9px 10px;
  width: 100%;
}

input:not([type="checkbox"]):not([type="radio"]),
select {
  height: var(--control-height);
}

input[type="checkbox"],
input[type="radio"] {
  min-height: auto;
  width: auto;
}

input[type="number"],
input[inputmode="decimal"],
.numeric-input,
.accounting-input {
  text-align: right;
}

textarea {
  line-height: 1.5;
  min-height: calc(4.5em + 20px);
  resize: vertical;
}

.checkbox-label {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  min-height: var(--control-height);
}

.checkbox-label input {
  min-height: auto;
  width: auto;
}

.checkbox-label span {
  margin-bottom: 0;
}

.checkbox-label.compact {
  min-height: 0;
}

.checkbox-only {
  justify-content: center;
  width: 100%;
}

.checkbox-only input[type="checkbox"] {
  height: 20px;
  min-height: 20px;
  width: 20px;
}

.admin-user-form {
  margin-top: 10px;
}

.form-band:has(.admin-user-form) {
  padding: 16px;
}

.admin-user-form .form-grid {
  gap: 10px;
}

.admin-user-form label span {
  font-size: 12px;
  margin-bottom: 4px;
}

.admin-user-form .form-actions {
  margin-top: 10px;
}

.admin-user-table input,
.admin-user-table select {
  height: 36px;
  min-height: 36px;
  min-width: 0;
  padding: 5px 7px;
}

.admin-user-form input,
.admin-user-form select {
  height: 36px;
  min-height: 36px;
  padding: 6px 8px;
}

.admin-user-table .icon-button {
  height: 36px;
  width: 36px;
}

.admin-user-table {
  min-width: 980px;
  table-layout: fixed;
}

.admin-user-table th,
.admin-user-table td {
  padding: 6px 5px;
  vertical-align: middle;
}

.admin-user-table .checkbox-label {
  min-height: 36px;
}

.admin-user-table th:nth-child(1),
.admin-user-table td:nth-child(1) {
  width: 14%;
}

.admin-user-table th:nth-child(2),
.admin-user-table td:nth-child(2) {
  width: 14%;
}

.admin-user-table th:nth-child(3),
.admin-user-table td:nth-child(3) {
  width: 13%;
}

.admin-user-table th:nth-child(4),
.admin-user-table td:nth-child(4),
.admin-user-table th:nth-child(5),
.admin-user-table td:nth-child(5) {
  width: 13%;
}

.admin-user-table th:nth-child(6),
.admin-user-table td:nth-child(6) {
  width: 14%;
}

.admin-user-table th:nth-child(7),
.admin-user-table td:nth-child(7) {
  text-align: center;
  width: 54px;
}

.admin-user-table th:nth-child(8),
.admin-user-table td:nth-child(8) {
  width: 92px;
}

.admin-user-table th:nth-child(9),
.admin-user-table td:nth-child(9) {
  text-align: center;
  width: 42px;
}

.admin-user-table .checkbox-only input[type="checkbox"] {
  height: 18px;
  min-height: 18px;
  width: 18px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 106, 90, 0.14);
  outline: none;
}

.requirement-list {
  display: grid;
  gap: 12px;
}

.requirement-row {
  border: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.1fr);
  padding: 16px;
}

.requirement-meta {
  display: grid;
  gap: 12px;
  grid-template-columns: 42px minmax(0, 1fr);
}

.requirement-meta p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.requirement-title {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.requirement-title h3 {
  margin-bottom: 0;
}

.sequence {
  align-items: center;
  background: #14372f;
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

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

.input-with-unit {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
}

.input-with-unit input,
.input-with-unit textarea {
  min-width: 0;
}

.input-with-unit input:not([type="file"]),
.input-with-unit textarea {
  border-right: 0;
}

.unit-addon {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid #cbd4cc;
  color: #34443c;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  height: var(--control-height);
  justify-content: center;
  max-width: 190px;
  min-height: var(--control-height);
  padding: 8px 12px;
  white-space: normal;
}

.input-with-unit textarea ~ .unit-addon {
  align-items: flex-start;
  height: auto;
  padding-top: 10px;
}

.file-control {
  background: var(--surface-alt);
  border: 1px dashed #b8c7bd;
  padding: 12px;
}

input[type="file"] {
  background: #fff;
  cursor: pointer;
}

.attachment-list {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.attachment-list li {
  display: grid;
  gap: 2px;
}

.detail-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 340px;
}

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

.location-summary {
  background: var(--surface-alt);
  margin: 18px 0 0;
  padding: 16px;
}

.location-summary dd {
  overflow-wrap: anywhere;
}

.definition-stack {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 3px 0 0;
}

.long-text {
  background: var(--surface-alt);
  margin-bottom: 0;
  padding: 14px;
  white-space: pre-wrap;
}

.hidden {
  display: none !important;
}

.calc-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.forecast-table {
  min-width: 900px;
}

.compact-table {
  min-width: 0;
}

.compact-table th,
.compact-table td {
  padding: 9px 8px;
}

.simulation-history-table {
  min-width: 1180px;
}

.simulation-history-table tr:has(+ tr.simulation-group-continuation) td,
.simulation-history-table tr.simulation-group-continuation:has(+ tr.simulation-group-continuation) td {
  border-bottom-color: transparent;
}

.simulation-history-table tr.simulation-group-continuation td {
  padding-top: 6px;
}

.simulation-history-table .simulation-group-blank {
  color: transparent;
}

.simulation-cell {
  display: grid;
  gap: 4px;
  min-width: 180px;
}

.simulation-cell strong {
  font-size: 13px;
}

.simulation-cell span {
  color: #34443c;
  font-size: 12px;
  line-height: 1.35;
}

.forecast-table input,
.forecast-table select {
  min-width: 96px;
}

.forecast-table output {
  align-items: center;
  display: inline-flex;
  font-weight: 800;
  min-height: var(--control-height);
  min-width: 110px;
}

.icon-button {
  align-items: center;
  background: #eef4ef;
  border: 1px solid #cbd4cc;
  border-radius: var(--control-radius);
  color: var(--brand);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 800;
  height: var(--control-height);
  justify-content: center;
  width: var(--control-height);
}

.icon-button:hover {
  background: #dde9e0;
  text-decoration: none;
}

.icon-button.add {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.icon-button.add:hover {
  background: var(--brand-dark);
}

.icon-button.danger {
  background: #f8ded9;
  border-color: #e7a59c;
  color: var(--danger);
}

.icon-button.danger:hover {
  background: #f1c2bb;
}

.action-buttons {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.calc-result-panel {
  position: sticky;
  top: 18px;
}

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

.cost-summary-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(220px, 1fr) var(--control-height) minmax(180px, 260px) minmax(150px, 180px);
}

.cost-saving-list {
  margin-top: 10px;
}

.cost-saving-row {
  grid-template-columns: minmax(260px, 1fr) var(--control-height) minmax(180px, 260px);
}

.cost-saving-summary-list {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0;
  margin-top: 14px;
}

.cost-saving-summary-row {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 260px);
  padding: 8px 0;
}

.cost-saving-summary-row + .cost-saving-summary-row {
  border-top: 1px solid var(--line);
}

.cost-saving-summary-row span {
  color: #34443c;
  font-size: 13px;
  font-weight: 800;
}

.cost-saving-summary-row.total {
  background: var(--surface-alt);
  padding-left: 10px;
  padding-right: 10px;
}

.cost-saving-observation {
  display: block;
  margin-top: 14px;
}

.cost-summary-row > span {
  color: #34443c;
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 0;
}

.cost-detail-button {
  align-self: center;
}

.cost-recurring-toggle {
  align-self: center;
  justify-content: flex-start;
  min-height: var(--control-height);
}

.cost-recurring-toggle input[type="checkbox"] {
  height: 18px;
  min-height: 18px;
  width: 18px;
}

.cost-recurring-toggle span {
  color: #34443c;
  font-size: 12px;
  font-weight: 800;
}

.cost-dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  color: var(--ink);
  max-width: min(980px, calc(100vw - 32px));
  padding: 18px;
  width: 100%;
}

.cost-dialog::backdrop {
  background: rgba(15, 33, 28, 0.48);
}

.cost-dialog .panel-heading {
  margin-bottom: 14px;
}

.cost-detail-table {
  min-width: 760px;
}

.cost-detail-table.lpo-detail-table {
  min-width: 980px;
}

.cost-detail-table input {
  min-width: 0;
}

.cost-detail-table select {
  min-width: 96px;
}

.cost-detail-table .cost-qty,
.cost-detail-table .cost-unit-cost,
.cost-detail-table .cost-line-cost {
  text-align: right;
}

.result-stack output {
  display: block;
  text-align: right;
}

.split-summary {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  display: grid;
  gap: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.split-summary > div {
  display: grid;
  gap: 6px;
  min-height: 44px;
  padding: 10px 14px;
}

.split-summary > div + div {
  border-left: 1px solid var(--line);
}

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

.split-summary output {
  font-weight: 800;
  text-align: right;
}

.split-edit-summary .input-with-unit input {
  min-width: 0;
  text-align: right;
}

#regular-split-fields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#pep-split-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cost-dialog-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

.economic-simulation-table {
  margin-top: 14px;
  min-width: 100%;
  table-layout: auto;
  width: max-content;
}

.economic-simulation-table th,
.economic-simulation-table td {
  white-space: nowrap;
}

.economic-simulation-table .column-unit {
  white-space: nowrap;
}

.economic-simulation-table td:nth-child(2),
.economic-simulation-table td:nth-child(3),
.economic-simulation-table td:nth-child(4),
.economic-simulation-table td:nth-child(5),
.economic-simulation-table td:nth-child(6),
.economic-simulation-table td:nth-child(7),
.economic-simulation-table td:nth-child(8),
.economic-simulation-table td:nth-child(9) {
  text-align: right;
}

.formula-summary {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  margin-bottom: 18px;
  padding: 16px;
}

.formula-list {
  gap: 10px;
  margin-top: 12px;
}

.formula-list code {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  display: block;
  font-size: 12px;
  line-height: 1.45;
  overflow-x: auto;
  padding: 8px;
  white-space: nowrap;
}

.symbol-notes {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 5px;
  margin-top: 14px;
  padding-top: 12px;
}

.symbol-notes p {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 0;
}

.symbol-notes strong {
  color: var(--ink);
}

.result-stack dd {
  font-size: 24px;
  font-weight: 800;
}

.result-stack #profile-selected-title {
  font-size: 16px;
  line-height: 1.3;
}

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

.case-summary .data-table {
  font-size: 13px;
}

.save-profile-button {
  justify-content: center;
  margin-top: 18px;
  width: 100%;
}

.save-status {
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 0;
}

@media (max-width: 900px) {
  .section-header,
  .nav-actions,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    gap: 12px;
    padding: 10px 18px;
  }

  .topbar-title {
    font-size: 13px;
    max-width: 52vw;
  }

  .page {
    padding: 18px;
  }

  .sidebar {
    width: var(--sidebar-collapsed-width);
  }

  .sidebar-toggle:checked ~ .app-page {
    margin-left: 0;
  }

  .sidebar-toggle:checked ~ .sidebar {
    width: min(var(--sidebar-width), 84vw);
  }

  .app-page {
    margin-left: 0;
  }

  h1 {
    font-size: 28px;
  }

  .form-grid.two,
  .form-grid.three,
  .form-grid.four,
  .form-grid.six,
  .requirement-row,
  .requirement-inputs,
  .detail-layout,
  .calc-layout,
  .definition-grid {
    grid-template-columns: 1fr;
  }

  .span-two,
  .span-three {
    grid-column: auto;
  }

  #regular-split-fields,
  #pep-split-fields {
    grid-template-columns: 1fr;
  }

  .split-summary > div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .datagrid-controls,
  .datagrid-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .datagrid-search {
    max-width: none;
    width: 100%;
  }
}
