:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --ink: #17212f;
  --muted: #687386;
  --line: #dbe2ea;
  --sidebar: #111827;
  --sidebar-soft: #1f2937;
  --accent: #0f8f72;
  --accent-2: #1f6feb;
  --green: #0e9f6e;
  --yellow: #c88719;
  --red: #d92d20;
  --blue: #2563eb;
  --cyan: #0891b2;
  --shadow: 0 20px 55px rgba(23, 33, 47, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: block;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  height: auto;
  min-height: 68px;
  padding: 12px 28px;
  color: #f9fafb;
  background: var(--sidebar);
  box-shadow: 0 12px 35px rgba(17, 24, 39, 0.18);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.brand-name {
  font-size: 18px;
  font-weight: 760;
}

.brand-caption {
  color: #aab3c2;
  font-size: 12px;
}

.nav-list {
  display: flex;
  flex: 1 1 auto;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-item {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.nav-item:hover,
.nav-item.is-active {
  border-color: rgba(255, 255, 255, 0.08);
  background: var(--sidebar-soft);
  color: #ffffff;
}

.pipeline-box {
  display: none;
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.pipeline-title {
  margin-bottom: 14px;
  font-size: 13px;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0;
}

.pipeline-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pipeline-step span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: rgba(15, 143, 114, 0.18);
  color: #6ee7c8;
  font-size: 12px;
  font-weight: 700;
}

.pipeline-step p {
  margin: 1px 0 0;
  color: #e5e7eb;
  font-size: 13px;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

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

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

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

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

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

select,
input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

select:focus,
input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: 19px;
}

.icon-button:hover {
  border-color: #b7c3d1;
}

.fx-strip,
.status-strip {
  display: grid;
  gap: 1px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

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

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

.fx-cell,
.status-cell {
  min-width: 0;
  padding: 14px 16px;
  background: var(--surface);
}

.fx-cell {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 12px;
}

.fx-cell span,
.status-cell span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.fx-cell strong {
  font-size: 20px;
  text-align: right;
}

.fx-cell em {
  font-style: normal;
  font-size: 12px;
  font-weight: 760;
}

.fx-cell em.up {
  color: #047857;
}

.fx-cell em.down {
  color: #b42318;
}

.fx-cell em.flat {
  color: var(--muted);
}

.status-cell strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(155px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-card {
  min-height: 158px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.kpi-title {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.status-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  margin-top: 3px;
  border-radius: 50%;
}

.status-dot.green {
  background: var(--green);
}

.status-dot.yellow {
  background: var(--yellow);
}

.status-dot.red {
  background: var(--red);
}

.kpi-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: auto;
}

.kpi-value strong {
  font-size: clamp(19px, 1.35vw, 25px);
  line-height: 1.05;
}

.kpi-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.kpi-delta {
  width: max-content;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 760;
}

.kpi-delta.good {
  background: rgba(14, 159, 110, 0.12);
  color: #047857;
}

.kpi-delta.warn {
  background: rgba(200, 135, 25, 0.14);
  color: #8a5a0a;
}

.kpi-delta.bad {
  background: rgba(217, 45, 32, 0.12);
  color: #b42318;
}

.kpi-delta.neutral {
  background: var(--surface-2);
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.82fr) minmax(330px, 0.82fr);
  gap: 18px;
}

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

.panel-large,
.panel-wide {
  grid-column: span 2;
}

.panel-full {
  grid-column: 1 / -1;
}

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

.panel-head.compact {
  margin-bottom: 12px;
}

.panel-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.chart-box {
  position: relative;
  width: 100%;
  height: 300px;
}

.chart-box canvas,
.donut-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.balance-breakdown {
  display: grid;
  gap: 14px;
}

.balance-row {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.balance-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.balance-row-head,
.part-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

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

.balance-row-head span,
.part-label strong {
  font-size: 14px;
  font-weight: 800;
}

.balance-part {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 8px 12px;
  align-items: center;
}

.part-label {
  grid-column: 1 / -1;
}

.part-label span,
.balance-part em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.account-list {
  display: grid;
  gap: 0;
}

.account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.account-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.account-row strong {
  font-size: 14px;
}

.account-row span,
.account-meta span {
  color: var(--muted);
  font-size: 12px;
}

.account-value,
.account-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-value em {
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  text-align: right;
}

.detail-table {
  display: grid;
  grid-template-columns: 1fr;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  gap: 1px;
}

.compact-detail {
  margin-top: 16px;
}

.detail-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(132px, max-content) minmax(112px, max-content) minmax(58px, max-content);
  gap: 16px;
  align-items: start;
  padding: 11px 12px;
  background: var(--surface);
}

.detail-row.important {
  background: #f8fafc;
}

.detail-row div {
  min-width: 0;
  display: grid;
  gap: 2px;
  align-content: start;
}

.detail-row strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.25;
}

.detail-row div > strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.detail-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.detail-row > strong,
.detail-row em,
.detail-row > span {
  text-align: right;
  white-space: nowrap;
}

.detail-row em {
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.donut-wrap {
  position: relative;
  width: min(260px, 100%);
  height: 230px;
  margin: 0 auto 6px;
}

.donut-center {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
}

.donut-center strong {
  font-size: 28px;
}

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

.legend {
  display: grid;
  gap: 9px;
}

.legend-row,
.answer-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.legend-row:first-child,
.answer-row:first-child {
  border-top: 0;
}

.legend-marker {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-row span,
.answer-row span {
  color: var(--muted);
  font-size: 13px;
}

.legend-row strong,
.answer-row strong {
  font-size: 14px;
}

.answer-list {
  display: grid;
  gap: 0;
}

.answer-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.answer-status {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.answer-status.green,
.status-pill.green {
  color: #047857;
  background: rgba(14, 159, 110, 0.12);
}

.answer-status.yellow,
.status-pill.yellow {
  color: #8a5a0a;
  background: rgba(200, 135, 25, 0.14);
}

.answer-status.red,
.status-pill.red {
  color: #b42318;
  background: rgba(217, 45, 32, 0.12);
}

.table-head {
  align-items: end;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #f8fafc;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.delta-positive {
  color: #047857;
  font-weight: 760;
}

.delta-negative {
  color: #b42318;
  font-weight: 760;
}

.delta-neutral {
  color: var(--muted);
  font-weight: 760;
}

.insight-box {
  padding: 14px 0 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.insight-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.insight-box p {
  margin: 0;
  font-size: 15px;
}

.full-button {
  width: 100%;
  min-height: 42px;
  margin-top: 14px;
  border: 0;
  border-radius: 7px;
  background: var(--ink);
  color: #ffffff;
  font-weight: 760;
}

.full-button:hover {
  background: #263447;
}

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

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

  .panel-large,
  .panel-wide {
    grid-column: span 1;
  }
}

@media (max-width: 980px) {
  .sidebar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 14px 18px;
  }

  .pipeline-box {
    display: none;
  }

  .nav-list {
    width: 100%;
  }

  .topbar {
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .select-label {
    min-width: 180px;
  }

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

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

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

@media (max-width: 720px) {
  .workspace {
    padding: 18px;
  }

  .sidebar {
    padding: 14px 16px;
  }

  h1 {
    font-size: 28px;
  }

  .fx-strip,
  .kpi-grid,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 15px;
  }

  .panel-head,
  .table-head {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-note {
    white-space: normal;
  }

  .chart-box {
    height: 260px;
  }

  .balance-row-head,
  .part-label,
  .account-value,
  .account-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .detail-row {
    min-width: 560px;
    grid-template-columns: minmax(190px, 1fr) minmax(118px, max-content) minmax(104px, max-content) minmax(52px, max-content);
    align-items: start;
  }

  .detail-row > strong,
  .detail-row em,
  .detail-row > span {
    text-align: right;
  }
}
