@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;600&display=swap');

/* ─── Paleta corporativa UV + variables de disseny ──────────────────────── */
:root {
  /* Colors corporatius UV */
  --uv-vermell:  #c4122f;
  --uv-taronja:  #F5A800;
  --uv-nav:      #003366;
  --uv-blau:     #0065a4;
  --uv-blau-clar:#E6F1FB;
  --uv-blanc:    #FFFFFF;
  --uv-gris:     #F4F6F9;
  --uv-gris-m:   #5A6B7F;
  --uv-brd:      #D6DDE6;
  --uv-txt:      #1A2332;
  /* Tipografia */
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'Inter', 'Sora', system-ui, sans-serif;
  /* Utilitats */
  --brd-r:       10px;
  --transition:  .22s ease;
  --shadow-sm:   0 2px 8px rgba(0,51,102,.08);
  --shadow-md:   0 6px 24px rgba(0,51,102,.12);
  --shadow-lg:   0 12px 40px rgba(0,51,102,.16);
}

/* ─── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--sans); background: var(--uv-gris); color: var(--uv-txt); min-height: 100vh; display: flex; flex-direction: column; }

/* ─── CANVI 2 · Capçalera redissenyada ─────────────────────────────────────── */
.header { background: var(--uv-nav); }

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--uv-nav);
}
.header-servei {
  font-size: 15px;
  font-weight: 300;
  color: #fff;
  flex: 1;
}
.header-uv {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--uv-taronja);
  text-align: center;
  flex: 1;
}
.header-seccio {
  font-size: 15px;
  font-weight: 300;
  color: #fff;
  text-align: right;
  flex: 1;
}

/* ─── CANVI 4 · Navegació amb 5 pestanyes ──────────────────────────────────── */
.nav {
  background: #243352;
  display: flex;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 3px solid transparent;
  font-family: var(--sans);
  transition: all .2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}
.nav-btn.act {
  background: var(--uv-taronja);
  color: var(--uv-txt);
  border-bottom-color: var(--uv-taronja);
  font-weight: 600;
}

/* ─── Barra d'estat global (sota la nav) ──────────────────────────────────── */
.status-bar {
  background: var(--uv-blanc);
  border-bottom: 1px solid var(--uv-brd);
  padding: 3px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #aaa;
  transition: background .3s;
}
/* CANVI 1 · Indicador actiu: taronja UV */
.dot.ok  { background: var(--uv-taronja); }
.dot.err { background: #f44336; }
.status-txt { font-size: 12px; color: var(--uv-gris-m); }

/* ─── Seccions ─────────────────────────────────────────────────────────────── */
.seccio { max-width: 1200px; margin: 10px auto; padding: 0 16px; display: none; }
.seccio.vis { display: block; }

/* ─── Text descriptiu dinàmic del motor ────────────────────────────────── */
.motor-descripcio {
  font-size: 13.5px;
  line-height: 1.5;
  color: #002E52;
  background: linear-gradient(135deg, rgba(168, 200, 233, 0.2) 0%, rgba(228, 235, 233, 0.4) 100%);
  border-left: 4px solid #0082C5;
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  margin: 6px 0 10px 0;
  font-weight: 450;
  transition: all 0.4s ease;
}

/* Subtítol antic (retrocompatibilitat) */
.subtitol {
  background: var(--uv-blanc);
  border: 1px solid var(--uv-brd);
  border-radius: 8px 8px 0 0;
  padding: 9px 16px;
  margin-bottom: 0;
  border-bottom: none;
}
.subtitol p {
  font-size: 12px;
  color: var(--uv-gris-m);
  font-style: italic;
  line-height: 1.5;
}

/* ─── Panells laterals ─────────────────────────────────────────────────────── */
.panells {
  display: grid;
  grid-template-columns: 1fr 140px 1fr;
  background: var(--uv-blanc);
  border: 1px solid var(--uv-brd);
  border-radius: 0 0 10px 10px;
  overflow: hidden;
  min-height: 240px;
}
/* Si hi ha subtítol/descripció adjunt, elimina radius superior */
.subtitol + .panells { border-top-left-radius: 0; border-top-right-radius: 0; }
.motor-descripcio + .panells { border-top-left-radius: 0; border-top-right-radius: 0; }

.panell-cap {
  padding: 11px 15px;
  border-bottom: 1px solid var(--uv-brd);
  background: #fafafa;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.idioma { font-size: 13px; font-weight: 600; }
.temps  { font-size: 11px; color: var(--uv-gris-m); }

.textarea {
  width: 100%;
  border: none;
  outline: none;
  padding: 15px;
  font-size: 15px;
  line-height: 1.65;
  resize: none;
  font-family: var(--sans);
  color: var(--uv-txt);
  min-height: 160px;
  flex: 1;
  transition: background var(--transition);
}
.textarea:focus {
  background: #FAFCFF;
}
.textarea.traduit { background: #fafafa; }
.panell-esquerre, .panell-dret { display: flex; flex-direction: column; }

/* Avís criteris lingüístics — bloc independent sota panells */
.avis-criteri {
  background: #E1E1CD;
  border-left: 4px solid var(--uv-nav);
  color: var(--uv-nav);
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.5;
  border-radius: 0 6px 6px 0;
  margin-top: 16px;
}

/* CANVI 5A · Comptadors de paraules */
.comp-bar {
  background: #F9F9F9;
  border-top: 1px solid var(--uv-brd);
  padding: 5px 15px;
  display: flex;
  justify-content: flex-end;
  font-size: 11px;
  color: var(--uv-gris-m);
}

/* CANVI 6 · Columna central horitzontal */
.central {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 140px;
  border-left: 1px solid var(--uv-brd);
  border-right: 1px solid var(--uv-brd);
  background: #FAFAFA;
  padding: 0 10px;
}

/* CANVI 6 · Botó Tradueix/Corregeix horitzontal, taronja UV */
.btn-tradueix {
  background: var(--uv-taronja);
  color: var(--uv-txt);
  border: none;
  border-radius: 6px;
  padding: 10px 28px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  min-width: 120px;
  font-family: var(--sans);
  transition: opacity .2s;
  /* Layout horitzontal — no s'usa text vertical */
}
.btn-tradueix:hover    { opacity: .85; }
.btn-tradueix:disabled { opacity: .45; cursor: not-allowed; }

/* Barra d'accions */
.accions {
  padding: 8px 15px;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  border-top: 1px solid var(--uv-brd);
}
.btn-sec {
  padding: 5px 13px;
  border: 1px solid var(--uv-brd);
  border-radius: 5px;
  background: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--uv-gris-m);
  font-family: var(--sans);
  transition: background .15s;
}
.btn-sec:hover { background: var(--uv-gris); }
.btn-desa {
  padding: 5px 15px;
  background: #0F6E56;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--sans);
}

/* ─── CANVI 5B · Zona càrrega documents ────────────────────────────────────── */
.upload-area {
  background: var(--uv-blanc);
  border: 1px solid var(--uv-brd);
  border-radius: 10px;
  padding: 40px 32px 32px;
  text-align: center;
  transition: border-color .2s;
}
.upload-area.drag-over { border-color: var(--uv-taronja); background: #FFFBF0; }

.upload-top { margin-bottom: 20px; }

.btn-apujar {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border-radius: 8px;
  border: none;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  background: #F5A800;
  color: #1B2A4A;
  transition: opacity 0.2s;
}
.btn-apujar:hover { opacity: .85; }

.drag-hint  { font-size: 13px; color: var(--uv-gris-m); margin-top: 10px; }
.formats-txt { font-size: 11px; color: var(--uv-gris-m); margin-top: 5px; }

/* Informació del fitxer carregat */
.fitxer-info {
  display: none;
  background: #F9F9F9;
  border: 1px solid var(--uv-brd);
  border-radius: 8px;
  padding: 14px 18px;
  text-align: left;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}
.fitxer-icona { font-size: 32px; flex-shrink: 0; }
.fitxer-detalls { flex: 1; }
.fitxer-nom  { font-size: 14px; font-weight: 600; }
.fitxer-meta { font-size: 12px; color: var(--uv-gris-m); margin-top: 3px; }
.btn-tradueix-doc {
  background: var(--uv-taronja);
  color: var(--uv-txt);
  border: none;
  border-radius: 6px;
  padding: 10px 22px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--sans);
  transition: opacity .2s;
  flex-shrink: 0;
}
.btn-tradueix-doc:hover { opacity: .9; }

/* ─── CANVI 8 · Barra de progrés ───────────────────────────────────────────── */
.progres-cont { margin-top: 16px; display: none; }
.progres-lbl  { font-size: 12px; color: var(--uv-gris-m); margin-bottom: 7px; }
.progres-bar  {
  background: #F0F0F0;
  border-radius: 8px;
  height: 10px;
  overflow: hidden;
}
.progres-fill {
  height: 100%;
  background: var(--uv-taronja);
  animation: progressAnim 1.8s ease-in-out infinite;
}
@keyframes progressAnim {
  0%   { width: 0; }
  50%  { width: 75%; }
  100% { width: 95%; }
}

/* Targeta de resultat */
.resultat-card {
  background: var(--uv-blanc);
  border: 1px solid var(--uv-brd);
  border-radius: 10px;
  padding: 18px 22px;
  display: none;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}
.res-icona { font-size: 34px; }
.res-info  { flex: 1; }
.res-nom   { font-size: 14px; font-weight: 600; }
.res-det   { font-size: 11px; color: var(--uv-gris-m); margin-top: 2px; }
.btn-descarrega {
  background: var(--uv-blau);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--sans);
}
.btn-descarrega:hover { opacity: .9; }

/* ─── Botó extracció imatges del document ─────────────────────────────────── */
#btn-extreu-imatges-doc {
  margin-top: 8px;
  border-color: var(--uv-blau-accent, #0082C5);
  color: var(--uv-blau-accent, #0082C5);
}
#btn-extreu-imatges-doc:hover {
  background: rgba(0, 130, 197, 0.08);
}

/* ─── CANVI 7 · Secció imatges ─────────────────────────────────────────────── */
.imatge-area {
  background: var(--uv-blanc);
  border: 1px solid var(--uv-brd);
  border-radius: 10px;
  padding: 40px 32px;
}
.imatge-upload { text-align: center; margin-bottom: 24px; }
.imatge-preview { display: none; margin-top: 16px; }
.imatge-preview img {
  max-height: 300px;
  border-radius: 8px;
  border: 1px solid var(--uv-brd);
  display: block;
  margin: 0 auto;
  max-width: 100%;
}
.imatge-meta {
  font-size: 12px;
  color: var(--uv-gris-m);
  margin-top: 8px;
  text-align: center;
}
.imatge-accio { text-align: center; margin-top: 14px; }
.imatge-resultat {
  background: #F9F9F9;
  border: 1px solid var(--uv-brd);
  border-radius: 8px;
  padding: 18px;
  margin-top: 18px;
  font-size: 14px;
  color: var(--uv-gris-m);
  font-style: italic;
  display: none;
  text-align: center;
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 780px) {
  .header-top { flex-direction: column; gap: 4px; text-align: center; padding: 10px 16px; }
  .header-servei, .header-seccio { text-align: center; }
  .panells { grid-template-columns: 1fr; }
  .central {
    border: none;
    border-top: 1px solid var(--uv-brd);
    border-bottom: 1px solid var(--uv-brd);
    padding: 12px 10px;
    min-width: auto;
  }
  .btn-tradueix { width: 100%; }
  .nav-btn { font-size: 12px; padding: 9px 10px; }
  .upload-area { padding: 28px 16px; }
}

/* ── Pestanya Glossaris: actualització ──────────────── */
/* NOTA: Els estils principals de .tab-btn estan a .tan-nav .tab-btn (més avall).
   Aquesta regla base s'unifica per evitar conflictes. */

.tab-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 11px 18px;
  color: rgba(255,255,255,.72);
  transition: color var(--transition), background var(--transition), border-color var(--transition);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: .01em;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255,255,255,.09);
}

.tab-btn.act {
  color: var(--uv-taronja);
  border-bottom-color: var(--uv-taronja);
  font-weight: 700;
  background: rgba(245,168,0,.08);
}

.glossari-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.glossari-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.glossari-descripcio {
  color: var(--uv-gris-m, #666);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.glossari-domini-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.glossari-domini-selector select {
  flex: 1;
  max-width: 400px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
}

.glossari-badge {
  background: var(--uv-nav, #1B2A4A);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.glossari-form {
  background: var(--uv-gris, #F5F5F5);
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.glossari-form h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.glossari-form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.glossari-form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.glossari-form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--uv-gris-m, #555);
}

.glossari-form-group input,
.glossari-form-group select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
}

.glossari-form-submit {
  justify-content: flex-end;
}

.btn-primary {
  background: linear-gradient(135deg, var(--uv-nav) 0%, var(--uv-blau) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--sans);
  box-shadow: 0 2px 6px rgba(0,51,102,.15);
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(0,51,102,.25);
  transform: translateY(-1px);
}

.glossari-missatge {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.glossari-missatge-ok {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.glossari-missatge-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.glossari-taula-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.glossari-taula-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.glossari-cerca {
  padding: 0.4rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  width: 220px;
}

.glossari-taula {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.glossari-taula th {
  background: var(--uv-nav, #1B2A4A);
  color: white;
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-weight: 600;
}

.glossari-taula td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #eee;
}

.glossari-taula tr:hover td {
  background: var(--uv-gris, #F5F5F5);
}

.btn-eliminar-terme {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.btn-eliminar-terme:hover {
  opacity: 1;
}

.glossari-buit {
  text-align: center;
  color: var(--uv-gris-m, #888);
  padding: 2rem;
  font-style: italic;
}

/* ── Botó de descàrrega TSV (pestanya Glossaris) ────── */

.glossari-taula-accions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-descarrega-glossari {
  padding: 0.4rem 0.9rem;
  background: var(--uv-blau, #0065a4);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-descarrega-glossari:hover {
  background: var(--uv-nav, #003366);
}

/* ── Pestanya Traducció d'imatges amb text ──────────── */

.imatge-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.imatge-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.imatge-descripcio {
  color: var(--uv-gris-m, #666);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.imatge-config {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  background: var(--uv-gris, #F5F5F5);
}

.imatge-config summary {
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--uv-blau, #0070AB);
}

.imatge-config-body {
  margin-top: 1rem;
}

.imatge-config-nota {
  font-size: 0.85rem;
  color: var(--uv-gris-m, #666);
  margin-bottom: 0.75rem;
}

.imatge-config-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.imatge-config-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: monospace;
}

.imatge-key-status {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.imatge-key-status.ok    { color: #155724; }
.imatge-key-status.error { color: #721c24; }

.btn-secondary {
  padding: 0.5rem 1rem;
  background: var(--uv-blanc);
  color: var(--uv-nav);
  border: 1.5px solid var(--uv-brd);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--sans);
  white-space: nowrap;
}

.btn-secondary:hover {
  background: var(--uv-blau-clar);
  border-color: var(--uv-blau);
}

.imatge-upload-zone {
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 2.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.imatge-upload-zone:hover {
  border-color: var(--uv-blau, #0070AB);
  background: #f0f7ff;
}

.imatge-upload-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.75rem;
}

.imatge-upload-placeholder p {
  color: var(--uv-gris-m, #666);
  margin: 0.5rem 0;
}

.imatge-upload-nota {
  font-size: 0.8rem !important;
  color: #999 !important;
}

.imatges-llista {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.imatge-item {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  width: 180px;
}

.imatge-preview-thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.imatge-preview-gran {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  display: block;
}

.imatge-item-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  background: var(--uv-gris, #F5F5F5);
}

.imatge-item-nom {
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}

.imatge-prompt-container {
  margin-bottom: 1.5rem;
}

.imatge-prompt-container label {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.imatge-prompt-container textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
}

.imatge-prompt-nota {
  font-size: 0.8rem;
  color: var(--uv-gris-m, #999);
  margin-top: 0.4rem;
}

.imatge-accions {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.btn-traduir-imatge {
  min-width: 180px;
}

.imatge-resultats {
  flex-direction: column;
  gap: 1rem;
}

.imatge-resultats h3 {
  font-size: 1rem;
  font-weight: 600;
}

.imatge-resultats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.imatge-resultat-item {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  max-width: 440px;
  flex: 1;
  min-width: 280px;
}

.imatge-resultat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  background: var(--uv-gris, #F5F5F5);
  border-bottom: 1px solid #eee;
}

.imatge-missatge {
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.imatge-missatge-ok {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.imatge-missatge-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.imatge-missatge-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* ── Refinament iteratiu d'imatges ──────────────────── */

.imatge-refinament {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--uv-gris, #F5F5F5);
  border: 1px solid #ddd;
  border-radius: 8px;
}

.imatge-refinament label {
  display: block;
  font-weight: 500;
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
}

.imatge-refinament textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  resize: vertical;
  font-family: inherit;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
}

.imatge-refinament-accions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.imatge-refinament-nota {
  font-size: 0.82rem;
  color: var(--uv-gris-m, #888);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CORRECCIÓ / POSTEDICIÓ DE TEXTOS EN VALENCIÀ
   ═══════════════════════════════════════════════════════════════════════════ */

.correccio-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.correccio-header h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--uv-blau, #003366);
  margin: 0 0 0.35rem 0;
}

.correccio-descripcio {
  font-size: 0.92rem;
  color: var(--uv-gris-m, #555);
  line-height: 1.55;
  margin: 0;
}

/* ── Configuració API Key ─────────────────────────────────────────────────── */

.correccio-config {
  background: #f4f8ff;
  border: 1px solid #c5d7ef;
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
}

.correccio-config summary {
  padding: 0.75rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--uv-blau, #003366);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.correccio-config summary::-webkit-details-marker { display: none; }

.correccio-config-body {
  padding: 0 1.1rem 1rem 1.1rem;
  border-top: 1px solid #c5d7ef;
}

.correccio-config-nota {
  font-size: 0.83rem;
  color: #555;
  margin: 0.7rem 0;
  line-height: 1.5;
}

.correccio-config-fila {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.correccio-config-input {
  flex: 1;
  min-width: 220px;
  padding: 0.45rem 0.7rem;
  border: 1px solid #b0c4de;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: monospace;
}

.correccio-config-missatge {
  margin-top: 0.55rem;
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
  border-radius: 5px;
}

.correccio-config-ok    { background: #e6f7ee; color: #1a6b3a; }
.correccio-config-error { background: #ffeaea; color: #b00020; }

/* ── Opcions ─────────────────────────────────────────────────────────────── */

.correccio-opcions {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 0.7rem 1rem;
}

.correccio-opcio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: #333;
}

.correccio-opcio-label small {
  color: #777;
  font-size: 0.78rem;
}

/* ── Textarea d'entrada ───────────────────────────────────────────────────── */

.correccio-entrada-bloc {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.correccio-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.correccio-comptador {
  font-size: 0.78rem;
  font-weight: 400;
  color: #888;
}

.correccio-textarea {
  width: 100%;
  min-height: 200px;
  padding: 0.8rem 1rem;
  border: 1.5px solid #b0c4de;
  border-radius: 8px;
  font-size: 0.93rem;
  line-height: 1.6;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.correccio-textarea:focus {
  outline: none;
  border-color: var(--uv-blau, #003366);
  box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

/* ── Botons d'acció ──────────────────────────────────────────────────────── */

.correccio-accions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* ── Missatges d'estat ───────────────────────────────────────────────────── */

.correccio-missatge {
  padding: 0.6rem 1rem;
  border-radius: 7px;
  font-size: 0.9rem;
}

.correccio-missatge-ok    { background: #e6f7ee; color: #1a6b3a; border: 1px solid #b2dfca; }
.correccio-missatge-error { background: #ffeaea; color: #b00020; border: 1px solid #ffb3b3; }
.correccio-missatge-info  { background: #e8f0fd; color: #1a3e72; border: 1px solid #b3caf5; }

/* ── Indicador de càrrega ────────────────────────────────────────────────── */

.correccio-carregant {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem;
  background: #f0f5ff;
  border-radius: 8px;
  border: 1px solid #c5d7ef;
  font-size: 0.92rem;
  color: var(--uv-blau, #003366);
}

.correccio-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #b3c9e8;
  border-top-color: var(--uv-blau, #003366);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* ── Bloc de resultats ───────────────────────────────────────────────────── */

.correccio-resultats {
  border: 1.5px solid #d0dce8;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

/* Barra d'estadístiques */
.correccio-stats-bar {
  display: flex;
  gap: 0;
  background: #f0f4fb;
  border-bottom: 1px solid #d0dce8;
}

.correccio-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.65rem 0.5rem;
  border-right: 1px solid #d0dce8;
}

.correccio-stat:last-child { border-right: none; }

.correccio-stat-num {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--uv-blau, #003366);
}

.correccio-stat-lt { color: #c47300; }
.correccio-stat-cl { color: #7b2fbe; }

.correccio-stat-lbl {
  font-size: 0.73rem;
  color: #777;
  margin-top: 0.2rem;
  text-align: center;
}

/* Resum */
.correccio-resum-bloc {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.65rem 1.1rem;
  background: #fffde7;
  border-bottom: 1px solid #e0d89a;
  font-size: 0.88rem;
  color: #4a3800;
  line-height: 1.5;
}

.correccio-resum-bloc strong {
  flex-shrink: 0;
  color: #6b5000;
}

/* Pestanyes */
.correccio-tabs {
  display: flex;
  border-bottom: 1.5px solid #d0dce8;
  background: #f8f9fa;
}

.correccio-tab-btn {
  padding: 0.55rem 1rem;
  border: none;
  background: none;
  font-size: 0.87rem;
  cursor: pointer;
  color: #555;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border-bottom: 2.5px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.correccio-tab-btn:hover { color: var(--uv-blau, #003366); }

.correccio-tab-activa {
  color: var(--uv-blau, #003366) !important;
  border-bottom-color: var(--uv-blau, #003366) !important;
  font-weight: 600;
}

.correccio-badge {
  background: #d0dce8;
  color: #333;
  border-radius: 10px;
  padding: 0.05rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Panels */
.correccio-panel {
  padding: 1rem 1.1rem;
}

/* Text corregit */
.correccio-text-accions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.correccio-text-resultat {
  white-space: pre-wrap;
  font-size: 0.93rem;
  line-height: 1.65;
  color: #1a1a1a;
  background: #fafcff;
  border: 1px solid #dce6f0;
  border-radius: 7px;
  padding: 0.85rem 1rem;
  min-height: 80px;
  max-height: 420px;
  overflow-y: auto;
}

/* Llista de correccions */
.correccio-llista {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 480px;
  overflow-y: auto;
}

.correccio-buit {
  color: #4a8a5a;
  font-size: 0.9rem;
  padding: 0.5rem 0;
  margin: 0;
}

.correccio-item {
  border-radius: 7px;
  padding: 0.6rem 0.85rem;
  font-size: 0.87rem;
}

.correccio-item-lt {
  background: #fff9f0;
  border: 1px solid #f5d99a;
}

.correccio-item-cl {
  background: #f9f0ff;
  border: 1px solid #ddb8f7;
}

.correccio-item-cap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.correccio-item-original {
  background: #ffe0e0;
  color: #8b0000;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85rem;
  text-decoration: line-through;
  text-decoration-color: #cc0000;
}

.correccio-item-corregit {
  background: #d4edda;
  color: #1a5c2a;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 600;
}

.correccio-regla-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.correccio-badge-lt {
  background: #ffd970;
  color: #6b4d00;
}

.correccio-badge-cl {
  background: #d9b3ff;
  color: #4b0082;
}

.correccio-item-missatge,
.correccio-item-justificacio {
  color: #444;
  font-size: 0.84rem;
  line-height: 1.45;
}

.correccio-suggerits {
  margin-top: 0.25rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.8rem;
  color: #666;
}

.correccio-suggerit {
  background: #e8f5e9;
  color: #1b5e20;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font-family: monospace;
}

/* Filtre per tipus */
.correccio-filtre-bloc {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.correccio-label-sm {
  font-size: 0.83rem;
  color: #555;
  font-weight: 600;
}

.correccio-select {
  padding: 0.3rem 0.6rem;
  border: 1px solid #b0c4de;
  border-radius: 6px;
  font-size: 0.85rem;
  background: #fff;
  cursor: pointer;
}

/* Tipus badges (per color de categoria) */
.correccio-tipus-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  text-transform: capitalize;
}

.correccio-tipus-ortografia  { background: #ffd6d6; color: #8b0000; }
.correccio-tipus-morfologia  { background: #ffe5b3; color: #6b3d00; }
.correccio-tipus-sintaxi     { background: #d6e8ff; color: #003380; }
.correccio-tipus-lèxic       { background: #e0f5d6; color: #1b5e20; }
.correccio-tipus-estil       { background: #ede0ff; color: #4b0082; }
.correccio-tipus-puntuació   { background: #f0f0f0; color: #333; }
.correccio-tipus-registre    { background: #fff3cd; color: #664d03; }

/* Botó petit ─────────────────────────────────────────────────────────────── */
.btn-sm {
  font-size: 0.82rem !important;
  padding: 0.3rem 0.7rem !important;
}

/* ── Correcció de documents DOCX / PPTX ──────────────────────────────────── */

.correccio-document-seccio {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.correccio-document-divisor {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  color: #888;
  font-size: 0.85rem;
}

.correccio-document-divisor::before,
.correccio-document-divisor::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #dde4ed;
}

.correccio-document-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.15rem;
  background: #f6f8fb;
  border: 1px solid #d0dce8;
  border-radius: 10px;
}

.correccio-document-esquerra {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.correccio-document-dreta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn-apujar-doc,
.btn-corregir-doc,
.btn-descarregar-doc {
  white-space: nowrap;
}

.correccio-doc-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  background: #fff;
  border: 1px solid #c5d7ef;
  border-radius: 6px;
  font-size: 0.87rem;
}

.correccio-doc-icona {
  font-size: 1.05rem;
  line-height: 1;
}

.correccio-doc-nom {
  font-weight: 500;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #222;
}

.correccio-doc-mida {
  color: #888;
  font-size: 0.8rem;
}

.correccio-document-nota {
  margin-top: 0.55rem;
  font-size: 0.79rem;
  color: #999;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOTÓ NAV · CLAUS API
   ═══════════════════════════════════════════════════════════════════════════ */

.btn-claus-api {
  margin-left: auto;
  padding: 0.38rem 0.85rem;
  background: transparent;
  border: 1px solid var(--color-border, #dde4ef);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--uv-blau, #003366);
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  white-space: nowrap;
  align-self: center;
}

.btn-claus-api:hover {
  background: var(--color-surface, #f0f4fb);
  border-color: var(--uv-blau, #003366);
}

.btn-claus-api-atencio {
  border-color: #856404 !important;
  color: #856404 !important;
  background: #fff8e1 !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL · CLAUS API
   ═══════════════════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.modal-contingut {
  background: #fff;
  border-radius: 12px;
  padding: 1.75rem 2rem;
  max-width: 560px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

.modal-capçalera {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.modal-capçalera h2 {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--uv-blau, #003366);
  margin: 0;
}

.modal-tancar {
  background: none;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  color: #888;
  padding: 0.2rem 0.45rem;
  border-radius: 5px;
  line-height: 1;
  transition: background 0.15s;
}

.modal-tancar:hover { background: #f0f0f0; }

.modal-descripcio {
  font-size: 0.84rem;
  color: #666;
  margin: 0 0 1.35rem 0;
  line-height: 1.55;
}

.modal-descripcio code {
  background: #f0f4fb;
  padding: 0.08rem 0.3rem;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.82rem;
}

/* Secció d'una clau */
.modal-clau-seccio { margin-bottom: 0.5rem; }

.modal-clau-capçalera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  gap: 0.5rem;
}

.modal-clau-titol {
  font-weight: 600;
  font-size: 0.93rem;
  color: #222;
}

.modal-clau-estat {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: 12px;
  white-space: nowrap;
}

.estat-ok    { background: #d4edda; color: #155724; }
.estat-error { background: #f8d7da; color: #721c24; }

.modal-clau-us {
  font-size: 0.81rem;
  color: #888;
  margin: 0 0 0.55rem 0;
}

.modal-clau-row {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.modal-clau-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.modal-clau-input {
  width: 100%;
  padding: 0.48rem 2.4rem 0.48rem 0.75rem;
  border: 1px solid #c0d0e8;
  border-radius: 6px;
  font-size: 0.88rem;
  font-family: monospace;
  transition: border-color 0.18s;
  box-sizing: border-box;
}

.modal-clau-input:focus {
  outline: none;
  border-color: var(--uv-blau, #003366);
  box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.modal-clau-ull {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0;
  opacity: 0.55;
  transition: opacity 0.15s;
  line-height: 1;
}

.modal-clau-ull:hover { opacity: 1; }

.btn-desar-clau {
  white-space: nowrap;
  padding: 0.48rem 1rem !important;
  font-size: 0.88rem !important;
}

.modal-clau-actual {
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.3rem;
  font-family: monospace;
  min-height: 1.1em;
}

.modal-clau-missatge {
  margin-top: 0.35rem;
  padding: 0.38rem 0.65rem;
  border-radius: 5px;
  font-size: 0.83rem;
}

.modal-clau-missatge-ok    { background: #d4edda; color: #155724; }
.modal-clau-missatge-error { background: #f8d7da; color: #721c24; }

.modal-separador {
  border: none;
  border-top: 1px solid #e8ecf2;
  margin: 1.1rem 0;
}

.modal-peu {
  margin-top: 1.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.modal-peu-nota {
  font-size: 0.79rem;
  color: #888;
  flex: 1;
  margin: 0;
  line-height: 1.5;
}

.modal-peu-nota code {
  background: #f0f4fb;
  padding: 0.08rem 0.3rem;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.78rem;
}

/* ── Selector de domini lingüístic (Traducció de documents) ── */

.doc-domini-selector {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: var(--color-surface, #f8f9fa);
  border: 1px solid var(--color-border, #ddd);
  border-radius: 8px;
  border-left: 3px solid var(--uv-blau, #0065a4);
}

.doc-domini-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
  color: var(--uv-nav, #003366);
}

.doc-domini-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.doc-domini-select {
  flex: 1;
  min-width: 250px;
  max-width: 500px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 6px;
  font-size: 0.9rem;
  background: white;
}

.doc-domini-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.doc-domini-badge-ok {
  background: #d4edda;
  color: #155724;
}

.doc-domini-badge-buit {
  background: #fff3cd;
  color: #856404;
}

.doc-domini-nota {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--uv-gris, #888);
  font-style: italic;
}

/* ── Lightbox de previsualització d'imatges ──────────── */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 1rem;
  cursor: zoom-out;
}

.lightbox-contingut {
  position: relative;
  background: white;
  border-radius: 12px;
  padding: 1.25rem;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  cursor: default;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}

.lightbox-tancar {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--uv-nav, #003366);
  color: white;
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox-tancar:hover { background: var(--uv-vermell, #c4122f); }

.lightbox-titol {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--uv-nav, #003366);
  padding-right: 2rem;
}

.lightbox-imatge {
  max-width: 80vw;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--color-border, #ddd);
}

.lightbox-peu {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--uv-gris, #888);
}

.imatge-clicable {
  cursor: zoom-in;
  transition: opacity 0.2s, transform 0.2s;
}

.imatge-clicable:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

/* ── Barres de progrés ───────────────────────────────── */

.progress-container {
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  background: var(--color-surface, #f8f9fa);
  border: 1px solid var(--color-border, #ddd);
  border-radius: 8px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  font-size: 0.88rem;
  font-weight: 500;
}

.progress-bar-track {
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--uv-blau, #0065a4), var(--uv-nav, #003366));
  border-radius: 4px;
  transition: width 0.4s ease;
}

.progress-bar-mig {
  background: linear-gradient(90deg, #f0a500, var(--uv-blau, #0065a4));
}

.progress-bar-complet {
  background: linear-gradient(90deg, #28a745, #20c997);
}

.progress-detall {
  font-size: 0.78rem;
  color: var(--uv-gris, #888);
  font-style: italic;
}

/* ── Pestanya Traducció anglès ↔ valencià ────────────── */

.angles-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.angles-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.angles-descripcio {
  color: var(--uv-gris, #666);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.angles-direccio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--color-surface, #f8f9fa);
  border: 1px solid var(--color-border, #ddd);
  border-radius: 10px;
}

.angles-direccio-selector {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.angles-llengua {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--uv-nav, #003366);
  min-width: 80px;
  text-align: center;
}

.angles-inverteix {
  background: var(--uv-blau, #0065a4);
  color: white;
  border: none;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.angles-inverteix:hover {
  background: var(--uv-nav, #003366);
  transform: rotate(180deg);
}

.angles-direccio-nota {
  font-size: 0.85rem;
  color: var(--uv-gris, #666);
}

.angles-text-seccio h3,
.angles-doc-seccio h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.angles-text-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 640px) {
  .angles-text-grid { grid-template-columns: 1fr; }
}

.angles-text-bloc {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.angles-text-bloc label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--uv-gris, #555);
}

.angles-text-bloc textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  line-height: 1.6;
}

.angles-sortida-accions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.angles-text-accions {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.angles-doc-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.angles-doc-accions {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.angles-nota-implementacio {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  font-size: 0.88rem;
  color: #856404;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CANVI 3 · CAPÇALERA, NAVEGACIÓ I ESTRUCTURA NOVA
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Capçalera principal ────────────────────────────────────────────────── */
.tan-header {
  background: linear-gradient(135deg, #001225 0%, #002E52 30%, #0065a4 70%, #0088D4 100%);
  position: relative;
  z-index: 100;
  box-shadow: 0 6px 24px rgba(0, 29, 61, 0.25);
  border-bottom: 3px solid var(--uv-taronja);
}

.tan-header-contingut {
  position: relative;
  padding: 16px 24px 12px 24px;
  text-align: center;
}

/* Bloc central de la capçalera */
.tan-header-central {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* Línia 1: TAN UV — 48px, pes 900 */
.tan-logo-nom {
  font-size: 48px;
  font-weight: 900;
  color: var(--uv-taronja);
  letter-spacing: 5px;
  font-family: var(--sans);
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  margin-bottom: 2px;
  line-height: 1;
}

/* Línia 2: Entorn de traducció... — 16px */
.tan-logo-subtitol {
  font-size: 16px;
  font-weight: 400;
  color: rgba(255,255,255,.95);
  letter-spacing: 1px;
  font-family: var(--sans);
  margin-bottom: 8px;
  white-space: nowrap;
}

/* Línia 3: Servei de Llengües... — 20px */
.tan-slogan-text {
  font-size: 20px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

/* Línia 4: Assessorament Lingüístic... — 15px */
.tan-slogan-uv {
  font-size: 15px;
  font-weight: 400;
  color: rgba(255,255,255,.85);
  letter-spacing: 0.3px;
}

/* Botó Claus API — posició absoluta dalt a la dreta */
.btn-claus-api {
  position: absolute;
  top: 16px;
  right: 24px;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.90);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 7px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
  z-index: 10;
}

.btn-claus-api:hover {
  background: rgba(255,255,255,.22);
  border-color: rgba(255,255,255,.55);
}

/* ── Barra de navegació enganxosa ───────────────────────────────────────── */
.tan-nav {
  background: rgba(0, 20, 48, .92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 0;
  z-index: 200;
  border-top: 1px solid rgba(255,255,255,.06);
}

.tan-nav::-webkit-scrollbar { display: none; }

.tan-nav .nav-btn,
.tan-nav .tab-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.72);
  padding: 11px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  font-family: var(--sans);
  transition: color var(--transition), background var(--transition), border-color var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: .01em;
}

.tan-nav .nav-btn:hover,
.tan-nav .tab-btn:hover {
  color: #fff;
  background: rgba(255,255,255,.09);
}

.tan-nav .nav-btn.act,
.tan-nav .tab-btn.act {
  color: var(--uv-taronja);
  border-bottom-color: var(--uv-taronja);
  font-weight: 700;
  background: rgba(245,168,0,.08);
}

/* ── Wrapper principal de contingut ────────────────────────────────────── */
.tan-main {
  flex: 1;
  padding-bottom: 0;
}

/* ── Peu de pàgina ─────────────────────────────────────────────────────── */
.tan-footer {
  background: linear-gradient(135deg, #001D3D 0%, var(--uv-nav) 100%);
  text-align: center;
  padding: 10px 24px;
  border-top: 3px solid var(--uv-taronja);
  line-height: 1.6;
  flex-shrink: 0;
}

.tan-footer a {
  color: var(--uv-taronja);
  text-decoration: none;
}

.tan-footer a:hover {
  text-decoration: underline;
}

.footer-text {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.95);
}

.footer-text-secundari {
  font-size: 12px;
  font-weight: 400;
  color: rgba(255,255,255,.8);
  margin-top: 4px;
}

.footer-text-copyright {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,255,.65);
  margin-top: 6px;
}

/* ── Responsiu per a la capçalera nova ─────────────────────────────────── */
@media (max-width: 780px) {
  .tan-header-contingut {
    padding: 18px 16px 14px;
  }
  .tan-logo-nom      { font-size: 36px; letter-spacing: 4px; }
  .tan-logo-subtitol { font-size: 13px; letter-spacing: 0.5px; white-space: normal; margin-bottom: 10px; }
  .tan-slogan-text   { font-size: 17px; }
  .tan-slogan-uv     { font-size: 13px; }
  .btn-claus-api     { top: 10px; right: 12px; font-size: 0.75rem; padding: 6px 10px; }
  .tan-nav .nav-btn,
  .tan-nav .tab-btn  { font-size: 12px; padding: 9px 11px; }
}

@media (max-width: 480px) {
  .tan-logo-nom      { font-size: 28px; letter-spacing: 3px; }
  .tan-logo-subtitol { font-size: 11px; margin-bottom: 6px; }
  .tan-slogan-text   { font-size: 14px; }
  .tan-slogan-uv     { font-size: 11px; }
  .btn-claus-api     { font-size: 0.7rem; padding: 5px 8px; }
}

/* ═══ Motor toggle switch (AINA / Claude) ══════════════════════════════════ */
.motor-toggle-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  background: var(--uv-blau-clar);
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid #B5D4F4;
}
.motor-toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--uv-nav);
}
.motor-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.motor-toggle-nom {
  font-size: 13px;
  font-weight: 500;
  color: var(--uv-gris-m);
  transition: color var(--transition), font-weight var(--transition);
}
.motor-toggle-nom.actiu,
.motor-toggle-nom-esq:not(.actiu ~ .motor-toggle-nom-dret) {
  color: var(--uv-nav);
  font-weight: 700;
}
/* Per defecte AINA (esq) està actiu */
.motor-toggle-nom-esq { color: var(--uv-nav); font-weight: 700; }
.motor-toggle-nom-dret { color: var(--uv-gris-m); font-weight: 500; }
.motor-toggle-nom.actiu { color: var(--uv-nav); font-weight: 700; }
.motor-toggle-nom:not(.actiu) { color: var(--uv-gris-m); font-weight: 500; }

/* Toggle switch */
.motor-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.motor-toggle input { opacity: 0; width: 0; height: 0; }
.motor-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--uv-blau);
  border-radius: 26px;
  transition: background var(--transition);
}
.motor-toggle-slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.motor-toggle input:checked + .motor-toggle-slider {
  background: linear-gradient(135deg, #7C3AED, #A855F7);
}
.motor-toggle input:checked + .motor-toggle-slider::before {
  transform: translateX(22px);
}

/* ─── Selector de motor de 3 opcions ──────────────────────────────────────── */
.motor-selector-3 {
  display: flex;
  gap: 0;
  margin-bottom: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--uv-gris-m, #5A6B7F);
  width: fit-content;
}

.motor-btn {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: white;
  color: var(--uv-gris-m, #5A6B7F);
  cursor: pointer;
  transition: all 0.3s ease;
  border-right: 1px solid var(--uv-gris-m, #5A6B7F);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.motor-btn:last-child {
  border-right: none;
}

.motor-btn:hover {
  background: rgba(0, 46, 82, 0.05);
}

.motor-btn.motor-btn-actiu[data-motor="salamandra"] {
  background: var(--uv-nav, #003366);
  color: white;
}

.motor-btn.motor-btn-actiu[data-motor="apertium"] {
  background: #2E7D32;
  color: white;
}

.motor-btn.motor-btn-actiu[data-motor="claude"] {
  background: var(--uv-blau, #0065a4);
  color: white;
}

/* ─── MOSAIC EINES DE LLENGUA ─────────────────────────────────────────────── */
.eines-mosaic {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: 100%;
}

@media (max-width: 1100px) {
  .eines-mosaic { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 780px) {
  .eines-mosaic { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .eines-mosaic { grid-template-columns: 1fr; }
}

.eina-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 12px;
  border-radius: 10px;
  border: 1.5px solid #ddd;
  text-decoration: none;
  color: var(--uv-nav, #003366);
  background: white;
  transition: all 0.25s ease;
  cursor: pointer;
}

.eina-card:hover {
  border-color: var(--uv-blau, #0065a4);
  background: rgba(0, 130, 197, 0.04);
  box-shadow: 0 4px 12px rgba(0, 46, 82, 0.1);
  transform: translateY(-2px);
}

.eina-card-destacat {
  border-color: var(--uv-taronja, #F5A800);
  background: rgba(245, 168, 0, 0.04);
}

.eina-card-destacat:hover {
  border-color: var(--uv-taronja, #F5A800);
  background: rgba(245, 168, 0, 0.08);
}

.eina-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  margin-bottom: 8px;
  object-fit: contain;
}

.eina-titol {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 4px;
  color: var(--uv-nav, #003366);
}

.eina-desc {
  font-size: 11.5px;
  color: var(--uv-gris-m, #5A6B7F);
  line-height: 1.3;
}

/* ═══ Correccions taula i estadístiques ═════════════════════════════════════ */
.correccions-taula-wrap {
  overflow-x: auto;
  margin-top: 12px;
}
.correccions-taula {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.correccions-taula th {
  background: #0C447C;
  color: #fff;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.correccions-taula td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}
.correccions-taula tr:nth-child(even) {
  background: #f7fafc;
}
.correccions-taula tr:hover {
  background: #edf2f7;
}
.cat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cat-SINT { background: #fed7d7; color: #c53030; }
.cat-MORF { background: #fefcbf; color: #975a16; }
.cat-LÈX, .cat-LEX { background: #c6f6d5; color: #276749; }
.cat-ORTO { background: #bee3f8; color: #2a69ac; }
.cat-ORTT { background: #e9d8fd; color: #553c9a; }
.cat-ESTIL { background: #fde8d0; color: #7b341e; }

.correccions-resum {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  background: #f7fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.resum-item {
  text-align: center;
}
.resum-item .resum-num {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: #0C447C;
}
.resum-item .resum-lbl {
  font-size: 11px;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.resum-diagnostic {
  margin-top: 12px;
  padding: 12px;
  background: #e6f1fb;
  border-radius: 8px;
  font-size: 13px;
  color: #2d3748;
  line-height: 1.5;
}

/* ── Taula resum de correccions de document (revisió) ─────────────── */
.correccio-doc-taula-resum {
  margin-top: 28px;
  padding: 24px;
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
  border: 2px solid #234E83;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(35, 78, 131, 0.12);
}
.correccio-doc-resum-header h3 {
  color: #002E52;
  font-size: 18px;
  margin: 0 0 8px 0;
}
.correccio-doc-resum-header p {
  color: #364F74;
  font-size: 13px;
  margin: 0 0 16px 0;
  line-height: 1.5;
}
.correccio-doc-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.correccio-doc-stat-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.correccio-doc-stat-densitat {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: #e2e8f0;
  color: #4a5568;
}
.correccions-taula-doc {
  font-size: 12px;
}
.correccions-taula-doc td del {
  color: #c53030;
  background: #fff5f5;
  padding: 1px 3px;
  border-radius: 3px;
}
.correccions-taula-doc td strong {
  color: #276749;
  background: #f0fff4;
  padding: 1px 3px;
  border-radius: 3px;
}
.correccio-doc-diagnostic {
  margin-top: 16px;
  padding: 14px 18px;
  background: #e6f1fb;
  border-radius: 10px;
  font-size: 13px;
  color: #2d3748;
  line-height: 1.6;
  border-left: 4px solid #234E83;
}

/* Toggle motor EN-VA */
.motor-btn.motor-btn-actiu[data-motor-angles="salamandra"] {
  background: linear-gradient(135deg, #F5A800, #E09200);
  color: white;
}
.motor-btn.motor-btn-actiu[data-motor-angles="claude"] {
  background: linear-gradient(135deg, #D97706, #B45309);
  color: white;
}
/* Toggle motor Correccio */
.motor-btn.motor-btn-actiu[data-motor-corr="salamandra"] {
  background: linear-gradient(135deg, #F5A800, #E09200);
  color: white;
}
.motor-btn.motor-btn-actiu[data-motor-corr="claude"] {
  background: linear-gradient(135deg, #D97706, #B45309);
  color: white;
}


/* ═══════════════════════════════════════════════════ */
/* XATBOT GEMMA — Interfície de xat                   */
/* ═══════════════════════════════════════════════════ */



/* ── Capçalera ── */






#btn-xatbot-nou {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
#btn-xatbot-nou:hover {
  background: rgba(255,255,255,0.25);
}

/* ── Àrea de missatges ── */




/* ── Missatges ── */

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
























/* Botons d'acció dels missatges */





/* ── Indicador de generació ── */




@keyframes xatbotTyping {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── Pantalla de benvinguda ── */









/* ── Adjunts ── */





/* ── Barra d'entrada ── */












/* ── File preview dins missatge ── */



/* ── Responsive ── */
@media (max-width: 768px) {
  
  
  
  
}

/* fi xatbot css */


/* ═══════════════════════════════════════════════════ */
/* XATBOT GEMMA v3 — Interfície LLM moderna           */
/* ═══════════════════════════════════════════════════ */

.g4-chat {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 130px);
  min-height: 450px;
  max-width: 820px;
  margin: 0 auto;
  position: relative;
}

/* ── Missatges ── */
.g4-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 30px 0 20px;
  scroll-behavior: smooth;
}
.g4-msgs::-webkit-scrollbar { width: 5px; }
.g4-msgs::-webkit-scrollbar-thumb { background: #ccd3da; border-radius: 3px; }

.g4-msg {
  padding: 20px 0;
  animation: g4In 0.3s ease;
}
@keyframes g4In {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.g4-msg + .g4-msg { border-top: 1px solid #eef1f4; }

.g4-msg-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.g4-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.g4-msg.user .g4-msg-avatar { background: #e8a838; color: #fff; }
.g4-msg.bot .g4-msg-avatar { background: #1a5276; color: #fff; }
.g4-msg-name { font-weight: 600; font-size: 14px; color: #1a2a3a; }

.g4-msg-text {
  padding-left: 38px;
  font-size: 15px;
  line-height: 1.75;
  color: #2c3e50;
  word-wrap: break-word;
}
.g4-msg.user .g4-msg-text { color: #3a4a5a; }

/* Markdown */
.g4-msg-text p { margin: 0 0 10px; }
.g4-msg-text p:last-child { margin-bottom: 0; }
.g4-msg-text strong { font-weight: 700; color: #1a3a5a; }
.g4-msg-text em { font-style: italic; }
.g4-msg-text ul, .g4-msg-text ol { margin: 8px 0; padding-left: 24px; }
.g4-msg-text li { margin-bottom: 4px; }
.g4-msg-text code {
  background: #f0f3f6;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 13.5px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  color: #c0392b;
}
.g4-msg-text pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 16px 20px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 12px 0;
  font-size: 13px;
  line-height: 1.6;
}
.g4-msg-text pre code { background: none; padding: 0; color: inherit; }
.g4-msg-text blockquote {
  border-left: 3px solid #1a5276;
  margin: 10px 0;
  padding: 6px 16px;
  color: #555;
  background: #f8fafb;
  border-radius: 0 8px 8px 0;
}
.g4-msg-text h1, .g4-msg-text h2, .g4-msg-text h3 {
  color: #1a5276;
  font-weight: 700;
  margin: 16px 0 8px;
}
.g4-msg-text h1 { font-size: 18px; }
.g4-msg-text h2 { font-size: 16px; }
.g4-msg-text h3 { font-size: 15px; }
.g4-msg-text a { color: #1a5276; text-decoration: underline; }
.g4-msg-text table { border-collapse: collapse; margin: 10px 0; width: 100%; font-size: 13.5px; }
.g4-msg-text th, .g4-msg-text td { border: 1px solid #dde3e8; padding: 8px 12px; text-align: left; }
.g4-msg-text th { background: #f0f4f7; font-weight: 600; color: #1a5276; }
.g4-msg-text hr { border: none; border-top: 1px solid #e0e6eb; margin: 16px 0; }

/* Accions */
.g4-msg-actions {
  padding-left: 38px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}
.g4-msg:hover .g4-msg-actions { opacity: 1; }
.g4-act {
  background: none;
  border: 1px solid #dde3e8;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: #6b7c8d;
  cursor: pointer;
  transition: all 0.15s;
}
.g4-act:hover { background: #f0f4f7; color: #1a5276; border-color: #1a5276; }

/* Typing */
.g4-dots { display: flex; gap: 5px; padding: 4px 0; }
.g4-dot {
  width: 8px; height: 8px;
  background: #1a5276;
  border-radius: 50%;
  animation: g4Dot 1.2s infinite ease-in-out;
}
.g4-dot:nth-child(2) { animation-delay: 0.15s; }
.g4-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes g4Dot {
  0%,80%,100% { transform: scale(0.5); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── Benvinguda ── */
.g4-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 20px;
}
.g4-welcome-logo { margin-bottom: 20px; }
.g4-welcome-title {
  font-size: 26px;
  font-weight: 700;
  color: #1a5276;
  margin: 0 0 8px;
}
.g4-welcome-sub {
  font-size: 14.5px;
  color: #6b7c8d;
  line-height: 1.6;
  margin: 0 0 30px;
}
.g4-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 600px;
}
.g4-sugg {
  padding: 10px 18px;
  background: #fff;
  border: 1.5px solid #dde3e8;
  border-radius: 20px;
  font-size: 13.5px;
  color: #2c3e50;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.g4-sugg:hover {
  border-color: #1a5276;
  background: #f0f6fa;
  color: #1a5276;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(26,82,118,0.12);
}

/* ── Adjunts ── */
.g4-attach-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background: #f8fafb;
  border: 1px solid #e8edf1;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
}
.g4-att {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid #dde3e8;
  border-radius: 6px;
  font-size: 12px;
}
.g4-att-x { cursor: pointer; color: #999; font-weight: 700; }
.g4-att-x:hover { color: #e74c3c; }

/* ── Input area ── */
.g4-bottom { flex-shrink: 0; padding-bottom: 6px; }
.g4-input-area { position: relative; }
.g4-input-box {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  border: 1.5px solid #ccd3da;
  border-radius: 24px;
  padding: 8px 8px 8px 6px;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.g4-input-box:focus-within {
  border-color: #1a5276;
  box-shadow: 0 0 0 3px rgba(26,82,118,0.08);
}
.g4-btn-attach {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  color: #8899a6;
  flex-shrink: 0;
  transition: all 0.15s;
}
.g4-btn-attach:hover { background: #f0f4f7; color: #1a5276; }
#g4-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  max-height: 200px;
  padding: 7px 4px;
  outline: none;
  color: #2c3e50;
}
#g4-input::placeholder { color: #a0adb8; }
.g4-btn-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #1a5276;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.g4-btn-send:hover { background: #1e6a9c; transform: scale(1.05); }
.g4-btn-send:disabled { background: #ccd3da; cursor: default; transform: none; }
.g4-disclaimer {
  text-align: center;
  font-size: 11px;
  color: #a0adb8;
  margin-top: 6px;
}

@media (max-width: 768px) {
  .g4-chat { height: calc(100vh - 110px); }
  .g4-suggestions { gap: 6px; }
  .g4-sugg { font-size: 12px; padding: 8px 14px; }
}

/* fi xatbot css */

/* ── TEAMS PANEL ─────────────────────────────── */
.teams-tab-btn { display:flex; align-items:center; gap:4px; }
.teams-tab-btn.teams-actiu { color:#a5a7e0 !important; border-bottom-color:#6264A7 !important; background:rgba(98,100,167,.15) !important; }
.teams-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.3); z-index:900; }
.teams-overlay.visible { display:block; }
.teams-panel { position:fixed; top:0; right:0; width:320px; height:100vh; background:#fff; box-shadow:-4px 0 20px rgba(0,0,0,.15); z-index:901; display:flex; flex-direction:column; transform:translateX(100%); transition:transform .25s ease; }
.teams-panel.obert { transform:translateX(0); }
.teams-panel-cap { background:#6264A7; padding:12px 16px; display:flex; align-items:center; justify-content:space-between; flex-shrink:0; }
.teams-panel-titol { color:#fff; font-size:13px; font-weight:500; display:flex; align-items:center; gap:7px; }
.teams-logo-mini { width:18px; height:18px; background:#fff; border-radius:4px; display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:700; color:#6264A7; flex-shrink:0; }
.teams-panel-tanca { background:none; border:none; color:rgba(255,255,255,.8); font-size:14px; cursor:pointer; padding:2px 4px; line-height:1; }
.teams-panel-tanca:hover { color:#fff; }
.teams-panel-cos { flex:1; padding:16px; display:flex; flex-direction:column; gap:14px; overflow-y:auto; }
.teams-avis { background:#fffbe6; border:1px solid #f0d060; border-radius:6px; padding:10px 12px; display:flex; gap:8px; align-items:flex-start; }
.teams-avis-ico { font-size:13px; flex-shrink:0; margin-top:1px; }
.teams-avis-text { font-size:11px; color:#7a6000; line-height:1.5; }
.teams-canal-card { background:#f5f5f5; border:1px solid #e0e0e0; border-radius:6px; padding:10px 12px; }
.teams-canal-label { font-size:10px; color:#888; text-transform:uppercase; letter-spacing:.06em; margin-bottom:4px; }
.teams-canal-nom { font-size:13px; font-weight:500; color:#1a1a1a; }
.teams-canal-equip { font-size:11px; color:#666; margin-top:2px; }
.teams-btn-obri { background:#6264A7; color:#fff; border:none; border-radius:6px; padding:11px 16px; font-size:13px; font-weight:500; cursor:pointer; width:100%; transition:background .15s; }
.teams-btn-obri:hover { background:#4f5195; }
.teams-btn-copia { background:none; border:1px solid #d0d0d0; border-radius:6px; padding:9px 16px; font-size:12px; color:#666; cursor:pointer; width:100%; transition:all .15s; }
.teams-btn-copia:hover { background:#f5f5f5; color:#1a1a1a; }
.teams-btn-copia.copiat { border-color:#3a9e6f; color:#3a9e6f; }
.teams-separador { border:none; border-top:1px solid #e8e8e8; margin:0; }
.teams-peu-text { font-size:11px; color:#999; text-align:center; line-height:1.5; }

/* ═══ XAT SLPL ════════════════════════════════════════════════════════════ */
.xat-barra {
  position: fixed; bottom: 0; right: 24px; z-index: 9000;
  display: flex; align-items: center; gap: 8px;
  background: #234E83; color: white;
  padding: 8px 16px; border-radius: 10px 10px 0 0;
  cursor: pointer; box-shadow: 0 -2px 12px rgba(0,0,0,0.2);
  font-weight: 600; font-size: 14px; user-select: none;
}
.xat-barra:hover { background: #1a3d6b; }
.xat-barra-ico { font-size: 18px; }
.xat-barra-btn { background: none; border: none; color: white;
  font-size: 16px; cursor: pointer; padding: 0 4px; }
.xat-badge {
  background: #e8a838; color: white; border-radius: 50%;
  width: 20px; height: 20px; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  animation: xat-pulse 1s infinite;
}
@keyframes xat-pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.2)} }
.xat-panel {
  position: fixed; bottom: 38px; right: 24px; z-index: 8999;
  width: 360px; max-height: 520px;
  background: white; border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
  display: flex; flex-direction: column;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  border: 1.5px solid #d0d8e4;
}
.xat-panel.xat-minimitzat { max-height: 0; opacity: 0; pointer-events: none; }
.xat-cap {
  display: flex; align-items: center; justify-content: space-between;
  background: #234E83; color: white; padding: 10px 14px;
  border-radius: 12px 12px 0 0; font-weight: 600; font-size: 13px;
}
.xat-cap-accions { display: flex; align-items: center; gap: 8px; }
.xat-online { font-size: 11px; opacity: 0.85; }
.xat-btn-ico { background: none; border: none; cursor: pointer;
  font-size: 18px; padding: 4px; border-radius: 6px;
  transition: background 0.15s; color: white; }
.xat-btn-ico:hover { background: rgba(255,255,255,0.15); }
.xat-missatges {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  max-height: 320px; min-height: 200px;
}
.xat-msg { display: flex; flex-direction: column; gap: 2px; }
.xat-msg-propi { align-items: flex-end; }
.xat-msg-altre { align-items: flex-start; }
.xat-msg-cap { font-size: 11px; color: #6b7a8d; font-weight: 600; }
.xat-bombolla {
  max-width: 80%; padding: 8px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.4; word-break: break-word;
}
.xat-msg-propi .xat-bombolla { background: #234E83; color: white; border-radius: 12px 12px 2px 12px; }
.xat-msg-altre .xat-bombolla { background: #f0f3f7; color: #1a1a2e; border-radius: 12px 12px 12px 2px; }
.xat-msg-sistema {
  text-align: center; font-size: 11px; color: #9aa5b4;
  font-style: italic; padding: 2px 0;
}
.xat-msg-hora { font-size: 10px; color: #9aa5b4; margin-top: 2px; }
.xat-emojis {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 8px 12px; border-top: 1px solid #e8ecf0;
  max-height: 100px; overflow-y: auto;
}
.xat-emoji-btn { background: none; border: none; font-size: 22px;
  cursor: pointer; padding: 2px; border-radius: 6px;
  transition: background 0.1s; }
.xat-emoji-btn:hover { background: #f0f3f7; }
.xat-entrada {
  border-top: 1.5px solid #e8ecf0;
  padding: 8px 10px; display: flex; flex-direction: column; gap: 6px;
}
.xat-entrada-fila { display: flex; align-items: center; gap: 6px; }
.xat-entrada-text { flex: 1; }
.xat-btn-ico:not(.xat-cap .xat-btn-ico) { color: #234E83; }
.xat-textarea {
  flex: 1; resize: none; border: 1.5px solid #d0d8e4;
  border-radius: 8px; padding: 8px 10px; font-size: 13px;
  font-family: inherit; outline: none; transition: border 0.2s;
}
.xat-textarea:focus { border-color: #234E83; }
.xat-envia-btn {
  background: #234E83; color: white; border: none;
  border-radius: 8px; padding: 8px 14px; font-size: 16px;
  cursor: pointer; transition: background 0.2s; align-self: flex-end;
}
.xat-envia-btn:hover { background: #1a3d6b; }
.xat-micro-btn-actiu { background: #dc2626 !important; animation: xat-pulse 0.6s infinite; }
label.xat-btn-ico { display: flex; align-items: center; cursor: pointer;
  color: #234E83; font-size: 18px; }
.xat-fitxer-msg { display: flex; flex-direction: column; gap: 4px; }
.xat-fitxer-msg a { color: #234E83; text-decoration: underline; font-size: 12px; }
.xat-fitxer-msg img { max-width: 200px; border-radius: 8px; cursor: pointer; }
.xat-fitxer-msg audio, .xat-fitxer-msg video { max-width: 100%; border-radius: 8px; }
/* ═══════════════════════════════════════════════════════════════════════════ */
