/* ═══════════════════════════════════════════════════════════════════════════
   sw.css — Full de estils unificat · SegurosWeb
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Variables globals ────────────────────────────────────────────────── */
:root {
  --sw-blue:       #0d6efd;
  --sw-blue-dk:    #084298;
  --sw-blue-md:    #0a58ca;
  --sw-blue-soft:  #e8f0fe;
  --sw-green:      #198754;
  --sw-red:        #dc3545;
  --sw-orange:     #fd7e14;
  --sw-sidebar-w:  240px;
}

/* ── 2. Utilitaris globals ───────────────────────────────────────────────── */
.fs-7 { font-size: .82rem !important; }
.fs-8 { font-size: .73rem !important; }

@media print { .no-print { display: none !important; } }

/* ── 3. Dark mode — base Bootstrap ──────────────────────────────────────── */
[data-bs-theme="dark"] body                  { background-color: #1a1d21 !important; }
[data-bs-theme="dark"] .bg-light             { background-color: #1a1d21 !important; }
[data-bs-theme="dark"] .bg-white             { background-color: #1e2228 !important; }
[data-bs-theme="dark"] .card                 { background-color: #252830 !important; border-color: #3a3f4b !important; }
[data-bs-theme="dark"] .card-body            { background-color: #252830 !important; }
[data-bs-theme="dark"] .table                { --bs-table-bg: #252830; --bs-table-striped-bg: #2d3139; --bs-table-hover-bg: #313640; color: #dee2e6; }
[data-bs-theme="dark"] .table-light          { --bs-table-bg: #2d3139; }
[data-bs-theme="dark"] .nav-tabs .nav-link               { color: #adb5bd; }
[data-bs-theme="dark"] .nav-tabs .nav-link.active        { background-color: #252830; border-color: #3a3f4b; color: #e2e8f0; }
[data-bs-theme="dark"] .nav-pills .nav-link              { color: #adb5bd; }
[data-bs-theme="dark"] .nav-pills .nav-link.active       { background-color: var(--sw-blue); color: #fff; }
[data-bs-theme="dark"] .form-select          { background-color: #2d3139; border-color: #3a3f4b; color: #e2e8f0; }
[data-bs-theme="dark"] .form-control         { background-color: #2d3139; border-color: #3a3f4b; color: #e2e8f0; }
[data-bs-theme="dark"] .form-label           { color: #adb5bd; }
[data-bs-theme="dark"] .text-muted           { color: #8b949e !important; }
[data-bs-theme="dark"] .border-bottom        { border-color: #3a3f4b !important; }
[data-bs-theme="dark"] .border-top           { border-color: #3a3f4b !important; }
[data-bs-theme="dark"] .shadow-sm            { box-shadow: 0 .125rem .25rem rgba(0,0,0,.4) !important; }
[data-bs-theme="dark"] .modal-content        { background-color: #252830; }
[data-bs-theme="dark"] .modal-header         { border-color: #3a3f4b; }
[data-bs-theme="dark"] .modal-footer         { border-color: #3a3f4b; }
[data-bs-theme="dark"] .dropdown-menu        { background-color: #252830; border-color: #3a3f4b; }
[data-bs-theme="dark"] .dropdown-item        { color: #dee2e6; }
[data-bs-theme="dark"] .dropdown-item:hover  { background-color: #2d3139; }
[data-bs-theme="dark"] .btn-outline-secondary              { color: #adb5bd; border-color: #3a3f4b; }
[data-bs-theme="dark"] .btn-outline-secondary:hover        { background-color: #2d3139; color: #dee2e6; }
[data-bs-theme="dark"] .badge.bg-light       { background-color: #2d3139 !important; color: #dee2e6 !important; }
[data-bs-theme="dark"] .list-group-item      { background-color: transparent; border-color: #3a3f4b; color: #dee2e6; }
[data-bs-theme="dark"] .alert-secondary      { background-color: #2d3139; border-color: #3a3f4b; color: #adb5bd; }
[data-bs-theme="dark"] .bg-light.p-3,
[data-bs-theme="dark"] .rounded.bg-light     { background-color: #2d3139 !important; }
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6                    { color: #e2e8f0; }
[data-bs-theme="dark"] small                 { color: #8b949e; }
[data-bs-theme="dark"] p                     { color: #dee2e6; }
[data-bs-theme="dark"] a:not(.btn):not(.nav-link) { color: #6ea8fe; }

/* ── 4. Components globals ───────────────────────────────────────────────── */

/* Rating pills */
.rating-pill { display: inline-block; width: 30px; height: 30px; border-radius: 50%; font-size: .76rem; font-weight: 700; line-height: 30px; text-align: center; }
.rating-a { background: #d1e7dd; color: #0f5132; }
.rating-b { background: #cfe2ff; color: #084298; }
.rating-c { background: #fff3cd; color: #664d03; }
.rating-d { background: #f8d7da; color: #842029; }

[data-bs-theme="dark"] .rating-a { background: #0f3c24; color: #75c899; }
[data-bs-theme="dark"] .rating-b { background: #0a2550; color: #7cb3f5; }
[data-bs-theme="dark"] .rating-c { background: #3d2c00; color: #ffc75a; }
[data-bs-theme="dark"] .rating-d { background: #3d0d12; color: #f08080; }

/* Botó dark mode toggle */
#darkModeToggle { width: 2.2rem; height: 2.2rem; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all .2s; flex-shrink: 0; }
#darkModeToggle:hover { transform: rotate(20deg); }

/* Indicadors de recomanació (formulari i fitxa) */
.reco-V { background: #f8d7da; font-weight: 700; }
.reco-R { background: #fff3cd; }
.reco-M { background: #e2e3e5; }
.reco-A { background: #d1e7dd; }
.reco-C { background: #0f5132; color: #fff; font-weight: 700; }

/* Tendència */
.trend-up { color: #198754; }
.trend-dn { color: #dc3545; }
.trend-eq { color: #6c757d; }

/* ── 5. Layout admin — sidebar + main ───────────────────────────────────── */
.sw-layout  { display: flex; min-height: 100vh; }

.sw-sidebar {
  width: var(--sw-sidebar-w); flex-shrink: 0;
  background: #0a1628; border-right: 1px solid #152240;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 200; overflow-y: auto; transition: transform .25s;
}
.sw-brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1rem 1.1rem .75rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
}
.sw-brand-text { color: #fff; font-weight: 700; font-size: 1rem; line-height: 1.15; }
.sw-brand-sub  { color: rgba(255,255,255,.45); font-size: .72rem; }
.sw-nav-section {
  padding: .5rem 1rem .2rem;
  color: rgba(255,255,255,.3); font-size: .65rem;
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.sw-nav-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .42rem 1rem .42rem 1.1rem;
  color: rgba(255,255,255,.65); font-size: .85rem;
  text-decoration: none; border-left: 3px solid transparent;
  transition: all .15s; cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
}
.sw-nav-link:hover          { background: rgba(255,255,255,.07); color: #fff; border-left-color: rgba(13,110,253,.5); }
.sw-nav-link.active         { background: rgba(13,110,253,.18); color: #6ea8fe; border-left-color: var(--sw-blue); font-weight: 600; }
.sw-nav-link i              { width: 18px; text-align: center; font-size: .95rem; }
.sw-nav-link .badge-dot     { width: 6px; height: 6px; border-radius: 50%; background: var(--sw-orange); margin-left: auto; flex-shrink: 0; }

/* Badges numèrics del sidebar */
.sw-nav-badge {
  margin-left: auto; flex-shrink: 0;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; font-size: .65rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
}
.sw-nav-badge-danger { background: #dc3545; color: #fff; }
.sw-nav-badge-warn   { background: #fd7e14; color: #fff; }
.sw-nav-badge-info   { background: #0dcaf0; color: #000; }

.sw-sidebar-footer          { margin-top: auto; padding: .75rem 1rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .78rem; color: rgba(255,255,255,.4); }

.sw-main    { margin-left: var(--sw-sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }
.sw-content { padding: 1.5rem; flex: 1; }

/* Topbar admin */
.sw-topbar-admin {
  background: #fff; border-bottom: 1px solid #dee2e6;
  padding: .55rem 1.25rem; position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: .75rem;
}
.sw-topbar-admin .breadcrumb { margin: 0; font-size: .82rem; }
.sw-page-title { font-size: 1rem; font-weight: 700; color: #212529; margin: 0; }

/* Backdrop mòbil */
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 199; }

@media (max-width: 991px) {
  .sw-sidebar          { transform: translateX(-100%); }
  .sw-sidebar.open     { transform: translateX(0); }
  .sw-main             { margin-left: 0; }
  .sidebar-backdrop    { display: block !important; }
}

/* ── 6. Dark mode admin ──────────────────────────────────────────────────── */
[data-bs-theme="dark"] .sw-topbar-admin    { background: #1e2228; border-color: #3a3f4b; }
[data-bs-theme="dark"] .sw-content,
[data-bs-theme="dark"] .sw-main,
[data-bs-theme="dark"] body               { background: #1a1d21; }
[data-bs-theme="dark"] .sw-page-title     { color: #e2e8f0; }

/* ── 7. Components admin ─────────────────────────────────────────────────── */

/* KPI cards admin */
.kpi-card {
  background: #fff; border: 1px solid #dee2e6; border-radius: .6rem;
  padding: 1rem 1.15rem; transition: box-shadow .2s, transform .15s;
  position: relative; overflow: hidden;
}
.kpi-card:hover             { box-shadow: 0 4px 18px rgba(13,110,253,.1); transform: translateY(-2px); }
.kpi-card::before           { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: .6rem .6rem 0 0; }
.kpi-blue::before           { background: var(--sw-blue); }
.kpi-green::before          { background: var(--sw-green); }
.kpi-red::before            { background: var(--sw-red); }
.kpi-orange::before         { background: var(--sw-orange); }
.kpi-card .kpi-val          { font-size: 1.65rem; font-weight: 800; line-height: 1; color: #212529; margin: .15rem 0 .1rem; }
.kpi-card .kpi-label        { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #6c757d; font-weight: 600; }
.kpi-card .kpi-icon         { position: absolute; right: .9rem; top: .9rem; width: 2.2rem; height: 2.2rem; border-radius: .4rem; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.kpi-card .kpi-sub          { font-size: .75rem; margin-top: .25rem; }

[data-bs-theme="dark"] .kpi-card           { background: #252830; border-color: #3a3f4b; }
[data-bs-theme="dark"] .kpi-card .kpi-val  { color: #e2e8f0; }
[data-bs-theme="dark"] .kpi-card .kpi-label { color: #8b949e; }

/* Panel */
.sw-panel               { background: #fff; border: 1px solid #dee2e6; border-radius: .6rem; }
.sw-panel-header        { padding: .7rem 1rem; border-bottom: 1px solid #dee2e6; display: flex; align-items: center; gap: .5rem; }
.sw-panel-header .ph-title { font-size: .85rem; font-weight: 700; color: #212529; flex: 1; }
.sw-panel-body          { padding: .85rem 1rem; }

[data-bs-theme="dark"] .sw-panel           { background: #252830; border-color: #3a3f4b; }
[data-bs-theme="dark"] .sw-panel-header    { border-color: #3a3f4b; }
[data-bs-theme="dark"] .sw-panel-header .ph-title { color: #e2e8f0; }

/* Quick-access cards admin */
.qa-card {
  border: 1.5px solid #dee2e6; border-radius: .75rem; padding: 1.25rem;
  text-align: center; cursor: pointer; transition: all .2s;
  text-decoration: none; display: block; background: #fff;
}
.qa-card:hover          { border-color: var(--sw-blue); box-shadow: 0 4px 16px rgba(13,110,253,.12); transform: translateY(-3px); }
.qa-card .qa-icon       { width: 3rem; height: 3rem; border-radius: .75rem; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; margin: 0 auto .6rem; }
.qa-card .qa-label      { font-size: .82rem; font-weight: 700; color: #212529; }
.qa-card .qa-desc       { font-size: .72rem; color: #6c757d; margin-top: .2rem; }

[data-bs-theme="dark"] .qa-card            { background: #252830; border-color: #3a3f4b; }
[data-bs-theme="dark"] .qa-card .qa-label  { color: #e2e8f0; }
[data-bs-theme="dark"] .qa-card .qa-desc   { color: #8b949e; }

/* Taula admin */
.sw-table thead th  { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #6c757d; font-weight: 700; border-bottom: 2px solid #dee2e6; }
[data-bs-theme="dark"] .sw-table           { --bs-table-bg: #252830; --bs-table-striped-bg: #2d3139; color: #dee2e6; }
[data-bs-theme="dark"] .sw-table thead th  { color: #8b949e; border-color: #3a3f4b; }

/* Stat pill */
.stat-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  background: #f0f4ff; border: 1px solid #c7d7f8; border-radius: 2rem;
  padding: .18rem .65rem; font-size: .75rem; font-weight: 600; color: var(--sw-blue-dk);
}
[data-bs-theme="dark"] .stat-pill          { background: #1a2240; border-color: #3a5fc0; color: #6ea8fe; }

/* Stat rows */
.stat-row           { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid #f1f3f5; }
.stat-row:last-child { border-bottom: none; }
.stat-row-label     { font-size: .8rem; color: #495057; flex: 1; }
.stat-row-val       { font-size: .8rem; font-weight: 700; color: #212529; }
[data-bs-theme="dark"] .stat-row           { border-color: #2d3139; }
[data-bs-theme="dark"] .stat-row-label     { color: #adb5bd; }
[data-bs-theme="dark"] .stat-row-val       { color: #e2e8f0; }

/* Coverage bars */
.cov-bar-wrap       { background: #e9ecef; border-radius: 2rem; height: 8px; overflow: hidden; }
.cov-bar            { height: 100%; border-radius: 2rem; transition: width .6s ease; }
.cov-12             { background: var(--sw-green); }
.cov-half           { background: var(--sw-orange); }
.cov-low            { background: var(--sw-red); }
[data-bs-theme="dark"] .cov-bar-wrap       { background: #2d3139; }

/* Alert strip */
.alert-strip        { border-radius: .4rem; padding: .45rem .75rem; font-size: .8rem; display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }

/* ── 8. Pàgina logs ──────────────────────────────────────────────────────── */
.stat-card          { background: #fff; border-radius: .75rem; padding: 1.25rem 1.5rem; box-shadow: 0 1px 4px rgba(0,0,0,.06); border: 1px solid #e9ecef; }
.stat-card .val     { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-card .lbl     { font-size: .78rem; color: #6c757d; margin-top: .25rem; }
.log-table          { font-size: .82rem; }
.log-table th       { background: #f8f9fa; font-weight: 600; border-bottom: 2px solid #dee2e6; white-space: nowrap; }
.log-table td       { vertical-align: middle; }
.badge-bloq         { background: #dc3545; color: #fff; border-radius: .4rem; padding: .2rem .5rem; font-size: .72rem; font-weight: 700; }
.badge-ok           { background: #198754; color: #fff; border-radius: .4rem; padding: .2rem .5rem; font-size: .72rem; }
.alert-inline       { border-radius: .5rem; font-size: .85rem; padding: .6rem 1rem; margin-bottom: 1rem; }

[data-bs-theme="dark"] .stat-card          { background: #1e2228; border-color: #2d3139; color: #e2e8f0; }

/* ── 9. Layout públic — topbar + hero ───────────────────────────────────── */
.sw-topbar {
  background: #fff; border-bottom: 1px solid #dee2e6; padding: .6rem 0;
}
.sw-topbar .nav-link        { font-size: .88rem; color: #495057; padding: .3rem .7rem; border-radius: .4rem; transition: background .15s; }
.sw-topbar .nav-link:hover  { background: #f0f4ff; color: var(--sw-blue); }
.sw-topbar .nav-link.active { color: var(--sw-blue); font-weight: 600; }

[data-bs-theme="dark"] .sw-topbar          { background: #1e2228; border-color: #3a3f4b; }
[data-bs-theme="dark"] .sw-topbar .nav-link         { color: #adb5bd; }
[data-bs-theme="dark"] .sw-topbar .nav-link:hover   { background: #2d3139; color: #6ea8fe; }

.sw-year-bar        { position: sticky; top: 0; z-index: 100; background: #fff; border-bottom: 1px solid #dee2e6; padding: .5rem 0; }
[data-bs-theme="dark"] .sw-year-bar        { background: #1e2228; border-color: #3a3f4b; }

.sw-hero { background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 60%, #084298 100%); color: #fff; padding: 2.75rem 0 2.25rem; }
.sw-hero h1             { font-size: 1.9rem; font-weight: 700; }
.sw-search-box          { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3); border-radius: .75rem; padding: 1.2rem; backdrop-filter: blur(4px); }
.sw-search-box .form-select,
.sw-search-box .form-control { background: rgba(255,255,255,.92); border: none; font-size: .9rem; }

/* ── 10. Components públics ──────────────────────────────────────────────── */

/* KPI cards públic */
.sw-kpi-card        { border: 1px solid #dee2e6; border-radius: .6rem; padding: 1rem 1.2rem; background: #fff; transition: box-shadow .2s, transform .15s; }
.sw-kpi-card:hover  { box-shadow: 0 4px 16px rgba(13,110,253,.12); transform: translateY(-2px); }
.sw-kpi-card .kpi-val   { font-size: 1.45rem; font-weight: 700; color: var(--sw-blue); }
.sw-kpi-card .kpi-label { font-size: .75rem; color: #6c757d; text-transform: uppercase; letter-spacing: .04em; }

[data-bs-theme="dark"] .sw-kpi-card        { background: #252830; border-color: #3a3f4b; }

/* Taula asseguradores */
.sw-insurer-row         { transition: background .1s; cursor: pointer; }
.sw-insurer-row:hover   { background: #f0f4ff !important; }
[data-bs-theme="dark"] .sw-insurer-row:hover { background: #2d3139 !important; }

/* Price cards */
.sw-price-card          { background: linear-gradient(135deg, #f8f9fa, #e9f0ff); border: 1px solid #c7d7f8; border-radius: .75rem; padding: 1.1rem; text-align: center; transition: box-shadow .2s; }
.sw-price-card:hover    { box-shadow: 0 4px 16px rgba(13,110,253,.15); }
.sw-price-card .price-val   { font-size: 1.3rem; font-weight: 700; color: var(--sw-blue-md); }
.sw-price-card .price-label { font-size: .76rem; color: #6c757d; }
.sw-price-card .price-asseg { font-size: .82rem; font-weight: 600; color: #212529; }
.sw-price-card.best-price   { border-color: #198754 !important; }
.sw-price-card.best-price .price-val { color: #198754; }

[data-bs-theme="dark"] .sw-price-card      { background: linear-gradient(135deg, #252830, #1a2240); border-color: #3a3f4b; }

/* News cards */
.sw-news-card           { border-radius: .6rem; overflow: hidden; transition: box-shadow .2s; }
.sw-news-card:hover     { box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.sw-news-tag            { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

/* Compare badge */
.compare-badge {
  background: #e8f0fe; color: var(--sw-blue); border: 1px solid #b6d0fe;
  border-radius: 2rem; font-size: .8rem; font-weight: 600;
  padding: .2rem .75rem; display: inline-flex; align-items: center; gap: .3rem;
}
[data-bs-theme="dark"] .compare-badge      { background: #1a2240; border-color: #3a5fc0; }

/* Analysis banner */
.sw-analysis-banner     { border-left: 4px solid var(--sw-blue); background: #e8f0fe; border-radius: 0 .5rem .5rem 0; padding: .75rem 1rem; }
[data-bs-theme="dark"] .sw-analysis-banner { background: #1a2240; }

/* ── 11. Login ───────────────────────────────────────────────────────────── */
.login-bg {
  background: linear-gradient(135deg, #0a1628 0%, #0d2552 60%, #0a3080 100%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-wrap         { width: 100%; max-width: 400px; padding: 1rem; }
.login-card         { border-radius: 1rem; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.login-brand        { background: linear-gradient(135deg, #0d6efd, #084298); padding: 2.5rem 2rem; text-align: center; color: #fff; }
.login-brand .brand-icon {
  width: 60px; height: 60px; background: rgba(255,255,255,.18); border-radius: .85rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto .85rem; font-size: 1.75rem;
}
.login-brand h4     { font-weight: 800; margin: 0 0 .2rem; }
.login-brand small  { opacity: .7; font-size: .85rem; }
.login-body         { background: #fff; padding: 2rem; }
.login-footer       { background: #f8f9fa; padding: .85rem 2rem; border-top: 1px solid #dee2e6; text-align: center; }
.btn-login          { background: linear-gradient(135deg, #0d6efd, #084298); border: none; font-weight: 700; letter-spacing: .02em; padding: .65rem; }
.btn-login:hover    { background: linear-gradient(135deg, #0b5ed7, #0a3580); }
.input-icon-wrap    { position: relative; }
.form-icon          { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: #6c757d; font-size: 1rem; pointer-events: none; z-index: 5; }
.input-icon-wrap input { padding-left: 2.5rem; }
.eye-toggle         { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); background: none; border: none; color: #6c757d; cursor: pointer; padding: .25rem; z-index: 5; }
.float-dots         { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.float-dot          { position: absolute; border-radius: 50%; background: rgba(255,255,255,.04); animation: floatUp linear infinite; }
@keyframes floatUp {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: .5; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}
[data-bs-theme="dark"] .login-body         { background: #1e2228; }
[data-bs-theme="dark"] .login-footer       { background: #252830; border-color: #3a3f4b; }

/* ── 12. Pàgina comparativa ──────────────────────────────────────────────── */
.cmp-logo           { width: 26px; height: 26px; object-fit: contain; border-radius: 4px; }
.cmp-best           { background: rgba(22,163,74,.10) !important; font-weight: 600; }
.cmp-worst          { background: rgba(220,38,38,.08) !important; }
.rank-1             { color: #16A34A; font-weight: 700; }
.rank-last          { color: #DC2626; }
.metric-bar-wrap    { background: #e9ecef; border-radius: 3px; height: 7px; overflow: hidden; margin-top: 3px; }
.metric-bar         { height: 100%; border-radius: 3px; transition: width .4s; }
.aseg-card          { transition: box-shadow .15s, transform .15s; }
.aseg-card:hover    { box-shadow: 0 6px 20px rgba(0,0,0,.13) !important; transform: translateY(-2px); }
.kpi-mini           { border-radius: .5rem; padding: .6rem .8rem; background: rgba(0,0,0,.03); }
[data-bs-theme="dark"] .kpi-mini           { background: rgba(255,255,255,.05); }
.chart-wrap         { position: relative; height: 260px; }
.chart-wrap-sm      { position: relative; height: 200px; }

/* Taula comparativa */
th.sortable                 { cursor: pointer; user-select: none; }
th.sortable:hover           { background: rgba(0,0,0,.04); }
th.sortable .sort-icon      { opacity: .4; margin-left: 2px; font-size: .7em; }
th.sortable.asc  .sort-icon::before { content: '\F235'; font-family: 'bootstrap-icons'; opacity: 1; }
th.sortable.desc .sort-icon::before { content: '\F229'; font-family: 'bootstrap-icons'; opacity: 1; }

#cmpTable th, #cmpTable td  { white-space: nowrap; vertical-align: middle; }
#cmpTable thead th          { font-size: .75rem; font-weight: 600; letter-spacing: .01em; padding: .45rem .4rem; text-align: center; min-width: 80px; }
#cmpTable thead th:first-child  { text-align: left; min-width: 150px; }
#cmpTable tbody td          { font-size: .81rem; padding: .35rem .4rem; }
#cmpTable tbody td:first-child  { min-width: 150px; }

.table-ratios th, .table-ratios td { white-space: nowrap; vertical-align: middle; }
.table-ratios thead th      { font-size: .75rem; font-weight: 600; padding: .45rem .4rem; text-align: center; min-width: 90px; }
.table-ratios thead th:first-child { text-align: left; min-width: 150px; }
.table-ratios tbody td      { font-size: .81rem; padding: .35rem .4rem; }

/* Sticky primera columna */
.table-sticky tbody td:first-child { position: sticky; left: 0; z-index: 2; background: #fff; box-shadow: 2px 0 5px -1px rgba(0,0,0,.10); }
.table-sticky thead th:first-child { position: sticky; left: 0; z-index: 3; background: #f8f9fa; box-shadow: 2px 0 5px -1px rgba(0,0,0,.10); }
[data-bs-theme="dark"] .table-sticky tbody td:first-child { background: #252830; }
[data-bs-theme="dark"] .table-sticky thead th:first-child { background: #2d3139; }

/* ── 13. Fitxa asseguradora ──────────────────────────────────────────────── */
#kpi-track::-webkit-scrollbar { display: none; }

/* ── 14. Formulari multi-pas — stepper visual ────────────────────────────── */

/* Contenidor del stepper (enganxat sota el topbar) */
.sw-stepper {
  background: #fff; border-bottom: 1px solid #dee2e6;
  padding: .8rem 1.5rem 1rem;
}

/* Capçalera: "Pas X de 8 — Nom" + percentatge */
.sw-stepper-meta {
  display: flex !important; flex-direction: row !important;
  align-items: center; justify-content: space-between;
  margin-bottom: .55rem; font-size: .82rem;
}
.sw-step-counter      { font-weight: 700; color: var(--sw-blue); }
.sw-step-current-name { color: #495057; margin-left: .3rem; }
.sw-stepper-pct       { color: #6c757d; font-size: .75rem; font-variant-numeric: tabular-nums; }

/* Barra de progrés prima */
.sw-stepper-track {
  height: 4px; background: #e9ecef; border-radius: 2px; margin-bottom: .85rem;
}
.sw-stepper-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sw-blue-md), var(--sw-blue));
  border-radius: 2px; transition: width .5s ease;
}

/* Nodes */
.sw-stepper-nodes {
  display: flex !important; flex-direction: row !important;
  flex-wrap: nowrap !important; align-items: flex-start; overflow: visible;
}

.sw-step-node {
  flex: 1 1 0% !important; min-width: 0;
  display: flex; flex-direction: column; align-items: center;
  position: relative; cursor: default; text-decoration: none;
}
/* Línia de connexió entre nodes */
.sw-step-node:not(:last-child)::after {
  content: ''; position: absolute; top: 13px; left: 50%;
  width: 100%; height: 2px; background: #e9ecef; z-index: 0;
}
.sw-step-node.done:not(:last-child)::after { background: var(--sw-green); }
.sw-step-node.active:not(:last-child)::after { background: #c7d9fd; }

/* Cercle del node */
.sw-step-circle {
  width: 28px; height: 28px; border-radius: 50%; position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700;
  background: #e9ecef; color: #6c757d; border: 2px solid #dee2e6;
  transition: transform .2s, box-shadow .2s;
}
.sw-step-node.done .sw-step-circle   { background: var(--sw-green); border-color: var(--sw-green); color: #fff; }
.sw-step-node.active .sw-step-circle {
  background: var(--sw-blue); border-color: var(--sw-blue); color: #fff;
  box-shadow: 0 0 0 4px rgba(13,110,253,.18);
}
.sw-step-node.clickable               { cursor: pointer; }
.sw-step-node.clickable:hover .sw-step-circle { transform: scale(1.18); box-shadow: 0 0 0 5px rgba(13,110,253,.14); }

/* Etiqueta sota el cercle */
.sw-step-label {
  font-size: .65rem; margin-top: .3rem; text-align: center; color: #adb5bd;
  white-space: nowrap; line-height: 1.2;
}
.sw-step-node.active .sw-step-label { color: var(--sw-blue); font-weight: 700; }
.sw-step-node.done .sw-step-label   { color: var(--sw-green); }

/* Mòbil: amagar etiquetes en pantalles molt petites */
@media (max-width: 479px) { .sw-step-label { display: none; } }

/* Dark mode */
[data-bs-theme="dark"] .sw-stepper            { background: #1e2228; border-color: #3a3f4b; }
[data-bs-theme="dark"] .sw-step-current-name  { color: #adb5bd; }
[data-bs-theme="dark"] .sw-stepper-track      { background: #2d3139; }
[data-bs-theme="dark"] .sw-step-node:not(:last-child)::after { background: #3a3f4b; }
[data-bs-theme="dark"] .sw-step-node.done:not(:last-child)::after { background: var(--sw-green); }
[data-bs-theme="dark"] .sw-step-node.active:not(:last-child)::after { background: #1a3a6e; }
[data-bs-theme="dark"] .sw-step-circle        { background: #2d3139; border-color: #3a3f4b; color: #6c757d; }
[data-bs-theme="dark"] .sw-step-label         { color: #4a5568; }

/* Compatibilitat enrere: l'antic step-indicator (si queda en algun lloc) */
.step-indicator { display: none; }
