/* InvestorIQ — components */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { color: var(--neg); }
.btn-danger:hover { background: var(--neg-soft); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2); cursor: pointer; font-size: 15px;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.sm { width: 24px; height: 24px; font-size: 12px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 16px 0; flex-wrap: wrap; }
.card-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); font-weight: 600; }
.card-sub { font-size: 12px; color: var(--text-3); }
.card-body { padding: 14px 16px 16px; }
.card-body.flush { padding: 10px 0 0; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-1); min-width: 0; }
.kpi-label { font-size: 12px; color: var(--text-2); }
.kpi-value { font-size: 20px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Toolbar, search, chips */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search { position: relative; flex: 0 1 280px; min-width: 180px; }
.search input, .input, select.input {
  width: 100%; height: 34px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.search input { padding-left: 30px; }
.search::before { content: "⌕"; position: absolute; left: 10px; top: 50%; transform: translateY(-52%); color: var(--text-3); font-size: 16px; }
.input:focus, .search input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 99px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  cursor: pointer; font-size: 13px; font-weight: 500;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip-sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 2px; }
.toolbar-count { color: var(--text-3); font-size: 13px; margin-left: auto; }

/* Data table */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data th, table.data td { padding: 9px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
table.data th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--text-2);
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  user-select: none;
}
table.data th.num, table.data td.num { text-align: right; }
table.data th.center, table.data td.center { text-align: center; }
table.data th.sortable { cursor: pointer; }
table.data th.sortable:hover { color: var(--text); }
table.data th[aria-sort="ascending"]::after { content: " ↑"; color: var(--accent); }
table.data th[aria-sort="descending"]::after { content: " ↓"; color: var(--accent); }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tr.row-link { cursor: pointer; }
table.data tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border-strong); border-bottom: 0; }
table.data .sticky-col { position: sticky; left: 0; z-index: 1; background: var(--surface); }
table.data th.sticky-col { z-index: 3; background: var(--surface-2); }
table.data tbody tr:hover td.sticky-col { background: var(--surface-2); }
.ticker { font-weight: 650; letter-spacing: 0.01em; }
.cell-sub { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 400; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.name-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; opacity: 0.55; }
tr:hover .row-actions, .row-actions:focus-within { opacity: 1; }
.price-cell { display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; }
.price-edit { width: 92px; height: 26px; text-align: right; padding: 0 6px; border: 1px solid var(--focus); border-radius: 4px; background: var(--surface); font-variant-numeric: tabular-nums; }

/* Tags, deltas, signals, scores */
.tag { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.fund { background: var(--fund-soft); color: var(--fund); }
.tag.pos { background: var(--pos-soft); color: var(--pos); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.signal {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 650; white-space: nowrap;
}
.signal i { font-style: normal; font-size: 9px; letter-spacing: -1px; }
.signal--strong { background: var(--strong-soft); color: var(--strong); }
.signal--positive { background: var(--pos-soft); color: var(--pos); }
.signal--neutral { background: var(--warn-soft); color: var(--warn); }
.signal--negative { background: var(--neg-soft); color: var(--neg); }
.signal--muted { background: var(--muted-soft); color: var(--text-3); }
.signal.lg { font-size: 14px; padding: 5px 12px; }

.score { display: inline-flex; align-items: center; gap: 7px; justify-content: flex-end; font-variant-numeric: tabular-nums; font-weight: 600; }
.score-bar { width: 36px; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.score-bar > i { display: block; height: 100%; border-radius: 2px; background: var(--text-3); }
.score.hi .score-bar > i { background: var(--pos); }
.score.mid .score-bar > i { background: var(--warn); }
.score.lo .score-bar > i { background: var(--neg); }

.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter.pos > i { background: var(--pos); }
.meter.warn > i { background: var(--warn); }
.meter.neg > i { background: var(--neg); }

/* Asset hero */
.asset-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: end; }
.hero-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hero-title h1 { font-size: 26px; }
.hero-name { font-size: 16px; color: var(--text-2); font-weight: 500; }
.hero-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.hero-actions { display: flex; gap: 8px; }
.stat-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.stat { padding: 12px 16px; border-right: 1px solid var(--border); min-width: 0; }
.stat:last-child { border-right: 0; }
.stat-label { font-size: 12px; color: var(--text-2); }
.stat-value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 3px; letter-spacing: -0.02em; white-space: nowrap; }
.stat-sub { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) { .stat-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } .stat:nth-child(3) { border-right: 0; } .stat:nth-child(-n+3) { border-bottom: 1px solid var(--border); } }
@media (max-width: 760px) {
  .asset-hero { grid-template-columns: minmax(0, 1fr); }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-right: 1px solid var(--border); }
  .stat:nth-child(2n) { border-right: 0; }
  .stat:nth-child(-n+4) { border-bottom: 1px solid var(--border); }
  .stat-value { font-size: 17px; }
}

/* Football field */
.ff { display: flex; flex-direction: column; gap: 10px; position: relative; }
.ff-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 84px; align-items: center; gap: 12px; font-size: 13px; }
.ff-label { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ff-track { position: relative; height: 22px; background: var(--surface-2); border-radius: 4px; }
.ff-range { position: absolute; top: 7px; height: 8px; border-radius: 4px; background: var(--accent-soft); border: 1px solid var(--accent); }
.ff-dot { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); }
.ff-dot.composite { background: var(--text); box-shadow: 0 0 0 1px var(--text); width: 14px; height: 14px; margin: -7px 0 0 -7px; }
.ff-price { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 2px dashed var(--neg); }
.ff-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.ff-row.disabled .ff-label, .ff-row.disabled .ff-value { color: var(--text-3); font-weight: 400; }
.ff-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-top: 6px; flex-wrap: wrap; }
.ff-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; background: var(--accent); }
.ff-legend .lg-price::before { border-radius: 0; width: 0; height: 12px; border-left: 2px dashed var(--neg); background: none; }
.ff-legend .lg-comp::before { background: var(--text); }
.ff-legend .lg-range::before { border-radius: 3px; width: 16px; height: 8px; background: var(--accent-soft); border: 1px solid var(--accent); }
@media (max-width: 480px) { .ff-row { grid-template-columns: 76px minmax(0, 1fr) 70px; gap: 8px; font-size: 12px; } }

/* Weights */
.weights { display: flex; flex-direction: column; gap: 12px; }
.weight-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 48px; gap: 12px; align-items: center; font-size: 13px; }
.weight-row output { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.weight-row.na label { color: var(--text-3); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.weights-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-2); padding-top: 4px; border-top: 1px solid var(--border); }

/* Score cards */
.score-head { display: flex; align-items: center; gap: 14px; }
.score-big { font-size: 34px; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.score-big small { font-size: 14px; color: var(--text-3); font-weight: 500; }
.score-summary { color: var(--text-2); font-size: 13px; margin-top: 10px; }
.factor-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.factor-table td { padding: 7px 0; border-top: 1px solid var(--border); vertical-align: middle; }
.factor-table td + td { padding-left: 10px; }
.factor-table .f-label { color: var(--text); }
.factor-table .f-help { display: block; color: var(--text-3); font-size: 11.5px; white-space: normal; max-width: 320px; }
.factor-table .f-val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.factor-table .f-bar { width: 32%; }
.factor-table .f-pts { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; width: 36px; }
.composite-formula { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text-2); overflow-x: auto; white-space: nowrap; }

/* Scenario table helpers */
.scn-bull { color: var(--pos); }
.scn-bear { color: var(--neg); }

/* Allocation bars */
.alloc { display: flex; flex-direction: column; gap: 9px; }
.alloc-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 54px; gap: 10px; align-items: center; font-size: 13px; }
.alloc-row span:last-child { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.field .unit { color: var(--text-3); }
.field-help { font-size: 11.5px; color: var(--text-3); }
.field-error { font-size: 11.5px; color: var(--neg); }
.field.invalid .input { border-color: var(--neg); }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); font-weight: 600; margin-bottom: 10px; padding: 0; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 140px; }
.inline-form .field.grow { flex: 2 1 220px; }
@media (max-width: 760px) { .form-grid, .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Modal */
dialog.modal {
  width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-2);
}
dialog.modal.sm { width: min(460px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(8, 12, 18, 0.55); }
.modal-form { display: flex; flex-direction: column; max-height: calc(100vh - 50px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 10px 10px; }

/* Toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: 6px; box-shadow: var(--shadow-2); font-size: 13px; animation: toast-in 0.18s ease-out; }
.toast.error { background: var(--neg); color: #fff; }
@keyframes toast-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Notices & empty */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 12.5px; }
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.empty { padding: 40px 16px; text-align: center; color: var(--text-2); }
.empty h3 { font-size: 15px; color: var(--text); margin-bottom: 6px; }

/* ETF */
.etf-search { display: flex; gap: 10px; flex-wrap: wrap; }
.etf-search .search { flex: 1 1 320px; max-width: 460px; }
.etf-search .search input { height: 42px; font-size: 16px; font-weight: 500; }
.etf-source { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.etf-arrow { color: var(--text-3); font-size: 18px; }
.etf-source .big { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }

/* Settings */
.settings-list { display: flex; flex-direction: column; gap: 10px; }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 10px; align-items: center; font-size: 13px; }
.kv .input { height: 30px; text-align: right; }
.data-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Responsive table columns */
@media (max-width: 1100px) { .hide-md { display: none; } }
@media (max-width: 760px) { .hide-sm { display: none; } table.data th, table.data td { padding: 8px 9px; } }
@media (max-width: 760px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 10px 12px; }
  .kpi-value { font-size: 17px; }
  .toolbar-count { margin-left: 0; }
}

/* ───────── Acceso, bienvenida y cuenta (modo nube) ───────── */
.notice.ok { background: var(--pos-soft); border-color: transparent; color: var(--pos); }
.notice.error { background: var(--neg-soft); border-color: transparent; color: var(--neg); }
.notice.info { background: var(--accent-soft); border-color: transparent; color: var(--text); }
.user-email { font-size: 12.5px; color: var(--text-2); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.is-auth .nav, body.is-auth #user-email, body.is-auth #logout-btn, body.is-auth .app-footer { display: none; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.auth-page { min-height: calc(100vh - 120px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 14px; }
.auth-card { width: 100%; max-width: 400px; padding: 28px 28px 22px; display: flex; flex-direction: column; gap: 14px; }
.auth-card.onboarding { max-width: 520px; }
.auth-card h1 { font-size: 22px; letter-spacing: -0.02em; margin: 0; }
.auth-sub { margin: -8px 0 0; font-size: 13.5px; }
.auth-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; letter-spacing: -0.02em; margin-bottom: 4px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form .input { text-align: left; height: 38px; font-size: 14px; }
.auth-submit { height: 40px; font-size: 14px; margin-top: 4px; }
.auth-check { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.auth-check input { margin-top: 2px; accent-color: var(--accent); }
.auth-links { display: flex; flex-direction: column; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); padding-top: 4px; }
.auth-legal { font-size: 12px; text-align: center; }
.onboarding-options { display: flex; flex-direction: column; gap: 10px; }
.onboarding-option { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.onboarding-option b { font-size: 14px; }
.onboarding-option span { font-size: 12.5px; color: var(--text-2); }
.onboarding-option:hover { border-color: var(--accent); }
.onboarding-option.is-primary { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.onboarding-option:disabled, .onboarding-option.is-disabled { opacity: .55; cursor: progress; }
.account-form { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 480px) { .auth-card { padding: 22px 18px 18px; } }

/* ───────── Introducción (tour de 3 pasos) ───────── */
dialog.modal.tour { width: min(520px, calc(100vw - 32px)); overflow: hidden; }
.tour-visual { min-height: 176px; padding: 26px 24px 20px; background: var(--surface-2); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.tour-body { padding: 20px 24px 6px; }
.tour-step { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); font-weight: 600; margin: 0 0 6px; }
.tour-body h2 { font-size: 20px; letter-spacing: -0.02em; margin: 0 0 8px; }
.tour-text { font-size: 14px; line-height: 1.55; color: var(--text-2); margin: 0; }
.tour-text b { color: var(--text); font-weight: 600; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px 20px; flex-wrap: wrap; }
.tour-dots { display: flex; gap: 6px; }
.tour-dot { width: 8px; height: 8px; border-radius: 50%; border: 0; padding: 0; background: var(--surface-3); cursor: pointer; }
.tour-dot.is-active { background: var(--accent); width: 20px; border-radius: 4px; }
.tour-actions { display: flex; gap: 8px; margin-left: auto; }
.tour-chip { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; }
.tour-chip.us { border-color: var(--accent); color: var(--accent); }
.tour-methods { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.tour-arrow { color: var(--text-3); font-size: 16px; line-height: 1; }
.tour-fv { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); font-size: 13px; color: var(--text-2); }
.tour-fv b { color: var(--pos); font-variant-numeric: tabular-nums; }
.tour-scores { width: min(300px, 100%); display: flex; flex-direction: column; gap: 8px; }
.tour-score { display: grid; grid-template-columns: 74px 1fr 26px; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.tour-score b { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.tour-signals { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 4px; }
.tour-etf { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
.tour-ucits { display: flex; flex-direction: column; gap: 6px; }
.tour-legal { font-size: 11.5px; color: var(--text-3); margin: 6px 0 0; text-align: center; }
body.is-auth #tour-btn { display: none; }
@media (max-width: 480px) {
  .tour-visual { min-height: 150px; padding: 20px 16px 16px; }
  .tour-body { padding: 16px 18px 4px; }
  .tour-foot { padding: 14px 18px 16px; }
  .tour-actions { width: 100%; }
  .tour-actions .btn-primary { flex: 1; }
}

/* ── Selector de tipo (Todos / Acciones / ETF / Fondos) ── */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--surface-3); max-width: 100%; overflow-x: auto; }
.segmented button {
  height: 30px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent;
  color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.segmented button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* ── Gráficos de cartera ── */
.chart-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: minmax(0, 1fr); } }
.donut { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut svg { width: 180px; height: 180px; flex: 0 0 auto; }
.donut-seg { transition: opacity .15s; cursor: default; }
.donut.has-focus .donut-seg:not(.on) { opacity: .35; }
.donut-k { font-size: 11px; fill: var(--text-2); }
.donut-v { font-size: 17px; font-weight: 700; fill: var(--text); }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.donut-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 52px; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 5px; font-size: 13px; }
.donut-legend li.on { background: var(--surface-3); }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend .lg-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.donut-legend .lg-val { color: var(--text-2); font-variant-numeric: tabular-nums; }
.donut-legend .lg-pct { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.linechart { position: relative; }
.linechart svg { width: 100%; height: auto; display: block; overflow: visible; }
.ln-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.ln-legend span, .ln-tip span { display: inline-flex; align-items: center; gap: 6px; }
.sw-value, .sw-cost { display: inline-block; width: 14px; height: 0; border-top: 2px solid var(--series-1); }
.sw-cost { border-top: 2px dashed var(--text-3); }
.ln-grid { stroke: var(--border); stroke-width: 1; }
.ln-axis { font-size: 11px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.ln-value { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ln-cost { fill: none; stroke: var(--text-3); stroke-width: 2; stroke-dasharray: 5 4; stroke-linejoin: round; }
.ln-dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.ln-dot.cost { fill: var(--text-3); }
.ln-cross { stroke: var(--border-strong); stroke-width: 1; }
.ln-tip {
  position: absolute; top: 28px; transform: translateX(-50%); pointer-events: none; z-index: 2;
  display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-2); font-size: 12.5px; white-space: nowrap;
}
.chart-head-actions { display: flex; align-items: center; gap: 8px; }
.segmented.sm button { height: 26px; padding: 0 10px; font-size: 12px; }
@media (max-width: 600px) { .ln-axis { font-size: 20px; } .ln-dot { r: 6px; } }
