/* ================================================
   TOKENS DE DISEÑO (mismos que SiverApp) + RESET
   Todo el color, radio y sombra sale de aquí: los componentes usan var(--token).
   ================================================ */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fuentes/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fuentes/inter-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: light;
  /* Marca: naranja (#D46427, el del logo de XaranGata y el de Amalgama) */
  --brand-900: #5c2a10; --brand-800: #7f3914; --brand-700: #9a4418; --brand-600: #b8501d;
  --brand-500: #d46427; --brand-400: #e8834a; --brand-200: #f6c9a8; --brand-100: #fbe6d6; --brand-50: #fdf4ec;
  /* Barra lateral: piedra oscura cálida */
  --side-900: #141110; --side-800: #221d1a; --side-700: #2e2723;
  /* Secundario: azul (contrapunto del naranja) */
  --azul-600: #2a6fb0; --azul-100: #dfeaf6; --azul-50: #eff5fb;

  --gray-900: #1c1917; --gray-800: #292524; --gray-700: #44403c; --gray-600: #57534e; --gray-500: #78716c;
  --gray-400: #a8a29e; --gray-300: #d6d3d1; --gray-200: #e7e5e4; --gray-100: #f5f5f4; --gray-50: #fafaf9;

  --bg: #faf8f6; --surface: #ffffff; --border: #ece8e4; --border-strong: #d6d3d1;
  --text: #1c1917; --text-muted: #78716c; --text-subtle: #a8a29e;

  --success-600: #15803d; --success-100: #dcfce7;
  --warning-600: #b45309; --warning-100: #fef3c7;
  --danger-600: #dc2626; --danger-700: #b91c1c; --danger-100: #fee2e2;
  --info-600: #2563eb; --info-100: #dbeafe;

  --radius-sm: 6px; --radius: 8px; --radius-lg: 12px; --radius-xl: 16px;
  --shadow-xs: 0 1px 2px rgba(28, 25, 23, 0.05);
  --shadow-sm: 0 1px 3px rgba(28, 25, 23, 0.08), 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-md: 0 4px 12px rgba(28, 25, 23, 0.08), 0 2px 4px rgba(28, 25, 23, 0.04);
  --shadow-lg: 0 16px 40px rgba(28, 25, 23, 0.16), 0 4px 10px rgba(28, 25, 23, 0.06);
  --ring: 0 0 0 3px rgba(212, 100, 39, 0.28);

  --sidebar-width: 240px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Gráficos: series validadas (CVD, todos los pares) sobre blanco, y rampa secuencial naranja */
  --s1: #d46427; --s2: #2a6fb0; --s3: #2a9d8f;
  --grid: #f0ece8; --axis: #d6d3d1;
  --seq-0: #f5f5f4; --seq-1: #fdf0e6; --seq-2: #fbd9c0; --seq-3: #f6b98f; --seq-4: #ec935c;
  --seq-5: #d46427; --seq-6: #a8471a; --seq-7: #6e2d0f;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01';
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--ring); }
::selection { background: var(--brand-100); }
[hidden] { display: none !important; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.neg { color: var(--danger-600); }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--gray-100); padding: 1px 5px; border-radius: 4px; }

/* ================================================
   LAYOUT: barra lateral fija en escritorio, cabecera + cajón en móvil
   ================================================ */
.shell { min-height: 100vh; display: flex; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); z-index: 200;
  background: var(--side-900); background-image: linear-gradient(180deg, var(--side-800) 0%, var(--side-900) 100%);
  color: var(--gray-300); display: flex; flex-direction: column; transition: transform 0.2s ease;
}
.scrim { display: none; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .shell.abierto .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .shell.abierto .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 150; }
}

.brand {
  display: flex; align-items: center; justify-content: center; padding: 18px 12px 14px; margin: 0 12px 4px;
  border: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); background: none; color: white; text-align: left;
}
/* el logo de la organización (o su nombre): como si la imagen estuviera directamente dentro */
.logo-org { display: contents; }
.brand .logo-org strong { text-transform: none; letter-spacing: normal; color: white; text-align: center; font-size: 17px; overflow-wrap: anywhere; }
/* Selector de organización (cuentas de más de una) */
.selector-org { margin: 0 12px 8px; position: relative; }
.org-actual, .org-opcion { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04); color: white; text-align: left; text-decoration: none; cursor: pointer; font: inherit; }
.org-actual:hover, .org-opcion:hover { background: rgba(255, 255, 255, 0.09); }
.org-actual svg { margin-left: auto; flex: none; color: var(--gray-400); }
.org-actual[aria-expanded="true"] svg { transform: rotate(180deg); }
.org-marca { flex: none; width: 30px; height: 30px; border-radius: 8px; background: rgba(255, 255, 255, 0.1); display: flex;
  align-items: center; justify-content: center; font-weight: 700; overflow: hidden; }
.org-marca img { width: 100%; height: 100%; object-fit: contain; }
.org-texto { display: flex; flex-direction: column; min-width: 0; }
.org-texto strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-texto small { font-size: 11.5px; color: var(--gray-400); }
.org-lista { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.org-lista[hidden] { display: none; }
.brand img { width: 168px; height: auto; display: block; transition: transform .2s; }
.brand:hover img { transform: rotate(-3deg) scale(1.03); }
.brand strong { display: block; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
.brand span { font-size: 11px; color: var(--gray-400); letter-spacing: 0.08em; text-transform: uppercase; }

.nav { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-separador { border: 0; border-top: 1px solid rgba(255, 255, 255, 0.1); margin: 14px 10px 8px; }
.nav-label { padding: 18px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray-500); }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 40px; padding: 0 12px; border: none;
  border-radius: var(--radius); background: transparent; color: var(--gray-300); font-size: 14px; font-weight: 500;
  text-align: left; position: relative; text-decoration: none; transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: white; }
.nav-item.activo { background: rgba(255, 255, 255, 0.1); color: white; font-weight: 600; }
.nav-item.activo::before {
  content: ''; position: absolute; left: -32px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-500);
}
.nav-item.activo svg { color: var(--brand-400); }

.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.sync-card { display: flex; align-items: center; gap: 10px; padding: 8px; margin-bottom: 6px; }
.sync-icono {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand-500); color: white;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sync-icono.error { background: var(--danger-600); }
.sync-texto { min-width: 0; line-height: 1.25; }
.sync-texto strong { display: block; color: white; font-size: 13px; font-weight: 600; }
.sync-texto span { display: block; font-size: 12px; color: var(--gray-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.footer-acciones { display: flex; gap: 6px; }
.footer-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04); color: var(--gray-300); font-size: 12px; font-weight: 600;
}
.footer-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); color: white; }
.footer-btn:disabled { opacity: .5; cursor: default; }
.version { margin-top: 10px; text-align: center; font-size: 11px; color: var(--gray-500); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-width); display: flex; flex-direction: column; }
.mobile-bar { display: none; }
@media (max-width: 900px) {
  .main { margin-left: 0; }
  .mobile-bar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 100; height: 56px; padding: 0 12px;
    background: var(--side-800); color: white; font-weight: 700;
  }
  .mobile-bar img { height: 44px; width: auto; }
  .mobile-bar .logo-org strong { font-size: 16px; }
}
.menu-btn { width: 40px; height: 40px; border: none; border-radius: var(--radius); background: transparent; color: white; display: flex; align-items: center; justify-content: center; }
.menu-btn:hover { background: rgba(255, 255, 255, 0.08); }

.content { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 28px 32px 40px; }
@media (max-width: 900px) { .content { padding: 20px 16px 32px; } }

/* ================================================
   COMPONENTES
   ================================================ */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.breadcrumb { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 6px; color: var(--text-muted); font-size: 13px; font-weight: 500; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--gray-900); }
.page-subtitle { margin-top: 4px; color: var(--text-muted); font-size: 14px; }
@media (max-width: 640px) { .page-title { font-size: 20px; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border: 1px solid var(--brand-600); border-radius: var(--radius); background: var(--brand-600); color: white;
  font-weight: 600; white-space: nowrap; transition: background 0.15s, border-color 0.15s;
}
.btn:hover:not(:disabled) { background: var(--brand-700); border-color: var(--brand-700); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secundario { background: var(--surface); color: var(--gray-700); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn.secundario:hover:not(:disabled) { background: var(--gray-50); color: var(--gray-900); }
.btn.chico { height: 32px; padding: 0 12px; gap: 6px; font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: 20px; min-width: 0; }
@media (max-width: 640px) { .card { padding: 16px; } }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 650; color: var(--gray-900); }
.card-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: var(--radius); background: var(--brand-50); color: var(--brand-600); flex-shrink: 0; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.grid > * { grid-column: span 12; }
.grid > .span-6 { grid-column: span 6; } .grid > .span-4 { grid-column: span 4; } .grid > .span-8 { grid-column: span 8; }
@media (max-width: 1100px) { .grid > .span-6, .grid > .span-4, .grid > .span-8 { grid-column: span 12; } }

/* KPIs (como el inicio de SiverApp) */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .kpis { gap: 10px; } }
.kpi { display: flex; align-items: center; gap: 16px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.kpi-icon { width: 44px; height: 44px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--brand-50); color: var(--brand-600); }
.kpi-icon.azul { background: var(--azul-100); color: var(--azul-600); }
.kpi-icon.exito { background: var(--success-100); color: var(--success-600); }
.kpi-icon.aviso { background: var(--warning-100); color: var(--warning-600); }
.kpi-text { min-width: 0; }
.kpi-text span { display: block; font-size: 13px; color: var(--text-muted); font-weight: 500; }
.kpi-text strong { display: block; font-size: 26px; line-height: 1.15; font-weight: 700; color: var(--gray-900); }
.kpi-text small { display: block; font-size: 12px; color: var(--text-subtle); margin-top: 2px; }
.kpi.destacado { grid-column: span 2; background: var(--brand-600); background-image: linear-gradient(135deg, var(--brand-500), var(--brand-700)); border-color: transparent; }
.kpi.destacado .kpi-icon { background: rgba(255, 255, 255, .16); color: white; }
.kpi.destacado .kpi-text span, .kpi.destacado .kpi-text small { color: rgba(255, 255, 255, .85); }
.kpi.destacado .kpi-text strong { color: white; font-size: 40px; letter-spacing: -0.02em; }
@media (max-width: 520px) {
  .kpi { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .kpi-icon { width: 36px; height: 36px; }
  .kpi-text strong { font-size: 22px; }
  .kpi.destacado .kpi-text strong { font-size: 30px; }
}

/* Control segmentado (pestañas) */
.segmented { display: inline-flex; padding: 3px; background: var(--gray-100); border: 1px solid var(--border); border-radius: var(--radius); gap: 2px; margin-bottom: 20px; max-width: 100%; overflow-x: auto; }
.segmented button {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; background: transparent; color: var(--gray-500); white-space: nowrap; transition: all 0.15s;
}
.segmented button:hover { color: var(--gray-900); }
.segmented button.activo { background: var(--surface); color: var(--gray-900); box-shadow: var(--shadow-sm); }

/* Campos */
.campo, select.campo {
  height: 38px; padding: 0 12px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  font-size: 14px; box-shadow: var(--shadow-xs); transition: border-color 0.15s, box-shadow 0.15s;
}
.campo:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--ring); }
select.campo {
  padding-right: 32px; appearance: none; cursor: pointer; background-repeat: no-repeat; background-position: right 10px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.buscador { position: relative; min-width: 0; }
.buscador svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-subtle); pointer-events: none; }
.buscador input { padding-left: 36px; width: 280px; max-width: 100%; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--gray-100); color: var(--gray-700); }
.badge.acento { background: var(--brand-100); color: var(--brand-800); }

.alerta { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 20px; font-size: 13px; overflow-wrap: anywhere; }
.alerta.error { background: var(--danger-100); color: var(--danger-700); }
.alerta svg { flex-shrink: 0; margin-top: 1px; }

.vacio { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 48px 16px; color: var(--text-muted); }
.vacio-icono { width: 48px; height: 48px; border-radius: 50%; background: var(--gray-100); color: var(--gray-400); display: flex; align-items: center; justify-content: center; }
.vacio-titulo { font-weight: 600; color: var(--gray-700); font-size: 15px; }
.vacio-cuerpo { font-size: 13px; max-width: 460px; }
code.email { display: inline-block; margin: 8px 0; padding: 6px 10px; font-size: 13px; user-select: all; word-break: break-all; color: var(--gray-900); }

.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: giro .7s linear infinite; opacity: .8; }
@keyframes giro { to { transform: rotate(360deg); } }
.skeleton { height: 16px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 37%, var(--gray-100) 63%); background-size: 800px 100%; animation: brillo 1.4s ease infinite; }
@keyframes brillo { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }

/* Tablas */
.table-wrap { overflow-x: auto; max-width: 100%; margin: 0 -20px; padding: 0 20px; }
.table-wrap.tall { max-height: 480px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; position: sticky; top: 0; background: var(--surface); cursor: pointer; user-select: none; z-index: 1; }
th:hover { color: var(--gray-900); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
th[data-dir="asc"]::after { content: " ▲"; font-size: 9px; } th[data-dir="desc"]::after { content: " ▼"; font-size: 9px; }
tbody tr:hover { background: var(--gray-50); }
tr.sel { background: var(--brand-50) !important; box-shadow: inset 3px 0 0 var(--brand-500); }
tr.clickable { cursor: pointer; }
td b { font-weight: 600; color: var(--gray-900); }
.bar-cell { display: inline-block; height: 8px; border-radius: 0 4px 4px 0; background: var(--s1); vertical-align: middle; margin-right: 8px; }

.heat td.cell { text-align: center; font-variant-numeric: tabular-nums; font-size: 12px; min-width: 56px; color: var(--gray-700); border-bottom: 2px solid var(--surface); border-right: 2px solid var(--surface); }
.heat td.h0 { background: var(--seq-0); } .heat td.h1 { background: var(--seq-1); } .heat td.h2 { background: var(--seq-2); } .heat td.h3 { background: var(--seq-3); }
.heat td.h4 { background: var(--seq-4); color: var(--gray-900); } .heat td.h5 { background: var(--seq-5); color: white; } .heat td.h6 { background: var(--seq-6); color: white; } .heat td.h7 { background: var(--seq-7); color: white; }

/* Gráficos */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--text-subtle); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--gray-600); }
.chart .val { fill: var(--gray-700); font-weight: 500; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart g.row:hover .mark { opacity: .82; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: -6px 0 10px; color: var(--gray-600); font-size: 12.5px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }

.tip { position: fixed; pointer-events: none; z-index: 1000; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: var(--radius); padding: 9px 11px; font-size: 12.5px; max-width: 280px; opacity: 0; transition: opacity .08s; }
.tip b { font-weight: 600; } .tip .k { color: var(--text-muted); }
.tip .row { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

.ficha-cab { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.notas { color: var(--gray-600); font-size: 13px; padding-left: 18px; margin: 0; }
.notas li { margin: 6px 0; }

/* Ajustes: marca sin subrayado, KPIs compactos dentro de una tarjeta, pestañas sin barra de scroll */
.brand { text-decoration: none; }
.brand span { white-space: nowrap; letter-spacing: 0.06em; font-size: 10.5px; }
.card .kpis { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.card .kpi { box-shadow: none; background: var(--gray-50); border-color: transparent; padding: 14px 16px; gap: 12px; }
.card .kpi .kpi-icon { width: 38px; height: 38px; border-radius: var(--radius); }
.card .kpi .kpi-text strong { font-size: 21px; }
.segmented { scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
/* Tarjetas con tabla: de dos en dos solo en pantallas anchas */
@media (max-width: 1500px) { .grid > .span-6.tabla { grid-column: span 12; } }

/* ================================================
   MÚSICOS: badges, chips, interruptores, modal y formulario
   ================================================ */
.badge.socio { background: var(--brand-100); color: var(--brand-800); }
.badge.llogat { background: var(--azul-100); color: #1d4f80; }
.badge.activo { background: var(--success-100); color: var(--success-600); }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; margin: 1px 4px 1px 0; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--gray-100); color: var(--gray-700); }
.chip.principal { background: var(--brand-50); color: var(--brand-800); box-shadow: inset 0 0 0 1px var(--brand-200); }
.prioridad { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; background: var(--brand-500); color: white; font-weight: 700; font-size: 12.5px; }

.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; border: 0; padding: 0; border-radius: 999px; background: var(--gray-300); transition: background .15s; vertical-align: middle; }
.switch span { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch.on { background: var(--success-600); }
.switch.on span { transform: translateX(16px); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gray-700); cursor: pointer; user-select: none; }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius); border: 1px solid transparent; background: transparent; color: var(--gray-500); }
.icon-btn:hover { background: var(--gray-100); color: var(--gray-900); }
.btn.peligro { background: var(--danger-600); border-color: var(--danger-600); }
.btn.peligro:hover:not(:disabled) { background: var(--danger-700); border-color: var(--danger-700); }
.btn.peligro-texto { color: var(--danger-600); }
.btn.peligro-texto:hover:not(:disabled) { background: var(--danger-100); color: var(--danger-700); }

.volver { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--text-muted); font-size: 13px; font-weight: 500; text-decoration: none; }
.volver:hover { color: var(--brand-600); }
.page-subtitle .badge { margin-right: 4px; }
.datos-musico { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
@media (max-width: 900px) { .datos-musico { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.meta { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-subtle); }
.seccion { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 16px; font-weight: 650; color: var(--gray-800); }
.seccion svg { color: var(--brand-500); }

.modal-fondo { position: fixed; inset: 0; z-index: 500; background: rgba(28, 25, 23, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; animation: aparecer .12s ease; }
.modal { width: 100%; background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.modal-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.modal-cab h2 { font-size: 17px; font-weight: 700; }
.modal-cuerpo { padding: 16px 20px; }
.modal-pie { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--gray-50); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
@keyframes aparecer { from { opacity: 0; } }

.form { display: flex; flex-direction: column; gap: 16px; }
.fila-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .fila-form { grid-template-columns: 1fr; } }
.campo-form { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo-form .campo { width: 100%; }
.etiqueta { font-size: 12px; font-weight: 600; color: var(--gray-700); }
.req { color: var(--danger-600); }
.error-form { margin: 0; padding: 8px 12px; border-radius: var(--radius); background: var(--danger-100); color: var(--danger-700); font-size: 13px; }
.opciones-tipo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opcion { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; color: var(--gray-500); transition: border-color .15s, background .15s; }
.opcion input { position: absolute; opacity: 0; pointer-events: none; }
.opcion span { display: flex; flex-direction: column; line-height: 1.25; }
.opcion b { color: var(--gray-900); font-size: 14px; }
.opcion small { font-size: 12px; color: var(--text-muted); }
.opcion.sel { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-600); box-shadow: var(--ring); }
.opcion.deshabilitada { opacity: .45; cursor: not-allowed; }
.chips-editables { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--gray-600); font-size: 13px; font-weight: 500; }
.chip-btn:hover { border-color: var(--gray-400); color: var(--gray-900); }
.chip-btn.sel { background: var(--brand-500); border-color: var(--brand-500); color: white; }
.otro-instr { display: flex; gap: 8px; margin-top: 4px; }
.otro-instr .campo { flex: 1; min-width: 0; }

#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 900; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius); background: var(--gray-900); color: white; font-size: 13px; box-shadow: var(--shadow-lg); animation: aparecer .15s ease; transition: opacity .3s, transform .3s; }
.toast svg { color: #4ade80; }
.toast.error svg { color: #f87171; }
.toast.fuera { opacity: 0; transform: translateY(6px); }
tr.inactivo td { color: var(--text-subtle); }
tr.inactivo td b, tr.inactivo .chip, tr.inactivo .badge { opacity: .6; }

/* ================================================
   ACTUACIONES
   ================================================ */
.alerta.info { background: var(--azul-50); color: #1d4f80; border: 1px solid var(--azul-100); }
.alerta.aviso { background: var(--warning-100); color: var(--warning-600); }
.enlace { border: 0; background: none; padding: 0; color: var(--brand-600); font-weight: 600; text-decoration: underline; cursor: pointer; }
.cap::first-letter { text-transform: uppercase; }
.badge.est-disponibilidad { background: var(--azul-100); color: #1d4f80; }
.badge.est-confirmada { background: var(--brand-100); color: var(--brand-800); }
.badge.est-lista { background: var(--success-100); color: var(--success-600); }
.badge.est-cobrada { background: var(--gray-800); color: white; }
.badge.est-cancelada { background: var(--gray-100); color: var(--gray-500); text-decoration: line-through; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--gray-100); color: var(--gray-600); }
.pill.ok { background: var(--success-100); color: var(--success-600); }
.pill.falta { background: var(--warning-100); color: var(--warning-600); }
.btn.mini { height: 28px; padding: 0 10px; font-size: 12.5px; gap: 5px; }

.evento-lista { display: flex; flex-direction: column; gap: 10px; }
.evento-card { display: flex; align-items: center; gap: 16px; width: 100%; padding: 14px 18px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); transition: box-shadow .15s, border-color .15s; color: var(--text); }
.evento-card:hover { box-shadow: var(--shadow-md); border-color: var(--gray-300); }
.evento-card > svg { color: var(--gray-400); flex-shrink: 0; }
.evento-fecha { width: 58px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: var(--radius); background: var(--brand-50); color: var(--brand-700); line-height: 1.1; }
.evento-fecha span, .evento-fecha small { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.evento-fecha strong { font-size: 24px; font-weight: 700; color: var(--brand-600); }
.evento-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.evento-titulo { font-size: 15px; font-weight: 650; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.evento-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; color: var(--text-muted); font-size: 13px; }
.evento-progreso { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--gray-600); }
.disp-mini .si { color: var(--success-600); } .disp-mini .no { color: var(--danger-600); }
.barra { width: 120px; height: 6px; border-radius: 999px; background: var(--gray-100); overflow: hidden; }
.barra span { display: block; height: 100%; background: var(--brand-500); border-radius: 999px; }

.datos-evento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.datos-evento .notas-evento { grid-column: 1 / -1; color: var(--gray-700); }
@media (max-width: 900px) { .datos-evento { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.pasos { display: flex; align-items: center; gap: 0; margin-bottom: 20px; flex-wrap: wrap; }
.paso { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--gray-600); font-weight: 600; box-shadow: var(--shadow-xs); }
.paso:hover:not(:disabled) { border-color: var(--gray-300); color: var(--gray-900); }
.paso:disabled { opacity: .5; cursor: not-allowed; }
.paso-num { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--gray-100); color: var(--gray-600); font-size: 12.5px; }
.paso.hecho .paso-num { background: var(--success-600); color: white; }
.paso.activo { border-color: var(--brand-500); color: var(--brand-700); box-shadow: var(--ring); }
.paso.activo .paso-num { background: var(--brand-500); color: white; }
.paso-linea { width: 28px; height: 2px; background: var(--border-strong); }
@media (max-width: 640px) { .paso-linea { width: 10px; } .paso { padding-right: 12px; } }

.mensaje { margin: 0; padding: 12px 14px; border-radius: var(--radius); background: #e7f8ee; border: 1px solid #c8eed6; font: 13px/1.5 var(--font); white-space: pre-wrap; color: var(--gray-900); }
.disp-grupos { columns: 2 280px; column-gap: 24px; }
.disp-grupo { break-inside: avoid; margin-bottom: 16px; }
.disp-cab { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.disp-fila { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; }
.disp-nombre { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tri { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--radius); background: var(--gray-100); flex-shrink: 0; }
.tri button { height: 26px; min-width: 34px; padding: 0 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--gray-500); font-size: 12.5px; font-weight: 600; }
.tri button:hover { color: var(--gray-900); }
.tri button.sel { box-shadow: var(--shadow-sm); }
.tri button.sel.si { background: var(--success-600); color: white; }
.tri button.sel.no { background: var(--danger-600); color: white; }
.tri button.sel.pend { background: var(--surface); color: var(--gray-700); }
.decision { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 16px; border-left: 4px solid var(--brand-500); }
.decision p { margin-top: 2px; font-size: 13px; }

.secciones-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.seccion-card { padding: 16px; }
.seccion-card.falta { border-color: #f7d9a6; }
.seccion-cab { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.seccion-cab h3 { font-size: 15px; font-weight: 650; margin: 0; flex: 1; }
.stepper { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.stepper button { width: 28px; height: 26px; border: 0; background: var(--surface); color: var(--gray-700); font-weight: 700; }
.stepper button + button { border-left: 1px solid var(--border-strong); }
.stepper button:hover:not(:disabled) { background: var(--gray-50); }
.stepper button:disabled { color: var(--gray-300); cursor: default; }
.huecos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.huecos li { display: flex; align-items: center; justify-content: space-between; min-height: 34px; padding: 0 6px 0 12px; border-radius: var(--radius); font-size: 13.5px; }
.huecos li.ocupado { background: var(--gray-50); border: 1px solid var(--border); }
.huecos li.libre { border: 1.5px dashed var(--border-strong); color: var(--text-subtle); }
.sugerencias { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.sugerencias .meta { width: 100%; margin-bottom: 0; }
.llogat-fila { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.llogat-fila.descartado { opacity: .55; }
.llogat-nombre { flex: 1; min-width: 120px; font-size: 13.5px; }
.llogat-acc { display: flex; gap: 6px; }
.prioridad.sin { background: var(--gray-200); color: var(--gray-600); }
input.importe { width: 90px; height: 32px; text-align: right; }
input.importe.cambiado { border-color: var(--brand-400); background: var(--brand-50); }
tfoot td { border-bottom: 0; padding-top: 12px; }
textarea.campo { height: auto; padding: 8px 12px; resize: vertical; font: inherit; }
.fila-form.tres { grid-template-columns: 1.4fr 1fr 1fr; }
@media (max-width: 520px) { .fila-form.tres { grid-template-columns: 1fr 1fr; } .fila-form.tres > :first-child { grid-column: 1 / -1; } }
a.btn { text-decoration: none; }

/* ================================================
   LOGIN
   ================================================ */
.pagina-login { background: var(--side-900); background-image: radial-gradient(circle at 50% 0%, var(--side-700), var(--side-900) 70%); min-height: 100vh; }
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 32px 16px; }
.login-logo { width: 240px; max-width: 70vw; height: auto; }
.login-logo-app { width: 96px; border-radius: 22px; }
/* Una organización sin logo: el icono de Amalgama y su nombre */
.marca-app { display: inline-flex; align-items: center; gap: 10px; }
.brand .marca-app img, .mobile-bar .marca-app img { width: 32px; height: 32px; border-radius: 8px; }
.brand .marca-app { white-space: normal; max-width: 100%; text-align: left; }
.brand .marca-app strong, .mobile-bar .marca-app strong { min-width: 0; overflow-wrap: anywhere; }
.login-card { width: 100%; max-width: 400px; text-align: center; display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.login-card h1 { font-size: 22px; font-weight: 700; }
.btn-google { height: 44px; background: white; color: var(--gray-800); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); text-decoration: none; }
.btn-google:hover:not(:disabled) { background: var(--gray-50); border-color: var(--gray-400); color: var(--gray-900); }

/* Usuario en la barra lateral */
.usuario-flecha { color: var(--gray-500); display: flex; transition: transform .15s, color .15s; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-500); color: white; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.usuario-texto { min-width: 0; line-height: 1.25; }
.usuario-texto strong { display: block; color: white; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-texto span { font-size: 12px; color: var(--gray-400); }
.sync-admin { border-top: 1px solid rgba(255, 255, 255, 0.08); margin-top: 8px; padding-top: 8px; }
.badge.rol-admin { background: var(--gray-800); color: white; }
.badge.rol-directiva { background: var(--brand-100); color: var(--brand-800); }
.badge.rol-socio { background: var(--success-100); color: var(--success-600); }
.badge.rol-llogat { background: var(--azul-100); color: #1d4f80; }
.badge.invitado { background: var(--warning-100); color: var(--warning-600); }
.usuario-fila { display: inline-flex; align-items: center; gap: 10px; }
.mini-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-100); color: var(--brand-700); font-weight: 700; }
.opciones-tipo.roles { grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .opciones-tipo.roles { grid-template-columns: 1fr; } }
.respuesta-card { margin-bottom: 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px; }
.respuesta-card h2 { font-size: 20px; font-weight: 700; }
.respuesta-botones { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn.grande { height: 52px; padding: 0 28px; font-size: 16px; border-radius: var(--radius-lg); min-width: 170px; }
.btn.si { background: var(--success-600); border-color: var(--success-600); }
.btn.si:hover:not(:disabled) { background: #166534; border-color: #166534; }
.btn.no { background: var(--danger-600); border-color: var(--danger-600); }
.btn.no:hover:not(:disabled) { background: var(--danger-700); border-color: var(--danger-700); }
.huecos li.yo { background: var(--brand-50); border-color: var(--brand-200); font-weight: 600; }
.pos { color: var(--success-600); }
.reparto { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.reparto-fila { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.entrar-como { display: flex; flex-direction: column; gap: 4px; margin: 0 4px 8px; font-size: 11px; color: var(--gray-400); text-transform: uppercase; letter-spacing: .06em; }
.entrar-como select { height: 32px; border-radius: var(--radius); border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.06); color: white; font-size: 12.5px; padding: 0 8px; text-transform: none; letter-spacing: 0; }
.entrar-como option { color: var(--gray-900); }

/* Pregunta en la app */
.marca { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; margin-right: 6px; padding: 0 4px; border-radius: 999px; font-size: 10.5px; font-weight: 600; color: var(--gray-500); background: var(--gray-100); vertical-align: -3px; }
.marca.app { color: var(--success-600); background: var(--success-100); }
.marca.sin { color: var(--warning-600); background: var(--warning-100); }
.pregunta { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--gray-700); }
.pregunta b { display: inline-block; min-width: 22px; color: var(--gray-900); }
.pendientes-card { margin-bottom: 20px; border-left: 4px solid var(--brand-500); }
.pendientes-card .card-title { margin-bottom: 10px; }
.pendiente { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.btn.mini-r { height: 36px; padding: 0 14px; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand-500); color: white; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Mi perfil ---------- */
.perfil-cab { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-bottom: 20px; }
.perfil-foto { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.avatar.grande { width: 96px; height: 96px; font-size: 38px; box-shadow: 0 0 0 4px var(--brand-50), var(--shadow-sm); }
.perfil-foto .btn { width: 100%; justify-content: center; }
.perfil-info { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
.perfil-info .muted { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.perfil-nombre { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.perfil-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; }
.perfil-chips .chip { margin: 0; }
.perfil-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.perfil-col { display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 960px) { .perfil-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .perfil-cab { flex-direction: column; text-align: center; }
  .perfil-info { align-items: center; min-width: 0; }
  .perfil-chips { justify-content: center; }
}
.separador-form { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.separador-form::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.perfil-fijo { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px; background: var(--gray-50); border: 1px solid var(--border); border-radius: var(--radius); }
.perfil-fijo > div { display: flex; flex-direction: column; gap: 6px; }
.perfil-sin-ficha { display: flex; align-items: flex-start; gap: 6px; padding: 10px 12px; background: var(--gray-50); border-radius: var(--radius); }
.acciones-form { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.perfil-fila { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.perfil-fila:first-child { border-top: 0; padding-top: 0; }
.perfil-fila-icono { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--gray-100); color: var(--gray-600); }
.perfil-fila-icono.ok { background: var(--success-100); color: var(--success-600); }
.perfil-fila-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.perfil-fila-texto b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.perfil-subtitulo { display: block; margin: 14px 0 2px; }
@media (max-width: 560px) {
  .perfil-fila { flex-wrap: wrap; }
  .perfil-fila > .btn { margin-left: 48px; }
}

/* ---------- Instrumento secundario: cambiar de sección en una actuación ---------- */
.hueco-nombre { min-width: 0; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 4px 0; }
.hueco-acc { display: inline-flex; flex-shrink: 0; }
.chip.secundario { background: var(--azul-50); color: #1d4f80; box-shadow: inset 0 0 0 1px var(--azul-100); margin: 0; }
.chip.fuera { background: var(--warning-100); color: var(--warning-600); margin: 0; }
.disp-otros { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 2px 0 6px; }
.menu-secciones { position: fixed; z-index: 900; min-width: 220px; max-height: 70vh; overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.menu-secciones .menu-titulo { padding: 6px 10px 4px; font-weight: 600; font-size: 13px; }
.menu-secciones .menu-grupo { padding: 8px 10px 2px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-subtle); }
.menu-secciones button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: var(--radius-sm); background: none; text-align: left; font-size: 13.5px; }
.menu-secciones button span { flex: 1; }
.menu-secciones button small { color: var(--text-muted); font-size: 12px; }
.menu-secciones button:hover, .menu-secciones button:focus-visible { background: var(--gray-100); box-shadow: none; }
.menu-secciones button.actual { color: var(--brand-700); font-weight: 600; }

/* ---------- Repertorio ---------- */
.segmented .cuenta { font-size: 11.5px; font-weight: 600; color: var(--text-subtle); margin-left: 2px; }
.segmented button.activo .cuenta { color: var(--brand-600); }
.segmented.compacto { margin-bottom: 0; }
.obra-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 12px; }
@media (max-width: 960px) { .obra-grid { grid-template-columns: 1fr; } }
.partes { display: flex; flex-direction: column; }
.parte-familia { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 8px 0; border-top: 1px solid var(--border); }
.parte-familia:first-child { border-top: 0; padding-top: 0; }
.parte-familia > b { width: 120px; flex-shrink: 0; font-weight: 600; font-size: 13px; }
.parte-familia .chip { margin: 0; }
.otros-ficheros { display: block; margin: 14px 0 6px; }
.notas-obra { white-space: pre-wrap; }
.opciones-tipo.tres { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 520px) { .opciones-tipo.tres { grid-template-columns: 1fr; } .parte-familia > b { width: 100%; } }
.badge.nivel-ok { background: var(--success-100); color: var(--success-600); }
.badge.nivel-aviso { background: var(--warning-100); color: var(--warning-600); }
.badge.nivel-error { background: var(--danger-100); color: var(--danger-700); }
.badge[class*="nivel-"] { gap: 4px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; cursor: help; }
.necesarios-hint { display: flex; align-items: center; gap: 6px; margin: -4px 0 12px; }
.grupo-ins { display: block; margin: 14px 0 8px; }
.fila-corregir { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 10px; }
.fila-corregir .campo-form { flex: 1; min-width: 0; margin: 0; }
.fila-corregir .icon-btn { flex: none; margin-bottom: 2px; }
.txt-aviso { color: var(--warning-600); font-weight: 600; }
.chip-btn small { font-size: 11px; opacity: .65; margin-left: 2px; }
.alerta.ok { background: var(--success-100); color: var(--success-600); }

/* ---------- Visor de partituras ---------- */
.visor { position: relative; overflow: hidden; background: var(--side-900); }
.visor-hoja { position: absolute; inset: 0; overflow: auto; touch-action: pan-x pan-y; overscroll-behavior: contain;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; scrollbar-width: thin; }
.visor-paginas { display: flex; gap: 8px; padding: 8px; box-sizing: border-box; width: max-content; min-width: 100%; min-height: 100%;
  align-items: center; justify-content: center; }
.visor-paginas.ancho { align-items: flex-start; }
.visor-pagina { display: block; flex-shrink: 0; background: #fff; box-shadow: 0 2px 14px rgba(0, 0, 0, .55); }
.visor-mensaje { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: var(--gray-300); font-size: 15px; }
.visor.cargando::after { content: ''; position: absolute; top: 50%; left: 50%; width: 32px; height: 32px; margin: -16px 0 0 -16px;
  border: 3px solid rgba(255, 255, 255, .2); border-top-color: var(--brand-400); border-radius: 50%; animation: giro .8s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }

body.con-visor { overflow: hidden; }
.pantalla-visor { position: fixed; inset: 0; z-index: 1500; display: flex; flex-direction: column; background: var(--side-900); color: white; outline: none; }
.pantalla-visor .pv-zona { flex: 1; position: relative; }
.pantalla-visor .visor { position: absolute; inset: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.pv-barra { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: 6px;
  padding: calc(6px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) 6px calc(8px + env(safe-area-inset-left));
  background: rgba(20, 17, 16, .94); box-shadow: 0 2px 12px rgba(0, 0, 0, .4); transform: translateY(-110%); transition: transform .2s ease; }
.pantalla-visor.barra-visible .pv-barra { transform: none; }
.pv-titulo { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.pv-titulo b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.pv-titulo span { color: var(--gray-300); white-space: nowrap; }
.pv-titulo select { max-width: 45%; height: 36px; padding: 0 8px; border-radius: var(--radius); border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .08); color: white; font-size: 14px; }
.pv-titulo select option, .pv-titulo select optgroup { color: var(--text); background: white; }
.pv-grupo { display: flex; gap: 2px; }
.pv-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--gray-200); }
.pv-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .1); color: white; }
.pv-btn:disabled { opacity: .3; cursor: default; }
.pv-pagina { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; color: var(--gray-300); font-size: 14px; white-space: nowrap; }
.pv-aviso { position: absolute; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 3; padding: 8px 16px;
  border-radius: 999px; background: rgba(20, 17, 16, .9); color: white; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.pv-aviso.visible { opacity: 1; }
@media (max-width: 640px) {
  #pv-menos, #pv-mas { display: none; }   /* en el móvil se pellizca */
  .pv-titulo { flex-direction: column; align-items: flex-start; gap: 2px; }
  .pv-titulo b { font-size: 13px; max-width: 100%; }
  .pv-titulo select { max-width: 100%; height: 30px; font-size: 13px; }
  .pv-pagina { min-width: 48px; font-size: 13px; }
}
.chip-ver { border: 0; cursor: pointer; font: inherit; font-size: 12px; transition: background .15s, color .15s; }
.chip-ver:hover, .chip-ver:focus-visible { background: var(--brand-100); color: var(--brand-800); }

/* ---------- Mi cuenta › Cobros ---------- */
.trayectoria { margin: -8px 0 16px; }
.desglose { display: flex; flex-direction: column; gap: 2px; }
.desglose > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.desglose > div span { color: var(--text-muted); }
.desglose > .total { border-bottom: 0; padding-top: 12px; font-size: 16px; }
.desglose > .total span { color: var(--text); font-weight: 600; }
.desglose b { font-variant-numeric: tabular-nums; }
.envolver { display: inline-block; min-width: 180px; white-space: normal; }

/* ---------- Eventos: clases ---------- */
.badge[class*="clase-"] { gap: 4px; }
.badge.clase-actuacion { background: var(--brand-50); color: var(--brand-800); box-shadow: inset 0 0 0 1px var(--brand-200); }
.badge.clase-concierto { background: var(--azul-50); color: #1d4f80; box-shadow: inset 0 0 0 1px var(--azul-100); }
.badge.clase-ensayo { background: #e6f4f1; color: #1f6f66; box-shadow: inset 0 0 0 1px #c3e5df; }
.badge.clase-reunion { background: var(--gray-100); color: var(--gray-700); box-shadow: inset 0 0 0 1px var(--gray-200); }
.opciones-tipo.clases-evento { grid-template-columns: repeat(4, 1fr); }
.opciones-tipo.clases-evento .opcion { justify-content: center; flex-direction: column; gap: 4px; padding: 10px 6px; text-align: center; }
@media (max-width: 520px) { .opciones-tipo.clases-evento { grid-template-columns: 1fr 1fr; } }
.filtros-eventos { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }

/* ---------- Arxiu: subir y revisar partituras ---------- */
.zona-subida { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; margin: 12px 0; border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg); color: var(--gray-500); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.zona-subida:hover, .zona-subida.encima { border-color: var(--brand-400); background: var(--brand-50); color: var(--brand-700); }
.zona-subida b { color: var(--text); }
.lista-subida { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; }
.lista-subida li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.lista-subida li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progreso-subida { height: 8px; border-radius: 999px; background: var(--gray-100); overflow: hidden; margin: 10px 0; }
.progreso-subida span { display: block; height: 100%; width: 0; background: var(--brand-500); transition: width .3s; }
.trabajando { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; text-align: center; }
.trabajando .progreso-subida { width: min(420px, 100%); }
.spin.grande { width: 36px; height: 36px; border-width: 3px; }

.revision { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .revision { grid-template-columns: 1fr; } .revision-lado { order: -1; position: static; max-height: none; } }
.revision-paginas { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
/* Fija al lado de las páginas solo cuando hay sitio; si es más alta que la pantalla, se desplaza por dentro */
.revision-lado { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 32px); overflow-y: auto; }
.revision-acciones { display: flex; flex-direction: column; gap: 8px; }
.revision-acciones .btn { width: 100%; }
.revision-acciones .muted { text-align: center; font-size: 12px; min-height: 18px; }
.partes-salida { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; }
.partes-salida li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13.5px; }
.partes-salida li b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.partes-salida li.aviso b { color: var(--warning-600); }
.color-parte { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.pagina-rev { background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--gray-300); border-radius: var(--radius-lg); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pagina-rev.descarta { opacity: .5; border-left-color: var(--gray-200); }
.pagina-rev.duda { box-shadow: 0 0 0 2px var(--warning-100); }
.pagina-rev header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pagina-rev header .num { font-weight: 600; font-size: 13px; }
.pagina-rev .chip { margin: 0; }
.rev-giro { margin-left: auto; display: inline-flex; }
.pagina-rev .miniatura { display: block; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: white; overflow: hidden; cursor: zoom-in; height: 130px; }
.pagina-rev .miniatura img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .2s; }
.pagina-rev .leido { margin: 0; font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.decision-rev { display: flex; flex-direction: column; gap: 6px; }
.decision-rev .segmented { margin: 0; align-self: flex-start; }
.decision-rev .segmented button { height: 28px; font-size: 12.5px; }
.decision-rev .campo { height: 34px; }
/* Un color por parte (en el orden de las partes): borde de la tarjeta y muestra en la lista */
.pagina-rev.c0, .color-parte.c0 { border-left-color: #d46427; } .color-parte.c0 { background: #d46427; }
.pagina-rev.c1 { border-left-color: #2a6fb0; } .color-parte.c1 { background: #2a6fb0; }
.pagina-rev.c2 { border-left-color: #2a9d8f; } .color-parte.c2 { background: #2a9d8f; }
.pagina-rev.c3 { border-left-color: #9b59b6; } .color-parte.c3 { background: #9b59b6; }
.pagina-rev.c4 { border-left-color: #c0392b; } .color-parte.c4 { background: #c0392b; }
.pagina-rev.c5 { border-left-color: #b8860b; } .color-parte.c5 { background: #b8860b; }
.pagina-rev.c6 { border-left-color: #1f7a4d; } .color-parte.c6 { background: #1f7a4d; }
.pagina-rev.c7 { border-left-color: #57534e; } .color-parte.c7 { background: #57534e; }

/* Selector d'idioma (entrada i perfil) */
.selector-idioma { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--border); }
.selector-idioma button { border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: 13px; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.selector-idioma button.activo { background: var(--surface, #fff); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.login .selector-idioma { margin-top: 16px; }

/* Ubicación de Google Maps en los eventos */
.ubicacion-entrada { display: flex; gap: 8px; }
.ubicacion-entrada .campo { flex: 1; min-width: 0; }
.ubicacion-entrada .btn { flex: none; white-space: nowrap; }
.ubicacion-vista { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.ubicacion-vista > svg { flex: none; color: var(--brand-600); }
.ubicacion-vista > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ubicacion-vista b { overflow-wrap: anywhere; }
.datos-evento .ubicacion-evento { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.datos-evento .ubicacion-evento .meta { flex-basis: 100%; }
.ubicacion-texto { display: inline-flex; align-items: center; gap: 4px; }
.ubicacion-botones { display: inline-flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 560px) { .ubicacion-entrada { flex-direction: column; } .ubicacion-entrada .campo { flex: none; } }

/* Directiva › Organització */
.org-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 960px) { .org-grid { grid-template-columns: minmax(0, 1fr); } }
.org-local { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 10px; }
.org-local.defecto { border-color: var(--brand-400); background: var(--brand-50); }
.org-local-cab { display: flex; justify-content: space-between; align-items: center; }
.org-sin-locales { margin: 0 0 12px; }
.org-acciones { margin-top: 16px; align-items: center; }
.org-acciones .hint { margin: 0 auto 0 0; }
.org-grid > .card { display: flex; flex-direction: column; gap: 14px; }
.org-grid > .card > .card-header { margin-bottom: 0; }

/* Subir partituras: primero los ficheros, después los datos que se van rellenando */
.zona-subida.gran { padding: 56px 16px; gap: 10px; font-size: 15px; }
.pujar .trabajando { padding: 28px 16px; }
.pujada-grid { display: flex; flex-direction: column; gap: 20px; }
.fases { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.fase { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--text-muted); }
.fase.activa { border-color: var(--brand-400); color: var(--brand-700); background: var(--brand-50); }
.fase.hecha { color: var(--success-600); }
.fase small { color: var(--text-muted); }
.fase-linea { width: 14px; height: 1px; background: var(--border-strong); }
.fases-nota { flex-basis: 100%; margin: 4px 0 0; }
.spin.mini { width: 11px; height: 11px; border-width: 2px; }
.marca-campo { font-weight: 400; margin-left: 4px; }
.marca-dato { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--text-muted); text-transform: none; letter-spacing: 0; }
.marca-dato.ok { color: var(--success-600); }
.marca-dato.duda { color: var(--warning-600); }
.campo.rellenado { animation: rellenado 1.2s ease-out; }
@keyframes rellenado { from { background: var(--brand-100); } to { background: var(--surface); } }
.destino-pujada { margin-bottom: 14px; }
.revision-resumen { margin: 0 0 10px; }

/* Cuenta sin organización: sus invitaciones pendientes */
.lista-invitaciones { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lista-invitaciones li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.lista-invitaciones li:last-child { border-bottom: 0; }
.lista-invitaciones li div { display: flex; flex-direction: column; min-width: 0; }
.lista-invitaciones small { color: var(--text-muted); }
/* Solicitudes de cambio de la ficha (perfil) */
.card.solicitudes { margin-bottom: 16px; border-color: var(--warning-100); }
.solicitud { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--gray-100); }
.solicitud:first-of-type { border-top: 0; }
.solicitud .toolbar { margin: 0; }
