:root {
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #eef3f2;
  --ink: #20242a;
  --muted: #66727d;
  --line: #dfe6e8;
  --brand: #0f8b8d;
  --brand-dark: #0b5f61;
  --accent: #f25c54;
  --gold: #f2b84b;
  --green: #4f8a5b;
  --charcoal: #182120;
  --shadow: 0 14px 36px rgba(22, 32, 35, 0.08);
  --radius: 8px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-width: 320px;
}

body:not(.authenticated) .app-shell {
  display: none;
}

body.authenticated .login-screen {
  display: none;
}

body:not(.password-required) .password-screen {
  display: none;
}

body.password-required .login-screen,
body.password-required .app-shell {
  display: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  min-height: 100vh;
  background: #e9efef;
  display: grid;
  place-items: center;
  padding: 24px;
}

.password-screen {
  min-height: 100vh;
  background: #e9efef;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(1040px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.login-intro {
  background: var(--charcoal);
  color: #f6fbfa;
  padding: 34px;
  display: grid;
  align-content: space-between;
  gap: 30px;
}

.login-brand {
  padding: 0;
}

.login-intro h1 {
  max-width: 520px;
  font-size: 34px;
}

.login-copy {
  max-width: 520px;
  margin: 14px 0 0;
  color: #b9c7c4;
  line-height: 1.7;
}

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

.login-metrics div {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
}

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

.login-metrics strong {
  font-size: 28px;
}

.login-metrics span {
  color: #b9c7c4;
  font-size: 12px;
  margin-top: 4px;
}

.login-card {
  padding: 42px;
  display: grid;
  align-content: center;
  gap: 16px;
}

.password-card {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 32px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

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

.password-card label,
.modal-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.password-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.login-card input,
.login-card select,
.login-button,
.password-card input {
  min-height: 44px;
}

.login-button {
  margin-top: 4px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  background: var(--charcoal);
  color: #f6fbfa;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 10px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #f2b84b;
  color: #182120;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #9eb0ad;
  font-size: 12px;
  margin-top: 3px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  border: 0;
  color: #d7e2e0;
  background: transparent;
  min-height: 44px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.nav-item.is-hidden {
  display: none !important;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 16px;
  color: #aebfbc;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

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

h1 {
  font-size: 28px;
  line-height: 1.2;
  margin: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
  margin: 0;
}

h3 {
  font-size: 15px;
  margin: 0;
}

.topbar-controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.preview-banner {
  border: 1px solid rgba(10, 118, 122, 0.18);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: #f1f8f8;
  padding: 12px;
  margin: -8px 0 18px;
  display: grid;
  gap: 10px;
}

.preview-banner[hidden] {
  display: none;
}

.preview-banner-head,
.preview-banner-actions,
.permission-badges,
.account-filter-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.preview-banner-head {
  justify-content: space-between;
}

.preview-banner strong {
  font-size: 14px;
}

.user-chip {
  min-height: 38px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 4px 10px 4px 4px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 900;
}

.user-chip strong,
.user-chip small {
  display: block;
  line-height: 1.15;
}

.user-chip strong {
  font-size: 13px;
}

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

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

.view-account-control select {
  min-width: 210px;
}

.account-filter-toolbar {
  justify-content: flex-end;
}

.account-filter-toolbar input,
.account-filter-toolbar select {
  min-width: 118px;
  min-height: 34px;
}

.account-filter-toolbar input {
  min-width: 150px;
}

select,
input {
  border: 1px solid var(--line);
  background: #fff;
  min-height: 38px;
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  min-width: 128px;
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

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

.icon-button,
.ghost-button,
.primary-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
}

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

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

.ghost-button {
  color: var(--brand-dark);
  font-weight: 700;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.kpi-card,
.panel,
.approval-column {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.kpi-card {
  padding: 16px;
  min-height: 126px;
  display: grid;
  align-content: space-between;
  gap: 12px;
}

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

.kpi-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}

.kpi-sub {
  color: var(--muted);
  font-size: 12px;
}

.trend {
  min-width: 56px;
  min-height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.trend.good {
  background: rgba(79, 138, 91, 0.14);
  color: var(--green);
}

.trend.warn {
  background: rgba(242, 184, 75, 0.18);
  color: #8b5d00;
}

.trend.bad {
  background: rgba(242, 92, 84, 0.14);
  color: #ad2f2a;
}

.content-grid {
  display: grid;
  gap: 18px;
}

.two-columns {
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
}

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

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

.execution-toolbar {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-control {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.mini-control select {
  min-width: 128px;
  min-height: 34px;
}

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

.import-strip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.import-strip strong {
  display: block;
  font-size: 14px;
}

.import-strip p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.file-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 36px;
  padding: 0 12px;
  background: #fff;
  color: var(--brand-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.file-button input {
  display: none;
}

.file-trigger {
  cursor: pointer;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(15, 139, 141, 0.12);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.neutral {
  background: var(--surface-2);
  color: #4e5b62;
}

.status-pill.warning {
  background: rgba(242, 184, 75, 0.18);
  color: #875600;
}

.status-pill.bad {
  background: rgba(242, 92, 84, 0.14);
  color: #a82e28;
}

.status-pill.good {
  background: rgba(79, 138, 91, 0.14);
  color: var(--green);
}

.permission-badges {
  gap: 6px;
}

.permission-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef3f3;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.permission-badge.good {
  background: #e7f2eb;
  color: #2d6a3d;
}

.permission-badge.warning {
  background: #fff3dc;
  color: #9a6500;
}

.permission-badge.bad {
  background: #fde7e7;
  color: #b83232;
}

.progress-stack {
  display: grid;
  gap: 14px;
}

.progress-row {
  display: grid;
  gap: 8px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.progress-track {
  height: 11px;
  background: #edf1f2;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: var(--value);
  background: var(--brand);
  border-radius: 999px;
}

.progress-fill.warn {
  background: var(--gold);
}

.progress-fill.bad {
  background: var(--accent);
}

.alert-list,
.ranking-list,
.risk-list,
.template-list,
.bar-list,
.cash-grid,
.cost-grid {
  display: grid;
  gap: 10px;
}

.alert-item,
.rank-item,
.risk-item,
.template-item,
.cash-item,
.cost-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.alert-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.alert-item p,
.rank-item p,
.risk-item p,
.template-item p,
.cash-item p,
.cost-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.bar-item {
  display: grid;
  gap: 7px;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

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

.source-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.source-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.source-card strong {
  display: block;
  font-size: 13px;
}

.source-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.cash-item strong,
.cost-item strong {
  display: block;
  font-size: 22px;
  line-height: 1.2;
}

.entry-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  align-items: end;
}

#adjustmentForm {
  margin-bottom: 20px;
}

.entry-form label,
.permission-editor label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.entry-form .wide {
  grid-column: span 2;
}

.entry-form.annual-entry-form {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px 12px;
  margin: 10px 0 14px;
}

.annual-entry-form label,
.annual-entry-form input,
.annual-entry-form select {
  min-width: 0;
  width: 100%;
}

.annual-entry-form .wide {
  grid-column: auto;
}

@media (max-width: 900px) {
  .entry-form.annual-entry-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .entry-form.annual-entry-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.permission-editor {
  display: grid;
  grid-template-columns: minmax(160px, 0.4fr) minmax(200px, 0.6fr);
  gap: 14px;
  align-items: end;
}

.permission-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.permission-grid label {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.permission-grid input {
  min-width: 0;
  min-height: 0;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.planning-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.planning-list {
  max-height: 380px;
  overflow: auto;
}

.planning-months {
  margin-top: 5px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.planning-months summary {
  cursor: pointer;
  color: var(--brand);
}

.planning-approval-grid {
  display: grid;
  gap: 28px;
}

.planning-chart {
  max-height: 600px;
  overflow: auto;
}

.planning-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
}

.planning-chart-legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  background: #95a6ac;
}
.planning-chart-legend span:nth-child(2)::before { background: #147f83; }
.planning-chart-legend span:nth-child(3)::before { background: #d49b39; }

.planning-chart-row {
  display: grid;
  grid-template-columns: minmax(100px, 180px) minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.planning-chart-line {
  display: grid;
  grid-template-columns: 100px minmax(80px, 1fr) minmax(110px, auto);
  gap: 8px;
  align-items: center;
  font-size: 12px;
  margin: 5px 0;
}

.planning-chart-track {
  height: 10px;
  background: #edf1f1;
  border-radius: 5px;
  overflow: hidden;
}

.planning-chart-track i { display: block; height: 100%; }
.planning-chart-track .annual { background: #95a6ac; }
.planning-chart-track .monthly { background: #147f83; }
.planning-chart-track .actual { background: #d49b39; }

@media (max-width: 700px) {
  .planning-chart-row { grid-template-columns: 1fr; }
  .planning-chart-line { grid-template-columns: 92px minmax(45px, 1fr) minmax(90px, auto); }
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 11px 10px;
  font-size: 13px;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:hover {
  background: #f7faf9;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 8px;
}

.segment {
  border: 0;
  border-radius: 6px;
  min-height: 30px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.segment.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(22, 32, 35, 0.08);
}

.approval-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
}

.approval-column {
  min-width: 0;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.approval-column h2 {
  font-size: 15px;
}

.approval-column-tools {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.approval-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 10px;
  background: #fff;
}

.approval-card strong {
  display: block;
}

.approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.small-button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  min-height: 32px;
  padding: 0 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

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

.small-button.danger {
  border-color: rgba(242, 92, 84, 0.4);
  color: #a82e28;
  background: rgba(242, 92, 84, 0.08);
}

.small-button:disabled,
.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.execution-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

[data-feu-only][hidden] {
  display: none !important;
}

.compact-summary {
  margin-bottom: 14px;
}

.summary-card {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  display: grid;
  align-content: center;
  gap: 3px;
  background: #fff;
}

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

.summary-card span,
.summary-card small {
  color: var(--muted);
  font-weight: 800;
}

.status-action-cell {
  display: grid;
  gap: 8px;
  align-content: center;
  justify-items: start;
  min-width: 96px;
}

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

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 18px;
  align-items: start;
}

.chart-block {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.chart-block-wide {
  grid-row: span 2;
}

.chart-title-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.chart-title-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.chart-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  width: 18px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.legend-budget {
  background: #cad4d8;
}

.legend-adjusted,
.compare-bar.adjusted {
  background: #557fba;
}

.legend-actual {
  background: var(--brand);
}

.compare-chart,
.completion-matrix,
.variance-driver-chart {
  display: grid;
  gap: 10px;
}

.completion-matrix {
  overflow-x: auto;
}

.compare-row {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.compare-label {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.compare-label strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.compare-bar-line {
  min-height: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 8px;
  align-items: center;
}

.compare-bar-line em,
.variance-chart-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  text-align: right;
}

.compare-bar {
  width: var(--value);
  height: 12px;
  border-radius: 999px;
  display: block;
  background: #cad4d8;
}

.compare-bar.actual {
  background: var(--brand);
}

.compare-bar.actual.warn {
  background: var(--gold);
}

.compare-bar.actual.bad {
  background: var(--accent);
}

.matrix-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) repeat(4, minmax(76px, 1fr));
  min-width: 430px;
  gap: 8px;
  align-items: center;
}

.matrix-row strong,
.matrix-head span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.matrix-cell {
  min-height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  background: var(--surface-2);
  color: #4e5b62;
}

.matrix-cell.good {
  background: rgba(79, 138, 91, 0.14);
  color: var(--green);
}

.matrix-cell.warn {
  background: rgba(242, 184, 75, 0.18);
  color: #875600;
}

.matrix-cell.bad {
  background: rgba(242, 92, 84, 0.14);
  color: #a82e28;
}

.variance-axis {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.variance-chart-row {
  display: grid;
  grid-template-columns: minmax(96px, 128px) minmax(0, 1fr) 64px;
  gap: 8px;
  align-items: center;
}

.variance-chart-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.variance-track {
  position: relative;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f3e4e2 0 50%, #e6f0ec 50% 100%);
  overflow: hidden;
}

.variance-zero {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: rgba(24, 33, 32, 0.45);
}

.variance-bar {
  position: absolute;
  top: 3px;
  left: var(--left);
  width: var(--width);
  height: 10px;
  border-radius: 999px;
}

.variance-bar.positive {
  background: var(--green);
}

.variance-bar.negative {
  background: var(--accent);
}

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

.negative-text {
  color: #a82e28 !important;
}

.summary-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.summary-tile span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-tile strong {
  display: block;
  margin-top: 7px;
  font-size: 22px;
}

.reason-input {
  min-width: 210px;
  width: 100%;
}

.table-input {
  min-width: 92px;
  width: 100%;
}

.table-select {
  min-width: 108px;
  width: 100%;
  min-height: 34px;
}

.money-input {
  min-width: 118px;
}

.auto-amount {
  display: inline-flex;
  align-items: center;
  min-width: 118px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 6px;
  background: #eef4f3;
  color: #1f2933;
  font-weight: 800;
  white-space: nowrap;
}

.rank-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.rank-bar {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #edf1f2;
  margin-top: 8px;
}

.rank-bar span {
  display: block;
  height: 100%;
  width: var(--value);
  background: var(--green);
}

.risk-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.template-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.template-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  color: var(--brand-dark);
}

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

.flow-list div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  font-weight: 700;
}

.flow-list span {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  min-height: 42px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 0 16px;
  border-radius: 8px;
  background: var(--charcoal);
  color: #fff;
  display: flex;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  box-shadow: 0 14px 36px rgba(22, 32, 35, 0.18);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(24, 33, 32, 0.36);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 52px rgba(22, 32, 35, 0.18);
  padding: 18px;
  display: grid;
  gap: 14px;
}

.modal-card .panel-head {
  margin-bottom: 2px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: #fff;
}

.trial-steps {
  display: grid;
  gap: 10px;
}

.trial-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.trial-step.done {
  border-color: rgba(79, 138, 91, 0.28);
  background: #fbfdfb;
}

.trial-step.doing {
  border-color: rgba(242, 184, 75, 0.38);
  background: #fffdf8;
}

.step-index {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--brand-dark);
  font-weight: 900;
}

.step-body {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.step-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.step-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

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

.gap-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 12px;
  align-content: space-between;
}

.gap-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 1120px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-intro {
    min-height: 360px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 12px;
  }

  .brand,
  .sidebar-footer {
    display: none;
  }

  .nav-list {
    grid-auto-flow: column;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    grid-template-columns: 20px auto;
    white-space: nowrap;
  }

  .kpi-grid,
  .two-columns,
  .approval-board,
  .chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-block-wide {
    grid-column: 1 / -1;
    grid-row: auto;
  }

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

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

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

@media (max-width: 720px) {
  .login-screen {
    padding: 14px;
  }

  .login-intro,
  .login-card {
    padding: 22px;
  }

  .login-intro h1 {
    font-size: 26px;
  }

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

  .main {
    padding: 16px;
  }

  .topbar {
    display: grid;
  }

  .topbar-controls {
    justify-content: start;
  }

  .execution-toolbar {
    justify-content: start;
  }

  .kpi-grid,
  .two-columns,
  .approval-board,
  .entry-form,
  .permission-editor,
  .permission-grid,
  .execution-summary,
  .chart-grid,
  .cash-grid,
  .cost-grid,
  .gap-grid,
  .source-grid {
    grid-template-columns: 1fr;
  }

  .chart-block-wide {
    grid-column: auto;
  }

  .chart-title-row,
  .compare-row,
  .import-strip {
    display: grid;
  }

  .import-strip {
    justify-content: stretch;
  }

  .file-button {
    width: 100%;
  }

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

  .matrix-row {
    grid-template-columns: minmax(96px, 1fr) repeat(4, minmax(76px, 1fr));
  }

  .variance-chart-row {
    grid-template-columns: 1fr 74px;
  }

  .variance-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .trial-step {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .trial-step .small-button {
    grid-column: 2;
    justify-self: start;
  }

  .entry-form .wide {
    grid-column: auto;
  }

  h1 {
    font-size: 24px;
  }
}
