:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #eef3f1;
  --ink: #17202a;
  --muted: #62717c;
  --line: #d9e1e5;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --blue: #2563eb;
  --amber: #a15c07;
  --danger: #b42318;
  --ok: #126348;
  --shadow: 0 16px 38px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

[hidden] {
  display: none !important;
}

html.auth-pending,
body.auth-pending {
  min-height: 100%;
  background: #101820;
}

html.auth-pending :is(#appHeader, #loginOverlay, #appContainer),
body.auth-pending :is(#appHeader, #loginOverlay, #appContainer) {
  display: none !important;
}

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

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

button {
  cursor: pointer;
}


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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.2;
}

.app-header {
  position: relative;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  padding: 24px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 380px;
  flex: 1 1 420px;
}

.logo-uploader {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 259px;
  height: 72px;
  overflow: hidden;
  border: 1px dashed #b7c6cc;
  border-radius: 8px;
  background: #f8fafb;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}

.logo-uploader.has-logo {
  border-color: transparent;
  background: white;
}

.logo-uploader input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.logo-uploader img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  background: transparent;
}

.logo-uploader.has-logo img {
  padding: 0;
}

.logo-remove {
  display: none !important;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid #ffd6ce;
  border-radius: 7px;
  background: #fff5f3;
  color: var(--danger);
  font-weight: 900;
}

.scenario-brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: -8px 0 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.brand-logo-uploader {
  width: 392px;
  height: 122px;
}

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

.header-actions,
.button-row {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select,
.filters input,
.filters select,
.button-row select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #cfd9de;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.compact-field {
  width: 210px;
}

.compact-field.small {
  width: 132px;
}

.primary-button,
.ghost-button,
.icon-button,
.nav-step {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 850;
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  background: var(--accent);
  color: white;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.company-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.company-user-actions .ghost-button {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 12px;
}

.self-email-change {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-top: 14px;
}

.self-email-change .field {
  min-width: min(100%, 320px);
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.lifecycle-dialog {
  width: min(460px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
}

.lifecycle-dialog::backdrop { background: rgba(3, 11, 18, .72); }
.lifecycle-dialog-card { padding: 22px; }
.lifecycle-dialog-card h2 { margin: 0 0 10px; font-size: 18px; }
.lifecycle-dialog-card p { margin: 0 0 18px; line-height: 1.45; }

@media (max-width: 768px) {
  .self-email-change { align-items: stretch; flex-direction: column; }
  .self-email-change .field { min-width: 0; }
  .self-email-change .ghost-button { min-height: 44px; }
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  text-decoration: none;
}

.ghost-button:hover,
.nav-step:hover {
  border-color: #b9c7cc;
  background: #fbfcfc;
}

.ghost-button.danger {
  color: var(--danger);
  border-color: #ffd6ce;
}

.tool-button {
  position: relative;
  width: 38px;
  min-width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.tool-button:hover {
  background: #eef9f8;
  border-color: #b7d8d5;
}

.tool-button.primary-tool {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

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

.owner-readonly-control[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
}

.workspace-readonly-banner {
  margin: 0 0 14px;
  padding: 11px 14px;
  border: 1px solid #d79520;
  border-radius: 8px;
  background: #fff4d8;
  color: #79520c;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.tool-button.danger {
  color: var(--danger);
  border-color: #ffd6ce;
  background: #fff5f3;
}

.tool-button.danger:hover {
  background: #fff1ef;
  border-color: #ffc5bb;
}

.tool-button[aria-label="CSV indir"] {
  font-size: 11px;
  letter-spacing: 0;
}

.tool-button[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 10000;
  width: max-content;
  max-width: 160px;
  white-space: nowrap;
  padding: 6px 8px;
  border-radius: 7px;
  background: #17202a;
  color: white;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(3px);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.tool-button[data-tooltip]:hover::after,
.tool-button[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.button-row .tool-button[data-tooltip]:nth-last-child(-n + 2)::after {
  right: 0;
  left: auto;
  transform: translateY(3px);
}

.button-row .tool-button[data-tooltip]:nth-last-child(-n + 2):hover::after,
.button-row .tool-button[data-tooltip]:nth-last-child(-n + 2):focus-visible::after {
  transform: translateY(0);
}

.tool-button[data-tooltip]::after {
  display: none !important;
}

.floating-tooltip {
  position: fixed;
  z-index: 999999;
  max-width: min(260px, calc(100vw - 16px));
  padding: 7px 9px;
  border: 1px solid rgba(41, 215, 246, 0.45);
  border-radius: 8px;
  background: #07131b;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.46);
  color: #f2f8ff;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.25;
  letter-spacing: 0;
  text-align: center;
  white-space: normal;
  pointer-events: none;
}

.floating-tooltip[hidden] {
  display: none;
}

.icon-button {
  width: 32px;
  min-height: 32px;
  background: #fff5f3;
  color: var(--danger);
  border-color: #ffd6ce;
}

.toggle-button {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--line);
  font-size: 18px;
  line-height: 1;
}

.toggle-button:hover {
  background: #eef9f8;
  border-color: #b7d8d5;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(6, minmax(128px, 1fr));
  gap: 1px;
  padding: 0 32px;
  background: var(--line);
}

.metric {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 16px;
  background: var(--surface);
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.metric strong {
  font-size: clamp(18px, 2vw, 25px);
  line-height: 1.1;
}

.workspace {
  display: grid;
  grid-template-columns: 265px minmax(0, 1fr);
  gap: 22px;
  padding: 22px 32px 36px;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 9px;
  position: sticky;
  top: 16px;
}

.nav-step {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 11px;
  padding: 11px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.nav-step.active {
  border-color: #8bc9c1;
  background: var(--surface-soft);
}

.step-index {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #e2e8f0;
  color: #334155;
  font-weight: 900;
}

.nav-step.active .step-index {
  background: var(--accent);
  color: white;
}

.nav-step strong,
.nav-step small {
  display: block;
}

.nav-step small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.work-panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-strip {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status-strip.ok {
  color: var(--ok);
  background: #eefaf4;
}

.status-strip.warn {
  color: #8a5a00;
  background: #fff8e7;
}

.status-strip.error {
  color: var(--danger);
  background: #fff1ef;
}

.status-download-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #8bc9c1;
  border-radius: 7px;
  background: white;
  color: var(--accent);
  font-weight: 900;
  text-decoration: none;
}

.view {
  display: none;
  padding: 22px;
}

.view.active {
  display: block;
}

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

.control-grid,
.cards-grid,
.filters,
.output-summary,
.page-total-summary {
  display: grid;
  gap: 12px;
}

.control-grid {
  grid-template-columns: minmax(180px, 220px) minmax(180px, 1fr) minmax(180px, 220px);
  margin-bottom: 16px;
}

.cards-grid {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  margin-bottom: 10px;
}

.network-admin {
  margin-bottom: 14px;
}

.network-admin .collapsible-content {
  display: grid;
  gap: 8px;
}

.network-admin .collapsible-content[hidden] {
  display: none;
}

.compact-actions {
  justify-content: flex-end;
  margin-top: 4px;
}

.scenario-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
}

.summary-panel {
  min-width: 0;
}

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

.control-wide-panel {
  grid-column: 1 / -1;
}

.control-center-grid .table-wrap {
  max-height: 360px;
  overflow: auto;
}

.control-sku-mapping-table-wrap {
  max-height: min(52vh, 460px) !important;
  overflow: auto;
}

.control-sku-mapping-table-wrap table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.control-sku-mapping-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.control-sku-mapping-index-col,
.control-sku-mapping-row-index {
  width: 72px;
  text-align: center;
  white-space: nowrap;
}

.control-sku-mapping-row-index {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.control-sku-mapping-table-wrap th:nth-child(1) {
  width: 44px;
}

.control-sku-mapping-table-wrap th:nth-child(2) {
  width: 34%;
}

.control-sku-mapping-table-wrap th:nth-child(3) {
  width: 92px;
}

.control-sku-mapping-table-wrap th:nth-child(5) {
  width: 104px;
}

.control-sku-mapping-table-wrap th:nth-child(6) {
  width: 44px;
}

.control-sku-mapping-table-wrap th,
.control-sku-mapping-table-wrap td {
  padding-right: 6px;
  padding-left: 6px;
}

.control-sku-mapping-table-wrap td:nth-child(2),
.control-sku-mapping-table-wrap td:nth-child(3) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-sku-mapping-table-wrap .cell-input,
.control-sku-mapping-table-wrap .cell-select {
  min-width: 0;
}

.control-sku-mapping-table-wrap .control-sku-mapping-trigger {
  max-width: 100%;
}

.control-sku-mapping-table-wrap .amount {
  font-size: 12px;
}

.control-sku-mapping-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.control-sku-mapping-import-status {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.control-sku-mapping-import-status.ok {
  border-color: rgba(27, 126, 86, 0.44);
  color: var(--ok);
}

.control-sku-mapping-import-status.error {
  border-color: rgba(212, 84, 84, 0.44);
  color: var(--danger);
}

.control-center-grid td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
}

.full-flow-summary {
  margin-bottom: 10px;
}

.full-flow-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 8px;
}

.full-flow-summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.full-flow-summary-grid strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
}

.full-flow-test-table th,
.full-flow-test-table td {
  vertical-align: top;
}

.full-flow-test-table td:nth-child(3),
.full-flow-test-table td:nth-child(4),
.full-flow-test-table td:nth-child(6) {
  min-width: 180px;
}

.full-flow-test-table td:nth-child(6) {
  color: var(--muted);
}

.full-flow-table-wrap {
  max-height: 480px;
}

.control-deployment-table {
  margin-bottom: 12px;
}

.control-deployment-table caption {
  padding: 4px 0 8px;
  color: #dce6ef;
  font-weight: 900;
  text-align: left;
}

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

.panel-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
}

.network-card,
.validation-item,
.output-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.network-card {
  display: grid;
  gap: 4px;
  min-height: 88px;
  padding: 9px 11px;
}

.cards-grid > .empty-state {
  grid-column: 1 / -1;
  min-height: 88px;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  place-items: center;
  text-align: center;
}

.network-card span,
.output-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.network-card strong,
.output-summary strong {
  font-size: 18px;
}

.network-card small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.network-card > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-total-lines {
  display: grid;
  gap: 2px;
}

.brand-total-lines div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 18px;
}

.brand-total-lines span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.brand-total-lines strong {
  font-size: 13px;
  line-height: 1.1;
}

.validation-list {
  display: grid;
  gap: 8px;
}

.scenario-detail-grid > .validation-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.month-validation-list {
  margin-bottom: 14px;
}

.validation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 9px 11px;
  font-size: 12px;
  font-weight: 800;
}

.validation-item strong {
  white-space: nowrap;
}

.validation-item.ok {
  color: var(--ok);
  background: #eefaf4;
}

.validation-item.warn {
  color: var(--amber);
  background: #fff8e7;
}

.validation-item.error {
  color: var(--danger);
  background: #fff1ef;
}

.table-wrap {
  position: relative;
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.budget-chart,
.budget-comparison-chart,
canvas {
  width: 100%;
  max-width: 100%;
}

.table-wrap.tall {
  max-height: 62vh;
}

.table-wrap.compact {
  max-height: none;
}

.output-load-row td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 10px;
  background: rgba(8, 18, 28, 0.96);
}

.output-load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.output-load-more span {
  color: #9da9b8;
  font-size: 12px;
  font-weight: 850;
}

.output-load-more .ghost-button {
  min-height: 32px;
  padding: 0 12px;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.segment-summary-table {
  min-width: 0;
  table-layout: auto;
  font-size: 11px;
}

.segment-summary-table th,
.segment-summary-table td {
  height: 28px;
  padding: 5px 8px;
  text-align: center;
  overflow-wrap: anywhere;
}

.segment-summary-table .amount {
  text-align: center;
}

.summary-brands {
  white-space: normal;
}

.month-table {
  min-width: 1320px;
  table-layout: fixed;
}

.month-table th,
.month-table td {
  width: 92px;
  text-align: center;
}

.month-table th:first-child,
.month-table td:first-child {
  width: 154px;
  text-align: left;
}

.month-table th:last-child,
.month-table td:last-child {
  width: 112px;
  text-align: center;
}

.month-table .amount {
  text-align: center;
}

.month-table .month-total-row th {
  top: 0;
  background: #eefaf4;
  color: var(--ok);
}

.month-table .month-label-row th {
  top: 44px;
}

.month-table .month-share-row th {
  top: 88px;
  background: #fff8e7;
}

.month-table .cell-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  text-align: center;
}

.month-table .cell-input[type="number"] {
  text-align: center;
}

.month-share-input {
  height: 30px;
}

.calculated-month {
  background: #fbfcfc;
}

.output-table {
  min-width: 1680px;
}

.output-table .output-totals-row th {
  top: 0;
  background: #eefaf4;
  color: var(--ok);
}

.output-table .output-label-row th {
  top: 34px;
}

table[data-table-key="skus"] {
  min-width: 1480px;
}

.sku-history-status {
  display: flex;
  align-items: center;
  min-height: 34px;
  margin: 0 0 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(18, 31, 40, 0.58);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.sku-history-status.ok {
  border-color: rgba(111, 207, 80, 0.5);
  color: #8ee86f;
}

.sku-history-status.warn {
  border-color: rgba(255, 179, 0, 0.58);
  color: #ffc552;
}

.sku-history-head {
  min-width: 112px;
  padding: 6px;
  vertical-align: top;
}

.sku-history-header-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  min-width: 96px;
}

.sku-history-header-fields label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
}

.sku-history-header-fields input {
  width: 72px;
  min-width: 0;
  height: 28px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  text-align: center;
}

.sku-history-header-fields .sku-history-weight-input {
  width: 58px;
}

.sku-history-header-fields input[aria-invalid="true"] {
  border-color: #ff6868;
  box-shadow: 0 0 0 1px rgba(255, 104, 104, 0.24);
}

.sku-history-percent-symbol {
  color: var(--muted);
  font-weight: 900;
}

.sku-history-field-error {
  min-height: 12px;
  color: #ff9b9b;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  white-space: normal;
}

.sku-history-field-error:empty {
  display: none;
}

th,
td {
  height: 44px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafb;
  color: #40505c;
  font-size: 12px;
  font-weight: 900;
}

th.draggable-header {
  cursor: grab;
  user-select: none;
}

th.draggable-header:active,
tr.draggable-row:active {
  cursor: grabbing;
}

tr.draggable-row {
  cursor: grab;
}

.dragging {
  opacity: 0.45;
}

th.drop-target {
  box-shadow: inset 3px 0 0 var(--accent);
}

tr.drop-before td {
  box-shadow: inset 0 3px 0 var(--accent);
}

tr.drop-after td {
  box-shadow: inset 0 -3px 0 var(--accent);
}

td {
  color: #273642;
  font-size: 13px;
}

td.actual-month {
  background: #eefaf4;
  color: var(--ok);
  font-weight: 850;
}

tbody tr:hover {
  background: #fbfcfc;
}

.cell-input,
.cell-select {
  width: 100%;
  min-width: 92px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid #cfd9de;
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
}

.cell-input[type="number"] {
  text-align: right;
}

.control-sku-mapping-combobox {
  position: relative;
}

.control-sku-mapping-trigger {
  display: block;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-sku-mapping-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(15 118 110 / 14%);
}

.control-sku-mapping-menu {
  position: fixed;
  z-index: 80;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
  padding: 7px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 30px rgb(15 23 42 / 22%);
}

.control-sku-mapping-search {
  min-width: 0;
}

.control-sku-mapping-options {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.control-sku-mapping-option,
.control-sku-mapping-empty {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  text-align: left;
}

.control-sku-mapping-option {
  cursor: pointer;
}

.control-sku-mapping-option:last-child {
  border-bottom: 0;
}

.control-sku-mapping-option:hover,
.control-sku-mapping-option.is-active {
  background: var(--surface);
  color: var(--accent-strong);
}

.control-sku-mapping-empty {
  color: var(--muted);
}

.amount {
  font-weight: 850;
  text-align: right;
  white-space: nowrap;
}

.icon-col {
  width: 54px;
  text-align: center;
}

td.icon-col {
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  min-height: 25px;
  padding: 3px 8px;
  border: 1px solid #9cc3e4;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  background: #e8f4ff;
  color: #144e91;
}

.pill.ok {
  border-color: #177a58;
  background: #126348;
  color: #f2fff8;
}

.pill.warn {
  border-color: #d79520;
  background: #fff4d8;
  color: var(--amber);
}

.pill.error {
  border-color: #d45454;
  background: #ffe7e7;
  color: #a21e1e;
}

.filters {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  margin-bottom: 14px;
  padding: 14px;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.output-summary {
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  margin-bottom: 14px;
}

.output-summary div,
.page-total-summary div {
  display: grid;
  gap: 4px;
  padding: 14px;
}

.page-total-summary {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  margin: -4px 0 14px;
}

.page-total-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.page-total-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.page-total-summary strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
}

.budget-archive-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.budget-panel {
  min-width: 0;
}

.budget-workflow-panel {
  border-color: rgba(41, 215, 246, 0.28);
  background:
    radial-gradient(circle at 100% 0%, rgba(41, 215, 246, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(36, 45, 52, 0.98), rgba(31, 39, 45, 0.98));
}

.panel-subtitle {
  margin: 4px 0 0;
  color: #9da9b8;
  font-size: 12px;
  font-weight: 750;
}

.budget-page-heading {
  align-items: flex-start;
}

.budget-page-heading p {
  margin: 6px 0 0;
  color: #9da9b8;
  font-size: 13px;
  font-weight: 700;
}

.budget-archive-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: #dfffea;
  font-size: 12px;
  font-weight: 900;
}

.budget-archive-status::before {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #8dff3f;
  content: "";
}

.budget-compare-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin-top: -4px;
  margin-bottom: 14px;
}

#budgetApprovalView table[data-table-key="budgetArchive"] th,
#budgetApprovalView table[data-table-key="budgetArchive"] td {
  text-align: center;
  vertical-align: middle;
}

#budgetApprovalView table[data-table-key="budgetArchive"] th:first-child,
#budgetApprovalView table[data-table-key="budgetArchive"] td:first-child {
  text-align: left;
}

.budget-compare-controls select[multiple] {
  min-height: 88px;
  padding: 8px;
}

.budget-target-list {
  min-height: 88px;
  max-height: 132px;
  overflow: auto;
  border: 1px solid #314252;
  border-radius: 8px;
  background: #071420;
  color: #dfe7f0;
}

.budget-target-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border-bottom: 1px solid rgba(157, 169, 184, 0.18);
  background: #0c1b2a;
}

.budget-target-head strong {
  color: #29d7f6;
  font-size: 11px;
  white-space: nowrap;
}

.budget-target-head span {
  overflow: hidden;
  color: #8f9aaa;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-target-options {
  display: grid;
  gap: 2px;
  padding: 6px;
}

.budget-target-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 7px;
  border-radius: 7px;
  color: #e8eef6;
  cursor: pointer;
}

.budget-target-option:hover {
  background: rgba(41, 215, 246, 0.08);
}

.budget-target-option input {
  width: 16px;
  height: 16px;
  accent-color: #29d7f6;
}

.budget-target-option span {
  overflow: hidden;
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-target-option em {
  color: #9da9b8;
  font-style: normal;
  font-weight: 800;
}

.budget-target-empty {
  padding: 12px;
  color: #9da9b8;
  font-size: 12px;
  font-weight: 800;
}

#budgetsView .page-total-summary {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

#budgetComparisonSummary {
  gap: 10px;
  margin: 0 0 18px;
}

#budgetComparisonSummary div {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 12px;
  min-height: 58px;
  padding: 12px 16px;
  border: 1px solid #1d3448;
  border-radius: 7px;
  background:
    radial-gradient(circle at 100% 0%, rgba(41, 215, 246, 0.06), transparent 44%),
    linear-gradient(180deg, #0d1a28 0%, #071420 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

#budgetComparisonSummary div::before {
  content: attr(data-icon);
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(0, 200, 255, 0.09);
  color: #00c8ff;
  font-size: 19px;
  font-weight: 950;
}

#budgetComparisonSummary span,
#budgetComparisonSummary strong {
  grid-column: 2;
}

#budgetComparisonSummary span {
  color: #9da9b8;
  font-size: 11px;
  font-weight: 850;
}

#budgetComparisonSummary strong {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
  color: #f7faff;
  font-size: 20px;
  line-height: 1.1;
  white-space: nowrap;
}

#budgetComparisonSummary strong em {
  color: #9bdd2f;
  font-size: 11px;
  font-style: normal;
  font-weight: 950;
}

#budgetComparisonSummary .tone-blue strong,
#budgetComparisonSummary .tone-blue::before {
  color: #00c8ff;
}

#budgetComparisonSummary .tone-green strong,
#budgetComparisonSummary .tone-green::before {
  color: #9bdd2f;
}

#budgetComparisonSummary .tone-purple strong,
#budgetComparisonSummary .tone-purple::before {
  color: #a765ff;
}

#budgetComparisonSummary .tone-purple::before {
  background: rgba(167, 101, 255, 0.12);
}

#budgetComparisonSummary .tone-green::before {
  background: rgba(155, 221, 47, 0.12);
}

.budget-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.budget-actions .icon-button {
  width: 30px;
  min-height: 30px;
  height: 30px;
}

.budget-chart {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.budget-chart-row {
  display: grid;
  grid-template-columns: minmax(120px, 220px) minmax(170px, 1fr) minmax(360px, 520px);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.budget-chart-month {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.budget-chart-bars {
  display: grid;
  gap: 5px;
}

.budget-bar {
  display: block;
  height: 8px;
  border-radius: 999px;
}

.budget-bar.base {
  background: #29d7f6;
}

.budget-bar.target {
  background: #c8f23a;
}

.budget-chart-values {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  text-align: right;
}

.budget-chart-values strong {
  color: var(--ink);
  font-size: 13px;
}

.budget-chart-values span,
.budget-chart-values strong {
  min-width: 0;
}

.budget-chart-values span::before,
.budget-chart-values strong::before {
  content: attr(data-label);
  display: block;
  margin-bottom: 2px;
  color: #7f8b99;
  font-size: 9px;
  font-weight: 900;
}

.budget-chart-values span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.budget-split-chart {
  display: block;
}

.budget-impact-panel {
  min-width: 0;
  border: 1px solid #22384b;
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 210, 255, 0.1), transparent 30%),
    linear-gradient(180deg, #0c1b2a 0%, #061321 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 18px 38px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.budget-impact-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 6px;
}

.budget-impact-title strong {
  color: #f7faff;
  font-size: 15px;
}

.budget-impact-title span {
  color: #7e8fa2;
  font-size: 11px;
  font-weight: 900;
}

.budget-impact-legend {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, 280px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  padding: 0 18px 8px;
  font-size: 11px;
  font-weight: 900;
}

.budget-impact-legend .price-side {
  grid-column: 3;
  justify-self: center;
  color: #a765ff;
}

.budget-impact-legend .budget-side {
  grid-column: 1;
  justify-self: center;
  color: #00c8ff;
}

.budget-impact-legend .budget-side::before,
.budget-impact-legend .price-side::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 2px;
  vertical-align: -1px;
}

.budget-impact-legend .budget-side::before {
  background: #009cf5;
}

.budget-impact-legend .price-side::before {
  background: #8dff3f;
}

.budget-series-key {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px 8px;
  min-width: 0;
}

.budget-series-key span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 128px;
  overflow: hidden;
  color: #c8d5e5;
  font-size: 10px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-series-key span::before {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  content: "";
}

.budget-impact-list {
  display: grid;
  gap: 8px;
  max-height: 470px;
  overflow: auto;
  padding: 0 18px 18px;
}

.budget-impact-scale-row,
.budget-impact-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 132px minmax(280px, 1fr);
  align-items: center;
  gap: 18px;
}

.budget-impact-scale-row {
  padding: 2px 18px 8px;
}

.budget-impact-scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  color: #77889a;
  font-size: 11px;
  font-weight: 800;
}

.budget-impact-scale.left {
  text-align: left;
}

.budget-impact-scale.right {
  text-align: right;
}

.budget-impact-scale-row > span {
  color: #b5c4d6;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.budget-impact-row {
  align-items: stretch;
  min-height: calc((var(--series-count, 1) * 13px) + 8px);
}

.budget-impact-label {
  display: grid;
  place-items: center;
  min-height: 34px;
  padding: 3px 10px;
  overflow: hidden;
  border: 1px solid rgba(76, 104, 130, 0.72);
  border-radius: 5px;
  background:
    radial-gradient(circle at 50% 0%, rgba(41, 215, 246, 0.08), transparent 72%),
    rgba(8, 20, 34, 0.86);
  color: #dce8f6;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.18;
  text-align: center;
  text-overflow: ellipsis;
}

.budget-impact-track {
  position: relative;
  display: grid;
  align-items: center;
  min-height: calc((var(--series-count, 1) * 13px) + 8px);
  padding: 4px 0;
  border-inline: 1px dashed rgba(126, 143, 162, 0.34);
}

.budget-impact-track.left {
  background:
    repeating-linear-gradient(90deg, transparent 0 95px, rgba(126, 143, 162, 0.1) 95px 96px),
    linear-gradient(180deg, transparent 49%, rgba(126, 143, 162, 0.1) 50%, transparent 51%);
}

.budget-impact-track.right {
  background:
    repeating-linear-gradient(90deg, transparent 0 95px, rgba(126, 143, 162, 0.1) 95px 96px),
    linear-gradient(180deg, transparent 49%, rgba(126, 143, 162, 0.1) 50%, transparent 51%);
}

.budget-impact-track.left::after,
.budget-impact-track.right::before {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 1px;
  background: rgba(100, 129, 156, 0.75);
  content: "";
}

.budget-impact-track.left::after {
  right: 0;
}

.budget-impact-track.right::before {
  left: 0;
}

.budget-series-stack {
  display: grid;
  gap: 3px;
  width: 100%;
}

.budget-impact-bar {
  display: block;
  height: 10px;
  min-width: 0;
  border-radius: 999px;
}

.budget-impact-track.left .budget-impact-bar {
  justify-self: end;
  border-radius: 999px 0 0 999px;
}

.budget-impact-track.right .budget-impact-bar {
  justify-self: start;
  border-radius: 0 999px 999px 0;
}

.budget-impact-bar.series-0,
.budget-series-key .series-0::before {
  background: linear-gradient(90deg, #007eea, #00d2ff);
  box-shadow: 0 0 14px rgba(0, 183, 255, 0.34);
}

.budget-impact-bar.series-1,
.budget-series-key .series-1::before {
  background: linear-gradient(90deg, #79d81d, #c6ff2e);
  box-shadow: 0 0 12px rgba(146, 255, 56, 0.28);
}

.budget-impact-bar.series-2,
.budget-series-key .series-2::before {
  background: linear-gradient(90deg, #7c3cff, #be5bff);
  box-shadow: 0 0 12px rgba(166, 86, 255, 0.3);
}

.budget-impact-bar.series-3,
.budget-series-key .series-3::before {
  background: linear-gradient(90deg, #ff9b38, #ffd166);
  box-shadow: 0 0 12px rgba(255, 177, 82, 0.28);
}

.budget-impact-bar.series-4,
.budget-series-key .series-4::before {
  background: linear-gradient(90deg, #ff4f76, #ff8aa2);
  box-shadow: 0 0 12px rgba(255, 95, 130, 0.25);
}

.budget-impact-bar.series-5,
.budget-series-key .series-5::before {
  background: linear-gradient(90deg, #00b894, #40f5cc);
  box-shadow: 0 0 12px rgba(26, 230, 195, 0.24);
}

.budget-impact-bar.series-6,
.budget-series-key .series-6::before {
  background: linear-gradient(90deg, #4e7cff, #8ab0ff);
  box-shadow: 0 0 12px rgba(96, 132, 255, 0.24);
}

.budget-impact-bar.series-7,
.budget-series-key .series-7::before {
  background: linear-gradient(90deg, #d8e2f0, #ffffff);
  box-shadow: 0 0 12px rgba(220, 235, 255, 0.18);
}

.price-placeholder {
  min-height: 320px;
  display: grid;
  place-items: center;
  text-align: center;
}

.price-placeholder > div {
  max-width: 420px;
  display: grid;
  gap: 8px;
}

.price-placeholder span {
  color: #29d7f6;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.price-placeholder strong {
  color: #f7faff;
  font-size: 30px;
}

.price-placeholder p {
  margin: 0;
  color: #9da9b8;
}

.price-placeholder {
  display: none;
}

.price-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.price-wide-panel {
  grid-column: 1 / -1;
}

.price-page-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 16px;
}

.price-page-card {
  min-height: 86px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border: 1px solid #3a434c;
  border-radius: 8px;
  background: linear-gradient(145deg, #30363c 0%, #252b31 100%);
  color: #f7faff;
  text-align: left;
  cursor: pointer;
}

.price-page-card.active {
  border-color: #29d7f6;
  box-shadow:
    0 14px 26px rgba(0, 0, 0, 0.2),
    inset 0 -2px 0 #29d7f6;
}

.price-page-icon {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  color: #29d7f6;
  font-size: 22px;
  font-weight: 950;
}

.price-page-card:nth-child(2) .price-page-icon {
  color: #c8f23a;
}

.price-page-card strong,
.price-page-card small {
  display: block;
  min-width: 0;
}

.price-page-card strong {
  font-size: 16px;
}

.price-page-card small {
  margin-top: 4px;
  color: #9da9b8;
  font-size: 12px;
  font-weight: 800;
}

.price-page-section {
  display: none;
}

.price-page-section.active {
  display: block;
}

.price-budget-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(100px, 140px) minmax(260px, 1.2fr);
  gap: 12px;
  margin-bottom: 12px;
}

.price-metric-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 16px;
}

.price-metric-band > div {
  min-height: 88px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: center;
  gap: 3px 14px;
  padding: 18px 20px;
  border: 1px solid #3a434c;
  border-radius: 8px;
  background: linear-gradient(145deg, #30363c 0%, #252b31 100%);
}

.price-metric-band > div::before {
  grid-row: 1 / 3;
  width: 34px;
  height: 34px;
  display: block;
  background: #29d7f6;
  content: "";
  -webkit-mask: var(--price-icon) center / 30px 30px no-repeat;
  mask: var(--price-icon) center / 30px 30px no-repeat;
}

.price-metric-band > div:nth-child(1) {
  --price-icon: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 20 7.5v9L12 21 4 16.5v-9L12 3Z'/%3E%3Cpath d='M4.5 7.5 12 12l7.5-4.5M12 12v8.5'/%3E%3C/g%3E%3C/svg%3E");
}

.price-metric-band > div:nth-child(2) {
  --price-icon: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M4 12h16M4 17h16'/%3E%3Cpath d='M8 5v4M16 10v4M12 15v4'/%3E%3C/g%3E%3C/svg%3E");
}

.price-metric-band > div:nth-child(3) {
  --price-icon: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 17 9 12l4 4 7-9'/%3E%3Cpath d='M15 7h5v5'/%3E%3C/g%3E%3C/svg%3E");
}

.price-metric-band > div:nth-child(4) {
  --price-icon: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12h12M12 6v12'/%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3C/g%3E%3C/svg%3E");
}

.price-metric-band > div:nth-child(2)::before,
.price-metric-band > div:nth-child(4)::before {
  background: #c8f23a;
}

.price-metric-band span {
  color: #9da9b8;
  font-size: 12px;
  font-weight: 850;
}

.price-metric-band strong {
  color: #f7faff;
  font-size: 24px;
  line-height: 1.1;
}

.inline-filters {
  width: min(520px, 100%);
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 180px);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.price-month-table,
.price-rule-table,
.price-output-table {
  table-layout: fixed;
}

.price-month-table {
  min-width: 980px;
}

.price-rule-table {
  min-width: 2140px;
}

.price-rule-table th:nth-child(1),
.price-rule-table td:nth-child(1) { width: 100px; }

.price-rule-table th:nth-child(2),
.price-rule-table td:nth-child(2) { width: 100px; }

.price-rule-table th:nth-child(3),
.price-rule-table td:nth-child(3) { width: 105px; }

.price-rule-table th:nth-child(4),
.price-rule-table td:nth-child(4) { width: 175px; }

.price-rule-table th:nth-child(5),
.price-rule-table td:nth-child(5) { width: 260px; }

.price-rule-table th:nth-child(n + 6):nth-child(-n + 17),
.price-rule-table td:nth-child(n + 6):nth-child(-n + 17) { width: 112px; }

.price-rule-table th:nth-child(18),
.price-rule-table td:nth-child(18) { width: 50px; }

.price-output-table {
  min-width: 1820px;
}

.price-month-table th,
.price-month-table td,
.price-rule-table th,
.price-rule-table td,
.price-output-table th,
.price-output-table td {
  text-align: center;
  vertical-align: middle;
}

.price-output-table th:nth-child(1),
.price-output-table th:nth-child(2),
.price-output-table th:nth-child(3),
.price-output-table th:nth-child(4),
.price-output-table th:nth-child(5),
.price-output-table th:nth-child(6),
.price-output-table td:nth-child(1),
.price-output-table td:nth-child(2),
.price-output-table td:nth-child(3),
.price-output-table td:nth-child(4),
.price-output-table td:nth-child(5),
.price-output-table td:nth-child(6) {
  text-align: left;
}

.price-output-table .cell-input,
.price-rule-table .cell-input,
.price-rule-table .cell-select,
.price-month-table .cell-input {
  min-width: 82px;
}

.price-rule-table .cell-input {
  width: 100%;
  min-width: 108px;
}

@media (max-width: 1180px) {
  .price-grid {
    grid-template-columns: 1fr;
  }

  .price-page-switch,
  .price-budget-form,
  .price-metric-band {
    grid-template-columns: 1fr;
  }

  .inline-filters {
    width: 100%;
    grid-template-columns: 1fr;
  }

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

  .budget-chart-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    text-align: left;
  }

  .budget-impact-scale-row,
  .budget-impact-row {
    grid-template-columns: minmax(180px, 1fr) 118px minmax(180px, 1fr);
    gap: 10px;
  }

  .budget-impact-legend {
    grid-template-columns: minmax(0, 1fr) minmax(118px, 180px) minmax(0, 1fr);
  }
}

.toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.file-input {
  max-width: 270px;
  min-height: 38px;
}

.hidden-file-input {
  display: none;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

.checkbox-cell {
  text-align: center;
}

.checkbox-cell input {
  width: 18px;
  height: 18px;
}

/* Dashboard theme */
body {
  background: #f4f7fb;
  color: #071537;
}

main {
  min-height: calc(100vh - 178px);
  background: linear-gradient(90deg, #001b4f 0 318px, #f4f7fb 318px);
}

.app-header {
  position: relative;
  z-index: 180;
  align-items: flex-start;
  gap: 28px;
  padding: 24px 42px 62px;
  color: white;
  border-bottom: 0;
  background:
    radial-gradient(circle at 9% 10%, rgba(21, 112, 255, 0.42), transparent 32%),
    linear-gradient(135deg, #041527 0%, #003274 46%, #001943 100%);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.09);
}

.brand-area {
  min-width: 460px;
  flex: 1 1 560px;
  gap: 18px;
}

.app-header .logo-uploader {
  width: 310px;
  height: 88px;
  border-color: rgba(180, 205, 240, 0.42);
  background: rgba(255, 255, 255, 0.06);
  color: #d8e8ff;
}

.app-header .logo-uploader.has-logo,
.scenario-brand-logo .logo-uploader.has-logo {
  border-color: transparent;
  background: transparent;
}

.logo-uploader img {
  background: transparent;
}

.eyebrow {
  margin: 0;
  padding-left: 20px;
  border-left: 1px solid rgba(255, 255, 255, 0.28);
  color: #9bec32;
  font-size: 13px;
  line-height: 88px;
}

.header-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 14px;
}

.app-header .field {
  color: #f3f7ff;
}

.app-header .field input,
.app-header .field select {
  height: 44px;
  border-color: rgba(19, 42, 83, 0.22);
  background: #f7f9ff;
  color: #081532;
  box-shadow: 0 9px 18px rgba(0, 12, 36, 0.22);
}

.app-header .compact-field {
  width: 220px;
}

.app-header .compact-field.small {
  width: 150px;
}

.primary-button {
  min-height: 44px;
  padding: 0 30px;
  border-radius: 8px;
  border-color: rgba(92, 220, 47, 0.5);
  background: linear-gradient(180deg, #a3eb31 0%, #34b333 100%);
  color: white;
  box-shadow: 0 12px 22px rgba(24, 129, 41, 0.28);
}

.primary-button:hover {
  background: linear-gradient(180deg, #b1f245 0%, #289d2c 100%);
}

.summary-band {
  position: relative;
  z-index: 3;
  gap: 0;
  margin: -44px 26px 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(200, 214, 228, 0.78);
  border-radius: 12px;
  background: white;
  box-shadow: 0 18px 42px rgba(7, 21, 55, 0.16);
}

.metric {
  position: relative;
  min-height: 114px;
  grid-template-columns: 58px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  align-content: center;
  gap: 2px 16px;
  padding: 20px 24px;
  background: white;
}

.metric::before {
  grid-row: 1 / 3;
  width: 56px;
  height: 56px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #eaf2ff;
  color: #0d62f2;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.metric:nth-child(1)::before {
  content: "\25CE";
}

.metric:nth-child(2)::before {
  content: "\2659";
  background: #edf9e8;
  color: #35a813;
}

.metric:nth-child(3)::before {
  content: "\25A1";
}

.metric:nth-child(4)::before {
  content: "\2197";
  background: #edf9e8;
  color: #35a813;
}

.metric:nth-child(5)::before {
  content: "\258E";
  background: #eaf5ff;
  color: #1c79dc;
}

.metric:nth-child(6)::before {
  content: "\2713";
  background: #edf9e8;
  color: #35a813;
}

.metric:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 31px;
  right: 0;
  width: 1px;
  height: 52px;
  background: #dce5ef;
}

.metric span {
  color: #44546a;
  font-size: 12px;
  font-weight: 850;
}

.metric strong {
  color: #071537;
  font-size: 26px;
  line-height: 1.1;
}

.workspace {
  grid-template-columns: 285px minmax(0, 1fr);
  gap: 24px;
  padding: 18px 26px 34px;
  background: linear-gradient(90deg, #001b4f 0 318px, #f4f7fb 318px);
}

.side-panel {
  top: 18px;
  gap: 11px;
  padding: 0 0 0 0;
}

.nav-step {
  min-height: 62px;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 11px 12px;
  border-color: rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  background: rgba(4, 34, 82, 0.86);
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.nav-step:hover {
  border-color: rgba(149, 236, 63, 0.45);
  background: rgba(6, 44, 103, 0.96);
}

.nav-step.active {
  border-color: #8de532;
  background: linear-gradient(135deg, rgba(5, 52, 113, 0.98), rgba(2, 28, 67, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(141, 229, 50, 0.14);
}

.step-index {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(180deg, #204b91, #112a62);
  color: white;
}

.nav-step.active .step-index {
  background: linear-gradient(180deg, #98e739, #2cab36);
  color: white;
}

.nav-step small {
  color: #acc2df;
}

.nav-step.active small {
  color: #eefadd;
}

.work-panel {
  overflow: hidden;
  border-color: #d7e4ee;
  border-radius: 12px;
  background: white;
  box-shadow: 0 18px 40px rgba(18, 35, 68, 0.12);
}

.status-strip {
  min-height: 46px;
  padding: 12px 20px;
  border-bottom-color: #d7e4ee;
}

.status-strip.ok {
  color: #087242;
  background: #effaf3;
}

.view {
  padding: 22px 20px 18px;
}

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

.section-heading h2 {
  color: #071537;
  font-size: 22px;
}

#scaleTargetsBtn {
  border-color: #003994;
  background: #003da5;
  color: white;
  box-shadow: 0 8px 18px rgba(0, 57, 148, 0.2);
}

#resetBtn {
  min-width: 92px;
}

.scenario-brand-logo {
  display: grid;
  grid-template-columns: 120px minmax(280px, 392px);
  align-items: center;
  margin: -4px 0 18px;
  color: #334155;
}

.scenario-brand-logo .logo-uploader {
  background: #ffffff;
}

.control-grid {
  grid-template-columns: minmax(180px, 250px) minmax(240px, 1fr) minmax(180px, 230px);
}

.cards-grid {
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.network-card,
.validation-item,
.output-summary div,
.page-total-summary div {
  border-color: #dbe6f0;
  background: white;
}

.network-card {
  position: relative;
  min-height: 112px;
  padding: 14px 14px 12px 56px;
  box-shadow: 0 8px 20px rgba(20, 38, 72, 0.06);
}

.network-card::before {
  content: "\25CE";
  position: absolute;
  top: 15px;
  left: 15px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eaf2ff;
  color: #0d62f2;
  font-size: 16px;
  font-weight: 900;
}

.network-card:nth-child(2)::before {
  content: "\2299";
  background: #edf9e8;
  color: #35a813;
}

.network-card:nth-child(3)::before {
  content: "\21AF";
}

.network-card:nth-child(4)::before {
  content: "\25F7";
  background: #f0f5fb;
  color: #475569;
}

.network-card:nth-child(5)::before {
  content: "\2713";
  background: #edf9e8;
  color: #35a813;
}

.network-card span {
  color: #071537;
  font-size: 12px;
}

.network-card strong {
  color: #071537;
  font-size: 21px;
}

.network-card small,
.brand-total-lines span {
  color: #43546a;
}

.brand-total-lines strong {
  color: #071537;
}

.table-wrap {
  border-color: #dbe6f0;
  border-radius: 10px;
  background: white;
}

th {
  background: #00358f;
  color: white;
  border-bottom-color: #00358f;
}

td {
  border-bottom-color: #e8eef5;
}

tbody tr:hover {
  background: #f6faff;
}

.field input,
.field select,
.filters input,
.filters select,
.button-row select {
  border-color: #cfdbe7;
  box-shadow: inset 0 1px 0 rgba(6, 21, 48, 0.03);
}

.ghost-button {
  border-color: #cfdbe7;
  color: #071537;
}

.toggle-button {
  color: #1b8d2b;
  border-color: #cfe7c4;
  background: #f8fff5;
}

/* Dark control-room theme */
:root {
  --bg: #11171d;
  --surface: #191f26;
  --surface-soft: #202832;
  --ink: #f2f6fb;
  --muted: #9aa7b6;
  --line: #303943;
  --accent: #29d7f6;
  --accent-dark: #12aeca;
  --blue: #29d7f6;
  --amber: #e0a934;
  --danger: #ff6b62;
  --ok: #9bf238;
  --shadow: 0 22px 46px rgba(0, 0, 0, 0.34);
}

body {
  background: #2b3035;
  color: #f2f6fb;
}

main {
  min-height: calc(100vh - 86px);
  background:
    radial-gradient(circle at 77% 8%, rgba(41, 215, 246, 0.06), transparent 30%),
    #2b3035;
}

.app-header {
  min-height: 98px;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 0;
  padding: 0;
  border-bottom: 1px solid #3c4650;
  background:
    radial-gradient(circle at 6% 0%, rgba(41, 215, 246, 0.07), transparent 28%),
    linear-gradient(180deg, #30353a 0%, #252a2f 100%);
  color: #f6f9ff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}

.brand-area {
  flex: 0 0 285px;
  min-width: 285px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-right: 2px solid #3f4a54;
}

.app-header .logo-uploader {
  width: 242px;
  height: 74px;
  display: grid;
  place-items: center;
  border-color: transparent;
  background: transparent;
  color: #7bdff0;
}

.app-header .logo-uploader img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
  padding: 0;
}

.app-header .logo-uploader:not(.has-logo) {
  border: 1px dashed #344657;
  background: #252b31;
}

.app-header .logo-uploader.has-logo,
.scenario-brand-logo .logo-uploader.has-logo {
  border-color: transparent;
  background: transparent;
}

.header-title {
  min-width: 210px;
  flex: 1 1 280px;
  display: flex;
  align-items: center;
  padding: 0 34px;
}

.header-title h1 {
  margin: 0;
  color: #35dfff;
  font-size: 18px;
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
}

.header-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  padding: 12px 18px 12px 10px;
}

.app-header .field {
  color: #9ca8b7;
}

.app-header .field input,
.app-header .field select {
  height: 38px;
  border-color: #3c464f;
  background: #252b31;
  color: #f4f8ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.app-header .compact-field {
  width: 188px;
}

.app-header .compact-field.small {
  width: 136px;
}

.primary-button {
  min-height: 38px;
  padding: 0 26px;
  border-color: #29d7f6;
  background: linear-gradient(180deg, #35e5ff 0%, #19bfdc 100%);
  color: #061217;
  box-shadow: 0 10px 22px rgba(41, 215, 246, 0.24);
}

.primary-button:hover {
  background: linear-gradient(180deg, #6deeff 0%, #13b2cf 100%);
}

.header-utilities {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px 0 2px;
}

.utility-icon,
.utility-avatar {
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #3c464f;
  border-radius: 50%;
  background: #252b31;
  color: #dce5ef;
  font-weight: 900;
}

.utility-icon {
  padding: 0;
}

.utility-icon::before {
  font-size: 17px;
  line-height: 1;
}

.utility-bell::before {
  content: "!";
}

.utility-help::before {
  content: "?";
}

.utility-bell span {
  position: absolute;
  top: -6px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #ff4b6e;
  color: white;
  font-size: 11px;
}

.utility-avatar {
  border-color: transparent;
  color: #30def8;
}

.user-menu {
  position: absolute;
  z-index: 320;
  top: 76px;
  right: 22px;
  display: grid;
  gap: 8px;
  width: 230px;
  padding: 14px;
  border: 1px solid #3a4651;
  border-radius: 12px;
  background: #252b31;
  color: #f3f7fb;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
}

.notification-panel {
  position: absolute;
  z-index: 330;
  top: 76px;
  right: 92px;
  width: min(360px, calc(100vw - 36px));
  padding: 14px;
  border: 1px solid #3a4651;
  border-radius: 12px;
  background: #252b31;
  color: #f3f7fb;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.3);
}

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

.notification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.notification-head strong {
  font-size: 15px;
}

.notification-head span {
  color: #8dff3f;
  font-size: 12px;
  font-weight: 900;
}

.notification-list {
  display: grid;
  gap: 8px;
}

.notification-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid #3a4651;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: #f3f7fb;
  text-align: left;
}

.notification-item:hover {
  border-color: #29d7f6;
  background: rgba(41, 215, 246, 0.08);
}

.notification-item span {
  color: #29d7f6;
  font-size: 11px;
  font-weight: 950;
}

.notification-item strong {
  grid-column: 1;
  overflow: hidden;
  color: #dce5ef;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-item em {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  color: #8dff3f;
  font-size: 12px;
  font-style: normal;
  font-weight: 950;
}

.notification-item.revision span,
.notification-item.revision em {
  color: #ffc74d;
}

.notification-empty {
  padding: 16px 10px;
  color: #9aa7b5;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.user-menu[hidden] {
  display: none;
}

.user-menu span {
  color: #9aa7b5;
  font-size: 12px;
  font-weight: 800;
}

.user-menu button {
  min-height: 36px;
  border: 1px solid #3a4651;
  border-radius: 8px;
  background: transparent;
  color: #dbe5ef;
  font-weight: 850;
}

.user-menu button:hover {
  border-color: #29d7f6;
  color: #29d7f6;
}

body[data-auth="out"] {
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

body[data-auth="out"] .app-header,
body[data-auth="out"] main {
  display: none;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: block;
  overflow: hidden;
  background: #020407;
  color: #f4f8ff;
}

.login-overlay[hidden] {
  display: none;
}

.login-overlay::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(100vw, calc(100vh * 1672 / 941));
  height: min(100vh, calc(100vw * 941 / 1672));
  background: url("assets/login-bg.png") center / 100% 100% no-repeat;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.login-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(100vw, calc(100vh * 1672 / 941));
  height: min(100vh, calc(100vw * 941 / 1672));
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: translate(-50%, -50%);
}

.login-form-layer {
  position: absolute;
  inset: 0;
  margin: 0;
}

.login-form-layer[hidden],
.auth-flow-panel[hidden] {
  display: none;
}

.invitation-acceptance-panel {
  min-height: auto;
}

.invitation-acceptance-actions {
  grid-template-columns: minmax(0, 1fr);
}

.login-form-layer h2,
.login-title-line,
.login-form-layer small {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.login-field {
  position: absolute;
  display: block;
  width: 25.1%;
  height: 6.05%;
  margin: 0;
  padding: 0;
  color: transparent;
}

.login-card .user-field {
  left: 54.9%;
  top: 45.2%;
}

.login-card .password-field {
  left: 54.9%;
  top: 57.35%;
}

.login-card .login-field > span:first-child {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.login-card .login-field input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0 4.2%;
  border: 1px solid transparent;
  border-radius: 2.3% / 17%;
  background: transparent;
  color: #f7fbff;
  font-size: clamp(12px, 1.05vw, 18px);
  font-weight: 750;
  outline: none;
  caret-color: #25dfff;
  box-shadow: none;
}

.login-card .login-field input:focus {
  border-color: rgba(41, 215, 246, 0.34);
  box-shadow: inset 0 0 16px rgba(41, 215, 246, 0.08);
}

.password-control {
  position: absolute;
  inset: 0;
  display: block;
}

.login-card .password-control input {
  padding-right: 12%;
}

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 15%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
}

.password-toggle::before,
.password-toggle::after {
  display: none;
}

.login-submit.primary-button {
  position: absolute;
  left: 54.9%;
  top: 66.55%;
  width: 25.1%;
  height: 6.15%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 2.3% / 17%;
  background: transparent;
  color: transparent;
  box-shadow: none;
  cursor: pointer;
}

.login-submit.primary-button:hover,
.forgot-link:hover {
  background: rgba(255, 255, 255, 0.02);
}

.login-submit.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.forgot-link {
  position: absolute;
  left: 63.4%;
  top: 74.85%;
  width: 7.8%;
  height: 3.1%;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
}

.form-error {
  position: absolute;
  left: 54.9%;
  top: 78.4%;
  width: 25.1%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 75, 110, 0.42);
  border-radius: 8px;
  background: rgba(255, 75, 110, 0.11);
  color: #ffb8c5;
  font-size: clamp(11px, 0.9vw, 14px);
  font-weight: 850;
}

#loginError[hidden] {
  display: none !important;
}

#usersUsernameHead[hidden],
#usersPasswordHead[hidden],
#supabaseUserInviteNotice[hidden] {
  display: none !important;
}

#supabaseUserInviteNotice:not([hidden]) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 12px;
}

#supabaseUserInviteNotice strong,
#supabaseUserInviteNotice span {
  grid-column: 1;
}

#supabaseUserInviteNotice button {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.cell-static {
  display: block;
  min-width: 150px;
  padding: 8px 10px;
  overflow-wrap: anywhere;
}

@media (min-width: 993px) {
  .login-card .user-field > #loginIdentityLabel {
    position: absolute;
    top: -48%;
    left: 7.5%;
    z-index: 2;
    width: auto;
    height: auto;
    padding: 0 8px 0 0;
    overflow: visible;
    clip: auto;
    background: rgba(2, 13, 22, 0.96);
    color: #dce7ef;
    font-size: clamp(11px, 0.9vw, 15px);
    line-height: 1.2;
    white-space: nowrap;
  }
}

.login-status {
  position: absolute;
  left: 54.9%;
  top: 78.4%;
  width: 25.1%;
  color: #73edff;
  font-size: clamp(11px, 0.9vw, 14px);
  font-weight: 800;
  text-align: center;
}

.login-status:not([hidden]) + .form-error {
  top: 82.2%;
}

.login-card :is(input, button):focus-visible {
  outline: 2px solid rgba(41, 215, 246, 0.7);
  outline-offset: 2px;
}

.auth-flow-panel {
  position: absolute;
  left: 54.9%;
  top: 43.2%;
  width: 25.1%;
  min-height: 41%;
  display: grid;
  align-content: start;
  gap: 2.35%;
  padding: 1.2%;
  border: 1px solid rgba(41, 215, 246, 0.36);
  border-radius: 2.3% / 3.2%;
  background: rgba(3, 11, 18, 0.88);
  color: #f4f8ff;
  box-shadow:
    0 0 20px rgba(41, 215, 246, 0.18),
    inset 0 0 18px rgba(41, 215, 246, 0.06);
}

.auth-flow-panel h3 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(15px, 1.45vw, 24px);
  line-height: 1.1;
  font-weight: 950;
}

.auth-flow-panel p {
  margin: 0;
  color: #b9c7d5;
  font-size: clamp(10px, 0.82vw, 14px);
  line-height: 1.35;
  font-weight: 700;
}

.auth-flow-field {
  gap: 4px;
  color: #e6eef7;
  font-size: clamp(10px, 0.78vw, 13px);
  font-weight: 850;
}

.auth-flow-field input {
  height: clamp(32px, 2.8vw, 46px);
  border-color: rgba(117, 198, 220, 0.42);
  border-radius: 9px;
  background: rgba(2, 12, 20, 0.54);
  color: #f7fbff;
  font-size: clamp(12px, 1vw, 17px);
  font-weight: 800;
  caret-color: #25dfff;
}

.auth-flow-field input:focus {
  border-color: rgba(41, 215, 246, 0.72);
  outline: none;
  box-shadow: inset 0 0 16px rgba(41, 215, 246, 0.1);
}

.auth-flow-message {
  padding: 7px 9px;
  border: 1px solid rgba(41, 215, 246, 0.28);
  border-radius: 8px;
  background: rgba(41, 215, 246, 0.08);
  color: #c8f5ff;
  font-size: clamp(10px, 0.74vw, 13px);
  line-height: 1.3;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.auth-flow-message.error {
  border-color: rgba(255, 75, 110, 0.42);
  background: rgba(255, 75, 110, 0.11);
  color: #ffb8c5;
}

.auth-flow-link {
  color: #25dfff;
  font-size: clamp(10px, 0.8vw, 13px);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-flow-link.disabled {
  color: rgba(185, 199, 213, 0.58);
  cursor: not-allowed;
  pointer-events: auto;
}

.code-field input {
  text-align: center;
  letter-spacing: 0;
  font-size: clamp(15px, 1.2vw, 20px);
}

.auth-flow-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.auth-flow-panel .primary-button,
.auth-flow-panel .ghost-button {
  min-height: clamp(32px, 2.7vw, 44px);
  padding: 0 12px;
  border-radius: 9px;
}

.auth-flow-panel .primary-button {
  border: 0;
  background: linear-gradient(90deg, #24dfff 0%, #10e28c 100%);
  color: #02080c;
  box-shadow: 0 0 18px rgba(41, 215, 246, 0.22);
}

.auth-flow-panel .ghost-button {
  border-color: rgba(117, 198, 220, 0.34);
  background: rgba(2, 12, 20, 0.38);
  color: #dce7f1;
}

.users-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.user-admin-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.user-admin-form select[multiple],
table[data-table-key="users"] select[multiple] {
  min-height: 76px;
  padding: 8px;
}

.pending-invitations {
  margin: 16px 0;
}

.pending-invitations .panel-heading {
  margin-bottom: 8px;
}

.invitation-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.invitation-actions button {
  min-height: 36px;
}

.approval-actions {
  display: grid;
  align-items: end;
  gap: 10px;
}

.approval-workflow-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 14px;
}

.approval-workflow-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid #3a4651;
  border-radius: 10px;
  background: rgba(5, 18, 29, 0.42);
}

.approval-workflow-card > strong {
  display: block;
  margin-top: 4px;
  color: #f3f7fb;
  font-size: 17px;
}

.approval-workflow-card > p {
  margin: 6px 0 12px;
  color: #9da9b8;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}

.workflow-label {
  color: #29d7f6;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.access-actions {
  grid-template-columns: minmax(220px, 1fr) auto auto;
}

.review-actions {
  grid-template-columns: auto auto minmax(220px, 1fr) auto;
}

.revision-note-field textarea {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #45525e;
  border-radius: 8px;
  background: #20282f;
  color: #f3f7fb;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  resize: vertical;
}

.revision-note-field textarea:disabled {
  opacity: 0.55;
}

.check-line {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c7d2df;
  font-size: 12px;
  font-weight: 850;
}

.notice-box,
.approval-status-card {
  padding: 12px;
  border: 1px solid #3a4651;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: #c7d2df;
}

.approval-panel {
  margin-bottom: 14px;
}

.approval-status-card {
  display: grid;
  gap: 12px;
}

.approval-status-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 14px;
}

.approval-status-main > span {
  grid-column: 1 / -1;
  color: #9da9b8;
  font-size: 11px;
  font-weight: 850;
}

.approval-status-main > strong {
  color: #f3f7fb;
  font-size: 20px;
  min-width: 0;
}

.approval-status-main > em {
  padding: 5px 10px;
  border: 1px solid rgba(141, 255, 63, 0.36);
  border-radius: 999px;
  color: #8dff3f;
  font-size: 12px;
  font-style: normal;
  font-weight: 950;
}

.approval-flow-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.approval-flow-steps span {
  padding: 8px 10px;
  border: 1px solid #34424e;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: #9da9b8;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.approval-flow-steps .current {
  border-color: rgba(41, 215, 246, 0.62);
  color: #29d7f6;
}

.approval-flow-steps .done {
  border-color: rgba(141, 255, 63, 0.48);
  color: #8dff3f;
}

.approval-status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 8px;
}

.approval-status-grid span {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(58, 70, 81, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: #9da9b8;
  font-size: 11px;
  font-weight: 850;
}

.approval-status-grid strong {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: #f3f7fb;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.revision-note-box {
  padding: 10px 12px;
  border: 1px solid rgba(255, 193, 7, 0.36);
  border-radius: 8px;
  background: rgba(255, 193, 7, 0.08);
}

.revision-note-box span {
  display: block;
  color: #ffc74d;
  font-size: 11px;
  font-weight: 950;
}

.revision-note-box strong {
  display: block;
  margin-top: 4px;
  color: #f7f0d2;
  font-size: 13px;
  line-height: 1.35;
}

.shared-users {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.muted-text {
  color: #9aa7b5;
  font-size: 12px;
  font-weight: 800;
}

.workspace {
  min-height: calc(100vh - 98px);
  grid-template-columns: 216px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  padding: 20px 18px 18px 0;
  background: transparent;
}

.side-panel {
  grid-column: 1;
  grid-row: 1 / span 2;
  position: sticky;
  z-index: 30;
  top: 0;
  align-content: start;
  gap: 10px;
  min-height: calc(100vh - 116px);
  padding: 88px 16px 20px;
  border-right: 1px solid #27313a;
  border-radius: 0 12px 12px 0;
  background:
    linear-gradient(180deg, rgba(49, 55, 61, 0.94), rgba(38, 44, 50, 0.98)),
    #2a3036;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
}

.side-panel::before {
  content: "";
  display: none;
}

.module-menu-button {
  position: absolute;
  top: 28px;
  left: 22px;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  gap: 4px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #808b98;
}

.module-menu-button span {
  width: 15px;
  height: 2px;
  border-radius: 999px;
  background: #8f9aa7;
}

.module-menu-button:hover,
.module-menu-button[aria-expanded="true"] {
  border-color: #3a4651;
  background: rgba(255, 255, 255, 0.05);
}

.module-menu {
  position: absolute;
  z-index: 20;
  top: 66px;
  left: 16px;
  right: 16px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #3a4651;
  border-radius: 10px;
  background: #252b31;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.24);
}

.module-menu[hidden] {
  display: none;
}

.module-menu button {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #dbe5ef;
  font-weight: 850;
  text-align: left;
}

.module-menu button:hover,
.module-menu button.active {
  border-color: #29d7f6;
  background: rgba(41, 215, 246, 0.1);
  color: #29d7f6;
}

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

body[data-module="budgetApproval"] .forecast-nav,
body[data-module="budgetApproval"] .side-status,
body[data-module="budgetApproval"] .summary-band,
body[data-module="budgetApproval"] .status-strip,
body[data-module="budgets"] .forecast-nav,
body[data-module="budgets"] .side-status,
body[data-module="budgets"] .summary-band,
body[data-module="budgets"] .status-strip,
body[data-module="price"] .forecast-nav,
body[data-module="price"] .side-status,
body[data-module="price"] .summary-band,
body[data-module="price"] .status-strip,
body[data-module="users"] .forecast-nav,
body[data-module="users"] .side-status,
body[data-module="users"] .summary-band,
body[data-module="users"] .status-strip,
body[data-module="controls"] .forecast-nav,
body[data-module="controls"] .side-status,
body[data-module="controls"] .summary-band,
body[data-module="controls"] .status-strip {
  display: none;
}

body[data-module="budgetApproval"] .workspace,
body[data-module="budgets"] .workspace,
body[data-module="price"] .workspace,
body[data-module="users"] .workspace,
body[data-module="controls"] .workspace {
  grid-template-columns: 72px minmax(0, 1fr);
}

body[data-module="budgetApproval"] .side-panel,
body[data-module="budgets"] .side-panel,
body[data-module="price"] .side-panel,
body[data-module="users"] .side-panel,
body[data-module="controls"] .side-panel {
  min-height: calc(100vh - 116px);
  padding: 20px 14px;
}

body[data-module="budgetApproval"] .module-menu-button,
body[data-module="budgets"] .module-menu-button,
body[data-module="price"] .module-menu-button,
body[data-module="users"] .module-menu-button,
body[data-module="controls"] .module-menu-button {
  top: 20px;
  left: 19px;
}

body[data-module="budgetApproval"] .module-menu,
body[data-module="budgets"] .module-menu,
body[data-module="price"] .module-menu,
body[data-module="users"] .module-menu,
body[data-module="controls"] .module-menu {
  top: 62px;
  left: 14px;
  right: auto;
  width: 220px;
}

body[data-module="budgetApproval"] .work-panel,
body[data-module="budgets"] .work-panel,
body[data-module="price"] .work-panel,
body[data-module="users"] .work-panel,
body[data-module="controls"] .work-panel {
  grid-row: 1 / span 2;
}

.nav-step {
  min-height: 58px;
  grid-template-columns: 36px 1fr 12px;
  gap: 12px;
  padding: 9px 10px 9px 12px;
  border-color: transparent;
  border-radius: 0;
  background: transparent;
  color: #f3f7fb;
  box-shadow: none;
}

.nav-step::after {
  content: "\203A";
  color: #7b8794;
  font-size: 20px;
}

.nav-step:hover {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.04);
}

.nav-step.active {
  border-color: transparent;
  border-left: 4px solid #29d7f6;
  background: linear-gradient(90deg, rgba(41, 215, 246, 0.14), rgba(255, 255, 255, 0.03));
  box-shadow: none;
}

.step-index {
  width: 34px;
  height: 34px;
  border: 1px solid #76818e;
  border-radius: 10px;
  background: transparent;
  color: #eef5fb;
}

.nav-step.active .step-index {
  border-color: #29d7f6;
  background: rgba(41, 215, 246, 0.1);
  color: #29d7f6;
}

.nav-step small {
  color: #8e9baa;
}

.nav-step.active small {
  color: #9fabb9;
}

.side-status {
  margin-top: auto;
  padding: 16px;
  border: 1px solid #2f3944;
  border-radius: 6px;
  background: rgba(37, 43, 49, 0.92);
  color: #aab4c0;
}

.side-status > span {
  display: block;
  margin-bottom: 16px;
  color: #aeb8c4;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.status-ring {
  --side-progress: 0%;
  width: 126px;
  height: 126px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #252b31 0 52%, transparent 53%),
    conic-gradient(#35ddff 0 var(--side-progress), #3a4148 var(--side-progress) 100%);
}

.status-ring[data-status="ok"] {
  background:
    radial-gradient(circle at center, #252b31 0 52%, transparent 53%),
    conic-gradient(#8dff3f 0 var(--side-progress), #3a4148 var(--side-progress) 100%);
}

.status-ring[data-status="warn"] {
  background:
    radial-gradient(circle at center, #252b31 0 52%, transparent 53%),
    conic-gradient(#ffb82e 0 var(--side-progress), #3a4148 var(--side-progress) 100%);
}

.status-ring strong {
  grid-area: 1 / 1;
  display: block;
}

.status-ring strong {
  align-self: center;
  color: white;
  font-size: 28px;
}

.side-health-note {
  margin: -4px 0 10px;
  padding: 7px 8px;
  border: 1px solid rgba(41, 215, 246, 0.22);
  border-radius: 6px;
  background: rgba(41, 215, 246, 0.07);
  color: #cfe8ef;
  font-size: 10px;
  font-weight: 850;
  line-height: 1.35;
  text-align: center;
}

.side-health-note[data-status="ok"] {
  border-color: rgba(141, 255, 63, 0.28);
  background: rgba(141, 255, 63, 0.08);
  color: #dcffca;
}

.side-health-note[data-status="warn"] {
  border-color: rgba(255, 184, 46, 0.32);
  background: rgba(255, 184, 46, 0.09);
  color: #ffe1a3;
}

.side-health-scale {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
}

.side-health-scale div {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  color: #a5b0bd;
  font-size: 9px;
  line-height: 1.2;
}

.side-health-scale strong {
  color: #e5ecf4;
  font-size: 9px;
  font-weight: 900;
}

.side-health-scale span {
  overflow-wrap: anywhere;
}

.side-status p {
  margin: 0;
  color: #8d98a6;
  font-size: 11px;
  line-height: 1.5;
}

.side-status p strong {
  display: block;
  color: #e9eef5;
}

.summary-band {
  grid-column: 2;
  grid-row: 1;
  grid-template-columns: repeat(6, minmax(118px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.metric {
  min-height: 92px;
  grid-template-columns: 46px 1fr;
  gap: 2px 14px;
  padding: 18px 20px;
  border: 1px solid #3a434c;
  border-radius: 8px;
  background: linear-gradient(145deg, #30363c 0%, #252b31 100%);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.2);
}

.metric:first-child {
  border-bottom-color: #29d7f6;
  box-shadow:
    0 14px 26px rgba(0, 0, 0, 0.2),
    inset 0 -2px 0 #29d7f6;
}

.metric::before {
  content: "";
  width: 42px;
  height: 42px;
  border-radius: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 28px 28px;
  color: #29d7f6;
  font-size: 23px;
}

.metric:nth-child(1)::before {
  content: "";
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='8' stroke='%2329d7f6' stroke-width='2'/%3E%3Ccircle cx='12' cy='12' r='3' stroke='%2329d7f6' stroke-width='2'/%3E%3Cpath d='M12 4V2M20 12H22M12 22V20M2 12H4' stroke='%2329d7f6' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.metric:nth-child(2)::before {
  content: "";
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8ZM16 11a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM2.5 21c.7-4 3-6 5.5-6s4.8 2 5.5 6M13.5 16.5c.8-1 1.9-1.5 3.2-1.5 2.1 0 3.9 1.7 4.3 5.1' stroke='%23c8f23a' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.metric:nth-child(3)::before {
  content: "";
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 3 20 7.5v9L12 21 4 16.5v-9L12 3Z' stroke='%2329d7f6' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M4.5 7.5 12 12l7.5-4.5M12 12v8.5' stroke='%2329d7f6' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.metric:nth-child(4)::before {
  content: "";
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 17 9 12l4 4 7-9' stroke='%239aa6b5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M15 7h5v5' stroke='%239aa6b5' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.metric:nth-child(5)::before {
  content: "";
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 5h14M5 12h14M5 19h14' stroke='%23c8f23a' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M8 3v4M16 10v4M12 17v4' stroke='%23c8f23a' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.metric:nth-child(6)::before {
  content: "";
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='8' stroke='%23ff6b62' stroke-width='2'/%3E%3Cpath d='M8 12.5 11 15.5 16.5 9' stroke='%23ff6b62' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.metric:nth-child(2)::before,
.metric:nth-child(5)::before {
  color: #c8f23a;
}

.metric:nth-child(4)::before {
  background-color: transparent;
  color: #9aa6b5;
}

.metric:nth-child(6)::before {
  color: #ff6b62;
}

.metric {
  --metric-icon-color: #29d7f6;
  --metric-icon: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='7'/%3E%3Ccircle cx='12' cy='12' r='2.5'/%3E%3Cpath d='M12 2v3M12 19v3M2 12h3M19 12h3'/%3E%3C/g%3E%3C/svg%3E");
}

.metric::before {
  width: 34px;
  height: 34px;
  background: var(--metric-icon-color);
  background-image: none;
  -webkit-mask: var(--metric-icon) center / 30px 30px no-repeat;
  mask: var(--metric-icon) center / 30px 30px no-repeat;
}

.metric:nth-child(1) {
  --metric-icon: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='7'/%3E%3Ccircle cx='12' cy='12' r='2.5'/%3E%3Cpath d='M12 2v3M12 19v3M2 12h3M19 12h3'/%3E%3C/g%3E%3C/svg%3E");
  --metric-icon-color: #29d7f6;
}

.metric:nth-child(2) {
  --metric-icon: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3Ccircle cx='17' cy='8' r='3'/%3E%3Cpath d='M2.5 20c.8-4 2.8-6 5.5-6s4.7 2 5.5 6M13.5 15c.9-.7 2-1 3.2-1 2.4 0 4.2 2 4.8 6'/%3E%3C/g%3E%3C/svg%3E");
  --metric-icon-color: #c8f23a;
}

.metric:nth-child(3) {
  --metric-icon: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 20 7.5v9L12 21 4 16.5v-9L12 3Z'/%3E%3Cpath d='M4.5 7.5 12 12l7.5-4.5M12 12v8.5'/%3E%3C/g%3E%3C/svg%3E");
  --metric-icon-color: #29d7f6;
}

.metric:nth-child(4) {
  --metric-icon: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 17 9 12l4 4 7-9'/%3E%3Cpath d='M15 7h5v5'/%3E%3C/g%3E%3C/svg%3E");
  --metric-icon-color: #9aa6b5;
}

.metric:nth-child(5) {
  --metric-icon: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 5h14M5 12h14M5 19h14'/%3E%3Cpath d='M8 3v4M16 10v4M12 17v4'/%3E%3C/g%3E%3C/svg%3E");
  --metric-icon-color: #c8f23a;
}

.metric:nth-child(6) {
  --metric-icon: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M8 12.5 11 15.5 16.5 9'/%3E%3C/g%3E%3C/svg%3E");
  --metric-icon-color: #ff6b62;
}

.metric:nth-child(n)::before {
  background: var(--metric-icon-color);
  background-image: none;
}

.metric:not(:last-child)::after {
  display: none;
}

.metric span {
  color: #9da9b8;
  font-size: 12px;
}

.metric strong {
  color: #f7faff;
  font-size: 24px;
}

.work-panel {
  grid-column: 2;
  grid-row: 2;
  overflow: hidden;
  border-color: #303943;
  border-radius: 8px;
  background:
    radial-gradient(circle at 62% 0%, rgba(41, 215, 246, 0.05), transparent 34%),
    linear-gradient(180deg, #30363c 0%, #252b31 100%);
  box-shadow: var(--shadow);
}

.status-strip {
  min-height: 34px;
  padding: 14px 28px 0;
  border-bottom: 0;
  background: transparent;
  color: #b5c2cf;
}

.status-strip::before {
  content: "";
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
  background: currentColor;
}

.status-strip.ok {
  color: #9bf238;
  background: transparent;
}

.status-strip.warn {
  color: #e0a934;
  background: transparent;
}

.status-strip.error {
  color: #ff6b62;
  background: transparent;
}

.view {
  padding: 16px 28px 18px;
}

.section-heading {
  align-items: center;
  margin-bottom: 18px;
}

.section-heading h2,
.panel-heading h3 {
  color: #f3f7fb;
}

.section-heading h2 {
  font-size: 21px;
}

.scenario-brand-logo {
  grid-template-columns: 96px minmax(280px, 392px);
  color: #a8b3c0;
}

#scenarioView.view.active {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(620px, 1.15fr);
  align-items: start;
  column-gap: 28px;
  row-gap: 10px;
  padding-top: 12px;
}

#scenarioView > .section-heading {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  grid-template-areas:
    "status buttons"
    ". fields";
  align-items: center;
  justify-content: end;
  gap: 8px 12px;
  margin: 0;
}

#scenarioView > .section-heading > div:first-child,
#scenarioView .scenario-brand-logo > span,
#scenarioView .scenario-detail-grid > .validation-list {
  display: none;
}

#scenarioView > .section-heading .status-strip {
  grid-area: status;
  justify-self: start;
  min-height: 32px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

#scenarioView > .section-heading .status-strip::before {
  flex: 0 0 auto;
}

.scenario-total-field {
  align-self: end;
  justify-self: end;
  min-width: 0;
  width: 138px;
}

.scenario-budget-field {
  justify-self: end;
  min-width: 0;
  width: 238px;
}

.scenario-year-field {
  justify-self: end;
  min-width: 0;
  width: 124px;
}

.scenario-total-field input,
#scenarioView #desiredTotalInput {
  height: 38px;
  text-align: right;
  width: 100%;
  min-width: 0;
  max-width: none;
  field-sizing: auto;
}

#scenarioView > .section-heading .scenario-action-row {
  grid-area: buttons;
  justify-content: flex-end;
  flex-wrap: nowrap;
  align-self: end;
  gap: 8px;
}

.scenario-field-row {
  grid-area: fields;
  display: flex;
  justify-content: flex-end;
  align-items: end;
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.scenario-field-row .field {
  margin: 0;
}

.scenario-field-row .field span {
  white-space: nowrap;
}

#scenarioView > .section-heading .scenario-action-row .tool-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  border-radius: 9px;
  font-size: 14px;
}

#scenarioView > .section-heading .scenario-action-row #scaleTargetsBtn {
  min-width: 36px;
}

#scenarioView > .section-heading .scenario-action-row .tool-button.danger {
  border-color: rgba(255, 112, 112, 0.72);
  background: #432022;
  color: #ffd5d5;
}

#scenarioView > .section-heading .scenario-action-row .tool-button.danger:hover {
  border-color: rgba(255, 139, 139, 0.9);
  background: #54282a;
}

#scenarioView .scenario-brand-logo {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  grid-template-columns: minmax(320px, 440px);
  margin: 0;
}

#scenarioView > .network-admin,
#scenarioView > .cards-grid,
#scenarioView > .scenario-detail-grid {
  grid-column: 1 / -1;
}

.scenario-brand-logo .logo-uploader {
  border-color: transparent;
  background: transparent;
}

.control-grid {
  grid-template-columns: minmax(180px, 200px) minmax(240px, 1fr) minmax(180px, 230px);
}

#scenarioView .control-grid {
  grid-template-columns: minmax(180px, 220px);
}

.output-format-field {
  min-width: 210px;
}

.cards-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 20px;
  margin-bottom: 18px;
}

.network-card,
.validation-item,
.output-summary div,
.page-total-summary div {
  border-color: #3a434c;
  background: linear-gradient(145deg, #30363c 0%, #252b31 100%);
}

.budget-chart-row {
  border-color: #3a434c;
  background: linear-gradient(145deg, #30363c 0%, #252b31 100%);
}

.network-card {
  min-height: 118px;
  padding: 13px 18px 13px 20px;
  box-shadow: none;
}

.network-card::before {
  content: "";
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: 8px 0 0 8px;
  background: #29d7f6;
}

.network-card:nth-child(2)::before,
.network-card:nth-child(5)::before {
  background: #c8f23a;
}

.network-card:nth-child(4)::before {
  background: #ff776f;
}

.network-card > span {
  color: #29d7f6;
  font-size: 12px;
}

.network-card:nth-child(2) > span,
.network-card:nth-child(5) > span {
  color: #c8f23a;
}

.network-card:nth-child(4) > span {
  color: #ff776f;
}

.network-card strong,
.output-summary strong,
.page-total-summary strong {
  color: #f7faff;
}

.network-card small,
.brand-total-lines span,
.output-summary span,
.page-total-summary span,
.budget-chart-month,
.budget-chart-values span,
.panel-heading,
.field {
  color: #9da9b8;
}

.brand-total-lines strong {
  color: #e8eef7;
}

.budget-chart-values strong {
  color: #f7faff;
}

.field input,
.field select,
.filters input,
.filters select,
.button-row select,
.cell-input,
.cell-select,
td input,
td select {
  border-color: #444e58;
  background: #252b31;
  color: #f3f7fb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.field input:disabled,
.field select:disabled,
.cell-select:disabled,
td input:disabled {
  color: #d6dde6;
  background: #293036;
  opacity: 1;
}

.pill {
  border-color: #3f5363;
  background: #23313b;
  color: #dceeff;
}

.pill.ok {
  border-color: rgba(91, 224, 131, 0.75);
  background: #133b2b;
  color: #dfffea;
  box-shadow: inset 0 0 0 1px rgba(91, 224, 131, 0.08);
}

.pill.warn {
  border-color: rgba(224, 169, 52, 0.68);
  background: #3e321c;
  color: #ffe2a3;
}

.pill.error {
  border-color: rgba(255, 112, 112, 0.72);
  background: #432022;
  color: #ffd5d5;
}

#desiredTotalInput {
  text-align: right;
  font-weight: 900;
  width: auto;
  min-width: 96px;
  max-width: 168px;
  field-sizing: content;
}

.ghost-button,
.tool-button,
.icon-button {
  border-color: #444e58;
  background: #252b31;
  color: #e7edf5;
}

.ghost-button:hover,
.tool-button:hover,
.icon-button:hover {
  border-color: #29d7f6;
  background: #303941;
}

#scaleTargetsBtn,
.tool-button.primary-tool {
  border-color: #29d7f6;
  background: linear-gradient(180deg, #35e5ff, #16bbd9);
  color: #061217;
  box-shadow: 0 10px 22px rgba(41, 215, 246, 0.18);
}

.toggle-button {
  color: #29d7f6;
  border-color: #444e58;
  background: #252b31;
}

.table-wrap {
  border-color: #3f4851;
  border-radius: 7px;
  background: #252b31;
}

.filters {
  border-color: #454f59;
  background: #343a40;
}

.filters.inline-filters {
  border: 0;
  background: transparent;
}

table {
  color: #d9e0e9;
}

th {
  background: #343a40;
  color: #dfe7f0;
  border-bottom-color: #454f59;
}

td {
  color: #d3dae4;
  border-bottom-color: #343c44;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.025);
}

tbody tr:hover {
  background: rgba(41, 215, 246, 0.08);
}

th.draggable-header:active,
th.drop-target {
  background: #384854;
}

tr.drop-before td {
  border-top-color: #29d7f6;
}

tr.drop-after td {
  border-bottom-color: #29d7f6;
}

.month-table .month-total-row th,
.month-table .month-label-row th,
.month-table .month-share-row th,
.output-table .output-totals-row th,
.output-table .output-label-row th {
  background: #343a40;
  color: #edf4fb;
}

.month-table .month-share-row th {
  background: #363b31;
}

td.actual-month {
  background: rgba(155, 242, 56, 0.12);
}

.month-table th.actual-month,
.month-table td.actual-month {
  background: rgba(26, 82, 55, 0.72);
  color: #f1fff5;
}

.month-table th.actual-month .cell-input,
.month-table td.actual-month .cell-input,
.month-table .cell-input:disabled {
  border-color: rgba(91, 224, 131, 0.54);
  background: rgba(19, 59, 43, 0.78);
  color: #f1fff5;
  cursor: not-allowed;
  opacity: 1;
}

.actual-summary-row td {
  background: rgba(41, 215, 246, 0.06);
  color: #edf4fb;
}

.actual-detail-row td {
  background: rgba(255, 255, 255, 0.015);
}

.mapped-code {
  display: grid;
  gap: 2px;
  justify-items: center;
  line-height: 1.2;
}

.mapped-code strong {
  color: #f2f8ff;
}

.mapped-code small {
  color: #8feeff;
  font-size: 10px;
  font-weight: 800;
}

.actual-control-cell {
  white-space: nowrap;
  text-align: center;
}

.actual-control-cell > * {
  margin: 0 3px;
  vertical-align: middle;
}

.actual-month-check {
  width: 16px;
  height: 16px;
  accent-color: #29d7f6;
  cursor: pointer;
}

.actual-summary-row .icon-button {
  width: 26px;
  height: 26px;
  color: #29d7f6;
}

table[data-table-key="actuals"] th,
table[data-table-key="actuals"] td,
table[data-table-key="actuals"] .amount {
  text-align: center;
}

.actual-floor-cell {
  color: #f1fff5;
  background: rgba(19, 59, 43, 0.72);
}

.validation-item.ok {
  color: #dfffea;
  background: rgba(19, 59, 43, 0.76);
}

.validation-item.warn {
  color: #e0a934;
  background: rgba(224, 169, 52, 0.1);
}

.validation-item.error {
  color: #ff6b62;
  background: rgba(255, 107, 98, 0.1);
}

.status-download-link {
  border-color: #29d7f6;
  background: #252b31;
  color: #29d7f6;
}

@media (max-width: 1540px) and (min-width: 1181px) {
  .summary-band {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric {
    min-height: 82px;
    padding: 14px 18px;
  }
}

@media (max-width: 1180px) {
  main,
  .workspace {
    background: #2b3035;
  }

  .summary-band {
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    padding: 16px;
  }

  .side-panel {
    grid-column: 1;
    grid-row: 1;
    position: static;
    grid-template-columns: 42px minmax(0, 1fr);
    overflow-x: auto;
    padding: 12px;
    border-radius: 12px;
    min-height: auto;
    border: 1px solid #29323b;
    background: #2a3036;
  }

  .side-panel::before,
  .side-status {
    display: none;
  }

  .module-menu-button {
    position: relative;
    top: auto;
    left: auto;
    align-self: start;
  }

  .module-menu {
    top: 58px;
    left: 12px;
    right: auto;
    width: min(240px, calc(100vw - 48px));
  }

  .forecast-nav {
    grid-column: 2;
    display: grid;
    grid-template-columns: repeat(7, minmax(130px, 1fr));
    gap: 10px;
    overflow-x: auto;
  }

  .nav-step {
    min-width: 160px;
  }

  .work-panel {
    grid-column: 1;
    grid-row: 3;
  }

  body[data-module="budgets"] .work-panel,
  body[data-module="price"] .work-panel,
  body[data-module="users"] .work-panel,
  body[data-module="controls"] .work-panel {
    grid-row: 2;
  }

  body[data-module="budgets"] .workspace,
  body[data-module="price"] .workspace,
  body[data-module="users"] .workspace,
  body[data-module="controls"] .workspace {
    grid-template-columns: 1fr;
  }

  body[data-module="budgets"] .side-panel,
  body[data-module="price"] .side-panel,
  body[data-module="users"] .side-panel,
  body[data-module="controls"] .side-panel {
    grid-template-columns: 42px;
    width: 66px;
    min-height: auto;
    padding: 12px;
  }

  .control-center-grid {
    grid-template-columns: 1fr;
  }

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

  .scenario-detail-grid {
    grid-template-columns: 1fr;
  }

  #scenarioView.view.active {
    grid-template-columns: 1fr;
  }

  #scenarioView > .section-heading,
  #scenarioView .scenario-brand-logo,
  #scenarioView > .network-admin,
  #scenarioView > .cards-grid,
  #scenarioView > .scenario-detail-grid {
    grid-column: 1;
  }

  #scenarioView > .section-heading {
    grid-row: auto;
    grid-template-columns: minmax(180px, 1fr) auto;
    grid-template-areas:
      "status buttons"
      ". fields";
    justify-content: stretch;
  }

  #scenarioView .scenario-brand-logo {
    grid-row: auto;
    max-width: 440px;
  }

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

  .approval-actions {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .scenario-detail-grid > .validation-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
    padding: 0;
  }

  .brand-area {
    min-width: 0;
    flex-basis: auto;
    border-right: 0;
    border-bottom: 1px solid #2b333c;
  }

  .app-header .logo-uploader {
    width: min(242px, 100%);
    height: 74px;
  }

  .header-title,
  .header-actions,
  .header-utilities {
    padding-left: 18px;
    padding-right: 18px;
  }

  .summary-band,
  .workspace {
    padding-left: 18px;
    padding-right: 18px;
  }

  .summary-band {
    gap: 0;
    margin: 0;
    padding: 0;
  }

  .summary-band,
  .control-grid,
  .cards-grid,
  .filters,
  .output-summary,
  .page-total-summary,
  .budget-archive-grid,
  .budget-compare-controls,
  .users-grid,
  .user-admin-form,
  .approval-actions,
  .approval-workflow-grid,
  .approval-status-grid,
  .approval-flow-steps,
  .access-actions,
  .review-actions,
  .scenario-detail-grid > .validation-list {
    grid-template-columns: 1fr;
  }

  .section-heading {
    flex-direction: column;
  }

  #scenarioView.view.active {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  #scenarioView > .section-heading {
    grid-template-columns: 1fr;
    grid-template-areas:
      "status"
      "buttons"
      "fields";
    align-items: stretch;
  }

  #scenarioView > .section-heading .scenario-action-row {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .scenario-field-row {
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
  }

  .scenario-budget-field,
  .scenario-year-field,
  .scenario-total-field {
    width: 100%;
    justify-self: stretch;
  }

  #scenarioView > .section-heading .scenario-total-field,
  #scenarioView > .section-heading .scenario-total-field input,
  #desiredTotalInput {
    width: 100%;
    max-width: none;
  }

  #scenarioView .scenario-brand-logo {
    grid-template-columns: minmax(0, 1fr);
    max-width: none;
  }

  .view {
    padding: 16px;
  }

  .compact-field,
  .compact-field.small {
    width: 100%;
  }
}

/* Mobile and tablet layout */
.mobile-nav-toggle,
.mobile-nav-overlay {
  display: none;
}

html,
body {
  max-width: 100%;
}

main,
.workspace,
.work-panel,
.view,
.section-heading,
.control-grid,
.cards-grid,
.filters,
.output-summary,
.page-total-summary,
.budget-panel,
.price-wide-panel {
  min-width: 0;
  max-width: 100%;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  scrollbar-color: #71808c #20262c;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.price-rule-invalid td {
  background: color-mix(in srgb, var(--danger) 11%, transparent);
}

.price-rule-validation-row td {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  font-size: 12px;
  text-align: left;
}

.price-output-special-row td {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.price-output-special-row td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.price-special-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  vertical-align: middle;
}

@media (max-width: 1200px) {
  .summary-band {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cards-grid,
  .price-metric-band,
  .output-summary,
  .page-total-summary,
  .budget-comparison-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-grid,
  .price-budget-form,
  .budget-compare-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 992px) {
  html,
  body {
    overflow-x: hidden;
  }

  .table-wrap table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
  }

  body.mobile-nav-open {
    overflow: hidden;
    touch-action: none;
  }

  .app-header {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px 14px;
    min-width: 0;
    padding: max(10px, env(safe-area-inset-top)) 16px 12px;
  }

  .mobile-nav-toggle {
    grid-column: 1;
    grid-row: 1;
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-content: center;
    gap: 5px;
    padding: 10px;
    border: 1px solid #40505c;
    border-radius: 9px;
    background: #252b31;
  }

  .mobile-nav-toggle span {
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: #dce7ef;
  }

  .brand-area {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    flex: 0 1 auto;
  }

  .app-header .logo-uploader {
    width: min(220px, 100%);
    height: 60px;
  }

  .header-utilities {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    min-width: 0;
    padding: 0;
  }

  .header-title {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    padding: 0;
  }

  .header-title h1 {
    font-size: 19px;
    line-height: 1.2;
  }

  .mobile-nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 400;
    width: 100%;
    height: 100dvh;
    display: block;
    padding: 0;
    border: 0;
    background: rgba(3, 8, 12, 0.68);
    backdrop-filter: blur(2px);
  }

  .mobile-nav-overlay[hidden] {
    display: none;
  }

  .workspace,
  body[data-module="budgetApproval"] .workspace,
  body[data-module="budgets"] .workspace,
  body[data-module="price"] .workspace,
  body[data-module="users"] .workspace,
  body[data-module="controls"] .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 12px;
    padding: 12px;
  }

  .side-panel,
  body[data-module="budgetApproval"] .side-panel,
  body[data-module="budgets"] .side-panel,
  body[data-module="price"] .side-panel,
  body[data-module="users"] .side-panel,
  body[data-module="controls"] .side-panel {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 420;
    width: min(320px, calc(100vw - 48px));
    height: 100dvh;
    min-height: 0;
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    padding: max(72px, calc(env(safe-area-inset-top) + 60px)) 14px max(20px, env(safe-area-inset-bottom));
    border: 0;
    border-right: 1px solid #43505a;
    border-radius: 0 12px 12px 0;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    visibility: hidden;
    overscroll-behavior: contain;
  }

  body.mobile-nav-open .side-panel {
    transform: translateX(0);
    visibility: visible;
  }

  .side-panel .module-menu-button,
  body[data-module="budgetApproval"] .module-menu-button,
  body[data-module="budgets"] .module-menu-button,
  body[data-module="price"] .module-menu-button,
  body[data-module="users"] .module-menu-button,
  body[data-module="controls"] .module-menu-button {
    position: absolute;
    top: max(18px, env(safe-area-inset-top));
    left: 18px;
    width: 44px;
    height: 44px;
  }

  .module-menu,
  body[data-module="budgetApproval"] .module-menu,
  body[data-module="budgets"] .module-menu,
  body[data-module="price"] .module-menu,
  body[data-module="users"] .module-menu,
  body[data-module="controls"] .module-menu {
    position: static;
    width: 100%;
    margin-bottom: 12px;
  }

  .forecast-nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    overflow: visible;
  }

  .nav-step {
    width: 100%;
    min-width: 0;
    min-height: 54px;
  }

  .summary-band {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .work-panel,
  body[data-module="budgetApproval"] .work-panel,
  body[data-module="budgets"] .work-panel,
  body[data-module="price"] .work-panel,
  body[data-module="users"] .work-panel,
  body[data-module="controls"] .work-panel {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    overflow: hidden;
  }

  .view {
    min-width: 0;
    padding: 16px;
  }

  .button-row,
  .header-actions,
  .section-heading,
  .panel-heading {
    flex-wrap: wrap;
  }

  button,
  input,
  select,
  textarea,
  .primary-button,
  .ghost-button,
  .icon-button {
    min-height: 44px;
  }

  .field,
  .compact-field,
  .compact-field.small,
  .inline-filters,
  .output-format-field {
    min-width: 0;
    width: 100%;
  }

  .field input,
  .field select,
  .filters input,
  .filters select,
  textarea {
    width: 100%;
    max-width: 100%;
  }

  .control-grid,
  .price-budget-form,
  .budget-compare-controls,
  .user-admin-form,
  .approval-status-grid,
  .approval-workflow-grid,
  .approval-actions,
  .access-actions,
  .review-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #scenarioView.view.active {
    grid-template-columns: minmax(0, 1fr);
  }

  #scenarioView > .section-heading,
  #scenarioView .scenario-brand-logo,
  #scenarioView > .network-admin,
  #scenarioView > .cards-grid,
  #scenarioView > .scenario-detail-grid {
    grid-column: 1;
    grid-row: auto;
  }

  #scenarioView > .section-heading {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "status" "buttons" "fields";
  }

  #scenarioView > .section-heading .scenario-action-row,
  .scenario-field-row {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .scenario-field-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 10px;
  }

  .scenario-budget-field,
  .scenario-year-field,
  .scenario-total-field {
    width: 100%;
    justify-self: stretch;
  }

  .notification-panel,
  .user-menu {
    position: fixed;
    z-index: 460;
    top: max(76px, calc(env(safe-area-inset-top) + 66px));
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100dvh - 92px);
    overflow-y: auto;
  }

  :is(dialog, [role="dialog"], .modal, .popup) {
    max-width: calc(100vw - 24px);
    max-height: 90dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .budget-impact-panel {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .budget-impact-panel > * {
    min-width: 680px;
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: initial;
    align-items: center;
  }

  .control-grid,
  .price-budget-form,
  .budget-compare-controls,
  .user-admin-form,
  .approval-status-grid,
  .approval-workflow-grid,
  .approval-actions,
  .access-actions,
  .review-actions,
  .users-grid,
  .filters,
  .inline-filters {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary-band,
  .cards-grid,
  .price-metric-band,
  .output-summary,
  .page-total-summary,
  .budget-comparison-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scenario-field-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .section-heading,
  .panel-heading {
    align-items: stretch;
    gap: 12px;
  }

  .button-row > :not(.tool-button):not(.icon-button),
  .auth-flow-actions > button {
    width: 100%;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  body[data-auth="out"] {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  .login-overlay {
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    display: grid;
    place-items: center;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  }

  .login-overlay::before {
    inset: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: 24% center;
    opacity: 0.42;
    transform: none;
  }

  .login-overlay::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(1, 6, 10, 0.52);
    pointer-events: none;
  }

  .login-card {
    position: relative;
    z-index: 1;
    left: auto;
    top: auto;
    width: min(100%, 440px);
    height: auto;
    min-height: 0;
    padding: 24px;
    border: 1px solid rgba(41, 215, 246, 0.44);
    border-radius: 14px;
    background: rgba(3, 11, 18, 0.93);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.48);
    transform: none;
  }

  .login-form-layer,
  .auth-flow-panel {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: 0;
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .login-form-layer h2,
  .login-title-line,
  .login-form-layer small {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .login-form-layer h2 {
    color: #fff;
    font-size: 28px;
  }

  .login-title-line {
    height: 2px;
    background: linear-gradient(90deg, #24dfff, #10e28c);
  }

  .login-form-layer small {
    color: #8795a3;
  }

  .login-field,
  .login-card .user-field,
  .login-card .password-field,
  .login-submit.primary-button,
  .forgot-link,
  .login-status,
  .form-error {
    position: static;
    width: 100%;
    height: auto;
    min-height: 0;
  }

  .login-status {
    text-align: left;
  }

  .login-status:not([hidden]) + .form-error {
    top: auto;
  }

  .login-field {
    display: grid;
    gap: 6px;
    color: #dce7ef;
  }

  .login-card .login-field > span:first-child {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    color: #dce7ef;
    white-space: normal;
  }

  .login-card .login-field input,
  .password-control {
    position: relative;
    inset: auto;
    width: 100%;
    height: 48px;
  }

  .login-card .login-field input {
    padding: 0 14px;
    border: 1px solid rgba(117, 198, 220, 0.42);
    border-radius: 9px;
    background: rgba(2, 12, 20, 0.68);
    font-size: 16px;
  }

  .password-toggle {
    width: 48px;
    height: 48px;
    min-height: 48px;
    color: #b9c7d5;
  }

  .password-toggle::before {
    content: "◉";
    display: block;
    color: #b9c7d5;
    font-size: 17px;
  }

  .login-submit.primary-button {
    min-height: 48px;
    border-radius: 9px;
    background: linear-gradient(90deg, #24dfff, #10e28c);
    color: #02080c;
    font-weight: 900;
  }

  .forgot-link {
    min-height: 44px;
    color: #25dfff;
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .form-error {
    padding: 10px 12px;
    font-size: 13px;
  }

  .auth-flow-panel {
    border-radius: 0;
  }

  .auth-flow-panel h3 {
    font-size: 24px;
  }

  .auth-flow-panel p,
  .auth-flow-field,
  .auth-flow-message,
  .auth-flow-link {
    font-size: 13px;
  }

  .auth-flow-field input {
    height: 48px;
    font-size: 16px;
  }

  .auth-flow-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 480px) {
  .app-header {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    padding-right: 10px;
    padding-left: 10px;
  }

  .app-header .logo-uploader {
    width: min(154px, 100%);
    height: 52px;
  }

  .header-utilities {
    gap: 4px;
  }

  .header-utilities .utility-help {
    display: none;
  }

  .utility-icon,
  .utility-avatar {
    width: 44px;
    height: 44px;
  }

  .workspace {
    padding: 10px;
  }

  .summary-band,
  .cards-grid,
  .price-metric-band,
  .output-summary,
  .page-total-summary,
  .budget-comparison-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric {
    min-height: 76px;
    padding: 12px 14px;
  }

  .view {
    padding: 14px 12px;
  }

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

  .button-row {
    align-items: stretch;
  }

  .button-row > button:not(.tool-button):not(.icon-button) {
    flex: 1 1 100%;
  }

  .login-card {
    padding: 20px 16px;
  }
}

@media (max-width: 768px) and (max-height: 520px) and (orientation: landscape) {
  .login-overlay {
    place-items: start center;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .login-card {
    width: min(94vw, 620px);
    padding: 14px 18px;
  }

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

  .login-form-layer h2,
  .login-title-line,
  .login-form-layer .form-error,
  .login-form-layer small {
    grid-column: 1 / -1;
  }

  .login-submit.primary-button,
  .forgot-link {
    align-self: end;
  }
}

/* Persistent header logo */
.brand-area {
  position: relative;
}

.logo-change-button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid #465560;
  border-radius: 8px;
  background: rgba(37, 43, 49, 0.92);
  color: #35dfff;
  font-size: 16px;
  font-weight: 900;
}

.logo-change-button:hover,
.logo-change-button:focus-visible {
  border-color: #35dfff;
  background: #303941;
}

.segment-scroll-hint {
  display: none;
}

@media (max-width: 992px) {
  .side-panel[data-menu-type="modules"] .forecast-nav {
    display: none !important;
  }

  .side-panel[data-menu-type="forecast"] .module-menu {
    display: none !important;
  }

  .segment-summary-wrap {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .segment-summary-table {
    width: max(100%, var(--segment-summary-min-width, 1128px));
    min-width: var(--segment-summary-min-width, 1128px);
    table-layout: auto;
  }

  .segment-summary-table th,
  .segment-summary-table td {
    height: 32px;
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
  }

  .segment-summary-table .segment-group-col {
    width: 110px;
    min-width: 110px;
  }

  .segment-summary-table .segment-tech-col {
    width: 260px;
    min-width: 260px;
    text-align: left;
  }

  .segment-summary-table .segment-network-col {
    width: 132px;
    min-width: 132px;
  }

  .segment-summary-table .segment-total-col {
    width: 130px;
    min-width: 130px;
  }

  .segment-summary-table .segment-sku-col {
    width: 100px;
    min-width: 100px;
  }

  .segment-summary-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
  }

  .segment-scroll-hint {
    display: block;
    margin-top: 6px;
    color: #91a0ae;
    font-size: 10px;
    font-weight: 750;
    text-align: right;
  }
}
/* Authenticated company and department context selectors */
.context-controls {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  margin-left: auto;
}

.context-selector {
  position: relative;
  display: grid;
  gap: 5px;
  width: min(270px, 26vw);
  min-width: 210px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.context-selector[hidden],
.context-native-select {
  display: none !important;
}

.context-selector-label {
  padding-left: 3px;
  line-height: 1;
}

.context-selector-trigger,
.context-selector-option {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 56px;
  color: var(--ink);
  text-align: left;
}

.context-selector-trigger {
  gap: 10px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgb(15 118 110 / 9%);
}

.context-selector-trigger:hover:not(:disabled),
.context-selector-trigger:focus-visible,
.context-selector-option:hover:not(:disabled),
.context-selector-option:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgb(15 118 110 / 14%);
}

.context-selector-trigger:disabled {
  cursor: default;
  opacity: 0.88;
}

.context-selector-trigger-content {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.context-selector-chevron {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.context-selector-trigger[aria-expanded="true"] .context-selector-chevron {
  transform: rotate(225deg) translate(-2px, -2px);
}

.context-selector-avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.context-selector-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--surface);
}

.department-avatar svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.context-selector-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 0 9px;
  flex: 1;
}

.context-selector-copy strong,
.context-selector-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-selector-copy strong {
  font-size: 13px;
  line-height: 1.2;
}

.context-selector-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.context-selector-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 130;
  display: grid;
  gap: 5px;
  width: max(100%, 300px);
  max-width: min(420px, calc(100vw - 24px));
  max-height: min(440px, calc(100dvh - 110px));
  padding: 8px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 20px 46px rgb(11 25 34 / 25%);
  overscroll-behavior: contain;
}

.context-selector-option {
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
}

.context-selector-option.is-selected {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.context-selector-option:disabled {
  cursor: wait;
  opacity: 0.68;
}

.context-selector-check {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  color: var(--accent);
  font-size: 20px;
  font-weight: 900;
}

.context-selector-loading {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: context-selector-spin 700ms linear infinite;
}

.context-selector-admin {
  display: flex;
  gap: 8px;
  padding: 8px 4px 2px;
  border-top: 1px solid var(--line);
}

.context-selector-admin button {
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 11px;
  font-weight: 850;
}

@keyframes context-selector-spin {
  to { transform: rotate(360deg); }
}

.company-selection-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
  overflow-y: auto;
  background: #101820;
}

.company-selection-overlay[hidden] {
  display: none !important;
}

.company-selection-panel {
  width: min(560px, calc(100vw - 32px));
  max-height: 90dvh;
  padding: 28px;
  overflow-y: auto;
  border: 1px solid #3b4b57;
  border-radius: 16px;
  background: #202b33;
  color: #eef4f7;
  box-shadow: 0 20px 56px rgb(0 0 0 / 35%);
}

.company-selection-panel h2 {
  margin: 6px 0 8px;
  font-size: 24px;
}

.company-selection-panel p {
  margin: 0 0 20px;
  color: #b3c0c9;
  line-height: 1.5;
}

.company-selection-kicker {
  color: #23d6f2;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.company-selection-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.initial-company-option {
  min-height: 64px;
  border-color: #455662;
  background: #17232c;
  color: #f4f8fa;
}

.initial-company-option .context-selector-avatar img {
  background: #17232c;
}

.initial-company-option .context-selector-copy small {
  color: #91a1ad;
}

@media (max-width: 992px) {
  .context-controls {
    grid-column: 1 / -1;
    grid-row: 3;
    order: 4;
    width: 100%;
  }

  .context-selector {
    width: 100%;
    min-width: 0;
    flex: 1 1 280px;
  }
}

@media (max-width: 480px) {
  body.context-selector-open {
    overflow: hidden;
  }

  .context-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .context-selector-menu {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    max-width: none;
    max-height: min(70dvh, 520px);
    border-radius: 16px;
  }

  .company-selection-overlay {
    align-items: start;
    padding: 16px;
  }

  .company-selection-panel {
    margin-top: max(16px, env(safe-area-inset-top));
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .context-selector-chevron,
  .context-selector-loading {
    transition: none;
    animation-duration: 1ms;
  }
}
