/* ============================================
   XG BLUR — DESIGN SYSTEM v2 (refined)
   ============================================ */
:root {
  --brand: #2563EB; --brand-dk: #1E40AF; --brand-lt: #DBEAFE; --brand-glass: #EFF6FF;
  --accent: #F59E0B; --accent-lt: #FEF3C7; --accent-dk: #B45309;
  --ok: #10B981; --ok-lt: #D1FAE5;
  --warn: #F59E0B; --warn-lt: #FEF3C7;
  --no: #EF4444; --no-lt: #FEE2E2;
  --ink: #0B1220; --text: #0F172A; --text-soft: #334155; --text-mute: #64748B; --text-dim: #94A3B8;
  --bg: #F8FAFC; --bg-card: #FFFFFF; --bg-soft: #F1F5F9; --rule: #E2E8F0; --rule-strong: #CBD5E1;
  --sh-sm: 0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.06);
  --sh-md: 0 4px 6px -1px rgba(15,23,42,0.07), 0 2px 4px -2px rgba(15,23,42,0.05);
  --sh-lg: 0 12px 24px -6px rgba(15,23,42,0.10), 0 6px 12px -3px rgba(15,23,42,0.06);
  --sh-card: 0 1px 0 rgba(15,23,42,0.04), 0 2px 8px rgba(15,23,42,0.05);
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-full: 999px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale; line-height: 1.5;
}
.frame-desktop { width: 1440px; height: 900px; background: var(--bg); position: relative; overflow: hidden; display: flex; flex-direction: column; }
.frame-desktop > .topbar + * { flex: 1; min-height: 0; overflow: auto; }
.frame-mobile { width: 390px; height: 844px; background: var(--bg); position: relative; overflow: hidden; }

.h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; color: var(--text); }
.h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; color: var(--text); }
.h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.005em; color: var(--text); }
.h4 { font-size: 15px; font-weight: 600; color: var(--text); }
.body { font-size: 14px; color: var(--text-soft); }
.small { font-size: 13px; color: var(--text-mute); }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-mute); }
.mono { font-family: "SF Mono", "JetBrains Mono", Consolas, ui-monospace, monospace; font-size: 13px; }

.topbar { height: 64px; background: var(--bg-card); border-bottom: 1px solid var(--rule); display: flex; align-items: center; padding: 0 32px; gap: 16px; z-index: 10; flex-shrink: 0; }
.topbar-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--text); font-size: 16px; }
.topbar-brand .brand-dot { width: 32px; height: 32px; background: var(--brand); border-radius: 8px; display: grid; place-items: center; color: white; font-weight: 800; font-size: 13px; letter-spacing: -0.02em; }
.topbar-nav { display: flex; gap: 4px; margin-left: 24px; }
.topbar-nav a { padding: 8px 14px; border-radius: 8px; text-decoration: none; color: var(--text-soft); font-size: 14px; font-weight: 500; display:inline-flex; gap:6px; align-items:center; }
.topbar-nav a.active { background: var(--brand-glass); color: var(--brand); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.lang-pill { display: inline-flex; background: var(--bg-soft); border-radius: var(--r-full); padding: 2px; }
.lang-pill button { border: none; background: transparent; padding: 4px 10px; font-size: 11px; font-weight: 600; color: var(--text-mute); border-radius: var(--r-full); cursor: pointer; font-family: inherit; }
.lang-pill button.active { background: var(--text); color: white; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-soft); display: grid; place-items: center; font-weight: 600; font-size: 13px; color: var(--brand); overflow: hidden; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: var(--r-md); font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid transparent; font-family: inherit; white-space: nowrap; }
.btn-primary { background: var(--brand); color: white; }
.btn-secondary { background: var(--bg-card); color: var(--text); border-color: var(--rule); }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-danger { background: var(--no); color: white; }
/* 🆕 Botó de tancar sessió: roig clarament identificable com a "destructive" */
.btn-logout { background: var(--no-lt); color: var(--no); border: 1px solid var(--no); font-weight: 700; }
.btn-logout:hover { background: var(--no); color: white; }
.btn-logout .icon { stroke: currentColor; }
.btn-success { background: var(--ok); color: white; }
.btn-accent { background: var(--accent); color: white; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }

.card { background: var(--bg-card); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--sh-card); }
.card-header { padding: 20px 24px; border-bottom: 1px solid var(--rule); }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; background: var(--bg-soft); border-top: 1px solid var(--rule); border-radius: 0 0 var(--r-lg) var(--r-lg); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: var(--r-full); font-size: 11px; font-weight: 600; }
.badge-brand { background: var(--brand-glass); color: var(--brand); }
.badge-ok { background: var(--ok-lt); color: #047857; }
.badge-warn { background: var(--warn-lt); color: var(--accent-dk); }
.badge-no { background: var(--no-lt); color: #B91C1C; }
.badge-neutral { background: var(--bg-soft); color: var(--text-soft); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text); }
.field input, .field textarea, .field select { height: 42px; border: 1px solid var(--rule); border-radius: var(--r-md); padding: 0 14px; font-size: 14px; font-family: inherit; background: var(--bg-card); color: var(--text); outline: none; }
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glass); }
.field textarea { height: auto; padding: 12px 14px; min-height: 90px; resize: none; }
.field .hint { font-size: 12px; color: var(--text-mute); }

.mobile-statusbar { height: 44px; background: var(--bg-card); display: flex; align-items: center; justify-content: space-between; padding: 0 20px 0 28px; font-size: 14px; font-weight: 600; }
.mobile-statusbar::before { content: "9:41"; font-weight: 700; letter-spacing: -0.01em; }
.mobile-statusbar .icons { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text); }
.mobile-topbar { height: 56px; background: var(--bg-card); border-bottom: 1px solid var(--rule); display: flex; align-items: center; padding: 0 16px; gap: 12px; }
.mobile-topbar .icon-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-soft); display: grid; place-items: center; color: var(--text); }
.mobile-topbar .brand-dot { width:36px; height:36px; background: var(--brand); border-radius: 8px; display: grid; place-items: center; color: white; font-weight: 800; font-size: 13px; }
.mobile-topbar .title { font-weight: 700; font-size: 16px; flex: 1; }
.mobile-tabbar { position: absolute; bottom: 0; left: 0; right: 0; height: 84px; background: var(--bg-card); border-top: 1px solid var(--rule); display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: 22px; }
.mobile-tabbar .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 10px; font-weight: 600; color: var(--text-mute); }
.mobile-tabbar .tab.active { color: var(--brand); }
.mobile-tabbar .tab .ic { width: 24px; height: 24px; display: grid; place-items: center; }

.row { display: flex; gap: 16px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 16px; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--rule); margin: 16px 0; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; }
.text-center { text-align: center; }
.hidden { display: none !important; }

/* 🆕 Base responsive: tots els media i form-controls respecten el seu pare.
   NO usem overflow-x: hidden a html/body perquè trenca el pinch-zoom natural
   d'iOS Safari i impedeix veure el contingut real quan zoom-ejes.
   En comptes d'amagar overflows, els resolem amb min-width:0 als contenidors. */
img, video { max-width: 100%; height: auto; }
input, textarea, select { max-width: 100%; box-sizing: border-box; min-width: 0; }
/* Default CSS Grid posa min-width:auto als items, que pot ser més gran que el
   contenidor i forçar overflow horitzontal. Posem min-width:0 a tots els
   contenidors usuals per evitar-ho. */
.card, .card-body, .card-header, .card-footer { min-width: 0; }
.row, .col { min-width: 0; }

/* 🆕 Contenidor anti-overflow horitzontal. `overflow-x: clip` és més segur
   que `hidden`: NO crea un containing block, NO inhibeix pinch-zoom (iOS
   tracta el zoom sobre el visual viewport, independent d'aquesta propietat).
   L'apliquem a body perquè cap pàgina pugui scroll lateralment per errors
   d'estil que se'ns escapin. */
body { overflow-x: clip; }

/* 🆕 Anti auto-zoom d'iOS Safari: si un <input>/<select>/<textarea> té font
   menor a 16px, iOS amplia automàticament la pàgina quan reps focus (típic
   quan s'obre l'autofill de contrasenya). El zoom-out manual no torna sol i
   la pàgina queda "tallada". Forcem 16px en mòbil. Visualment és pràcticament
   idèntic al 14px però evita el bug. */
@media (max-width: 768px) {
    input, select, textarea,
    .field input, .field select, .field textarea {
        font-size: 16px !important;
    }
}

/* 🆕 Loader d'aplicació global (per cobrir pantalla durant operacions llargues
   com el processat d'una foto). S'activa afegint `.show` al .app-loader. */
.app-loader { position: fixed; inset: 0; background: rgba(15,23,42,0.78); display: none; align-items: center; justify-content: center; z-index: 9000; padding: 20px; }
.app-loader.show { display: flex; }
.app-loader .app-loader-card { background: var(--bg-card); padding: 32px 28px; border-radius: 16px; text-align: center; max-width: 360px; box-shadow: 0 12px 40px rgba(0,0,0,0.45); }
.app-loader .app-loader-spin { width: 56px; height: 56px; margin: 0 auto 14px; border: 5px solid var(--bg-soft); border-top-color: var(--brand); border-radius: 50%; animation: appLoaderSpin 0.9s linear infinite; }
.app-loader .app-loader-title { font-size: 17px; font-weight: 700; color: var(--text); }
.app-loader .app-loader-sub { font-size: 13px; color: var(--text-soft); margin-top: 6px; line-height: 1.5; }
@keyframes appLoaderSpin { to { transform: rotate(360deg); } }

/* Inputs en graelles de 2 columnes en mòbil → 1 columna. Cobreix qualsevol
   `grid-template-columns: 1fr 1fr` (estil inline o classe) sota 600px. */
@media (max-width: 600px) {
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.125em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ============================================
   ADAPTACIONS PER A L'APP REAL (no als mockups)
   ============================================ */

/* Layout shell: topbar fixa + content scrollable + tabbar al mòbil */
body { min-height: 100vh; display: flex; flex-direction: column; }
body.has-topbar { padding-top: 64px; }
/* Padding inferior = altura tabbar + safe-area + buffer. Així el contingut no
   queda mai amagat sota la tabbar ni l'indicador d'iniciar de l'iPhone. */
body.has-tabbar-mobile { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 12px); }
main.page-content { flex: 1; min-height: 0; width: 100%; }

/* Topbar fixa al damunt */
.topbar.fixed { position: fixed; top: 0; left: 0; right: 0; }

/* Topbar nav links — interactius */
.topbar-nav a { cursor: pointer; transition: background .12s ease, color .12s ease; }
.topbar-nav a:hover:not(.active) { background: var(--bg-soft); color: var(--text); }
.topbar-actions .icon-btn { width:36px; height:36px; border-radius: var(--r-md); background: var(--bg-card); border:1px solid var(--rule); display:grid; place-items:center; cursor:pointer; color: var(--text-soft); position:relative; }
.topbar-actions .icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.topbar-actions .icon-btn .bell-dot { position:absolute; top:8px; right:8px; width:7px; height:7px; border-radius:50%; background: var(--no); border: 2px solid var(--bg-card); display:none; }
.topbar-actions .icon-btn.has-unread .bell-dot { display:block; }
.lang-pill button { cursor: pointer; }

/* Notification dropdown */
.notif-wrap { position: relative; }
.notif-dropdown { position: absolute; top: calc(100% + 8px); right: 0; width: 360px; background: var(--bg-card); border:1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--sh-lg); z-index: 50; display: none; }
.notif-dropdown.open { display: block; }
.notif-dropdown-header { padding: 14px 18px; border-bottom: 1px solid var(--rule); display:flex; align-items:center; justify-content:space-between; }
.notif-dropdown-list { max-height: 380px; overflow-y: auto; }
.notif-item { padding: 12px 18px; display:flex; gap:12px; align-items:flex-start; border-bottom: 1px solid var(--rule); text-decoration:none; color: var(--text); }
.notif-item:last-child { border-bottom:none; }
.notif-item:hover { background: var(--bg-soft); }
.notif-item .icon-circle { width:36px; height:36px; border-radius:50%; display:grid; place-items:center; flex-shrink:0; }
.notif-empty { padding: 32px 20px; text-align: center; color: var(--text-mute); font-size:13px; }
.notif-loading { padding: 24px; text-align: center; color: var(--text-mute); font-size:12px; }

/* Avatar amb foto o inicial */
.avatar.gradient { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dk) 100%); color:white; }
.avatar img { width:100%; height:100%; object-fit:cover; border-radius:inherit; }

/* Flash messages — global container al sobre del content */
.flash-stack { position: fixed; top: 12px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
/* 🆕 Quan hi ha topbar, el flash es posiciona PER SOTA del menú (no per damunt).
   Desktop: topbar 64px + 12px de respir → top:76px.
   Mòbil: topbar 56px + 12px → top:68px. */
body.has-topbar .flash-stack { top: calc(64px + 12px); }
@media (max-width: 768px) {
    .flash-stack { right: 12px; left: 12px; max-width: none; }
    body.has-topbar .flash-stack { top: calc(56px + 12px); }
}
.flash { padding: 12px 16px; border-radius: var(--r-md); box-shadow: var(--sh-md); font-size: 13px; display:flex; align-items:flex-start; gap:10px; animation: flashIn .25s ease-out; }
.flash.success { background: var(--ok-lt); color: #047857; border:1px solid var(--ok); }
.flash.error { background: var(--no-lt); color: #B91C1C; border:1px solid var(--no); }
.flash.warning { background: var(--accent-lt); color: var(--accent-dk); border:1px solid var(--accent); }
.flash.info { background: var(--brand-glass); color: var(--brand); border:1px solid var(--brand-lt); }
.flash button.close { background:none; border:none; cursor:pointer; color: inherit; opacity: .6; font-size:16px; line-height:1; padding:0; margin-left:auto; }
.flash button.close:hover { opacity: 1; }
@keyframes flashIn { from { transform: translateX(20px); opacity:0; } to { transform: translateX(0); opacity:1; } }

/* RESPONSIVE — sota 768px la topbar es compacta i la tabbar inferior apareix */
@media (max-width: 768px) {
  body.has-topbar { padding-top: 56px; }
  /* La topbar segueix visible al mòbil però en versió compacta */
  .topbar { padding: 0 12px; height: 56px; gap: 8px; }
  .topbar-brand span { display: none; }  /* només logo al mòbil */
  .topbar-nav { display: none; }          /* nav es mou a la tabbar inferior */
  .topbar-actions { margin-left: auto; gap: 6px; }
  .lang-pill button, .lang-pill a { padding: 3px 7px; font-size: 10px; }
  .avatar { width: 32px; height: 32px; font-size: 12px; }
  .theme-toggle { width: 32px; height: 32px; }
  .topbar-actions .icon-btn { width: 32px; height: 32px; }
  .mobile-tabbar { display: grid; }
}

/* SOBRE 768px amaguem la tabbar mobile */
@media (min-width: 769px) {
  .mobile-tabbar { display: none; }
  body.has-tabbar-mobile { padding-bottom: 0; }
  /* Sobre desktop, el botó d'info ja és visible al nav: amaguem la versió icon-only */
  .topbar-info-btn { display: none; }
}

/* Tabbar mobile — icones grans, ben llegibles
   🆕 Suma 8px extra a sota dels icones perquè a iPhones sense home button
   els icones no caiguin sobre l'àrea del swipe del home indicator.
   Requereix viewport-fit=cover al <meta viewport> perquè env() funcioni. */
.mobile-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  padding-top: 4px;
  background: var(--bg-card); border-top: 1px solid var(--rule);
  grid-template-columns: repeat(4, 1fr);
  z-index: 40;
}
/* 🆕 Variant amb 5 columnes + FAB central */
.mobile-tabbar-5 { grid-template-columns: repeat(5, 1fr); align-items: end; }
.mobile-tabbar-5 .tab-fab {
    position: relative;
    /* Sobresurt cap a dalt */
    margin-top: -22px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dk) 100%);
    color: white !important;
    border: 4px solid var(--bg-card);
    border-radius: 50%;
    width: 64px; height: 64px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0; font-size: 9px; font-weight: 700;
    cursor: pointer; padding: 0; font-family: inherit;
    /* Centrar respecte la cel·la del grid */
    justify-self: center;
    transition: transform .15s, box-shadow .15s;
}
.mobile-tabbar-5 .tab-fab:active { transform: scale(0.95); }
.mobile-tabbar-5 .tab-fab .ic { width: 30px; height: 30px; color: white; }
.mobile-tabbar-5 .tab-fab .ic svg.icon,
.mobile-tabbar-5 .tab-fab .ic svg { width: 28px !important; height: 28px !important; stroke: white !important; }
.mobile-tabbar-5 .tab-fab span { font-size: 9px; margin-top: 1px; line-height: 1; color: rgba(255,255,255,0.95); }
[data-theme="dark"] .mobile-tabbar-5 .tab-fab { border-color: var(--bg-card); }
.mobile-tabbar a.tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; text-decoration: none; color: var(--text-mute);
    font-size: 11px; font-weight: 600;
}
.mobile-tabbar .tab.active { color: var(--brand); }
.mobile-tabbar .tab .ic {
    width: 28px; height: 28px; display: grid; place-items: center;
}
.mobile-tabbar .tab .ic svg.icon,
.mobile-tabbar .tab .ic svg {
    width: 26px !important; height: 26px !important; stroke-width: 2;
}

/* Mobile topbar simplificada (només mòbil, sticky) */
@media (max-width: 768px) {
  .mobile-topbar.fixed { position: sticky; top: 0; z-index: 20; }
  .mobile-topbar { display: flex; }
  body.has-mobile-topbar { padding-top: 0; }
}
@media (min-width: 769px) {
  .mobile-topbar { display: none; }
}

/* Containers de pàgina */
.page-padded { padding: 24px 32px; max-width: 1280px; margin: 0 auto; width: 100%; }
@media (max-width: 768px) { .page-padded { padding: 16px; } }

/* Inputs disabled */
.field input[disabled], .field select[disabled], .field textarea[disabled] {
  background: var(--bg-soft); color: var(--text-mute); cursor: not-allowed;
}

/* Links de la app */
a { color: inherit; text-decoration: none; }
a.linklike { color: var(--brand); font-weight: 600; }
a.linklike:hover { text-decoration: underline; }

/* btn-link (text-only) */
.btn-link { background: transparent; color: var(--brand); font-weight: 600; }
.btn-link:hover { text-decoration: underline; }

/* Page hide chrome (per pantalles especials com login/captura facial fullscreen) */
body.no-chrome .topbar, body.no-chrome .mobile-tabbar, body.no-chrome .mobile-topbar { display: none !important; }
body.no-chrome { padding-top: 0 !important; padding-bottom: 0 !important; }

/* Layout 2 cols genèric (per /perfil i d'altres) */
.layout-sidebar { display: grid; grid-template-columns: 280px 1fr; gap: 32px; }
@media (max-width: 1024px) { .layout-sidebar { grid-template-columns: 1fr; gap: 20px; } }

/* ============================================
   LOGO XG BLUR — substitueix el placeholder .brand-dot
   ============================================ */
.brand-logo {
    width: 32px; height: 32px; border-radius: 8px;
    object-fit: cover; flex-shrink: 0;
    background: white;  /* fons blanc per al logo (que és blau sobre blanc) */
}
.brand-logo.large { width: 48px; height: 48px; border-radius: 10px; }
.brand-logo.huge { width: 96px; height: 96px; border-radius: 16px; }
.brand-logo.on-dark { background: white; padding: 2px; }
/* Topbar brand-logo mobile */
.mobile-topbar .brand-logo { width: 36px; height: 36px; }

/* ============================================
   DARK MODE — tokens alternatius
   ============================================ */
[data-theme="dark"] {
    --brand-glass:  rgba(96, 165, 250, 0.18);   /* per active-nav i info cards */
    --brand-lt:     rgba(96, 165, 250, 0.25);
    --accent-lt:    rgba(245, 158, 11, 0.18);
    --ok-lt:        rgba(16, 185, 129, 0.20);
    --warn-lt:      rgba(245, 158, 11, 0.18);
    --no-lt:        rgba(239, 68, 68, 0.20);

    --text:         #F1F5F9;
    --text-soft:    #CBD5E1;
    --text-mute:    #94A3B8;
    --text-dim:     #64748B;

    --bg:           #0B1220;     /* page bg fosc */
    --bg-card:      #1E293B;     /* cards fosques */
    --bg-soft:      #0F172A;     /* table headers / áreas suaus */
    --rule:         #334155;
    --rule-strong:  #475569;

    --sh-card: 0 1px 0 rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.3);
    --sh-md:   0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.3);
    --sh-lg:   0 12px 24px -6px rgba(0,0,0,0.5), 0 6px 12px -3px rgba(0,0,0,0.4);
}

/* Dark mode: textos badge més clars */
[data-theme="dark"] .badge-ok { background: rgba(16,185,129,0.18); color: #34D399; }
[data-theme="dark"] .badge-no { background: rgba(239,68,68,0.18); color: #F87171; }
[data-theme="dark"] .badge-warn { background: rgba(245,158,11,0.18); color: #FBBF24; }
[data-theme="dark"] .badge-brand { background: rgba(96,165,250,0.18); color: #93C5FD; }
[data-theme="dark"] .badge-neutral { background: #334155; color: #CBD5E1; }

/* Dark mode: el logo amb fons blanc destaca millor */
[data-theme="dark"] .brand-logo { background: white; }

/* Dark mode: nav links active */
[data-theme="dark"] .topbar-nav a.active { background: rgba(96,165,250,0.18); color: #93C5FD; }

/* Dark mode: avatar gradient més clar */
[data-theme="dark"] .avatar.gradient { background: linear-gradient(135deg, #3B82F6, #1E40AF); }

/* Dark mode: inputs */
[data-theme="dark"] .field input,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .field select { background: #0F172A; color: var(--text); border-color: var(--rule); }
[data-theme="dark"] .field input::placeholder { color: var(--text-mute); }
[data-theme="dark"] .field input[disabled], [data-theme="dark"] .field select[disabled] { background: #1E293B; color: var(--text-mute); }

/* Dark mode: buttons secondary */
[data-theme="dark"] .btn-secondary { background: var(--bg-card); color: var(--text); border-color: var(--rule); }
[data-theme="dark"] .btn-secondary:hover { background: var(--bg-soft); }
[data-theme="dark"] .btn-ghost { color: var(--text-soft); }
[data-theme="dark"] .btn-ghost:hover { background: var(--bg-soft); }

/* Dark mode: notif dropdown */
[data-theme="dark"] .notif-dropdown { background: var(--bg-card); border-color: var(--rule); }
[data-theme="dark"] .notif-item:hover { background: var(--bg-soft); }

/* Dark mode: tabbar mobile */
[data-theme="dark"] .mobile-tabbar { background: var(--bg-card); border-top-color: var(--rule); }

/* Dark mode: topbar */
[data-theme="dark"] .topbar { background: var(--bg-card); border-bottom-color: var(--rule); }

/* Dark mode: lang-pill */
[data-theme="dark"] .lang-pill { background: var(--bg-soft); }
[data-theme="dark"] .lang-pill button { color: var(--text-mute); }
[data-theme="dark"] .lang-pill button.active { background: var(--brand); color: white; }

/* Dark mode: scrollbar */
[data-theme="dark"] ::-webkit-scrollbar { width: 12px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 6px; border: 3px solid var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--rule-strong); }

/* Transició suau quan canvies de tema */
html, body, .card, .topbar, .mobile-tabbar, .field input, .field textarea, .field select,
.btn, .notif-dropdown, .badge {
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

/* Toggle button específic per al tema */
.theme-toggle {
    width: 36px; height: 36px; border-radius: var(--r-md);
    background: var(--bg-card); border: 1px solid var(--rule);
    display: grid; place-items: center; cursor: pointer;
    color: var(--text-soft);
}
.theme-toggle:hover { background: var(--bg-soft); color: var(--text); }
.theme-toggle .ic-sun { display: inline-block; }
.theme-toggle .ic-moon { display: none; }
[data-theme="dark"] .theme-toggle .ic-sun { display: none; }
[data-theme="dark"] .theme-toggle .ic-moon { display: inline-block; }
