/* =====================================================
   GENERADOR DE INFORMES INMOBILIARIOS - PREMIUM STYLES
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:wght@600;700&display=swap');

:root {
  /* FONDO Y SUPERFICIES - blancos y grises muy claros */
  --bg-primary: #f0f4f2;
  --bg-secondary: #e8eeeb;
  --bg-card: #ffffff;
  --bg-card-hover: #f7faf8;
  --bg-input: #f5f8f6;
  --border: #d0dcd6;
  --border-hover: #9bbcae;

  /* ACENTO PISTACHO - verde suave del logo */
  --accent: #7aab8a;
  --accent-light: #95c4a3;
  --accent-glow: rgba(122, 171, 138, 0.18);
  --accent-dark: #5a8a6a;

  /* PRIMARIO AZUL GRISACEO - del logo */
  --blue: #4a6e7e;
  --blue-light: #6a90a2;
  --blue-glow: rgba(74, 110, 126, 0.15);

  /* VERDE PISTACHO VIVO - para positivos */
  --green: #6db88a;
  --green-light: #85cfa3;
  --green-glow: rgba(109, 184, 138, 0.12);

  --red: #d95f5f;
  --red-light: #e87a7a;

  /* TEXTOS - sobre fondo claro */
  --text-primary: #1e2e28;
  --text-secondary: #4a6358;
  --text-muted: #8aaa9a;

  --shadow-sm: 0 2px 8px rgba(60,90,75,0.08);
  --shadow-md: 0 4px 20px rgba(60,90,75,0.12);
  --shadow-lg: 0 8px 40px rgba(60,90,75,0.16);
  --shadow-accent: 0 4px 20px rgba(122,171,138,0.2);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: 0.2s ease;

  /* REPORT COLORS RESTORED */
  --report-navy: #1a1a2e;
  --report-gold: #c5a059;
  --report-pistacho: #7aab8a;
  --report-gray: #f8fafc;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* BACKGROUND PATTERN */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 10%, rgba(122,171,138,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 80% 80%, rgba(74,110,126,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ======================== LAYOUT ======================== */

.app-container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ======================== HEADER ======================== */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-logo-img {
  height: 110px;
  width: auto;
  object-fit: contain;
}

.logo-text h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--report-navy-dark, #1a2744);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.logo-text p {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ======================== TABS ======================== */

.tabs-bar {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: 36px;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  min-width: 140px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.tab-btn.active {
  background: var(--report-navy-dark, #1a2744);
  color: white;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(26,39,68,0.3);
}

/* ======================== TIPO SELECTOR ======================== */

.tipo-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.metric-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 120px;
}

.tipo-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.tipo-btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.tipo-btn.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 20px rgba(201,168,76,0.1);
}

.tipo-icon {
  font-size: 28px;
  margin-bottom: 4px;
}

.tipo-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.tipo-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.tipo-btn.active .tipo-label { color: var(--accent-light); }

.hab-preview {
  background: var(--green-glow);
  border: 1px solid rgba(62,207,142,0.2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--green-light);
  margin-top: 12px;
}

.tab-btn .tab-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  font-size: 11px;
  font-weight: 700;
}

.tab-btn.active .tab-number {
  background: rgba(0,0,0,0.2);
}

/* ======================== TAB PANELS ======================== */

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ======================== CARDS ======================== */

.card {
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  transition: border-color var(--transition);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--report-navy-dark, #1a2744) 0%, var(--accent, #7aab8a) 100%);
  opacity: 0.8;
}

.card:hover { border-color: var(--border-hover); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title .icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.icon-gold { background: var(--accent-glow); }
.icon-blue { background: var(--blue-glow); }
.icon-green { background: var(--green-glow); }

/* ======================== FORM GRID ======================== */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.form-grid.grid-1 { grid-template-columns: 1fr; }
.form-grid.grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid.grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid.grid-loc { grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr 1.5fr; }
.form-grid.grid-chars { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .form-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important; }
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.span-2 { grid-column: span 2; }
.form-group.span-3 { grid-column: span 3; }
.form-group.span-4 { grid-column: span 4; }

label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

input, select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 10px 14px;
  transition: all var(--transition);
  outline: none;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }

select option { background: var(--bg-card); color: var(--text-primary); }

.input-prefix {
  position: relative;
}

.input-prefix input { padding-left: 30px; }
.input-prefix span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.input-suffix {
  position: relative;
}
.input-suffix input { padding-right: 40px; }
.input-suffix span {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}

/* TOGGLE */
.toggle-group {
  display: flex;
  gap: 8px;
}

.toggle-btn {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.toggle-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.toggle-btn.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent-light); }

/* ======================== BUTTONS ======================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--report-navy-dark, #1a2744);
  color: white;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(26,39,68,0.25);
}

.btn-primary:hover {
  background: #2a3b5a;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(26,39,68,0.35);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.btn-danger {
  background: rgba(240,82,82,0.1);
  border: 1px solid rgba(240,82,82,0.3);
  color: var(--red);
}
.btn-danger:hover { background: rgba(240,82,82,0.2); }

.btn-success {
  background: linear-gradient(135deg, #3ecf8e, #52e0a0);
  color: #0d0f14;
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(62,207,142,0.3); }

.btn-lg { padding: 14px 28px; font-size: 15px; border-radius: var(--radius-md); }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-icon { width: 36px; height: 36px; padding: 0; }

/* ======================== COMPARABLES ======================== */

.comparable-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 12px;
  position: relative;
  transition: all var(--transition);
}

.comparable-item:hover { border-color: var(--border-hover); }

.comparable-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.comparable-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 3px 10px;
  border-radius: 20px;
}

.comparable-price-badge {
  font-size: 16px;
  font-weight: 700;
  color: var(--blue-light);
}

/* ======================== STATS / METRICS ======================== */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 150px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: transparent;
  transition: background 0.3s ease;
}

.metric-card:hover::after {
  background: var(--accent);
}

.metric-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.metric-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
}

.metric-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--blue);
  line-height: 1;
}

.metric-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.optimist-value {
  color: var(--accent) !important;
  font-weight: 800;
}

.prudente-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

.optimist-label {
  color: var(--accent);
}

.neta-dual-content {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-top: 8px;
}

.neta-item {
  flex: 1;
}

.neta-val-small {
  font-size: 20px !important;
}

.neta-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

/* MINI CARDS PARA SECCIONES PLEGADAS */
.mini-card {
  padding: 0 !important;
  border-color: #e2e8f0 !important;
  background: #fcfdfd !important;
  margin-bottom: 12px !important;
}

.mini-card .card-header {
  padding: 12px 18px !important;
  background: none !important;
}

.mini-card .collapse-icon {
  font-size: 10px;
  opacity: 0.5;
}

#val-gestion-auto {
  text-shadow: 0 0 10px var(--accent-glow);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { opacity: 0.8; }
  50% { opacity: 1; }
  100% { opacity: 0.8; }
}

/* ======================== RENTABILITY TABLE ======================== */

.rent-table {
  width: 100%;
  border-collapse: collapse;
}

.rent-table th {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 2px solid var(--report-border);
}

.rent-table td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--report-navy);
  border-bottom: 1px solid var(--report-border);
}

.rent-table tr:hover td { background: rgba(0,0,0,0.01); }

.rent-table .row-total td {
  font-weight: 800;
  font-size: 14px;
  background: var(--report-gray);
  border-bottom: 2px solid var(--report-navy);
}

.rent-table .row-section td {
  font-size: 11px;
  font-weight: 800;
  color: white;
  background: var(--report-navy-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 16px;
}

.rent-table .value-positive { color: var(--green); font-weight: 700; }
.rent-table .value-negative { color: var(--red); font-weight: 700; }
.rent-table .value-accent { color: var(--report-gold); font-weight: 800; }

/* ======================== COMPARABLES TABLE ======================== */

.comp-table { width: 100%; border-collapse: collapse; }
.comp-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.comp-table td {
  padding: 11px 14px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(42,47,66,0.5);
  vertical-align: middle;
}
.comp-table tr:hover td { background: rgba(255,255,255,0.02); }
.comp-table .highlight-row td { background: rgba(201,168,76,0.05); border-color: rgba(201,168,76,0.15); }

/* ======================== PROGRESS INDICATOR ======================== */

.progress-bar-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 32px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ======================== BADGES ======================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-green { background: var(--green-glow); color: var(--green-light); border: 1px solid rgba(62,207,142,0.2); }
.badge-red { background: rgba(240,82,82,0.1); color: var(--red-light); border: 1px solid rgba(240,82,82,0.2); }
.badge-gold { background: var(--accent-glow); color: var(--accent-light); border: 1px solid rgba(201,168,76,0.2); }
.badge-blue { background: var(--blue-glow); color: var(--blue-light); border: 1px solid rgba(74,143,255,0.2); }

/* ======================== SECTION SEPARATOR ======================== */

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ======================== DIVIDER ======================== */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ======================== ALERT ======================== */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
}

.alert-info { background: var(--blue-glow); border: 1px solid rgba(74,143,255,0.2); color: var(--blue-light); }
.alert-success { background: var(--green-glow); border: 1px solid rgba(62,207,142,0.2); color: var(--green-light); }
.alert-warning { background: var(--accent-glow); border: 1px solid rgba(201,168,76,0.2); color: var(--accent-light); }

/* ======================== REPORT PREVIEW ======================== */

#report-panel {
  position: relative;
}

.report-preview-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.report-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.report-actions h2 {
  font-size: 17px;
  font-weight: 700;
}

/* ======================== THE PRINTABLE REPORT ======================== */

#printable-report {
  background: white;
  color: #1a1a2e;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  font-family: 'Inter', sans-serif;
  width: 297mm;
  margin: 0 auto;
}

.report-page {
  width: 297mm;
  min-height: 210mm;
  padding: 0;
  background: white;
  position: relative;
  page-break-after: always;
  overflow: hidden;
}

.report-inner {
  padding: 40px 50px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 2px solid #1a2744;
  padding-bottom: 12px;
  margin-bottom: 30px;
}

.page-header-title {
  font-size: 18px;
  font-weight: 800;
  color: #1a2744;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.page-header-logo {
  font-size: 10px;
  font-weight: 700;
  color: #8892aa;
  letter-spacing: 2px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.detail-item {
  border: 1px solid #eef0f5;
  border-radius: 8px;
  padding: 12px 16px;
}

.detail-item.highlight {
  background: #fcf9f2;
  border-color: #f1e4c7;
}

.d-label {
  font-size: 9px;
  font-weight: 700;
  color: #8892aa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.d-value {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}

.report-table th {
  background: #f8fafc;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid #edf2f7;
}

.report-table td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid #edf2f7;
}

.report-table .section-row td {
  background: #f1f5f9;
  font-weight: 700;
  font-size: 11px;
  color: #475569;
  padding: 6px 12px;
}

.report-table .total-row td {
  font-weight: 800;
  background: #f8fafc;
  border-top: 2px solid #1a2744;
  font-size: 14px;
}

.report-table .negative { color: #c0392b; font-weight: 600; }
.report-table .positive { color: #1a7c50; font-weight: 600; }
.report-table .gold { color: #9a7c32; font-weight: 700; }

.obs-section {
  border-left: 4px solid #c9a84c;
  background: #fbfbfb;
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
}

.obs-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: #9a7c32;
  margin-bottom: 8px;
}

.obs-text { font-size: 13px; line-height: 1.6; color: #3a3a5c; }

.obs-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.obs-tag {
  background: white;
  border: 1px solid #eef0f5;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #1a2744;
}

.rent-summary-box {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: #edf2f7;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 20px;
}

.rent-summary-item {
  background: white;
  padding: 20px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rent-summary-item.featured {
  background: #1a2744;
  color: white;
}

.rs-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: #8892aa;
}

.featured .rs-label { color: rgba(255,255,255,0.6); }

.rs-value {
  font-size: 22px;
  font-weight: 800;
}

.featured .rs-value { color: #c9a84c; }

.rs-sub { font-size: 10px; color: #9aa0b4; }

.report-footer {
  padding: 20px 50px;
  border-top: 1px solid #eef0f5;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #9aa0b4;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* COVER PAGE */
.report-cover {
  background: linear-gradient(160deg, #0d1b2a 0%, #1a2744 40%, #0d2a1f 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-height: 210mm;
}

.report-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(201,168,76,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 10% 80%, rgba(62,207,142,0.08) 0%, transparent 60%);
}

.cover-top {
  padding: 40px 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.cover-logo {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.cover-date {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

.cover-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 50px;
  position: relative;
  z-index: 1;
}

.cover-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #c9a84c;
  border: 1px solid rgba(201,168,76,0.4);
  background: rgba(201,168,76,0.1);
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 24px;
  width: fit-content;
}

.cover-title {
  font-family: 'Playfair Display', serif;
  font-size: 42px;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 8px;
  color: white;
}

.cover-subtitle {
  font-size: 18px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 40px;
  font-weight: 300;
}

.cover-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin-top: auto;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  overflow: hidden;
  max-width: 600px;
}

.cover-metric {
  padding: 20px 24px;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(4px);
}

.cover-metric:not(:last-child) { border-right: 1px solid rgba(255,255,255,0.1); }

.cover-metric label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 6px;
}

.cover-metric .val {
  font-size: 22px;
  font-weight: 800;
  color: white;
}

.cover-metric .val.gold { color: #c9a84c; }
.cover-metric .val.green { color: #3ecf8e; }

.cover-bottom {
  padding: 30px 50px;
  border-top: 1px solid rgba(255,255,255,0.08);
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cover-confidence {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

/* REPORT INNER PAGES */
.report-inner {
  background: #f8f9fb;
  padding: 40px 50px;
}

.report-inner .page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 2px solid #e8eaf0;
  margin-bottom: 30px;
}

.page-header-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a2e;
}

.page-header-logo {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #c9a84c;
  text-transform: uppercase;
}

/* PROPERTY DETAILS SECTION */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.detail-item {
  background: white;
  border: 1px solid #e8eaf0;
  border-radius: 8px;
  padding: 14px 16px;
}

.detail-item .d-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9aa0b4;
  margin-bottom: 4px;
}

.detail-item .d-value {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
}

.detail-item.highlight { border-color: #c9a84c; background: #fffbf0; }
.detail-item.highlight .d-value { color: #9a7c32; }

/* REPORT TABLES */
.report-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.report-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
  background: #1a1a2e;
  padding: 11px 14px;
  text-align: left;
}
.report-table td {
  padding: 11px 14px;
  font-size: 13px;
  color: #1a1a2e;
  border-bottom: 1px solid #e8eaf0;
}
.report-table tr:nth-child(even) td { background: #f4f5f8; }
.report-table .total-row td {
  font-weight: 700;
  font-size: 14px;
  background: #fffbf0 !important;
  border-top: 2px solid #c9a84c;
  color: #9a7c32;
}
.report-table .section-row td {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
  background: #2d3a6b !important;
  padding: 8px 14px;
}
.report-table .positive { color: #1a7c50; font-weight: 700; }
.report-table .negative { color: #c0392b; font-weight: 600; }
.report-table .gold { color: #9a7c32; font-weight: 700; }

/* RENTABILITY SUMMARY BOX */
.rent-summary-box {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.rent-summary-item {
  background: white;
  border: 1px solid #e8eaf0;
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rent-summary-item.featured {
  background: linear-gradient(135deg, #1a2744, #0d2a1f);
  border-color: #c9a84c;
  color: white;
}

.rent-summary-item .rs-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9aa0b4;
}

.rent-summary-item.featured .rs-label { color: rgba(255,255,255,0.5); }

.rent-summary-item .rs-value {
  font-size: 28px;
  font-weight: 800;
  color: #1a1a2e;
}

.rent-summary-item.featured .rs-value { color: #c9a84c; }

.rent-summary-item .rs-sub {
  font-size: 12px;
  color: #9aa0b4;
}
.rent-summary-item.featured .rs-sub { color: rgba(255,255,255,0.5); }

/* CHART PLACEHOLDER */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 80px;
  margin: 16px 0;
}

.bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.bar-fill {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #c9a84c, #9a7c32);
  transition: height 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.bar-subject .bar-fill { background: linear-gradient(180deg, #3ecf8e, #1a9962); }

.bar-label { font-size: 9px; color: #9aa0b4; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bar-value { font-size: 10px; font-weight: 700; color: #1a1a2e; }

/* OBSERVATIONS */
.obs-section {
  background: white;
  border: 1px solid #e8eaf0;
  border-left: 3px solid #c9a84c;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.obs-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #9a7c32; margin-bottom: 8px; }
.obs-text { font-size: 13px; color: #3a3a5c; line-height: 1.6; }
.obs-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.obs-tag { background: #f0f2f8; padding: 3px 10px; border-radius: 20px; font-size: 12px; color: #3a3a5c; font-weight: 500; }

/* FOOTER */
.report-footer {
  background: #1a1a2e;
  color: rgba(255,255,255,0.4);
  padding: 16px 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

/* ======================== EMPTY STATE ======================== */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ======================== SCROLL ANIMATION ======================== */

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

/* ======================== TOOLTIPS ======================== */

[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #0d0f14;
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 100;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ======================== SCROLLBAR ======================== */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ======================== RESPONSIVE UTILITIES ======================== */

.grid-loc { grid-template-columns: 2fr 1fr 1fr 1fr; }
.grid-chars { grid-template-columns: repeat(4, 1fr); }
.grid-econ { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 1024px) {
  .grid-loc { grid-template-columns: 1fr 1fr; }
  .grid-chars { grid-template-columns: repeat(3, 1fr); }
  .grid-econ { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .form-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .cover-metrics { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .tipo-selector { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .metrics-grid { grid-template-columns: 1fr !important; }
  .form-grid, .grid-loc, .grid-chars, .grid-econ, .grid-2 { grid-template-columns: 1fr !important; }
  .form-group.span-2, .form-group.span-3, .form-group.span-4 { grid-column: span 1 !important; }
  .tabs-bar { gap: 2px; }
  .tab-btn { font-size: 11px; padding: 8px 10px; min-width: 100px; }
  .app-header { flex-direction: column; gap: 16px; align-items: flex-start; }
  .header-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .header-actions .btn:last-child { grid-column: span 2; }
  
  /* Report Preview scaling for mobile */
  .report-preview-container {
    overflow-x: auto;
    padding: 12px;
  }
  #printable-report {
    transform: scale(0.45);
    transform-origin: top left;
    width: 297mm; /* Mantener fijo para que el escalado funcione */
    margin-bottom: -150mm; /* Compensar espacio vacío del escalado */
  }
}

/* ======================== REPORT SYSTEM (MULTI-PAGE) ======================== */

:root {
  --report-bg: #ffffff;
  --report-navy: #4a6e7e; /* Azul grisáceo corporativo */
  --report-navy-dark: #1a2744;
  --report-pistacho: #7aab8a; /* Verde pistacho corporativo */
  --report-gray: #f8fafc;
  --report-border: #e2e8f0;
  --report-text-muted: #94a3b8;
}

#printable-report {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  background: #f1f5f9;
  padding: 60px 0;
  gap: 60px;
}

.report-page {
  background: white;
  width: 297mm;
  height: 210mm;
  margin: 40px auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Sidebar for internal pages */
.report-page.with-sidebar {
  padding-left: 12mm; /* Ensure content doesn't touch the 6mm sidebar */
}

.report-page.with-sidebar::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6mm;
  background-color: var(--report-navy);
  z-index: 10;
}

/* PORTADA Y SECCIÓN */
.report-cover-v2 {
  display: flex;
  flex-direction: column;
}

.cover-header-bar {
  height: 80px;
  background: linear-gradient(90deg, var(--report-navy-dark) 0%, var(--report-navy) 100%);
  display: flex;
  align-items: center;
  padding: 0 60px;
  color: white;
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  font-weight: 700;
  border-bottom: 5px solid var(--report-pistacho);
}

.cover-body {
  flex: 1;
  position: relative;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  padding: 0 80px;
}

.cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0.7) 40%, transparent 100%);
}

.cover-content {
  position: relative;
  z-index: 5;
  width: 45%;
}

.info-box {
  background: white;
  padding: 35px;
  border-radius: 4px;
  box-shadow: 20px 20px 60px rgba(0,0,0,0.05);
  border-left: 8px solid var(--report-pistacho);
  border-top: 1px solid #f0f0f0;
  margin-bottom: 20px;
}

.info-line {
  margin-bottom: 12px;
  font-size: 17px;
  color: #475569;
}

.info-line strong {
  color: var(--report-navy);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 1px;
  display: block;
  margin-bottom: 2px;
}

.cover-property-photo {
  position: absolute;
  right: 80px;
  top: 50%;
  transform: translateY(-50%);
  width: 500px;
  height: 420px;
  border-radius: 2px;
  background-size: cover;
  background-position: center;
  box-shadow: 40px 40px 80px rgba(26,39,68,0.3);
  z-index: 10;
  border: 10px solid white;
}

.cover-footer {
  height: 100px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 80px;
  border-top: 1px solid #f1f5f9;
}

.signature-name {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-style: italic;
  color: var(--report-navy);
  border-bottom: 2px solid var(--report-pistacho);
}

/* PAGINAS INTERNAS */
.report-inner-v2 {
  display: flex;
  flex-direction: column;
  padding: 30px 60px;
  padding-bottom: 90px;
  background: radial-gradient(circle at top right, #fcfdfe 0%, #ffffff 100%);
}

.report-section-header {
  font-family: 'Playfair Display', serif;
  background: none;
  color: var(--report-navy-dark);
  padding: 0;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.report-section-header::after {
  content: '';
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--report-pistacho) 0%, transparent 100%);
}

.report-section-grid {
  background: white;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
  display: grid;
  padding: 30px;
  margin-bottom: 40px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.02);
}

.report-data-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f8fafc;
  font-size: 14px;
}

.report-data-item:last-child { border: none; }
.report-data-item span { color: #94a3b8; font-weight: 600; text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px; }
.report-data-item strong { color: var(--report-navy-dark); font-weight: 700; }

/* REFORMA GRID */
.reforma-report-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.reforma-col {
  background: white;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.02);
}

.reforma-col-title {
  background: var(--report-navy);
  padding: 12px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: white;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.reforma-col-content {
  padding: 15px;
  font-size: 13px;
  line-height: 1.6;
  color: #64748b;
}

/* FOOTER INTERNO */
.report-internal-footer {
  position: absolute;
  bottom: 25px;
  left: 60px;
  right: 60px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-marker {
  font-size: 10px;
  font-weight: 700;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.page-marker strong { color: var(--report-pistacho); font-size: 13px; margin-left: 5px; }

/* IMAGEN MERCADO */
.market-image-full {
  width: 100%;
  height: 520px;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 4px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 30px 60px rgba(0,0,0,0.1);
}

/* IA PAGE */
.ia-quote-box {
  margin: auto;
  max-width: 90%;
  padding: 40px 60px;
  background: white;
  border-radius: 4px;
  position: relative;
  box-shadow: 30px 30px 80px rgba(0,0,0,0.03);
  border-top: 4px solid var(--report-pistacho);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ia-quote-box::before {
  content: '“';
  position: absolute;
  top: -40px;
  left: 30px;
  font-family: 'Playfair Display', serif;
  font-size: 140px;
  color: var(--report-pistacho);
  line-height: 1;
  opacity: 0.15;
}

.ia-text {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.85;
  color: #334155;
  font-weight: 400;
}

.report-metrics-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: start;
}

.report-metrics-split .rent-table {
  background: white;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.02);
}


/* PRINT STYLES RESTORED TO PORTRAIT */
@media print {
  @page {
    size: A4 landscape;
    margin: 0;
  }
  body { background: white !important; }
  .report-page {
    width: 297mm;
    height: 210mm;
    page-break-after: always;
    box-shadow: none;
    margin: 0;
  }
  #printable-report { padding: 0; gap: 0; background: white; }
}

/* ======================== RESPONSIVE MOBILE ======================== */
@media (max-width: 900px) {
  .app-header { flex-direction: column; text-align: center; gap: 16px; padding: 20px 10px; }
  .logo { flex-direction: column; text-align: center; }
  .logo-text h1 { font-size: 20px; }
  .header-actions { flex-wrap: wrap; justify-content: center; }
  
  .form-grid { grid-template-columns: 1fr !important; }
  .grid-loc, .grid-chars, .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr !important; }
  
  .tabs-bar { flex-wrap: wrap; justify-content: center; }
  .tab-btn { flex: 1 1 auto; padding: 12px 10px; font-size: 13px; }
  
  .tipo-selector { flex-direction: column; display: flex; gap: 12px; }
  .card { padding: 16px; margin-bottom: 16px; }
  .app-container { padding: 0 10px 80px; }
  
  /* Report Preview scaling for mobile */
  .report-preview-container { overflow-x: auto; padding: 10px; }
  #printable-report { transform: scale(0.35); transform-origin: top center; margin-bottom: -1300px; }
  
  /* Login Screen */
  #login-overlay > div { width: 90% !important; padding: 30px 20px !important; }
}

@media (max-width: 600px) {
  #printable-report { transform: scale(0.28); margin-bottom: -1500px; }
}
