:root {
  --navy: #173b5e;
  --sidebar: #123a59;
  --blue: #005b96;
  --green: #00a878;
  --muted: #566a7c;
  --line: #e3eaf0;
  --surface: #f7f9fb;
  --white: #fff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--surface);
  color: #344054;
  font: 1rem/1.45 Arial, Helvetica, system-ui, sans-serif;
}
button, input, select { font: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid #3188c2; outline-offset: 3px; }
h1, h2, h3 { color: var(--navy); line-height: 1.2; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.eyebrow {
  margin-bottom: 12px;
  color: var(--blue);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.brand { color: var(--white); font-size: 2rem; font-weight: 800; letter-spacing: -.05em; }
.brand span { color: var(--green); }
.brand small {
  display: block;
  color: #b9d3e3;
  font-size: .65rem;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.mobile-brand { display: none; }
.button {
  min-height: 44px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 700;
  cursor: pointer;
}
.outline { background: var(--white); color: var(--navy); border-color: #bdcdd9; }
a.button { display: inline-flex; align-items: center; justify-content: center; }
.outline:hover { background: #eff6fa; text-decoration: none; }
.compact { min-height: 36px; font-size: .875rem; }
.primary { background: var(--blue); color: var(--white); }
.primary:hover { background: #004b7d; }
.text-button {
  background: none;
  border: 0;
  color: var(--blue);
  font-weight: 700;
  padding: 8px 4px;
  cursor: pointer;
}

.login-screen {
  display: grid;
  grid-template-columns: 52% 48%;
  min-height: 100vh;
  background: var(--white);
}
.login-art {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 44px;
  padding: 54px 12%;
  min-height: 640px;
  background: #103552;
  color: var(--white);
}
.login-art::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 600px;
  height: 600px;
  right: -280px;
  top: 110px;
  border: 1px solid #ffffff26;
  border-radius: 50%;
  box-shadow: 0 0 0 100px #ffffff08, 0 0 0 220px #ffffff06;
}
.login-art .eyebrow { color: #75d9bc; }
.login-message {
  font-size: clamp(2.55rem, 5vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -.055em;
  line-height: 1.05;
  margin-bottom: 22px;
}
.login-message em { color: #70d2b4; font-style: normal; }
.login-description { max-width: 390px; color: #c1d8e6; }
.login-foot { display: flex; align-items: center; gap: 15px; color: #b5cad9; font-size: .825rem; }
.login-foot img { width: 105px; filter: invert(1); }
.login-form-wrap { display: grid; place-items: center; padding: 36px; }
.login-form { width: min(380px, 100%); }
.login-form h1 { font-size: 1.85rem; letter-spacing: -.035em; margin-bottom: 8px; }
.login-form .muted { margin-bottom: 28px; }
.field { display: grid; gap: 7px; }
.login-form .field { margin-bottom: 17px; }
.field label { color: var(--navy); font-size: .875rem; font-weight: 700; }
.field input, .field select {
  min-height: 44px;
  width: 100%;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid #bdcdd9;
  border-radius: 9px;
  color: var(--navy);
}
.login-button { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.login-caption { margin-top: 24px; color: var(--muted); font-size: .8125rem; text-align: center; }
.error { color: #992821; background: #fff0ef; padding: 10px; border-radius: 8px; margin-bottom: 12px; }
.error ul { padding: 0; margin: 0; list-style: none; }

.app { display: grid; min-height: 100vh; grid-template-columns: 234px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 15px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--sidebar);
}
.sidebar .brand { padding: 0 14px 32px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 8px;
  color: #bbd2df;
  padding: 12px 13px;
  font-size: .875rem;
  font-weight: 700;
}
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a[aria-current] {
  background: #ffffff18;
  color: var(--white);
  box-shadow: inset 3px 0 var(--green);
}
.sidebar-bottom { padding: 0 11px; }
.sidebar-bottom p { border-top: 1px solid #ffffff35; padding: 16px 0; color: #b9d3e3; font-size: .8125rem; }
.sidebar-logo { background: var(--white); border-radius: 8px; padding: 12px; }
.sidebar-logo img { display: block; width: min(112px, 100%); margin: auto; }
.topbar {
  min-height: 76px;
  padding: 12px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}
.breadcrumb, .platform-title { display: block; color: var(--navy); }
.breadcrumb { font-size: .75rem; font-weight: 800; letter-spacing: .12em; }
.platform-title { font-size: .875rem; }
.top-actions { display: flex; align-items: center; gap: 20px; white-space: nowrap; }
.top-meta { font-size: .8125rem; color: var(--muted); }
.user-menu { position: relative; }
.user-menu summary {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  cursor: pointer;
  font-size: .875rem;
  font-weight: 700;
  list-style: none;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary::after { content: "⌄"; }
.user-menu form {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 2;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 8px 26px #15385215;
}
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ddefea;
  color: #08694f;
}
.content-shell { width: min(100%, 1420px); margin: auto; padding: 32px 36px 42px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.page-head h1 { font-size: clamp(1.85rem, 3vw, 2.35rem); letter-spacing: -.045em; margin-bottom: 6px; }
.source-form { display: flex; align-items: end; gap: 10px; }
.source-form select { min-width: 205px; }
.source-form button { white-space: nowrap; }
.meta-strip, .legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: .8125rem;
}
.meta-strip { margin: 22px 0; }
.meta-strip li + li::before { content: "·"; margin-right: 14px; color: #7c91a2; }
.meta-strip strong { color: #08694f; }
.kpi-grid, .grid-main { display: grid; gap: 16px; margin-bottom: 18px; }
.kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); }
.card, .kpi {
  min-width: 0;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--white);
  box-shadow: 0 8px 26px #1538520b;
}
.kpi { border-top: 3px solid var(--blue); }
.kpi:nth-child(2) { border-top-color: #88b0c3; }
.kpi:nth-child(3) { border-top-color: #239d76; }
.kpi h2 { text-transform: uppercase; color: var(--muted); font-size: .8125rem; }
.kpi p { color: var(--muted); font-size: .8125rem; }
.kpi .value { margin: 8px 0 3px; line-height: 1.1; color: var(--navy); font-size: 2.45rem; font-weight: 800; letter-spacing: -.05em; }
.text-link { font-size: .875rem; font-weight: 700; }
.kpi-link { display: block; text-align: right; margin-top: 4px; }
.card h2 { font-size: 1.15rem; letter-spacing: -.02em; }
.card-subtitle { margin-top: 5px; color: var(--muted); font-size: .875rem; }
.card + .card { margin-top: 18px; }
.grid-main .card { margin: 0; }
.finding { padding: 14px 0; border-bottom: 1px solid var(--line); }
.finding:last-child { border-bottom: 0; padding-bottom: 0; }
.finding-label { display: block; margin-bottom: 4px; font-size: .75rem; letter-spacing: .11em; font-weight: 800; text-transform: uppercase; color: #087454; }
.finding strong { display: block; color: var(--navy); line-height: 1.35; }
.finding p { margin: 5px 0; color: var(--muted); font-size: .875rem; }
.chart { margin-top: 13px; }
.chart svg { display: block; width: 100%; min-height: 155px; overflow: visible; }
.chart-gridline { stroke: #e5ebf0; }
.chart-divider { stroke: #a4bacb; stroke-dasharray: 4 5; }
.chart-axis { fill: #546b7d; font-size: 14px; }
.chart-series { fill: none; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.chart-observed { stroke: var(--blue); }
.chart-forecast { stroke: #00875f; }
.chart-band { fill: var(--green); opacity: .13; }
.chart-point { fill: var(--white); stroke: #00875f; stroke-width: 2.5; }
.chart a:focus-visible .chart-point, .chart a:hover .chart-point { fill: #a8ebd7; }
.chart[data-chart-interactive] { position: relative; }
.chart-month-guide, .chart-month-marker { visibility: hidden; pointer-events: none; }
.chart-month.is-active .chart-month-guide, .chart-month.is-active .chart-month-marker { visibility: visible; }
.chart-month-guide { stroke: #a4bacb; stroke-dasharray: 3 4; }
.chart-month-marker { fill: var(--white); stroke: var(--blue); stroke-width: 2; }
.chart-month-marker-b { stroke: #a65219; }
.chart-month-marker-forecast { stroke: #00875f; }
.chart-tooltip {
  position: absolute;
  top: 8px;
  z-index: 2;
  width: max-content;
  max-width: min(22rem, 100%);
  padding: 8px 11px;
  border-radius: 6px;
  background: var(--navy);
  color: var(--white);
  font-size: .8rem;
  font-weight: 700;
  pointer-events: none;
}
.legend { margin: 8px 0 0; }
.legend i { display: inline-block; width: 14px; height: 3px; margin-right: 3px; vertical-align: middle; background: var(--blue); }
.legend .forecast-key { background: var(--green); }
.legend .band-key { height: 8px; background: #d4eee6; }
.month-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.month-card { display: grid; justify-items: start; gap: 5px; padding: 12px; border: 1px solid #ccdbe5; border-radius: 9px; color: var(--navy); }
.month-card[aria-current] { border-color: #00875f; background: #eff9f5; }
.month-value { font-size: 1.25rem; font-weight: 800; }
.badge { padding: 3px 7px; border-radius: 12px; background: #fff2cc; color: #6c4e00; font-size: .8125rem; font-weight: 700; }
.badge.alto { background: #fdebd8; color: #803700; }
.badge.bajo { background: #e5f5ee; color: #08694f; }
.month-detail { margin-top: 14px; padding: 13px; border-radius: 8px; background: #edf6fa; }
.month-detail p { margin-top: 5px; }
.table-wrap { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); }
th { color: var(--navy); font-size: .8125rem; }
td { font-size: .875rem; }
.numeric { text-align: right; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 16px 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8125rem; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 192px minmax(0, 1fr); }
  .content-shell { padding-inline: 24px; }
  .month-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .top-meta { display: none; }
}
@media (max-width: 860px) {
  .app { display: block; }
  .sidebar { position: static; height: auto; flex-direction: row; padding: 10px 18px; }
  .sidebar > div:first-child { display: flex; align-items: center; gap: 20px; }
  .sidebar .brand { padding: 0; font-size: 1.65rem; }
  .sidebar-bottom, .sidebar .brand small { display: none; }
  .sidebar nav a { padding: 8px; }
  .topbar { min-height: 60px; padding-inline: 24px; }
}
@media (max-width: 670px) {
  .page-head, .grid-main { display: block; }
  .source-form { margin-top: 15px; }
  .grid-main .card + .card { margin-top: 16px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .login-screen { display: block; }
  .login-art { display: none; }
  .login-form-wrap { min-height: 100vh; padding: 24px; }
  .mobile-brand { display: block; color: var(--navy); margin-bottom: 26px; }
}
@media (max-width: 460px) {
  .platform-title, .user-name { display: none; }
  .content-shell, .topbar, .footer { padding-inline: 14px; }
  .source-form select { min-width: 0; }
  .source-form .field { flex: 1; min-width: 0; }
  .month-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card, .kpi { padding: 16px; }
  .meta-strip li + li::before { content: none; }
}

.head-controls { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.predictive > .card, .predictive-split { margin-top: 17px; }
.predictive-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.filter-actions { grid-column: 1 / -1; }
.filter-actions, .download-actions, .card-heading-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.compare-panel { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); }
.compare-panel summary { color: var(--blue); font-weight: 700; cursor: pointer; }
.card-heading-actions { justify-content: space-between; align-items: start; }
.predictive-loading {
  width: min(340px, calc(100% - 32px));
  padding: 26px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
}
.predictive-loading::backdrop { background: rgb(18 58 89 / 48%); }
html:has(.predictive-loading[open]) { overflow: hidden; }
.predictive-loading h2 { font-size: 1.05rem; }
.predictive-loading h2:focus { outline: none; }
.predictive-spinner {
  display: block;
  width: 32px;
  height: 32px;
  margin: 0 auto 14px;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
}
@media (prefers-reduced-motion: no-preference) {
  .predictive-spinner { animation: predictive-spin 800ms linear infinite; }
}
@keyframes predictive-spin { to { transform: rotate(360deg); } }
.download-error { flex-basis: 100%; color: #a12626; font-size: .875rem; }
.predictive-kpis { margin-block: 17px 0; }
.validation-caption { padding: 12px 0 6px; text-align: left; font-weight: 700; }
.kpi .value small { font-size: 1rem; letter-spacing: 0; }
.predictive-detail, .predictive-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.predictive-detail { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-block: 14px; }
.predictive-detail > div { background: #f4f8fb; border-radius: 8px; padding: 12px; }
.predictive-detail strong, .predictive-detail span { display: block; }
.predictive-detail strong { color: var(--navy); }
.predictive-detail span { font-size: .875rem; color: var(--muted); margin-bottom: 4px; }
.predictive-detail .badge { display: inline-block; margin: 0; }
.predictive-split .card { margin: 0; }
.seasonal-bars {
  display: grid;
  grid-template-columns: repeat(12, minmax(44px, 1fr));
  gap: 4px;
  overflow-x: auto;
  margin-top: 15px;
  padding-top: 18px;
}
.seasonal-comparison { grid-template-columns: repeat(12, minmax(84px, 1fr)); }
.seasonal-bar { text-align: center; font-size: .75rem; color: var(--muted); }
.seasonal-track { display: flex; align-items: end; justify-content: center; height: 105px; background: #f4f8fb; border-radius: 4px; margin: 4px 0; }
.seasonal-track > div { width: 72%; }
.seasonal-fill { position: relative; background: #4386aa; border-radius: 3px 3px 0 0; }
.seasonal-value {
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  font-size: .6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--navy);
}
.chart-comparison { stroke: #a65219; }
.chart-comparison-history { stroke-dasharray: 6 4; }
.legend .comparison-key { background: #a65219; }
.selected-month { background: #eff9f5; }
.notice { margin-top: 16px; padding: 12px; border-radius: 8px; background: #eef5fa; color: var(--navy); }

@media (max-width: 860px) {
  .sidebar nav a { white-space: nowrap; }
  .head-controls { align-items: start; }
}

@media (max-width: 670px) {
  .predictive-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .predictive-split, .predictive-detail { grid-template-columns: 1fr; }
  .head-controls > .outline { margin-top: 4px; }
}

@media (max-width: 510px) {
  .sidebar > div:first-child { flex-wrap: wrap; gap: 8px 12px; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .predictive-filters { grid-template-columns: 1fr; }
}

.scenario-fields { padding: 0; margin: 0 0 14px; min-width: 0; border: 0; }
.scenario-fields legend { padding: 0; font-size: 1rem; font-weight: 800; }
.scenario-a-label { display: none; }
.predictive-form:has(.compare-panel[open]) .scenario-a-label { display: block; color: var(--blue); }
.predictive-form:has(.compare-panel[open]) .apply-single { display: none; }
.compare-panel[open] summary { margin-bottom: 14px; }
.scenario-fields.scenario-b { padding: 14px; background: #fff9f3; border: 1px solid #f0d9c9; border-radius: 9px; }
.scenario-fields.scenario-b legend { color: #9a4616; }
.scenario-split, .kpi-scenarios { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.scenario-split { margin-block: 14px; }
.scenario-split > :only-child, .kpi-scenarios > :only-child { grid-column: 1 / -1; }
.scenario-note { padding: 12px; border-radius: 8px; background: #edf6fc; border-left: 3px solid var(--blue); }
.scenario-note p { margin-top: 6px; }
.scenario-note.scenario-b { background: #fff5eb; border-color: #a65219; }
.scenario-text-a { color: var(--blue); }
.scenario-text-b { color: #9a4616; }
.kpi-scenarios > div > span { font-size: .8125rem; font-weight: 800; display: block; margin-top: 9px; }
.kpi-scenarios > div + div { border-left: 1px solid var(--line); padding-left: 12px; }
.chart-heading { margin-top: 18px; font-size: .95rem; }
.chart-cut-b { stroke: #a65219; }
.chart-point-b { fill: #fff; stroke: #a65219; stroke-width: 2.5; }
.chart a:focus-visible .chart-point-b, .chart a:hover .chart-point-b { fill: #f3d7c2; }
.chart-compared .chart-observed { stroke-dasharray: 6 4; }
.chart-compared .chart-forecast, .chart-compared .chart-point { stroke: var(--blue); }
.legend .scenario-a-key { background: var(--blue); }
.chart-band-a { fill: var(--blue); }
.chart-band-b { fill: #a65219; }
.legend .band-key-a { background: rgb(0 91 150 / 13%); }
.legend .band-key-b { background: rgb(166 82 25 / 13%); }
.legend .dashed-key {
  border-top: 2px dashed currentColor;
  height: 0;
  background: none;
}
.legend .comparison-key.dashed-key { color: #a65219; }
.seasonal-comparison .seasonal-track { gap: 2px; }
.seasonal-comparison .seasonal-track > div { width: 44%; }
.seasonal-b { background: #a65219; }
.seasonal-b .seasonal-value { color: #9a4616; }

@media (max-width: 550px) {
  .scenario-split { grid-template-columns: 1fr; }
}

.auth-switch { margin-top: 17px; font-size: .875rem; text-align: center; }
.auth-success { padding: 10px; margin-bottom: 14px; color: #08694f; background: #e5f5ee; border-radius: 8px; }
.register-form .muted { margin-bottom: 20px; }
.register-form .field { margin-bottom: 13px; }

.upload-form { margin-top: 16px; }
.upload-form .field { margin-bottom: 12px; max-width: 440px; }
