/* ── Trigger card ── */
.llm-trigger-card {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg-warm);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.llm-trigger-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.llm-trigger-card__label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--leaf);
}

.llm-trigger-card__model {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  background: var(--leaf-light);
  padding: 2px 6px;
  border-radius: 4px;
}

.llm-btn {
  width: 100%;
  padding: 9px 14px;
  background: var(--leaf);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-base);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.25s var(--ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1));
}
.llm-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.llm-btn:hover:not(:disabled) {
  background: var(--leaf-deep);
  transform: translateY(-2px);
}

/* ── Loading state ── */
.ai-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
}

.ai-loading__dot {
  width: 8px;
  height: 8px;
  background: var(--leaf);
  border-radius: 50%;
  animation: teal-pulse 1.2s ease-in-out infinite;
}

/* ── Informe estructurado ── */
.ai-report {
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-report__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.ai-report__titulo {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.ai-report__nivel {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 3px 8px;
  border-radius: 999px;
}

.ai-nivel--alto  { background: rgba(7, 128, 128, 0.12); color: var(--leaf-deep); }
.ai-nivel--medio { background: rgba(245, 158, 11, 0.12); color: #92400e; }
.ai-nivel--bajo  { background: rgba(244, 93, 72, 0.12);  color: #9a1b0f; }

.ai-report__sections {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Sección individual ── */
.ai-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  position: relative;
  overflow: hidden;
}

.ai-section::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 2.5px;
  border-radius: 0 2px 2px 0;
}

.ai-section--teal::before  { background: var(--leaf); }
.ai-section--coral::before { background: var(--coral); }
.ai-section--amber::before { background: #f59e0b; }

.ai-section__label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  display: block;
  margin-bottom: 3px;
}

.ai-section__title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 5px;
}

.ai-section__destacado {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--leaf);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 5px;
}

.ai-section--coral .ai-section__destacado { color: var(--coral); }

.ai-section__texto {
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.45;
  margin: 0;
}

.ai-section__items {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-section__items li {
  font-size: 0.77rem;
  color: var(--ink-soft);
  line-height: 1.35;
  padding-left: 12px;
  position: relative;
}

.ai-section__items li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--leaf);
  font-size: 0.7rem;
}

/* ── Conclusión ── */
.ai-conclusion {
  background: var(--leaf-light);
  border: 1px solid rgba(7, 128, 128, 0.18);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--leaf-deep);
  line-height: 1.4;
}

/* ── Fallback texto plano ── */
.ai-report--plain {
  padding: 10px 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.ai-error { color: var(--color-error); }
.hidden   { display: none !important; }

/* ── Banner hero de resultados ── */
.analysis-hero {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.9rem 1.6rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.08);
  animation: hero-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  white-space: nowrap;
}
@keyframes hero-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.analysis-hero__kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1.2rem;
}
.analysis-hero__value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--leaf);
  letter-spacing: -0.03em;
  line-height: 1;
}
.analysis-hero__label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--ink-soft);
  margin-top: 0.2rem;
}
.analysis-hero__divider {
  width: 1px;
  height: 2rem;
  background: var(--line-strong);
  flex-shrink: 0;
}

.estudio-container {
  display: flex;
  width: 100vw;
  height: calc(100vh - 60px);
  background: var(--bg-warm);
  position: relative;
  overflow: hidden;
}

.viewer-section {
  flex: 1;
  position: relative;
  height: 100%;
}

.viewer-3d {
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #1c1a17;
}

.viewer-modes {
  position: absolute;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  background: rgba(255, 255, 254, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-card);
}

.mode-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-soft);
  padding: 0.65rem 1rem;
  min-height: 44px;
  border-radius: 999px;
  font-family: var(--font-base);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.mode-btn:hover {
  color: var(--ink);
  background: var(--leaf-light);
}

.mode-btn:focus-visible {
  outline: 2px solid var(--leaf);
  outline-offset: 2px;
}

.mode-btn.active {
  background: var(--leaf);
  color: #fff;
}

.lidar-legend {
  position: absolute;
  bottom: 4rem;
  left: 1.5rem;
  z-index: 10;
  padding: 0.5rem 0.85rem;
  background: rgba(255, 255, 254, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.lidar-legend__item {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 0.3em;
}

.lidar-legend__item::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.lidar-legend__item--roof::before   { background: #f45d48; }
.lidar-legend__item--wall::before   { background: #078080; }
.lidar-legend__item--ground::before { background: #94a3b8; }

.lidar-legend__source {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-muted);
  padding-left: 0.5rem;
  border-left: 1px solid var(--line);
}

.coordinates-badge {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 254, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.badge-kwp-chip {
  background: rgba(7, 128, 128, 0.12);
  color: var(--leaf);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.update-kwh-chip {
  position: absolute;
  bottom: 3.6rem;
  left: 1.5rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  background: rgba(255, 255, 254, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font-base);
  font-size: 11px;
  font-weight: 600;
  color: var(--leaf);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
  box-shadow: var(--shadow-card);
}
.update-kwh-chip:hover { background: var(--leaf-light); border-color: var(--leaf-mid); }
.update-kwh-chip:focus-visible { outline: 2px solid var(--leaf); outline-offset: 2px; }

.analysis-sidebar {
  width: 480px;
  height: 100%;
  border-left: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  z-index: 10;
  box-shadow: -4px 0 20px rgba(35, 35, 35, 0.06);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.sidebar-header__title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.transparency-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
}

.badge-label { color: var(--ink-soft); }

.badge-value {
  color: var(--leaf-deep);
  font-weight: 600;
}

.badge-confidence {
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.65rem;
  background: var(--leaf-light);
  color: var(--leaf-deep);
}

.agent-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-soft);
  padding: 0.9rem 0;
  font-family: var(--font-base);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: center;
  transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover { color: var(--ink); }

.tab-btn.active {
  color: var(--leaf-deep);
  border-bottom-color: var(--leaf);
}

.tab-content-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.tab-pane {
  display: none;
  flex-direction: column;
  animation: fade-in 0.35s ease-out forwards;
}

.tab-pane.active { display: flex; }

.pane-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
}

.pane-description {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
}

.details-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
}

.details-card h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--leaf-deep);
  margin-bottom: 0.6rem;
}

.details-card ul {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.details-card li {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.details-card li b,
.details-card li span {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
}

.mini-kpi-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.mini-kpi-bar span { color: var(--ink-soft); }

.mini-kpi-bar strong {
  font-family: var(--font-display);
  color: var(--leaf-deep);
  font-weight: 700;
}

.neighbors-section,
.subsidies-section { margin-top: 1rem; }

.neighbors-section h4,
.subsidies-section h4 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.neighbors-list,
.subsidies-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.neighbor-card,
.subsidy-card {
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.neighbor-card__header,
.subsidy-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.neighbor-card__name,
.subsidy-card__title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
}

.neighbor-card__comp {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--leaf-deep);
  background: var(--leaf-light);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.neighbor-card__meta,
.subsidy-card__meta {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}

.neighbor-card__notes,
.subsidy-card__desc {
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

.hria-report-card {
  margin-top: 1.5rem;
  border: 1px solid var(--coral-mid);
  background: var(--coral-light);
  border-radius: var(--radius-md);
  padding: 1.1rem;
}

.hria-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid rgba(244, 93, 72, 0.15);
  padding-bottom: 0.4rem;
}

.hria-header h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--coral);
}

.hria-score {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--leaf);
  letter-spacing: -0.02em;
}

.hria-risks {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.risk-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.risk-item__title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}

.risk-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.risk-badge--high { background: rgba(220, 38, 38, 0.1); color: var(--color-error); }
.risk-badge--med  { background: var(--coral-light); color: var(--coral); }
.risk-badge--low  { background: var(--leaf-light); color: var(--leaf-deep); }

.risk-item__mitigation {
  font-size: 0.75rem;
  color: var(--ink-soft);
  line-height: 1.3;
}

.subsidy-amount {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--leaf-deep);
  letter-spacing: -0.04em;
  margin-top: 0.25rem;
}

.subsidy-card__badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--leaf-light);
  color: var(--leaf-deep);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.subsidy-card__footer {
  margin-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.subsidy-card__source {
  font-family: var(--font-mono);
  color: var(--leaf-deep);
  letter-spacing: 0.08em;
}

.financial-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* ── KPI grid — usado en tabs geo, clima, financiero ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.kpi-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.22s ease, transform 0.22s var(--ease-spring);
}

.kpi-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--leaf);
}

.kpi-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-float);
}

.kpi-item--highlight::before { background: var(--coral); }
.kpi-item--highlight .kpi-value { color: var(--coral); }

.kpi-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-muted);
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.04em;
  line-height: 1;
}

/* ── Chart container ── */
.chart-container {
  position: relative;
  height: 180px;
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

/* ── Payback callout — banner financiero destacado ── */
.payback-callout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.payback-callout__card {
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.payback-callout__card--main {
  background: var(--leaf-light);
  border: 1px solid rgba(7, 128, 128, 0.2);
}

.payback-callout__card--alt {
  background: var(--coral-light);
  border: 1px solid rgba(244, 93, 72, 0.2);
}

.payback-callout__label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}

.payback-callout__value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
}

.payback-callout__card--main .payback-callout__value { color: var(--leaf-deep); }
.payback-callout__card--alt  .payback-callout__value { color: var(--coral); }

.payback-callout__sub {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

/* ── Agent status bar ── */
.agent-status-bar {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.65rem 1.5rem 0.7rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-warm);
}

/* Cabecera IA */
.agent-bar-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--leaf);
  letter-spacing: 0.06em;
}

.agent-bar-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  animation: agent-hex-spin 4s linear infinite;
}

.agent-bar-label {
  font-weight: 600;
}

.agent-bar-cursor {
  animation: agent-cursor-blink 0.85s step-end infinite;
  font-size: 9px;
  opacity: 1;
  margin-left: -0.2em;
}

.agent-bar-count {
  margin-left: auto;
  font-size: 10px;
  color: var(--ink-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* Chips row */
.agent-status-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* Chip base */
.agent-status {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.22rem 0.55rem 0.22rem 0.42rem;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: color 0.3s, background 0.3s, border-color 0.3s;
  color: var(--ink-muted);
  background: transparent;
}

.agent-status__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line-strong);
  flex-shrink: 0;
  transition: background 0.3s;
}

/* Estado: cargando */
.agent-status--loading {
  color: var(--leaf);
  background: rgba(7, 128, 128, 0.07);
  border-color: rgba(7, 128, 128, 0.25);
}
.agent-status--loading .agent-status__dot {
  background: var(--leaf);
  animation: teal-pulse 1.1s ease-in-out infinite;
}
/* Puntos animados tras el label durante carga */
.agent-status--loading .agent-status__label::after {
  content: '';
  display: inline-block;
  width: 1.4em;
  overflow: hidden;
  vertical-align: bottom;
  animation: agent-dots 1.6s steps(4, end) infinite;
}

/* Estado: completado */
.agent-status--done {
  color: var(--leaf-deep);
  background: rgba(7, 128, 128, 0.04);
  border-color: rgba(7, 128, 128, 0.15);
}
.agent-status--done .agent-status__dot {
  background: var(--leaf);
}
/* Tick visual en el dot al completar */
.agent-status--done .agent-status__dot {
  width: 9px;
  height: 9px;
  background: none;
  border: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 9 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 4.5L3.8 7 7.5 2' stroke='%23078080' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
}

/* Estado: error */
.agent-status--error {
  color: var(--coral);
  background: rgba(244, 93, 72, 0.06);
  border-color: rgba(244, 93, 72, 0.2);
}
.agent-status--error .agent-status__dot {
  background: var(--coral);
  width: 5px;
  height: 5px;
}

/* Animaciones */
@keyframes agent-hex-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes agent-cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

@keyframes agent-dots {
  0%  { content: '';    }
  25% { content: '.';   }
  50% { content: '..';  }
  75% { content: '...'; }
}

/* ── Skeleton loaders ── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface) 25%,
    var(--bg-warm) 50%,
    var(--surface) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: 6px;
  height: 1.25rem;
  width: 80%;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── empty-message ── */
.empty-message {
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-style: italic;
  text-align: center;
  padding: 1.5rem 0;
}

/* ── Sección Proyectos Europeos ── */
.eu-section {
  margin-top: 1.5rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.eu-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.eu-section__label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #1d4ed8;
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.eu-section__label::before {
  content: '★';
  font-size: 9px;
  color: #f59e0b;
}

.eu-section__max {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  color: #1d4ed8;
  letter-spacing: -0.03em;
}

.eu-projects-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.eu-card {
  padding: 0.9rem 1.1rem;
  background: rgba(29, 78, 216, 0.04);
  border: 1px solid rgba(29, 78, 216, 0.15);
  border-left: 3px solid #1d4ed8;
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, background 0.2s;
}

.eu-card:hover {
  background: rgba(29, 78, 216, 0.07);
  border-color: rgba(29, 78, 216, 0.3);
}

.eu-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.eu-card__name {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  flex: 1;
}

.eu-card__pct {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  background: rgba(29, 78, 216, 0.1);
  color: #1d4ed8;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
}

.eu-card__desc {
  font-size: 0.76rem;
  color: var(--ink-soft);
  line-height: 1.35;
  margin-bottom: 0.35rem;
}

.eu-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.71rem;
  color: var(--ink-muted);
}

.eu-card__status {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 0.12rem 0.35rem;
  border-radius: 3px;
  background: rgba(16, 185, 129, 0.1);
  color: #065f46;
  letter-spacing: 0.06em;
}

.eu-card__ods {
  display: flex;
  gap: 0.3rem;
}

.eu-ods-badge {
  font-size: 9px;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  background: rgba(29, 78, 216, 0.08);
  color: #1d4ed8;
  font-family: var(--font-mono);
}

/* ── Company save button ── */
.save-company-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: var(--leaf-light);
  border-bottom: 1px solid rgba(7, 128, 128, 0.12);
}

.save-company-btn {
  padding: 0.5rem 1.1rem;
  background: var(--leaf);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-base);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s var(--ease-spring);
}

.save-company-btn:hover {
  background: var(--leaf-deep);
  transform: translateY(-1px);
}

.save-company-btn--saved {
  background: var(--surface);
  color: var(--leaf-deep);
  border: 1px solid rgba(7, 128, 128, 0.3);
}

.save-company-label {
  font-size: 0.8rem;
  color: var(--leaf-deep);
  font-weight: 500;
}

.tab-content-container::-webkit-scrollbar { width: 4px; }
.tab-content-container::-webkit-scrollbar-track { background: transparent; }
.tab-content-container::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }

/* ══════════════════════════════════════════════
   WIZARD DE DATOS — overlay sobre la página
   ══════════════════════════════════════════════ */
.estudio-wizard {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 26, 23, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in 0.3s ease-out both;
}

.estudio-wizard.wizard--hidden {
  animation: fade-out 0.28s ease-in forwards;
  pointer-events: none;
}

@keyframes fade-out {
  to { opacity: 0; }
}

.estudio-wizard__card {
  width: 520px;
  max-width: calc(100vw - 2rem);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0,0,0,0.22);
  overflow: hidden;
  animation: panel-reveal 0.4s var(--ease-expo, cubic-bezier(0.16, 1, 0.3, 1)) both;
}

.wizard-header {
  padding: 2rem 2rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.wizard-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--leaf);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.wizard-eyebrow::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 1.5px;
  background: var(--leaf);
  border-radius: 1px;
}

.wizard-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.wizard-subtitle {
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

/* Tabs internos del wizard */
.wizard-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
}

.wizard-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.9rem 1rem;
  font-family: var(--font-base);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.wizard-tab:hover { color: var(--ink); }

.wizard-tab.active {
  color: var(--leaf-deep);
  border-bottom-color: var(--leaf);
}

/* Paneles del wizard */
.wizard-panel {
  display: none;
  padding: 1.5rem 2rem;
  flex-direction: column;
  gap: 1.1rem;
}

.wizard-panel.active { display: flex; }

.wizard-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.wizard-field label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

.wizard-input {
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-base);
  font-size: 0.9rem;
  color: var(--ink);
  transition: border-color 0.2s;
  width: 100%;
}

.wizard-input:focus {
  outline: none;
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(7,128,128,0.1);
}

.wizard-hint {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

/* Área de carga PDF */
.wizard-upload-area {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-md);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.wizard-upload-area:hover,
.wizard-upload-area.drag-over {
  border-color: var(--leaf);
  background: var(--leaf-light);
}

.wizard-upload-icon { font-size: 2rem; margin-bottom: 0.5rem; }

.wizard-upload-text {
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.wizard-upload-text small { font-size: 0.75rem; color: var(--ink-muted); }

.wizard-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* Status de análisis de factura */
.wizard-invoice-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--leaf-light);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--leaf-deep);
}

.wizard-invoice-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(7,128,128,0.25);
  border-top-color: var(--leaf);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.wizard-invoice-result {
  background: var(--leaf-light);
  border: 1px solid rgba(7,128,128,0.2);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
}

.wizard-invoice-result__row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 0.2rem 0;
}

.wizard-invoice-result__label { color: var(--ink-soft); }

.wizard-invoice-result__value {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--leaf-deep);
}

.wizard-invoice-result__confidence {
  margin-top: 0.4rem;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.wizard-privacy-note {
  font-size: 0.72rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

.wizard-privacy-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  background: var(--leaf-light);
  color: var(--leaf-deep);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  vertical-align: middle;
}

/* Acciones del wizard */
.wizard-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--line);
  background: var(--bg-warm);
}

.wizard-skip {
  background: transparent;
  border: none;
  font-family: var(--font-base);
  font-size: 0.82rem;
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 0.2s;
}

.wizard-skip:hover { color: var(--ink); }

.wizard-submit {
  padding: 0.7rem 1.75rem;
  background: var(--leaf);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-base);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.25s var(--ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1));
}

.wizard-submit:hover {
  background: var(--leaf-deep);
  transform: translateY(-2px);
}

.wizard-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ══════════════════════════════════════════════
   PESTANA RENOVABLES — Agente 6
   ══════════════════════════════════════════════ */

/* Tarjeta renovable principal */
.renew-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
  transition: box-shadow 0.22s ease, transform 0.22s var(--ease-spring);
}

.renew-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-float);
}

.renew-card--compact {
  padding: 0.8rem 0.9rem;
  margin-bottom: 0;
}

.renew-card__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.renew-card__icon {
  color: var(--leaf);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.renew-card__title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  flex: 1;
}

.renew-card__title--sm {
  font-size: 0.8rem;
}

/* Badge de clasificacion */
.renew-card__badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--leaf-light);
  color: var(--leaf-deep);
  display: inline-block;
  margin-bottom: 0.4rem;
}

.renew-badge--excellent,
.renew-badge--high     { background: rgba(7, 128, 128, 0.15); color: var(--leaf-deep); }
.renew-badge--very-good { background: rgba(16, 185, 129, 0.12); color: #065f46; }
.renew-badge--good     { background: rgba(16, 185, 129, 0.08); color: #047857; }
.renew-badge--moderate { background: rgba(245, 158, 11, 0.12); color: #92400e; }
.renew-badge--low      { background: rgba(244, 93, 72, 0.10); color: #9a1b0f; }

.renew-badge--hydro-ok { background: rgba(29, 78, 216, 0.10); color: #1d4ed8; }
.renew-badge--hydro-no { background: rgba(100, 116, 139, 0.10); color: #475569; }

/* Metricas dentro de la tarjeta */
.renew-card__metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.renew-metric {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.renew-metric__label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}

.renew-metric__value {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  color: var(--leaf-deep);
  letter-spacing: -0.03em;
  line-height: 1;
}

/* Descripcion textual dentro de la tarjeta */
.renew-card__desc {
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.4;
  margin: 0 0 0.6rem;
}

.renew-card__desc--sm { font-size: 0.73rem; margin-bottom: 0.4rem; }

/* Fuente de datos */
.renew-card__source {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border-top: 1px solid var(--line);
  padding-top: 0.5rem;
  margin-top: 0.1rem;
}

.renew-source-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}

.renew-source-link {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--leaf);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.15s;
}

.renew-source-link:hover { color: var(--leaf-deep); text-decoration: underline; }

/* Grid 2 columnas para biomasa + mini-hidro */
.renew-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

/* Encabezados de seccion */
.renew-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 1rem 0 0.55rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}

.renew-section-header--mix {
  margin-top: 1.1rem;
}

.renew-section-title {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.renew-section-subtitle {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  text-align: right;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badge fuente ESIOS dentro del kpi-grid */
.renew-grid-source-badge .kpi-value {
  font-size: 0.75rem;
}

/* Mix recomendado */
.renew-mix-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.renew-mix-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s var(--ease-spring);
}

.renew-mix-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--leaf);
  border-radius: 0 2px 2px 0;
}

.renew-mix-card:nth-child(2)::before { background: #10b981; }
.renew-mix-card:nth-child(3)::before { background: var(--coral); }

.renew-mix-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-float);
}

.renew-mix-card__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.renew-mix-card__priority {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--leaf);
  background: var(--leaf-light);
  border-radius: 4px;
  padding: 1px 6px;
  letter-spacing: 0.04em;
}

.renew-mix-card:nth-child(2) .renew-mix-card__priority {
  color: #047857;
  background: rgba(16, 185, 129, 0.1);
}

.renew-mix-card:nth-child(3) .renew-mix-card__priority {
  color: var(--coral);
  background: var(--coral-light);
}

.renew-mix-card__tech {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.renew-mix-card__rationale {
  font-size: 0.76rem;
  color: var(--ink-soft);
  line-height: 1.4;
  margin: 0 0 0.3rem;
}

.renew-mix-card__lcoe {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  margin-top: 0.25rem;
}

/* ══════════════════════════════════════════════
   RESPONSIVE ESTUDIO — Tablet 769px–1024px
══════════════════════════════════════════════ */
@media (min-width: 769px) and (max-width: 1024px) {
  .analysis-sidebar {
    width: 380px;
  }
}

/* ══════════════════════════════════════════════
   RESPONSIVE ESTUDIO — Mobile ≤ 768px
══════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Main container stacks vertically */
  .estudio-container {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  /* 3D viewer becomes a fixed-height strip */
  .viewer-section {
    height: 55vw;
    min-height: 240px;
    max-height: 320px;
    flex-shrink: 0;
    width: 100%;
  }

  /* Sidebar goes full width below the viewer */
  .analysis-sidebar {
    width: 100%;
    height: auto;
    min-height: 0;
    overflow-y: visible;
    border-left: none;
    border-top: 1px solid var(--line-strong);
    box-shadow: none;
  }

  /* Mode button bar: horizontal scroll strip */
  .viewer-modes {
    /* anchor relative to the viewer-section instead of centering */
    left: 0.75rem;
    right: 0.75rem;
    transform: none;
    border-radius: var(--radius-sm);
    padding: 0.35rem;
    gap: 0.35rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    /* hide scrollbar visually */
    scrollbar-width: none;
  }
  .viewer-modes::-webkit-scrollbar { display: none; }

  .mode-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
    /* keep 44px touch target height */
    min-height: 40px;
  }

  /* Coordinates badge: smaller, tighter */
  .coordinates-badge {
    bottom: 0.75rem;
    left: 0.75rem;
    font-size: 9px;
    padding: 0.35rem 0.6rem;
    letter-spacing: 0.08em;
  }

  /* kWh chip: reposition so it doesn't clash with coordinates badge */
  .update-kwh-chip {
    bottom: 0.75rem;
    left: auto;
    right: 0.75rem;
    font-size: 10px;
    padding: 0.3rem 0.65rem;
  }

  /* LiDAR legend: smaller, full-width strip */
  .lidar-legend {
    bottom: 3rem;
    left: 0.75rem;
    right: 0.75rem;
    gap: 0.4rem;
    padding: 0.35rem 0.6rem;
    font-size: 9px;
  }

  /* Analysis hero banner: full width at bottom, shrink font */
  .analysis-hero {
    left: 1rem;
    right: 1rem;
    transform: none;
    white-space: normal;
    flex-wrap: wrap;
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    gap: 0.5rem;
    justify-content: center;
  }
  .analysis-hero__value  { font-size: 0.95rem; }
  .analysis-hero__label  { font-size: 8px; }
  @keyframes hero-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Sidebar header */
  .sidebar-header { padding: 1rem 1rem 0.75rem; }
  .sidebar-header__title { font-size: 1.1rem; }

  /* Agent tabs: allow horizontal scroll if labels overflow */
  .agent-tabs {
    overflow-x: auto;
    scrollbar-width: none;
  }
  .agent-tabs::-webkit-scrollbar { display: none; }
  .tab-btn {
    min-width: 64px;
    font-size: 0.75rem;
    padding: 0.8rem 0.5rem;
    flex-shrink: 0;
  }

  /* Tab content area */
  .tab-content-container { padding: 1rem; }

  /* KPI grids: stay 2-col on mobile (they're already small) */
  .kpi-grid { gap: 0.5rem; }

  /* Financial details grid: 1 col on very narrow */
  .financial-details { grid-template-columns: 1fr; gap: 0.75rem; }

  /* Renew grid 2: stack vertically */
  .renew-grid-2 { grid-template-columns: 1fr; }

  /* Wizard card */
  .estudio-wizard__card { width: calc(100vw - 1.5rem); }
  .wizard-header { padding: 1.5rem 1.25rem 1rem; }
  .wizard-panel  { padding: 1.25rem 1.25rem; }
  .wizard-actions { padding: 1rem 1.25rem; }
  .wizard-title { font-size: 1.2rem; }

  /* Agent status bar: ajuste móvil */
  .agent-status-bar {
    padding: 0.5rem 1rem;
    gap: 0.4rem;
  }
  .agent-status-chips {
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  /* Save company bar */
  .save-company-bar { padding: 0.6rem 1rem; flex-wrap: wrap; }

  /* Payback callout: keep 2 col but smaller values */
  .payback-callout__value { font-size: 1.6rem; }
}

/* ── Selector de edificios del historial ── */
.building-switcher {
  position: absolute;
  bottom: 44px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  min-width: 175px;
}
.building-switcher__toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(14, 12, 10, 0.80);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 7px;
  color: #e8e4dc;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s;
  width: 100%;
}
.building-switcher__toggle:hover { background: rgba(30, 26, 22, 0.92); }
.building-switcher__caret { margin-left: auto; opacity: 0.6; }
.building-switcher__dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: rgba(20, 18, 14, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 7px;
  overflow: hidden;
  max-height: 220px;
  overflow-y: auto;
}
.building-switcher__loading,
.building-switcher__empty {
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(232,228,220,0.5);
  text-align: center;
}
.building-switcher__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.15s;
}
.building-switcher__item:last-child { border-bottom: none; }
.building-switcher__item:hover { background: rgba(7,128,128,0.15); }
.building-switcher__item--active { background: rgba(7,128,128,0.10); }
.building-switcher__item-name {
  font-family: var(--font-base);
  font-size: 10.5px;
  color: #e8e4dc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 115px;
}
.building-switcher__item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.building-switcher__item-date {
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(232,228,220,0.45);
  white-space: nowrap;
  flex-shrink: 0;
}
.building-switcher__btn-select {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(7,128,128,0.5);
  background: transparent;
  color: #6bc;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.building-switcher__btn-select:hover {
  background: rgba(7,128,128,0.25);
  color: #8df;
}
.building-switcher__btn-select:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ── Tab subtítulos ── */
.tab-btn__sub {
  display: block;
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 64px;
}
.tab-btn.active .tab-btn__sub { color: var(--leaf); }

/* ── Mapas de calor solar y relieve ── */
.geo-maps-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
  margin-bottom: 4px;
}
.geo-map-card {
  background: var(--bg-warm);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.geo-map-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.geo-map-card__title {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}
.geo-heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--ink-muted);
}
.geo-heatmap-grad {
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(to right, #fde68a, #f97316, #dc2626);
}
.geo-map-canvas {
  width: 100%;
  aspect-ratio: 10 / 7;
  border-radius: 4px;
  display: block;
  background: var(--bg-warm);
}
.geo-map-caption {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--ink-muted);
  text-align: center;
  letter-spacing: 0.04em;
}

/* ── Leaflet mini-map (geo tab) ── */
.geo-location-map {
  width: 100%;
  aspect-ratio: 10 / 7;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-warm);
  min-height: 100px;
}

/* ── Territorio / municipio strip ── */
.geo-territory {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-warm);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.geo-territory__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.geo-territory__label {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.geo-territory__value {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 480px) {
  .geo-territory { grid-template-columns: 1fr 1fr; }
}

/* ── IA Gestora de Trámites ── */
.ia-tramites {
  margin-top: 16px;
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--leaf);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ia-tramites__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ia-tramites__title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--leaf);
}
.ia-tramites__badge {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
  padding: 2px 7px;
  border-radius: 999px;
}
.ia-tramites__desc {
  font-size: 0.8rem;
  color: var(--ink-muted);
  line-height: 1.4;
}
.ia-tramites__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ia-tramites__btn {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-base);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background 0.18s, border-color 0.18s, transform 0.18s;
}
.ia-tramites__btn:hover {
  background: var(--leaf-light);
  border-color: var(--leaf);
  color: var(--leaf-deep);
  transform: translateX(3px);
}
.ia-tramites__output {
  margin-top: 2px;
}
.ia-email-draft {
  background: var(--bg-warm);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.ia-email-draft__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(7, 128, 128, 0.06);
  border-bottom: 1px solid var(--line);
}
.ia-email-draft__badge {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--leaf);
  letter-spacing: 0.08em;
}
.ia-email-draft__copy {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  color: var(--leaf);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}
.ia-email-draft__copy:hover { background: rgba(7,128,128,0.1); }
.ia-email-draft__field {
  display: flex;
  gap: 6px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  align-items: flex-start;
}
.ia-email-draft__field > span { color: var(--ink-muted); min-width: 46px; flex-shrink: 0; }
.ia-email-draft__field > strong { color: var(--ink); font-weight: 500; }
.ia-email-draft__body {
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  max-height: 240px;
  overflow-y: auto;
}
.ia-email-draft__note {
  padding: 6px 10px;
  font-size: 0.72rem;
  color: var(--ink-muted);
  border-top: 1px solid var(--line);
  font-style: italic;
  margin: 0;
}

/* ══════════════════════════════════════════════
   RESPONSIVE ESTUDIO — Small mobile ≤ 480px
══════════════════════════════════════════════ */
@media (max-width: 480px) {
  .viewer-section {
    height: 50vw;
    min-height: 220px;
    max-height: 280px;
  }

  .mode-btn { padding: 0.45rem 0.7rem; font-size: 0.77rem; }

  .sidebar-header__title { font-size: 1rem; }

  .tab-btn { font-size: 0.72rem; min-width: 56px; }

  .tab-content-container { padding: 0.85rem; }

  .kpi-value { font-size: 1.1rem; }

  .payback-callout { grid-template-columns: 1fr; }
  .payback-callout__value { font-size: 1.75rem; }

  .analysis-hero {
    bottom: 0.75rem;
    padding: 0.6rem 0.75rem;
  }
  .analysis-hero__kpi { padding: 0 0.75rem; }
}

/* ── No-building screen ── */
.no-building-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: 2rem 1rem;
  background: var(--bg-warm);
}
.no-building-card {
  max-width: 480px;
  width: 100%;
  padding: 2.5rem 2rem;
  border-radius: var(--radius-lg, 16px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.no-building-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--leaf-light, rgba(7,128,128,0.08));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--leaf);
  margin-bottom: 0.25rem;
}
.no-building-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.03em;
  margin: 0;
}
.no-building-desc {
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0;
}
.no-building-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  margin-top: 0.5rem;
}
.no-building-btn {
  display: block;
  width: 100%;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm, 8px);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.no-building-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.no-building-btn--primary {
  background: var(--leaf);
  color: #fff;
}
.no-building-btn--ghost {
  background: transparent;
  border: 1px solid var(--line-strong, #c8c0b0);
  color: var(--ink-soft);
}
.no-building-demo {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin: 0;
}
.no-building-demo-link {
  color: var(--leaf);
  text-decoration: underline;
  text-underline-offset: 2px;
}

