/* ==========================================================================
 * 05-datos.css · parte 5/11 — Datos: resultados de filings, vista previa, histórico, widget y autenticación
 * Orden de carga obligatorio (reproduce la cascada del styles.css original).
 * No reordenar los <link> ni mover reglas entre partes sin revisar la cascada.
 * ========================================================================== */

/* ── Resultados (filings) del screener ─────────────────────────── */
.screener-toolbar[hidden], .screener-period-toggle[hidden] { display: none; }
.filings-view { padding-top: 12px; }
.filings-head { display: flex; align-items: center; gap: 12px; margin-bottom: 7px; }
.filings-head #filings-bulk-analyze { height: 24px; }
.filings-table .filing-select-col { width: 30px; padding-right: 0; }
.filings-table .filing-select-col input { width: 13px; height: 13px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.screener-block table.filings-table { table-layout: auto; min-width: 640px; }
.filings-table th, .filings-table td { text-align: left; white-space: nowrap; }
.filings-table th { padding: 8px 12px; font-size: 9px; }
.filings-table td { padding: 8px 12px; font-size: 11px; color: var(--muted-strong); }
.filings-table td:first-child { display: table-cell; color: var(--muted-strong); }
.filings-table tbody tr:hover td, .filings-table tbody tr:hover td.sticky-col { background: var(--surface-2); }
.filing-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 20px; padding: 0 7px; border-radius: 3px; font-size: 9px; font-weight: 700; }
.filing-badge-10q { border: 1px solid #c9d9e8; background: #eef3f8; color: #24548f; }
.filing-badge-10k { border: 1px solid var(--accent-mid); background: var(--accent-soft); color: var(--accent-text); }
.filing-action-presentation { border-color: #f3d3a8; background: #fdf4e7; color: #9a5b13; white-space: nowrap; }
.filing-action-presentation:hover { border-color: #d99a3f; color: #7a4610; }
.filing-action-release { border-color: var(--line-mid); background: var(--surface-2); color: var(--muted-strong); white-space: nowrap; }
.filing-action-release:hover { border-color: var(--muted-2); color: var(--ink-2); }
.filing-period { color: var(--ink-3); font-weight: 600; }
.filing-date { color: var(--muted); font-size: 10px; }
.filing-actions { display: flex; gap: 6px; }
.filing-action { display: inline-flex; height: 24px; align-items: center; padding: 0 9px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); color: var(--muted-strong); font-size: 10px; font-weight: 600; cursor: pointer; text-decoration: none; }
.filing-action:hover { border-color: var(--accent); color: var(--accent-dark); }
.filing-action-download { border-color: var(--accent-mid); background: var(--surface-2); color: var(--accent-text); }
.filing-action-analyze { border-color: #a8d8b1; background: #f2fbf4; color: #22703a; white-space: nowrap; }
.filing-action-analyze:hover { border-color: var(--green); color: #1c5c30; }
.filing-action-analyze.filing-action-locked { border-color: #d8dde3; background: var(--surface-2); color: var(--muted); cursor: pointer; }
.filing-action-analyze.filing-action-locked:hover { border-color: var(--line-mid); background: var(--surface-3); color: var(--muted-strong); }
.filing-action-analyze.filing-action-progress { border-color: #f3d3a8; background: #fdf4e7; color: #9a5b13; }
.filing-action-analyze.filing-action-progress:hover { border-color: #d99a3f; color: #7a4610; }
.filing-action-analyze.filing-action-ready { border-color: var(--green-text); background: var(--green-bg); color: var(--green-text-2); font-weight: 700; }
.filing-action-analyze.filing-action-ready:hover { border-color: var(--green-text-2); background: #d1fae5; color: #166534; }
.filing-rating-pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 3px; font-size: 10px; font-weight: 700; border: 1px solid var(--amber-border); background: var(--amber-bg); color: var(--amber-text); white-space: nowrap; cursor: pointer; user-select: none; transition: all 0.15s ease; }
.filing-rating-pill:hover { background: var(--amber-bg); border-color: #f59e0b; color: var(--amber-text); transform: translateY(-1px); box-shadow: 0 1px 3px rgba(245, 158, 11, 0.25); }
.filing-rating-pill .filing-rating-star { color: #f59e0b; font-size: 11px; line-height: 1; }
.filing-rating-pill-empty { border-color: var(--line-soft2); background: var(--surface-2); color: var(--muted); }
.filing-rating-pill-empty:hover { background: var(--surface-3); border-color: var(--line-mid); color: var(--muted-strong); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); }
.filing-rating-pill-empty .filing-rating-star { color: var(--muted-2); }
.filing-lock-icon { margin-right: 4px; vertical-align: -1px; opacity: 0.85; }
.filing-lock-pill { display: inline-flex; align-items: center; margin-left: 5px; padding: 1px 5px; border-radius: 3px; background: var(--line-soft2); color: var(--muted-strong); font-size: 8.5px; font-weight: 700; line-height: 1.2; text-transform: uppercase; letter-spacing: 0.2px; }
.filings-scope-note { margin-left: auto; font-size: 10.5px; font-weight: 500; color: var(--muted); background: var(--surface-3); border: 1px solid var(--line-soft2); padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.filing-action-loading { display: inline-flex; height: 24px; align-items: center; gap: 5px; padding: 0 9px; border: 1px solid var(--line-soft2); border-radius: 3px; background: var(--surface-2); color: var(--muted); font-size: 9.5px; font-weight: 600; white-space: nowrap; cursor: default; user-select: none; }
.filing-action-loading:hover { border-color: var(--line-soft2); color: var(--muted); }
.filing-analyze-group { position: relative; display: inline-flex; align-items: stretch; }
.filing-analyze-group .filing-action-analyze { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.filing-analyze-menu { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 24px; border: 1px solid var(--green-text); border-left: 0; border-top-right-radius: 3px; border-bottom-right-radius: 3px; background: var(--green-bg); color: var(--green-text-2); font-size: 12px; line-height: 1; cursor: pointer; }
.filing-analyze-menu:hover { background: #d1fae5; color: #166534; }
.filing-analyze-group.has-update::after { content: ''; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border: 1.5px solid var(--surface); border-radius: 50%; background: #f59e0b; }
.filing-version-popover { position: fixed; z-index: 60; width: min(340px, calc(100vw - 24px)); padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 14px 32px rgba(15, 23, 42, .2); }
.filing-version-popover[hidden] { display: none; }
.filing-version-popover-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 8px; border-bottom: 1px solid var(--line-soft2); }
.filing-version-popover-head span { font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.filing-version-popover-head strong { font-size: 13px; color: var(--accent-dark); }
.filing-version-upgrade { display: flex; flex-direction: column; gap: 2px; width: 100%; margin: 8px 0 2px; padding: 8px 10px; border: 1px solid var(--accent-mid); border-radius: 7px; background: var(--accent-faint); color: var(--accent-dark); font-size: 11.5px; font-weight: 700; text-align: left; cursor: pointer; }
.filing-version-upgrade:hover { border-color: var(--accent); background: var(--accent-soft); }
.filing-version-upgrade small { font-size: 9.5px; font-weight: 500; color: var(--muted-strong); }
.filing-version-uptodate { margin: 8px 0 2px; padding: 7px 10px; border-radius: 7px; background: var(--green-bg); color: var(--green-text-2); font-size: 11px; font-weight: 600; }
.filing-version-popover-sub { margin: 10px 4px 5px; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.filing-version-list { display: flex; flex-direction: column; max-height: 220px; overflow-y: auto; }
.filing-version-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 4px; }
.filing-version-row + .filing-version-row { border-top: 1px solid var(--line-soft2); }
.filing-version-row-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.filing-version-row-info strong { font-size: 11.5px; color: var(--ink); }
.filing-version-row-info span { font-size: 9.5px; color: var(--muted); }
.filing-version-row-actions { display: flex; flex-shrink: 0; gap: 4px; }
.filing-version-row-actions .row-action { display: inline-flex; align-items: center; height: 22px; min-width: 24px; padding: 0 6px; text-decoration: none; }
.filing-version-loading, .filing-version-empty { padding: 10px 6px; font-size: 11px; color: var(--muted); }
.filing-table-loading-cell { text-align: center !important; padding: 40px 16px !important; color: var(--muted); font-size: 12px; font-weight: 500; }
.filing-table-loading-cell .loading-spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line-soft2); border-top-color: var(--accent); border-radius: 50%; animation: filings-spin .8s linear infinite; vertical-align: -3px; margin-right: 8px; }
.loading-spinner-sm { display: inline-block; width: 10px; height: 10px; border: 1.5px solid rgba(100, 116, 139, .3); border-top-color: currentColor; border-radius: 50%; animation: filings-spin .8s linear infinite; vertical-align: -1px; }
.filings-presentations-status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; color: var(--amber-text); background: var(--amber-bg); border: 1px solid var(--amber-border); white-space: nowrap; }
.filings-presentations-status[hidden] { display: none; }
.filings-presentations-status .loading-spinner-sm { border-color: rgba(180, 83, 9, .25); border-top-color: var(--amber-text); }

/* ── Modal de vista previa de informes ─────────────────────────── */
.filings-preview-backdrop { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 22px; background: rgba(0, 0, 0, .75); }
.filings-preview-backdrop[hidden] { display: none; }
.filings-preview { display: flex; flex-direction: column; width: min(1100px, 96vw); height: min(86vh, 900px); overflow: hidden; border-radius: 8px; background: var(--surface); box-shadow: 0 22px 55px rgba(0,0,0,.4); }
.filings-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.filings-preview-head strong { color: var(--ink-3); font-size: 12px; }
.filings-preview-actions { display: flex; align-items: center; gap: 14px; }
.filings-preview-actions a { color: var(--accent-dark); font-size: 11px; font-weight: 600; text-decoration: none; }
.filings-preview-actions a:hover { text-decoration: underline; }
.filings-preview-close { border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.filings-preview-close:hover { color: var(--ink); }
.filings-preview-frame-wrap { position: relative; flex: 1; display: flex; min-height: 0; }
.filings-preview-loading { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 9px; background: var(--surface); color: var(--muted); font-size: 12px; }
.filings-preview-loading[hidden] { display: none; }
.filings-preview-loading .loading-spinner { width: 15px; height: 15px; border: 2px solid #ddd; border-top-color: var(--accent); border-radius: 50%; animation: filings-spin .8s linear infinite; }
@keyframes filings-spin { to { transform: rotate(360deg); } }
.filings-preview-pages { flex: 1; overflow: auto; padding: 18px; background: #525659; }
.filings-preview-pages[hidden] { display: none; }
.filings-preview-pages img { display: block; width: 100%; max-width: 860px; margin: 0 auto 14px; border-radius: 2px; background: var(--surface); box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }

/* ── Histórico y pie ──────────────────────────────────────────── */
.history-panel { border-top: 1px solid var(--line); }
.history-panel .section-title-row h2 { margin-bottom: 0; }
.history-panel .section-title-row { align-items: flex-end; }
.history-panel .section-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.text-button { border: 0; background: transparent; color: var(--accent-dark); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.history-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.history-filter { display: flex; flex-direction: column; gap: 5px; margin: 0; border: 0; padding: 0; }
.history-filter > span, .history-date-type legend { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.history-filter input[type="text"], .history-filter input[type="date"] { height: 34px; padding: 0 10px; border: 1px solid #d5d5d5; border-radius: 5px; background: var(--surface); color: var(--ink); font-size: 12px; outline: 0; }
.history-filter input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.history-company { position: relative; }
.history-company input { width: 220px; }

.history-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--surface);
  border: 1px solid #d5d5d5;
  border-radius: 6px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, .15), 0 8px 10px -6px rgba(0, 0, 0, .1);
  max-height: 240px;
  overflow-y: auto;
}

.history-suggest-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid #f1f1f1;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease;
}

.history-suggest-option:last-child { border-bottom: 0; }

.history-suggest-option:hover,
.history-suggest-option.active { background: var(--accent-faint); }

.history-suggest-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}

.history-suggest-ticker {
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 800;
  flex-shrink: 0;
}

.history-suggest-count {
  flex-shrink: 0;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.history-suggest-empty {
  padding: 10px;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}
.history-date-type, .history-report-type { flex-direction: row; align-items: flex-end; }
.history-date-option, .history-type-option { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.history-date-option input, .history-type-option input { accent-color: var(--accent); cursor: pointer; }
.history-date-option span, .history-type-option span { color: var(--muted); font-size: 12px; }
.history-date-type .history-date-option + .history-date-option,
.history-report-type .history-type-option + .history-type-option { margin-left: 10px; }

.analysis-type-pill {
  display: inline-block;
  padding: 1px 5px;
  font-size: 9.5px;
  font-weight: 700;
  border-radius: 3px;
  letter-spacing: 0.03em;
  margin-left: 6px;
  vertical-align: middle;
}
.analysis-type-pill.annual {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.analysis-type-pill.quarterly {
  background: var(--surface-3);
  color: var(--muted-strong);
  border: 1px solid var(--line-mid);
}
[data-mode="dark"] .analysis-type-pill.annual {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}
[data-mode="dark"] .analysis-type-pill.quarterly {
  background: var(--surface-2);
  color: var(--muted-2);
  border-color: var(--line);
}
.analysis-type-pill.language {
  background: transparent;
  color: var(--muted-2);
  border: 1px solid var(--line);
  letter-spacing: 0.06em;
}
[data-mode="dark"] .analysis-type-pill.language {
  background: transparent;
  color: var(--muted-2);
  border-color: var(--line);
}
.history-clear { height: 34px; padding: 0 14px; font-size: 11px; }
.history-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 22px 0 6px; }
.history-empty p { margin: 0; color: var(--muted-2); font-size: 12px; }
.history-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; margin-top: 14px; }
.history-pagination[hidden] { display: none; }
.pagination-summary { color: var(--muted); font-size: 11px; }
.pagination-controls { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.pagination-button, .pagination-page { min-width: 30px; height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted-strong); font-size: 11px; font-weight: 600; transition: background .12s ease, border-color .12s ease, color .12s ease; }
.pagination-button:hover:not(:disabled), .pagination-page:hover { border-color: var(--accent); background: var(--accent-faint); color: var(--accent-dark); }
.pagination-button:disabled { opacity: .45; cursor: default; }
.pagination-page.active { border-color: var(--accent); background: var(--accent); color: var(--accent-on); }
.pagination-ellipsis { padding: 0 2px; color: var(--muted-2); font-size: 11px; }
.history-panel tbody tr { cursor: pointer; }
.history-panel td:last-child { text-align: right; }
.history-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 5px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 680px; border-collapse: collapse; }
th { padding: 0 10px 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 700; text-align: left; text-transform: uppercase; letter-spacing: .04em; }
td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }
tbody tr:hover { background: var(--accent-faint); }
td:first-child { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.table-file { position: relative; width: 26px; height: 26px; overflow: hidden; }
.table-file img { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--surface); }
td strong { font-size: 11px; font-weight: 600; color: var(--ink); }
.td-ticker { margin-left: 5px; padding: 1px 6px; border-radius: 3px; background: #f4f4f4; color: var(--muted); font-family: monospace; font-size: 10px; font-weight: 700; }
.td-change { font-family: monospace; font-size: 11px; font-weight: 700; }
.table-status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; font-size: 10px; font-weight: 600; }
.table-status i { width: 5px; height: 5px; border-radius: 50%; }
.table-status.done { color: var(--green-text-2); background: #ecfdf3; }
.table-status.done i { background: var(--green); }
.table-status.warning { color: var(--accent-dark); background: var(--accent-faint); }
.table-status.warning i { background: var(--accent); }
.row-action { min-width: 30px; height: 25px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: .02em; cursor: pointer; transition: border-color .15s ease, background .15s ease, color .15s ease; }
.row-action:hover { border-color: var(--accent); background: var(--accent-faint); color: var(--accent-dark); }
.row-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]::after { display: inline-block; margin-left: 4px; color: #c4c4c4; font-size: 9px; content: '↕'; }
th[data-sort]:hover { color: var(--ink); }
th.sorted-asc::after, th.sorted-desc::after { color: var(--accent-dark); font-weight: 700; }
th.sorted-asc::after { content: '↑'; }
th.sorted-desc::after { content: '↓'; }
.empty-hint { margin-top: 12px; color: var(--muted-2); font-size: 10px; }
.page-footer { display: flex; align-items: center; justify-content: space-between; padding: 0 28px 27px; color: var(--muted-2); font-size: 10px; }
.page-footer b { padding: 0 4px; color: var(--muted-2); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 40; max-width: 320px; padding: 12px 15px; border: 1px solid var(--line-mid); border-radius: 5px; background: #1e293b; box-shadow: 0 5px 18px rgba(0,0,0,.22); color: #fff; font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(9px); transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }

/* ── Widget de análisis en segundo plano (abajo a la derecha) ──── */
.analysis-job-widget { position: fixed; right: 22px; bottom: 22px; z-index: 45; width: min(280px, calc(100vw - 32px)); padding: 11px 12px 10px; border: 1px solid var(--line-mid); border-radius: 10px; background: var(--surface); box-shadow: 0 12px 32px rgba(15, 23, 42, .18); }
body.analysis-job-active .toast { bottom: 122px; }
.ajw-main { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.analysis-job-widget.done .ajw-main, .analysis-job-widget.error .ajw-main { cursor: default; }
.ajw-icon { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--accent-faint); color: var(--accent-dark); }
.analysis-job-widget.done .ajw-icon { background: #e8f6ec; color: #1e8e4e; }
.analysis-job-widget.error .ajw-icon { background: #fdf0ef; color: #c0392b; }
.ajw-spinning svg { animation: ajw-spin .9s linear infinite; }
@keyframes ajw-spin { to { transform: rotate(360deg); } }
.ajw-info { flex: 1; min-width: 0; }
.ajw-title { display: block; overflow: hidden; color: var(--ink); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.ajw-stage { display: block; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ajw-percent { flex: none; color: var(--accent-dark); font-size: 11px; font-weight: 700; }
.ajw-track { height: 4px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.ajw-bar { display: block; width: 2%; height: 100%; border-radius: inherit; background: var(--accent); transition: width .45s ease; }
.analysis-job-widget.done .ajw-bar { background: #1e8e4e; }
.ajw-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 7px; }
.ajw-actions:empty { display: none; }
.ajw-view { padding: 4px 10px; border: 1px solid var(--accent); border-radius: 5px; background: var(--accent-faint); color: var(--accent-dark); font-size: 10.5px; font-weight: 700; cursor: pointer; }
.ajw-view:hover { background: var(--accent); color: #fff; }
.ajw-dismiss { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted-2); font-size: 11px; cursor: pointer; }
.ajw-dismiss:hover { background: var(--surface-3); color: var(--ink); }
.analysis-job-widget.multi { width: min(340px, calc(100vw - 32px)); }
.ajw-list { display: flex; flex-direction: column; gap: 4px; max-height: 240px; margin-top: 8px; overflow-y: auto; }
.ajw-list[hidden] { display: none; }
.ajw-row { display: flex; align-items: center; gap: 8px; padding: 6px 7px; border: 1px solid transparent; border-radius: 7px; cursor: pointer; }
.ajw-row:hover { background: var(--surface-2); }
.ajw-row.focused { border-color: var(--accent-mid); background: var(--accent-faint); }
.ajw-row-icon { display: grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 50%; background: var(--accent-faint); color: var(--accent-dark); }
.ajw-row-icon svg { width: 12px; height: 12px; }
.ajw-row-icon.queued { background: var(--surface-3); color: var(--muted-strong); }
.ajw-row-icon.done { background: #e8f6ec; color: #1e8e4e; }
.ajw-row-icon.error { background: #fdf0ef; color: #c0392b; }
.ajw-row-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ajw-row-info strong { overflow: hidden; color: var(--ink); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.ajw-row-info span { overflow: hidden; color: var(--muted); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.ajw-row-status { flex: none; color: var(--muted-strong); font-size: 10px; font-weight: 700; }
.ajw-row-status.done { color: #1e8e4e; }
.ajw-row-status.error { color: #c0392b; }
.ajw-row-view { flex: none; padding: 3px 8px; border: 1px solid var(--accent); border-radius: 5px; background: var(--accent-faint); color: var(--accent-dark); font-size: 9.5px; font-weight: 700; cursor: pointer; }
.ajw-row-view:hover { background: var(--accent); color: #fff; }
.ajw-row-dismiss { flex: none; width: 17px; height: 17px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted-2); font-size: 10px; cursor: pointer; }
.ajw-row-dismiss:hover { background: var(--surface-3); color: var(--ink); }
@media (max-width: 640px) { .analysis-job-widget { right: 12px; bottom: 12px; } body.analysis-job-active .toast { bottom: 122px; } }

/* ── Modal de autenticación ───────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 18px; background: rgba(0, 0, 0, .55); }
.modal { position: relative; width: min(430px, 100%); padding: 26px 27px 22px; border-radius: 10px; background: var(--surface); box-shadow: 0 22px 55px rgba(0,0,0,.35); }
.modal-close { position: absolute; top: 12px; right: 14px; border: 0; background: transparent; color: var(--muted-2); font-size: 22px; line-height: 1; }
.modal-close:hover { color: var(--ink); }
.modal-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 15px; color: var(--muted-strong); font-size: 13px; font-weight: 700; }
.modal-brand .cifra-symbol { width: 17px; height: 17px; vertical-align: -3px; }
.modal h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.02em; }
.modal-subtitle { margin: 0 0 17px; color: var(--muted); font-size: 13px; }
.modal-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.modal-tab { padding: 10px 0; border: 0; background: var(--surface-3); color: var(--muted); font-size: 13px; font-weight: 700; }
.modal-tab:hover { color: var(--ink); }
.modal-tab.active { background: var(--surface); color: var(--accent-dark); box-shadow: inset 0 -2px 0 var(--accent); }
.auth-field { display: block; margin-bottom: 14px; }
.auth-field > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.auth-field input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line-mid); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 14px; outline: 0; transition: .15s ease; }
.auth-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.modal-error { margin: 0 0 13px; padding: 9px 11px; border: 1px solid #f0c4c1; border-radius: 6px; background: #fdf0ef; color: #c0392b; font-size: 12px; }
.auth-submit { width: 100%; min-height: 44px; border-radius: 7px; font-size: 14px; }
.verify-hint { margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.verify-actions { display: flex; justify-content: space-between; margin: -2px 0 14px; }
.verify-actions .link-button { padding: 0; border: 0; background: none; color: var(--accent-dark); font-size: 12px; font-weight: 700; cursor: pointer; }
.verify-actions .link-button:hover { text-decoration: underline; }
.verify-actions .link-button:disabled { color: var(--muted-2); cursor: not-allowed; text-decoration: none; }
.forgot-row { justify-content: flex-start; margin: 2px 0 14px; }
.modal-note { margin: 14px 0 0; color: var(--muted-2); font-size: 11px; text-align: center; }
.oauth-section { margin-bottom: 14px; }
.oauth-google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 42px; border: 1px solid #d0d5dd; border-radius: 6px; background: var(--surface); color: #374151; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease; box-sizing: border-box; }
.oauth-google-btn:hover { background: var(--surface-2); border-color: var(--muted-2); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.oauth-google-btn:focus-visible { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.google-icon { flex-shrink: 0; }
.auth-divider { display: flex; align-items: center; text-align: center; margin: 14px 0 12px; color: #8c8c8c; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; border-bottom: 1px solid #e5e5e5; }
.auth-divider span { padding: 0 10px; }

/* ── Menú contraído y responsive ──────────────────────────────── */
.app-shell.sidebar-collapsed .sidebar { width: 68px; }
.app-shell.sidebar-collapsed .main-content { margin-left: 68px; }
.app-shell.sidebar-collapsed .brand-area { width: 68px; flex-basis: 68px; justify-content: center; padding-right: 0; padding-left: 0; }
.app-shell.sidebar-collapsed .brand-lockup strong, .app-shell.sidebar-collapsed .nav-link > span, .app-shell.sidebar-collapsed .nav-section-title, .app-shell.sidebar-collapsed .new-badge, .app-shell.sidebar-collapsed .nav-arrow, .app-shell.sidebar-collapsed .sidebar-footer { display: none; }
.app-shell.sidebar-collapsed .brand-lockup { display: none; }
.app-shell.sidebar-collapsed .main-nav { padding-right: 11px; padding-left: 11px; }
.app-shell.sidebar-collapsed .nav-link { justify-content: center; padding: 0; }

@media (max-width: 1120px) {
  :root { --sidebar-width: 232px; }
  .brand-area { padding-left: 16px; }
}

@media (max-width: 900px) {
  .topbar { position: fixed; }
  .brand-area { width: auto; flex-basis: auto; gap: 13px; border-right: 0; }
  .collapse-button { order: -1; }
  .search-wrap { width: min(430px, 45vw); margin-left: 8px; }
  .promo-button { padding-right: 10px; padding-left: 10px; font-size: 11px; }
  .sidebar { transform: translateX(-100%); box-shadow: 8px 0 22px rgba(0,0,0,.18); }
  .sidebar.open { transform: translateX(0); }
  .backdrop { display: block; position: fixed; inset: var(--topbar-height) 0 0; z-index: 14; background: rgba(0,0,0,.32); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .backdrop.visible { opacity: 1; pointer-events: auto; }
  .main-content, .app-shell.sidebar-collapsed .main-content { margin-left: 0; }
  .app-shell.sidebar-collapsed .sidebar { width: var(--sidebar-width); }
  .app-shell.sidebar-collapsed .brand-area { width: auto; flex-basis: auto; justify-content: space-between; padding-right: 12px; padding-left: 16px; }
  .app-shell.sidebar-collapsed .brand-lockup { display: flex; }
  .app-shell.sidebar-collapsed .brand-lockup strong, .app-shell.sidebar-collapsed .nav-link > span, .app-shell.sidebar-collapsed .nav-section-title, .app-shell.sidebar-collapsed .new-badge, .app-shell.sidebar-collapsed .nav-arrow, .app-shell.sidebar-collapsed .sidebar-footer { display: initial; }
  .app-shell.sidebar-collapsed .nav-link > span { overflow: hidden; }
  .app-shell.sidebar-collapsed .nav-section-title { display: flex; }
  .app-shell.sidebar-collapsed .sidebar-footer { display: block; }
  .app-shell.sidebar-collapsed .nav-link { justify-content: initial; padding-right: 12px; padding-left: 12px; }
  .app-shell.sidebar-collapsed .company-nav-head { display: flex; }
}

@media (max-width: 700px) {
  .topbar { height: 58px; }
  :root { --topbar-height: 58px; }
  .brand-lockup strong { font-size: 14px; }
  .search-wrap { flex: 1; width: auto; height: 38px; margin-left: 0; }
  .search-wrap input { font-size: 13px; }
  .search-shortcut, .settings-button { display: none; }
  .topbar-actions { padding-right: 7px; }
  .ghost-button { display: none; }
  .promo-button { display: none; }
  .user-email { display: none; }
  .user-chip { padding-right: 5px; }
  .market-section, .analysis-section, .history-panel, .screener-section { padding: 22px 15px; }
  .section-title-row h2 { font-size: 21px; }
  .market-grid, .analysis-layout, .analysis-layout:has(.coverage-panel:not([hidden])) { grid-template-columns: 1fr; }
  .screener-company-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .profile-section-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .profile-source { text-align: left; }
  .profile-quote-card { align-items: flex-start; flex-direction: column; }
  .profile-sparkline { width: 100%; height: 64px; }
  .profile-card-grid { grid-template-columns: 1fr; }
  .screener-toolbar { align-items: flex-start; flex-wrap: wrap; gap: 7px 10px; }
  .screener-period-range { order: 3; width: 100%; }
  .screener-tools { margin-left: auto; }
  .screener-tabs { overflow-x: auto; }
  .screener-tab { flex: 0 0 auto; padding-right: 11px; padding-left: 11px; }
  .market-grid { gap: 8px; }
  .market-card { min-height: 120px; }
  .analysis-title { align-items: flex-start; }
  .scope-badge { font-size: 8px; }
  .upload-panel, .coverage-panel { padding: 16px; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .form-footer p { max-width: none; }
  .primary-button { width: 100%; }
  .result-grid { grid-template-columns: 1fr; }
  .page-footer { align-items: flex-start; flex-direction: column; gap: 7px; padding-right: 15px; padding-left: 15px; }
  .toast { right: 14px; bottom: 14px; left: 14px; max-width: none; }
}
