/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Material Design Palette — Stitch-inspired */
:root {
  --bg: #f0f4f9;
  --bg-subtle: #e8ecf1;
  --card-bg: #ffffff;
  --text: #1d1b20;
  --text-secondary: #49454f;
  --text-tertiary: #79747e;
  --accent: #0b57d0;
  --accent-light: #d3e3fd;
  --accent-dark: #0842a0;
  --green: #1e8e3e;
  --green-bg: #e6f4ea;
  --red: #d93025;
  --red-bg: #fce8e6;
  --border: #c4c7c5;
  --border-light: #e1e3e1;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --font: 'Google Sans', 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Google Sans Mono', 'Geist Mono', 'SF Mono', 'Fira Code', monospace;
  --blue: #1a73e8;
  --yellow: #f9ab00;
}

[data-theme="dark"] {
  --bg: #1b1b1f;
  --bg-subtle: #2b2b30;
  --card-bg: #2d2d32;
  --text: #e6e1e5;
  --text-secondary: #c4c0c8;
  --text-tertiary: #938f96;
  --accent: #a8c7fa;
  --accent-light: #1a2740;
  --accent-dark: #7cacf8;
  --green: #81c995;
  --green-bg: #1a2e1f;
  --red: #f28b82;
  --red-bg: #3c2020;
  --border: #444449;
  --border-light: #3a3a3f;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow: 0 2px 6px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.15);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
}

[data-theme="light"] {
  --bg: #f0f4f9;
  --bg-subtle: #e8ecf1;
  --card-bg: #ffffff;
  --text: #1d1b20;
  --text-secondary: #49454f;
  --text-tertiary: #79747e;
  --accent: #0b57d0;
  --accent-light: #d3e3fd;
  --accent-dark: #0842a0;
  --green: #1e8e3e;
  --green-bg: #e6f4ea;
  --red: #d93025;
  --red-bg: #fce8e6;
  --border: #c4c7c5;
  --border-light: #e1e3e1;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

/* Cotizaciones Strip */
.cotizaciones-strip {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-light);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cotizaciones-strip::-webkit-scrollbar { display: none; }
.cotizaciones-strip.loaded { display: flex; }
.cotizaciones-strip-inner {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  justify-content: center;
}
.cotiz-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 20px;
  border-right: 1px solid var(--border-light);
  min-width: 0;
  flex-shrink: 0;
}
.cotiz-item:last-child { border-right: none; }
.cotiz-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.cotiz-price {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
@media (max-width: 600px) {
  .cotizaciones-strip-inner { justify-content: flex-start; }
  .cotiz-item { padding: 4px 12px; }
  .cotiz-price { font-size: 0.7rem; }
}

/* News Ticker */
.news-ticker {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-light);
  overflow: hidden;
  white-space: nowrap;
  height: 30px;
  display: none;
  align-items: center;
  position: relative;
}
.news-ticker-close {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: 0.7rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  line-height: 1;
  padding: 0;
  transition: background 0.15s;
}
.news-ticker-close:hover { color: var(--accent); border-color: var(--accent); }
.news-ticker-track {
  display: inline-flex;
  gap: 0;
  animation: tickerScroll 200s linear infinite;
  will-change: transform;
}
.news-ticker-track:hover { animation-play-state: paused; }
.news-ticker-item {
  display: inline-flex;
  align-items: center;
  padding: 0 32px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s;
  font-weight: 500;
}
.news-ticker-item:hover { color: var(--accent); }
/* hover handled above */
.news-ticker-item::before {
  content: '>';
  margin-right: 6px;
  font-size: 0.6rem;
  color: var(--accent);
  font-weight: 700;
}
.news-ticker-source {
  font-weight: 700;
  color: var(--accent);
  margin-right: 6px;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
[data-theme="dark"] .news-ticker {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

/* Mundo Detail Modal */
.mundo-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.mundo-modal {
  background: var(--card-bg);
  border-radius: 28px;
  border: 1px solid var(--border-light);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  position: relative;
}
.mundo-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.mundo-modal-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.mundo-modal-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.mundo-modal-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.mundo-modal-price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.mundo-modal-price {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  font-family: var(--font);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.mundo-modal-change {
  font-size: 0.85rem;
  font-weight: 600;
}
.mundo-modal-date {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  height: 14px;
  visibility: visible;
}
.mundo-modal-date:empty {
  visibility: hidden;
}
.mundo-modal-tabs {
  display: flex;
  gap: 4px;
}
.mundo-range-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.mundo-range-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.mundo-range-btn:hover:not(.active) {
  background: var(--border);
}
.mundo-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  margin-left: 8px;
}
.mundo-modal-close:hover { color: var(--text); }
.mundo-modal-body {
  padding: 16px 20px 20px;
  min-height: 200px;
  position: relative;
}
.mundo-modal-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-tertiary);
  font-size: 0.85rem;
  display: none;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.logo {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.04em;
  cursor: pointer;
}

.currency-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-subtle);
  border-radius: 24px;
  padding: 4px;
  overflow: hidden;
}

.currency-tab {
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 20px;
  width: auto;
  text-align: center;
  justify-content: center;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.currency-tab.active {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.currency-tab.disabled {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
}
.currency-tab[data-soon]::after {
  content: 'soon';
  position: absolute;
  top: -6px;
  right: -4px;
  font-size: 0.45rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent);
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1.3;
}

.chart-wrapper {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chart-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chart-logo {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
}
.chart-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}
.chart-bar-wrap {
  flex: 1;
  min-width: 0;
}
.chart-bar {
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  min-width: 60px;
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.chart-row:first-child .chart-bar {
  height: 32px;
  border-radius: 8px;
}
.chart-value {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.chart-row:first-child .chart-value {
  font-size: 0.85rem;
}

/* LECAP Table */
.lecap-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--card-bg);
}
.lecap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  white-space: nowrap;
  table-layout: auto;
}
.lecap-table thead {
  background: var(--bg-subtle);
  color: var(--accent);
}
.lecap-table th {
  padding: 8px 12px;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: right;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.lecap-table th:hover, .soberanos-table th:hover, .cer-table th:hover { color: rgba(255,255,255,0.7); }
[data-theme="dark"] .lecap-table th:hover, [data-theme="dark"] .soberanos-table th:hover, [data-theme="dark"] .cer-table th:hover { color: rgba(255,255,255,0.7); }
.lecap-table th .sort-arrow, .soberanos-table th .sort-arrow, .cer-table th .sort-arrow { font-size: 0.6rem; margin-left: 3px; opacity: 0.4; }
.lecap-table th .sort-arrow.active, .soberanos-table th .sort-arrow.active, .cer-table th .sort-arrow.active { opacity: 1; color: var(--accent); }
.calc-hint { font-size: 0.75rem; color: var(--text-tertiary); margin-bottom: 8px; }
.calc-hint span { background: var(--accent-light); color: var(--accent); padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; }
.lecap-table th:first-child { text-align: left; }
.lecap-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-light);
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.lecap-table td:first-child {
  text-align: left;
  font-weight: 600;
}
/* Column widths */
.lecap-table .col-ticker { width: 18%; }
.lecap-table .col-precio { width: 11%; }
.lecap-table .col-pago { width: 13%; }
.lecap-table .col-dias { width: 7%; }
.lecap-table .col-vto { width: 14%; }
.lecap-table .col-tna { width: 12%; }
.lecap-table .col-tem { width: 12%; }
.lecap-table .col-tir { width: 13%; }
.lecap-table tbody tr {
  background: var(--card-bg);
}
.lecap-table tbody tr:hover {
  background: var(--bg-subtle);
}
.lecap-table tbody tr:last-child td {
  border-bottom: none;
}
.lecap-table .lecap-ticker {
  font-weight: 700;
  color: var(--accent);
}
.lecap-table td.mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.lecap-table .lecap-tir,
.soberanos-table .lecap-tir {
  font-weight: 700;
  color: var(--green);
}
.lecap-table .lecap-tna {
  font-weight: 600;
}
.lecap-table .lecap-tem {
  font-weight: 600;
}
.lecap-type-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}
.lecap-type-badge.lecap { background: var(--green-bg); color: var(--green); }
.lecap-type-badge.boncap { background: var(--accent-light); color: var(--accent); }
[data-theme="dark"] .lecap-type-badge.lecap { background: var(--green-bg); color: var(--green); }
[data-theme="dark"] .lecap-type-badge.boncap { background: var(--accent-light); color: var(--accent); }
.lecap-table .highlighted-row td {
  background: rgba(59, 130, 246, 0.06);
}
[data-theme="dark"] .lecap-table .highlighted-row td {
  background: rgba(59, 130, 246, 0.1);
}

/* Scatter Plot */
.scatter-plot {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 8px;
  height: 420px;
  box-shadow: var(--shadow-sm);
}

.spread-positive { color: #ef4444; font-weight: 600; }
.spread-negative { color: var(--green); font-weight: 600; }

/* Soberanos Table */
.soberanos-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border-light); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--card-bg); }
.soberanos-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; white-space: nowrap; table-layout: fixed; }
.soberanos-table thead { background: var(--bg-subtle); color: var(--accent); }
.soberanos-table th { padding: 8px 12px; font-weight: 600; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; text-align: right; }
.soberanos-table th:first-child, .soberanos-table th:nth-child(2) { text-align: left; }
.soberanos-table td { padding: 7px 12px; border-bottom: 1px solid var(--border-light); text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.soberanos-table td:first-child, .soberanos-table td:nth-child(2) { text-align: left; }
.soberanos-table tbody tr { background: var(--card-bg); }
.soberanos-table tbody tr:hover { background: var(--bg-subtle); }
.soberanos-table tbody tr:last-child td { border-bottom: none; }
.soberano-ticker { font-weight: 700; color: var(--accent); margin-right: 6px; }
.soberano-ley { font-size: 0.6rem; padding: 2px 6px; border-radius: 4px; font-weight: 600; vertical-align: middle; }
.soberano-ley.ley-local { background: #fef7e0; color: #b06000; }
.soberano-ley.ley-ny { background: var(--accent-light); color: var(--accent); }
[data-theme="dark"] .soberano-ley.ley-local { background: #3a3000; color: #ffd600; }
[data-theme="dark"] .soberano-ley.ley-ny { background: var(--accent-light); color: var(--accent); }
.soberano-ytm { font-weight: 700; }

.admin-link {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid var(--border-light);
  border-radius: 20px;
  transition: all 0.15s;
  font-weight: 500;
}

.admin-link:hover {
  border-color: var(--text);
}

/* Auth Area */
.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.auth-user {
  display: flex;
  align-items: center;
  gap: 6px;
}
.auth-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
}
.auth-logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-tertiary);
  font-family: var(--font);
  padding: 2px 4px;
}
.auth-logout-btn:hover { color: var(--red); }

/* Portfolio */
.portfolio-google-btn {
  display: inline-flex;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--accent);
  border-radius: 24px;
  padding: 10px 24px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}
.portfolio-google-btn:hover { background: var(--accent-light); border-color: var(--accent-dark); }
.portfolio-add-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}
.portfolio-add-btn:hover { opacity: 0.9; }

/* Portfolio Summary Cards */
.portfolio-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.portfolio-summary-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.portfolio-summary-card .label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.portfolio-summary-card .value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 900px) {
  .portfolio-summary-card .value { font-size: 0.9rem; }
}

/* Portfolio Holdings Table */
.portfolio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 16px;
}
.portfolio-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.portfolio-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.portfolio-table tr:hover td {
  background: var(--bg-subtle);
}
.portfolio-table .col-actions {
  text-align: right;
  white-space: nowrap;
}
.portfolio-table .col-actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  font-size: 0.85rem;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.portfolio-table .col-actions button:hover { opacity: 1; }

/* Portfolio Modal */
.portfolio-modal-step { margin-bottom: 16px; }
.portfolio-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.portfolio-type-btn {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font);
  transition: all 0.15s;
}
.portfolio-type-btn:hover { border-color: var(--accent); background: var(--accent-light); }
.portfolio-type-btn.selected { border-color: var(--accent); background: var(--accent-light); }
.portfolio-type-btn .emoji { font-size: 1.3rem; display: block; margin-bottom: 4px; }

/* Cashflow Table */
.cashflow-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 12px;
}
.cashflow-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
}
.cashflow-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
}
.cashflow-month-header {
  background: var(--bg-subtle);
  font-weight: 700;
  font-size: 0.85rem;
}
.cashflow-month-header td { padding: 10px !important; }

/* Portfolio TC Toggle */
.portfolio-tc-btn {
  background: none;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
  white-space: nowrap;
}
.portfolio-tc-btn.active {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.portfolio-tc-btn:hover:not(.active) { color: var(--text); }

/* Portfolio empty state */
.portfolio-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
}
.portfolio-empty .emoji { font-size: 2.5rem; margin-bottom: 12px; }
.portfolio-empty p { font-size: 0.85rem; }

/* Operations Modal */
.ops-modal { max-width: 480px; }
.ops-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px;
  background: var(--bg-subtle);
  border-radius: 4px;
  border: 1px solid var(--border);
}
.ops-summary-item { flex: 1; text-align: center; }
.ops-label { display: block; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); font-weight: 600; margin-bottom: 2px; }
.ops-value { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.ops-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-bottom: 16px;
}
.ops-table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
}
.ops-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-light); }
.ops-buy td:nth-child(2) { color: var(--green); font-weight: 600; }
.ops-sell td:nth-child(2) { color: var(--red); font-weight: 600; }
.ops-add-section {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.ops-type-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.ops-type-btn {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  background: var(--card-bg);
  color: var(--text-secondary);
  transition: all 0.15s;
}
.ops-type-buy.active { background: rgba(0, 230, 118, 0.15); border-color: var(--green); color: var(--green); }
.ops-type-sell.active { background: rgba(255, 59, 59, 0.15); border-color: var(--red); color: var(--red); }
.ops-type-btn:hover { border-color: var(--text-secondary); }
.ops-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.ops-field label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.ops-field input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
}
.ops-badge {
  display: inline-block;
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-subtle);
  color: var(--text-tertiary);
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}
@media (max-width: 600px) {
  .ops-form-row { grid-template-columns: 1fr 1fr; }
  .ops-summary { flex-wrap: wrap; }
}

/* Theme Toggle */
.theme-toggle {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  transition: all 0.15s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--border);
}

.theme-toggle svg,
.flag svg,
.icon-logo,
.icon-hint {
  display: inline-block;
  vertical-align: middle;
}

/* Subnav */
.subnav {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.subnav-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.subnav-inner::-webkit-scrollbar { display: none; }

.subnav-tab {
  text-decoration: none;
  padding: 10px 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.subnav-tab:hover:not(.active):not(.disabled) {
  color: var(--text-secondary);
}

.subnav-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.subnav-tab.disabled {
  opacity: 0.3;
  pointer-events: none;
}

.subnav-tab:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Hero */
.hero {
  max-width: 780px;
  margin: 0 auto;
  padding: 16px 24px 8px;
}

.hero h1 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 6px;
  color: var(--text);
  text-transform: none;
}

.hero p {
  color: var(--text-tertiary);
  font-size: 0.75rem;
  max-width: 480px;
  line-height: 1.4;
}

/* Container */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* Sections */
.section {
  margin-top: 20px;
}

.section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
}

.section-desc {
  color: var(--text-tertiary);
  font-size: 0.72rem;
  margin-bottom: 12px;
}

.risk-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

/* Card List */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Fund Card */
.fund-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.fund-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.fund-card.highlighted {
  border-color: var(--accent);
  background: var(--accent-light);
}

.fund-card.promoted {
  border: 1.5px solid var(--accent);
}


/* Logo */
.fund-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.65rem;
  flex-shrink: 0;
  overflow: hidden;
}

.fund-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

/* Info */
.fund-info {
  flex: 1;
  min-width: 0;
}

.fund-name {
  font-weight: 650;
  font-size: 0.9rem;
  letter-spacing: -0.015em;
}

.fund-entity {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.fund-description {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.4;
}

.fund-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tag {
  font-size: 0.65rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.tag.type {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.tag.limit {
  background: var(--red-bg);
  color: var(--red);
}

.tag.limit.no-limit {
  background: var(--green-bg);
  color: var(--green);
}

.tag.category {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.tag.billetera {
  background: var(--red-bg);
  color: var(--red);
}

/* Rate */
.fund-rate {
  text-align: right;
  flex-shrink: 0;
  min-width: 100px;
}

.rate-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: -0.03em;
  font-family: var(--font-mono);
  line-height: 1;
}

.rate-label {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.rate-date {
  font-size: 0.63rem;
  color: var(--text-tertiary);
  margin-top: 1px;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-tertiary);
  font-size: 0.82rem;
}

.loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Footer */
.footer {
  max-width: 780px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
}

.footer p + p { margin-top: 4px; }
.visit-counter { margin-bottom: 12px; font-size: 1.1rem; font-weight: 600; color: var(--accent); letter-spacing: 0.02em; }

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #d4d4d8;
  border-radius: 11px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* Buttons */
.btn {
  padding: 10px 24px;
  border: none;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover { opacity: 0.85; }

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
}

.btn-danger:hover { background: #fee2e2; }

.btn-sm {
  padding: 4px 10px;
  font-size: 0.72rem;
}

/* Compare Page */
.compare-selectors {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.compare-select-group {
  flex: 1;
  min-width: 200px;
}

.compare-select-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.compare-select-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-family: var(--font);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
}

.compare-select-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* Mundo Monitor */
.mundo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.mundo-col {
  display: contents;
}
.mundo-group-header {
  grid-column: 1 / -1;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 8px 12px 4px;
}
.mundo-group-header:first-child {
  padding-top: 6px;
}
.mundo-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card-bg);
  cursor: pointer;
  transition: background 0.1s;
}
.mundo-card:hover {
  background: var(--hover-bg, rgba(255,255,255,0.03));
}
.mundo-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.7;
}
.mundo-info {
  flex: 1;
  min-width: 0;
}
.mundo-name {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mundo-group-tag { display: none; }
.mundo-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font);
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.mundo-spark {
  flex-shrink: 0;
  width: 60px;
  height: 24px;
}
.mundo-spark canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.spark-dot {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: sparkPulse 1.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sparkPulse {
  0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.3; transform: translate(-50%, -50%) scale(1.8); }
}
.mundo-change {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  min-width: 50px;
  justify-content: flex-end;
}
.mundo-arrow {
  font-size: 0.55rem;
}

/* Mundo Mobile — single column, larger fonts */
@media (max-width: 600px) {
  .mundo-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1px;
  }
  .mundo-col {
    display: contents;
  }
  .mundo-card {
    padding: 10px 14px;
    gap: 10px;
  }
  .mundo-icon {
    font-size: 1.1rem;
  }
  .mundo-info {
    flex: 1;
    min-width: 0;
  }
  .mundo-name {
    font-size: 0.72rem;
  }
  .mundo-price {
    font-size: 1.1rem;
  }
  .mundo-spark {
    flex: 0 0 auto;
    width: 108px;
    height: 28px;
  }
  .mundo-change {
    font-size: 0.8rem;
    min-width: 52px;
  }
  .mundo-arrow {
    font-size: 0.5rem;
  }
  .mundo-group-header {
    padding: 10px 14px 4px;
    font-size: 0.6rem;
    font-size: 0.5rem;
    border: none;
  }
}

/* Hot US Movers */
.hot-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 18px 0 10px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.hot-subtitle {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-secondary);
}
.hot-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.hot-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  min-width: 220px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.hot-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.hot-rank {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-secondary);
  min-width: 18px;
}
.hot-info {
  flex: 1;
  min-width: 0;
}
.hot-symbol {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.hot-name {
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.hot-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font);
}
.hot-change {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
  min-width: 55px;
}
.hot-arrow {
  font-size: 0.7rem;
}

/* Soon badge */
.soon-badge {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--red);
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  vertical-align: super;
  margin-left: 2px;
}
.admin-link.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

#chart-container {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.compare-details {
  margin-top: 24px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.compare-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--bg-subtle);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.compare-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.compare-table td:first-child {
  font-family: var(--font);
  font-weight: 500;
  color: var(--text-secondary);
}

/* Focus styles */
.fund-card:focus-visible,
.mundo-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.currency-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 6px;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mundo-range-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Smooth section transitions */
[role="tabpanel"] {
  animation: fadeIn 0.2s ease-out;
}

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

/* Selection color */
::selection {
  background: var(--accent);
  color: #fff;
}

/* ─── AI Chat Home (Claude-style) ─── */
.chat-home {
  display: none;
  min-height: calc(100vh - 120px);
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.chat-home.active {
  display: flex;
}

.chat-home-center {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.chat-home-logo {
  opacity: 0.9;
  margin-bottom: 4px;
}

.chat-home-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.chat-home-sub {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  text-align: center;
  max-width: 420px;
  line-height: 1.5;
}

.chat-home-input-wrap {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-top: 8px;
  transition: border-color 0.2s;
}

.chat-home-input-wrap:focus-within {
  border-color: var(--text-tertiary);
}

.chat-home-messages {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px 8px;
  max-height: 400px;
  overflow-y: auto;
}

.chat-home-messages.has-messages {
  display: flex;
}

.chat-home-input-box {
  display: flex;
  align-items: center;
  gap: 0;
}

.chat-home-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  padding: 16px;
  font-family: var(--font);
  outline: none;
}

.chat-home-input::placeholder {
  color: var(--text-tertiary);
}

.chat-home-send {
  background: none;
  border: none;
  color: var(--text-tertiary);
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  flex-shrink: 0;
}

.chat-home-send:hover {
  color: var(--accent);
}

.chat-home-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.chat-home-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 4px;
}

.chat-suggestion {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}

.chat-suggestion:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Chat messages (shared) */
.chat-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: chatFadeIn 0.25s ease;
}

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

.chat-msg.user {
  flex-direction: row-reverse;
}

.chat-msg-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.55;
}

.chat-msg.user .chat-msg-bubble {
  background: var(--accent);
  color: #000;
  font-weight: 500;
  border-radius: 12px 12px 2px 12px;
}

.chat-msg.assistant .chat-msg-bubble {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px 12px 12px 2px;
}

.chat-msg.assistant .chat-msg-bubble strong {
  color: var(--accent);
  font-weight: 700;
}

.chat-msg.assistant .chat-msg-bubble ul,
.chat-msg.assistant .chat-msg-bubble ol {
  padding-left: 16px;
  margin: 4px 0;
}

.chat-msg.assistant .chat-msg-bubble li {
  margin-bottom: 2px;
}

.chat-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 2px;
  width: fit-content;
}

.chat-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-tertiary);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}

.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Responsive */
@media (max-width: 640px) {
  .header-inner {
    padding: 8px 12px;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .header-inner::-webkit-scrollbar { display: none; }
  .logo { font-size: 0.8rem; white-space: nowrap; flex-shrink: 0; }
  .currency-tabs { flex-shrink: 0; gap: 0; padding: 2px; }
  .currency-tab { padding: 4px 8px; font-size: 0.65rem; width: auto; min-width: 0; }
  .currency-tab .flag { display: none; }
  .auth-area { display: none; }
  .auth-login-btn { font-size: 0.6rem; padding: 3px 6px; }
  .admin-link { display: none; }
  .portfolio-type-grid { grid-template-columns: repeat(2, 1fr); }
  .portfolio-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .subnav-inner { padding: 0 16px; gap: 16px; }
  .subnav-tab { font-size: 0.75rem; padding: 8px 0; }
  .hero { padding: 16px 16px 8px; }
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: 0.78rem; }
  .container { padding: 0 16px 60px; }
  .fund-card {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
  }
  .fund-logo { width: 32px; height: 32px; border-radius: 8px; font-size: 0.6rem; }
  .fund-logo img { border-radius: 8px; }
  .fund-name { font-size: 0.8rem; }
  .fund-entity { font-size: 0.68rem; }
  .fund-tags { gap: 3px; margin-top: 3px; }
  .tag { font-size: 0.58rem; padding: 1px 5px; }
  .rate-date { display: none; }
  .rate-label { font-size: 0.6rem; }
  .fund-rate {
    text-align: right;
    min-width: 70px;
  }
  .rate-value { font-size: 1.1rem; }
  .card-list .fund-card:first-child { padding: 14px 16px; }
  .card-list .fund-card:first-child .rate-value { font-size: 1.3rem; }
  .card-list .fund-card:first-child .fund-logo { width: 40px; height: 40px; }
  .card-list .fund-card:first-child .fund-name { font-size: 0.88rem; }
  /* Tables mobile - keep all columns, shrink font, allow horizontal scroll */
  .lecap-table, .soberanos-table, .cer-table { table-layout: auto; font-size: 0.65rem; white-space: nowrap; }
  .lecap-table th, .soberanos-table th, .cer-table th { padding: 6px 6px; font-size: 0.58rem; }
  .lecap-table td, .soberanos-table td, .cer-table td { padding: 5px 6px; }
  .lecap-type-badge { font-size: 0.5rem; padding: 1px 4px; margin-left: 4px; }
  .scatter-plot { height: 280px; }
  .footer { padding: 24px 16px 40px; }
  .foro-header { flex-direction: column; gap: 12px; }
  .foro-filters { flex-wrap: wrap; }
  .foro-thread-card { flex-direction: column; gap: 8px; }
  .foro-thread-right { flex-direction: row; gap: 6px; }
  .foro-replies-count { font-size: 1rem; }
}

/* ─── FORO ─────────────────────────────────────────────────── */
.foro-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.foro-filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.foro-filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.foro-filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.foro-filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.foro-new-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.foro-new-btn:hover { opacity: 0.85; }
.foro-login-hint { background: var(--bg-subtle); color: var(--text-secondary); border: 1px solid var(--border); }
.foro-login-hint:hover { border-color: var(--accent); color: var(--accent); }
.foro-thread-list { display: flex; flex-direction: column; gap: 2px; }
.foro-thread-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.foro-thread-card:hover { border-color: var(--accent); background: var(--bg-subtle); }
.foro-thread-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.foro-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-subtle);
}
.foro-avatar-sm { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; background: var(--bg-subtle); }
.foro-thread-info { min-width: 0; }
.foro-thread-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
}
.foro-thread-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 3px;
}
.foro-cat-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.foro-thread-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 50px;
}
.foro-replies-count { font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.foro-replies-label { font-size: 0.65rem; color: var(--text-secondary); }
.foro-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

/* Thread detail */
.foro-back-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 16px;
}
.foro-back-btn:hover { text-decoration: underline; }
.foro-thread-detail {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 24px;
}
.foro-thread-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.foro-thread-detail-title { margin: 0 0 4px; font-size: 1.2rem; }
.foro-thread-body { font-size: 0.92rem; line-height: 1.6; color: var(--text); }

/* Replies */
.foro-replies-section { margin-bottom: 20px; }
.foro-replies-section h3 { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 12px; }
.foro-reply {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 8px;
}
.foro-reply-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.82rem;
}
.foro-reply-time { color: var(--text-secondary); font-size: 0.75rem; }
.foro-reply-content { font-size: 0.88rem; line-height: 1.5; color: var(--text); }
.foro-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0.4;
  padding: 2px 4px;
  margin-left: auto;
}
.foro-delete-btn:hover { opacity: 1; }

/* Reply form */
.foro-reply-form { margin-top: 16px; }
.foro-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}
.foro-textarea:focus { outline: none; border-color: var(--accent); }
.foro-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  box-sizing: border-box;
}
.foro-input:focus { outline: none; border-color: var(--accent); }
.foro-submit-btn {
  margin-top: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.foro-submit-btn:hover { opacity: 0.85; }
.foro-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Calculator Modal */
.calc-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.calc-modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.calc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.calc-modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
}
.calc-modal-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}
.calc-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.calc-modal-close:hover { color: var(--text); }
.calc-modal-body {
  padding: 16px 20px;
}
.calc-row {
  margin-bottom: 12px;
}
.calc-row label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}
.calc-row input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.calc-row input:focus {
  outline: none;
  border-color: var(--accent);
}
.calc-results {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.calc-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.calc-result-row.total {
  font-weight: 700;
  color: var(--text);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 8px;
}
.calc-result-value {
  font-family: var(--font-mono);
  font-weight: 600;
}
.calc-result-value.positive { color: var(--green); }
.calc-result-value.negative { color: var(--red); }

/* ─── Fund Chart Panel ─── */
.fund-card-wrapper {
  cursor: pointer;
}
.fund-card-wrapper .fund-card {
  transition: border-color 0.2s;
}
.fund-card-wrapper:hover .fund-card {
  border-color: var(--accent);
}
.fund-chart-hint {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-align: right;
  margin-top: 4px;
  padding-right: 4px;
  opacity: 0.7;
}
.fund-chart-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  margin-top: -12px;
  padding: 0 16px;
}
.fund-chart-panel.expanded {
  max-height: 300px;
  padding: 16px;
}
.fund-chart-title {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.fund-chart-svg {
  width: 100%;
  height: 200px;
}
.fund-chart-svg .chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}
.fund-chart-svg .chart-area {
  fill: url(#chartGradient);
}
.fund-chart-svg .chart-axis {
  stroke: var(--border);
  stroke-width: 1;
}
.fund-chart-svg text {
  fill: var(--text-secondary);
  font-size: 10px;
}
.fund-chart-tooltip {
  position: absolute;
  background: var(--card-bg);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
}
.fund-chart-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  gap: 8px;
}
.fund-chart-loading .loading-spinner {
  width: 18px;
  height: 18px;
  border-width: 2px;
}
