:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #071733;
  --muted: #5c6b80;
  --line: #dde6ef;
  --accent: #0c7d68;
  --accent-soft: #e9f5f1;
  --negative: #dc111b;
  --positive: #118043;
  --warning: #8a5a00;
  --blue: #0f5dad;
  --navy: #082447;
  --shadow: 0 14px 34px rgb(15 35 65 / 10%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
  overflow: hidden;
}

#app {
  height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}

.sidebar {
  background:
    radial-gradient(circle at 0 0, rgb(20 185 129 / 24%), transparent 26%),
    linear-gradient(180deg, #061a37 0%, #09264d 50%, #041427 100%);
  color: #fff;
  padding: 26px 18px;
  height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
  box-shadow: inset -1px 0 0 rgb(255 255 255 / 8%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 30px;
  letter-spacing: 0;
}

.brand::before {
  content: "";
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #23d49d, #0d8c72);
  box-shadow: 0 10px 24px rgb(35 212 157 / 28%);
  flex: 0 0 auto;
}

nav {
  display: grid;
  gap: 10px;
}

button,
.file-button {
  border: 1px solid transparent;
  background: #fff;
  color: var(--ink);
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
}

nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  color: #dce8e5;
  text-align: left;
  border-color: transparent;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 12px;
  transition: background 0.16s ease, transform 0.16s ease;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  opacity: 0.94;
  flex: 0 0 auto;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

nav button.active,
nav button:hover {
  background: linear-gradient(135deg, #0b8f78, #067363);
  color: #fff;
  transform: translateX(2px);
  box-shadow: 0 16px 28px rgb(0 0 0 / 18%);
}

main {
  padding: 28px 32px;
  height: 100vh;
  overflow: auto;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  position: sticky;
  top: -24px;
  z-index: 10;
  padding: 16px 0 12px;
  background: linear-gradient(180deg, rgb(246 248 251 / 96%) 75%, rgb(246 248 251 / 0%));
  backdrop-filter: blur(10px);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 38px;
  margin-bottom: 0;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 15px;
  margin: 22px 0 8px;
  color: var(--muted);
}

.app-header span,
.section-title span,
.note,
.notes,
.warning {
  color: var(--muted);
}

.header-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
}

.header-pill,
.save-pill {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 8px 22px rgb(18 42 37 / 7%);
}

.header-pill.highlight {
  border-color: rgb(8 121 107 / 18%);
  background: linear-gradient(135deg, #e8fff8, #eef7ff);
  color: var(--accent);
}

.header-pill.ok {
  border-color: #a8d9c6;
  background: #eefaf4;
  color: var(--positive);
}

.header-pill.bad {
  border-color: #ffd5d5;
  background: #fff1f1;
  color: var(--negative);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.overview-page {
  display: grid;
  gap: 20px;
}

.overview-hero {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(0, 1.25fr);
  gap: 22px;
  align-items: center;
}

.overview-hero > div:first-child > span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.overview-hero h2 {
  margin: 5px 0 8px;
  font-size: 28px;
}

.overview-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.overview-grid {
  display: grid;
  gap: 20px;
}

.overview-grid .panel {
  overflow-x: auto;
}

.overview-grid table {
  min-width: 1120px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.title-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.excel-context,
.sheet-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.excel-context span,
.sheet-grid span {
  border: 1px solid var(--line);
  background: #f8fbfa;
  border-radius: 6px;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 13px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metrics.compact {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-top: 14px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
  box-shadow: 0 12px 28px rgb(18 42 37 / 6%);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.metric strong {
  display: block;
  font-size: 22px;
}

.dashboard-control {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.control-card,
.dash-kpi,
.forecast-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(255 255 255 / 86%);
  box-shadow: var(--shadow);
}

.control-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
}

.control-card span,
.dash-kpi span,
.forecast-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.control-card strong {
  font-size: 17px;
}

.control-card small,
.forecast-card small {
  color: var(--muted);
}

.control-card.attention {
  border-color: #ffd4be;
  background: #fff6f0;
}

.control-card.ok {
  border-color: #b6e2d2;
  background: #f0fbf6;
}

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.dashboard-tax-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: -8px 0 22px;
}

.dashboard-tax-strip div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #ffffff, #f8fbfa);
  box-shadow: 0 8px 22px rgb(18 42 37 / 6%);
}

.dashboard-tax-strip span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.dashboard-tax-strip strong {
  display: block;
  color: var(--ink);
  font-size: clamp(15px, 1vw, 18px);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
}

.dash-kpi {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  grid-template-areas:
    "icon text"
    "icon trend";
  align-items: center;
  column-gap: 14px;
  row-gap: 8px;
  min-height: 132px;
  padding: 18px;
}

.dash-kpi::before {
  display: none;
}

.dash-kpi.revenue::before,
.dash-kpi.result::before {
  background: #0f9f7a;
}

.dash-kpi.cost::before {
  background: #2563eb;
}

.dash-kpi.margin::before {
  background: #14b8a6;
}

.dash-kpi.liquidity::before {
  background: #7c3aed;
}

.dash-kpi i {
  grid-area: icon;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  color: #fff;
  font-size: 23px;
  font-style: normal;
  font-weight: 900;
  box-shadow: inset 0 0 16px rgb(255 255 255 / 18%), 0 16px 24px rgb(9 31 68 / 15%);
}

.dash-kpi.revenue i,
.dash-kpi.result i,
.dash-kpi.margin i {
  background: linear-gradient(135deg, #31b757, #087c43);
}

.dash-kpi.cost i,
.dash-kpi.liquidity i {
  background: linear-gradient(135deg, #166ec8, #062b60);
}

.dash-kpi div {
  grid-area: text;
  min-width: 0;
}

.dash-kpi strong {
  display: block;
  margin-top: 8px;
  max-width: 100%;
  font-size: clamp(22px, 1.45vw, 28px);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.dash-kpi em {
  grid-area: trend;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(380px, 0.9fr);
  gap: 22px;
  align-items: start;
}

.dashboard-left {
  display: grid;
  gap: 18px;
}

.dashboard-right {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 20px;
}

.business-bars {
  display: grid;
  gap: 14px;
  margin: 20px 0 24px;
  padding: 12px 0;
}

.business-bar-row {
  display: grid;
  grid-template-columns: 190px minmax(220px, 1fr) 150px;
  gap: 14px;
  align-items: center;
}

.business-bar-row span {
  font-weight: 700;
}

.business-bar-row b {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.business-bar-track {
  height: 26px;
  border-radius: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0, transparent 19.5%, rgb(7 23 51 / 7%) 20%),
    linear-gradient(90deg, transparent 0 49.7%, rgb(7 23 51 / 20%) 49.7% 50.3%, transparent 50.3% 100%);
  overflow: hidden;
}

.business-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.positive-row .business-bar-track i {
  margin-left: 50%;
  max-width: 50%;
  background: linear-gradient(90deg, #0f8f58, #0f6b44);
}

.negative-row .business-bar-track i {
  margin-left: calc(50% - var(--neg-width, 0px));
  background: linear-gradient(90deg, #ef111c, #c50e17);
  transform-origin: right center;
}

.negative-row .business-bar-track {
  display: flex;
  justify-content: flex-end;
}

.negative-row .business-bar-track i {
  margin-left: 0;
  margin-right: 50%;
  max-width: 50%;
}

.action-panel {
  min-height: 100%;
}

.action-list {
  display: grid;
  gap: 10px;
}

.action-item {
  display: grid;
  grid-template-columns: 46px 1fr 18px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fbfcfc;
}

.action-item i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  color: #fff;
  font-style: normal;
  font-weight: 900;
}

.action-item.bad i {
  background: #e7121b;
}

.action-item.warn i {
  background: #f59e0b;
}

.action-item.ok i {
  background: #10a37f;
}

.action-item b {
  color: var(--muted);
  font-size: 24px;
  font-weight: 400;
}

.action-item strong {
  display: block;
  margin-bottom: 4px;
}

.action-item span {
  color: var(--muted);
}

.action-item.bad {
  border-color: #f5c2bd;
  background: #fff6f5;
}

.action-item.warn {
  border-color: #ffd8a8;
  background: #fff8ed;
}

.action-item.ok {
  border-color: #b6e2d2;
  background: #f0fbf6;
}

.forecast-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.forecast-card {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
}

.forecast-card strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.forecast-card i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: linear-gradient(135deg, #31b757, #087c43);
  color: #fff;
  font-style: normal;
  font-weight: 900;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 12px;
  font-size: 14px;
  overflow: hidden;
  border-radius: 12px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: right;
  vertical-align: middle;
}

th:first-child,
td:first-child {
  text-align: left;
}

thead th {
  background: linear-gradient(180deg, #e5f5f1, #dcefeb);
  color: #123f37;
  font-weight: 700;
}

tfoot td {
  background: #edf8f5;
  border-top: 2px solid #b9d8d1;
  font-weight: 700;
  position: sticky;
  bottom: 0;
  z-index: 2;
}

input[type="number"] {
  width: 110px;
  max-width: 100%;
  padding: 7px;
  border: 1px solid #bcc9c5;
  border-radius: 9px;
  background: #fbfefd;
  text-align: right;
  font: inherit;
}

input[type="text"] {
  width: 100%;
  min-width: 180px;
  padding: 7px;
  border: 1px solid #bcc9c5;
  border-radius: 9px;
  background: #fbfefd;
  font: inherit;
}

input[type="search"] {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #bcc9c5;
  border-radius: 8px;
  font: inherit;
}

select {
  width: 100%;
  min-width: 150px;
  padding: 7px;
  border: 1px solid #bcc9c5;
  border-radius: 9px;
  background: #fff;
  font: inherit;
}

.wide-table {
  overflow-x: auto;
}

.wide-table table {
  min-width: 1500px;
}

.portfolio-shell {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 16px;
  align-items: start;
}

.portfolio-picker {
  position: sticky;
  top: 0;
  display: grid;
  gap: 12px;
}

.customer-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 210px);
  overflow: auto;
  padding-right: 2px;
}

.customer-card {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfc;
  color: var(--ink);
  text-align: left;
  border-radius: 12px;
  padding: 12px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.customer-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 10px 24px rgb(8 121 107 / 12%);
}

.customer-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgb(18 42 37 / 8%);
}

.customer-card[hidden] {
  display: none;
}

.customer-card span,
.customer-card small {
  color: var(--muted);
}

.portfolio-workspace {
  min-width: 0;
}

.search-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.portfolio-name-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.portfolio-name-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.tabs button {
  background: #f7faf9;
  border-color: var(--line);
  border-radius: 999px;
}

.tabs button.active {
  background: linear-gradient(135deg, var(--accent), #13a38e);
  color: #fff;
  box-shadow: 0 8px 18px rgb(8 121 107 / 18%);
}

.tab-panel {
  overflow-x: auto;
}

.tab-panel table {
  min-width: 1180px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.table-toolbar h3 {
  margin: 0;
}

.bulk-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.bulk-tools label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.bulk-tools input {
  width: 90px;
}

.tiny {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.danger {
  border-color: #f2b8b5;
  background: #fff4f3;
  color: var(--negative);
}

.projection {
  display: grid;
  gap: 16px;
}

.projection-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.projection-summary span {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: #fbfcfc;
  color: var(--positive);
  font-weight: 800;
  box-shadow: 0 8px 22px rgb(22 32 29 / 7%);
}

.projection-summary span::after {
  content: "";
  position: absolute;
  inset: auto -20px -38px auto;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  opacity: 0.14;
}

.projection-summary .income-card::after {
  background: #0f766e;
}

.projection-summary .expense-card::after {
  background: #b42318;
}

.projection-summary .result-card::after {
  background: #2563eb;
}

.projection-summary b {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 5px;
}

.projection svg {
  width: 100%;
  min-height: 280px;
  border: 1px solid #cfe1dc;
  border-radius: 8px;
  background: #fbfcfc;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 70%);
}

.projection .chart-backdrop {
  fill: url("#chartBg");
}

.projection text {
  fill: var(--muted);
  font-size: 12px;
}

.projection .axis {
  stroke: #7f918c;
  stroke-width: 1;
}

.projection .grid {
  stroke: #dcebe7;
  stroke-width: 1;
}

.projection .horizontal {
  stroke-dasharray: 4 6;
}

.projection .line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: drawLine 1.1s ease-out forwards;
}

.projection .income-line {
  stroke: #0f766e;
}

.projection .expense-line {
  stroke: #b43b47;
  animation-delay: 0.12s;
}

.projection .result-line {
  stroke: #2f6fed;
  animation-delay: 0.24s;
}

.projection .result-area {
  fill: url("#resultFill");
  opacity: 0;
  animation: fadeInChart 0.9s ease-out 0.45s forwards;
}

.income-point,
.expense-point,
.result-point {
  opacity: 0;
  animation: fadeInChart 0.35s ease-out 1s forwards;
}

.income-point {
  fill: #0f766e;
}

.expense-point {
  fill: #b43b47;
}

.result-point {
  fill: #2f6fed;
}

.end-label {
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  animation: fadeInChart 0.35s ease-out 1s forwards;
}

.income-label {
  fill: #0f766e;
}

.expense-label {
  fill: #b43b47;
}

.result-label {
  fill: #2f6fed;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 6px;
}

.income-dot::before {
  background: #166b5f;
}

.expense-dot::before {
  background: #b42318;
}

.result-dot::before {
  background: #2563eb;
}

@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes fadeInChart {
  to {
    opacity: 1;
  }
}

.projection.modern {
  gap: 18px;
  color: #e7eef8;
}

.projection.modern .projection-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
}

.projection-kpi {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 18px;
  padding: 16px;
  background:
    radial-gradient(circle at 86% 18%, rgb(255 255 255 / 14%), transparent 28%),
    linear-gradient(145deg, #172033, #0e1524);
  box-shadow: 0 18px 45px rgb(15 23 42 / 18%);
}

.projection-kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  opacity: 0.95;
}

.projection-kpi.green::before {
  background: #2dd4bf;
}

.projection-kpi.orange::before {
  background: #fb923c;
}

.projection-kpi.blue::before {
  background: #38bdf8;
}

.projection-kpi.violet::before {
  background: #8b5cf6;
}

.projection-kpi .kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #9fb0c8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.projection-kpi i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 28px;
  border-radius: 999px;
  background: rgb(255 255 255 / 9%);
  color: #dbeafe;
  font-size: 11px;
  font-style: normal;
}

.projection-kpi strong {
  display: block;
  margin-top: 14px;
  color: #f8fafc;
  font-size: 24px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.projection-kpi small {
  display: inline-flex;
  margin-top: 10px;
  color: #b6c5d8;
  font-size: 12px;
}

.projection.modern .projection-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 16px;
  align-items: stretch;
}

.projection-chart-card,
.projection-insights {
  border: 1px solid rgb(15 23 42 / 9%);
  border-radius: 18px;
  background: linear-gradient(145deg, #101827, #172235);
  box-shadow: 0 20px 52px rgb(15 23 42 / 15%);
}

.projection-chart-card {
  overflow: visible;
  padding: 18px 18px 14px;
}

.projection-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.projection-head h3,
.projection-insights h3 {
  margin: 0;
  color: #f8fafc;
  font-size: 16px;
}

.projection-head p {
  margin: 5px 0 0;
  color: #9fb0c8;
  font-size: 12px;
}

.projection-badge {
  flex: 0 0 auto;
  border: 1px solid rgb(45 212 191 / 28%);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgb(20 184 166 / 12%);
  color: #9ff3df;
  font-size: 12px;
  font-weight: 800;
}

.projection.modern svg {
  display: block;
  width: 100%;
  max-height: 390px;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.projection.modern text {
  fill: #94a3b8;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.projection.modern .modern-grid {
  stroke: rgb(148 163 184 / 18%);
  stroke-width: 1;
}

.projection.modern .modern-grid.vertical {
  stroke: rgb(148 163 184 / 10%);
}

.projection.modern .zero-axis {
  stroke: rgb(226 232 240 / 28%);
  stroke-width: 1.2;
}

.projection.modern .modern-line {
  fill: none;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 8px 14px rgb(0 0 0 / 18%));
  stroke-dasharray: 1300;
  stroke-dashoffset: 1300;
  animation: drawLine 1s ease-out forwards;
}

.projection.modern .modern-line.income {
  stroke: #2dd4bf;
}

.projection.modern .modern-line.expenses {
  stroke: #fb7185;
  animation-delay: 0.08s;
}

.projection.modern .modern-line.result {
  stroke: #60a5fa;
  animation-delay: 0.16s;
}

.projection.modern .modern-result-area {
  fill: url("#modernResultFill");
  opacity: 0;
  animation: fadeInChart 0.55s ease-out 0.25s forwards;
}

.projection.modern .chart-hit {
  fill: transparent;
  cursor: crosshair;
}

.projection-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  color: #aab8cc;
  font-size: 12px;
}

.projection-legend span::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 999px;
}

.legend-income::before {
  background: #2dd4bf;
}

.legend-expenses::before {
  background: #fb7185;
}

.legend-result::before {
  background: #60a5fa;
}

.projection-insights {
  padding: 18px;
}

.projection-insights dl {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
}

.projection-insights div {
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 14px;
  padding: 12px;
  background: rgb(255 255 255 / 5%);
}

.projection-insights dt {
  color: #94a3b8;
  font-size: 12px;
}

.projection-insights dd {
  margin: 5px 0 0;
  color: #f8fafc;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
  .app-header {
    align-items: flex-start;
    display: grid;
  }

  .header-pills {
    justify-content: flex-start;
  }

  .driver-row {
    grid-template-columns: 1fr;
  }

  .driver-row b {
    text-align: left;
  }

  .dashboard-control,
  .dashboard-kpis,
  .overview-hero,
  .overview-hero-kpis,
  .forecast-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .dashboard-main-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-right {
    position: static;
  }

  .business-bar-row {
    grid-template-columns: 150px minmax(160px, 1fr) 130px;
  }

  .projection.modern .projection-kpis,
  .projection.modern .projection-grid {
    grid-template-columns: 1fr 1fr;
  }

  .projection-insights {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .dashboard-control,
  .dashboard-kpis,
  .overview-hero,
  .overview-hero-kpis,
  .forecast-grid,
  .business-bar-row {
    grid-template-columns: 1fr;
  }

  .business-bar-row b {
    text-align: left;
  }

  .projection.modern .projection-kpis,
  .projection.modern .projection-grid {
    grid-template-columns: 1fr;
  }

  .projection-head {
    display: grid;
  }
}

.readonly-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.driver-list {
  display: grid;
  gap: 10px;
}

.driver-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 2fr) 150px;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfc;
}

.driver-row strong,
.driver-row b {
  font-variant-numeric: tabular-nums;
}

.driver-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.driver-row b {
  text-align: right;
}

.driver-bar {
  height: 10px;
  border-radius: 999px;
  background: #edf3f1;
  overflow: hidden;
}

.driver-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #166b5f, #38bdf8);
}

.workbook-dump {
  display: grid;
  gap: 10px;
}

.sheet-dump {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.sheet-dump summary {
  cursor: pointer;
  padding: 11px 12px;
  font-weight: 700;
}

.sheet-dump summary span {
  color: var(--muted);
  font-weight: 400;
  margin-left: 8px;
}

.sheet-dump-body {
  max-height: 520px;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding: 8px;
}

.excel-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #edf2f0;
}

.row-number {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 5px;
}

.excel-cells {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.excel-cell {
  min-width: 132px;
  max-width: 320px;
  border: 1px solid #d7e0dd;
  background: #fff;
  border-radius: 6px;
  padding: 5px 7px;
}

.excel-cell b,
.excel-cell span,
.excel-cell small {
  display: block;
}

.excel-cell b {
  color: var(--accent);
  font-size: 11px;
  margin-bottom: 2px;
}

.excel-cell span {
  overflow-wrap: anywhere;
}

.excel-cell small {
  color: var(--muted);
  overflow-wrap: anywhere;
  margin-top: 3px;
}

.negative {
  color: var(--negative);
}

.positive {
  color: var(--positive);
}

.warning {
  border-left: 4px solid var(--warning);
  background: #fff8e8;
  padding: 10px 12px;
}

.important-note {
  margin-top: 18px;
  border: 1px solid #f3c36b;
  border-left: 5px solid #f59e0b;
  border-radius: 14px;
  padding: 16px 18px;
  background: linear-gradient(180deg, #fff9eb, #fffdf7);
  color: #4b3410;
}

.important-note strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}

.important-note p {
  margin: 0;
  line-height: 1.5;
}

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 700;
  font-size: 12px;
}

.status.ok {
  background: #e5f6ec;
  color: var(--positive);
}

.status.bad {
  background: #fee4e2;
  color: var(--negative);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions button,
.file-button {
  background: var(--accent);
  color: #fff;
}

.file-button input {
  display: none;
}

@media (max-width: 900px) {
  #app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  nav {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  header,
  .section-title {
    display: block;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .projection-summary {
    grid-template-columns: 1fr;
  }

  .portfolio-shell,
  .portfolio-name-row {
    grid-template-columns: 1fr;
  }

  .portfolio-picker {
    position: static;
  }
}
