/* =====================================================================
   SUPER SAM LA VICTORIA — Hoja de estilos principal
   Ruta: /var/www/html/assets/css/app.css
   Identidad: rojo corporativo, negro elegante, blanco y grises.
   Estados: verde (al día), amarillo (pendiente), rojo (error).
   ===================================================================== */

:root {
  --red: #c8102e;
  --red-600: #a50d26;
  --red-700: #7e0a1d;
  --red-soft: rgba(200, 16, 46, .10);
  --green: #12a150;
  --green-soft: rgba(18, 161, 80, .12);
  --yellow: #e6a700;
  --yellow-strong: #f2b705;
  --yellow-soft: rgba(242, 183, 5, .14);
  --yellow-pale: rgba(242, 183, 5, .07);

  --bg: #f4f4f6;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8f8fa;
  --line: #e6e6ea;
  --line-strong: #d4d4da;
  --text: #121216;
  --text-2: #50505a;
  --text-3: #8a8a95;
  --sidebar: #0e0e11;
  --sidebar-2: #17171c;
  --sidebar-text: #c9c9d1;
  --shadow-sm: 0 1px 2px rgba(16, 16, 24, .06);
  --shadow: 0 6px 24px -8px rgba(16, 16, 24, .14), 0 2px 6px rgba(16, 16, 24, .05);
  --shadow-lg: 0 24px 60px -16px rgba(16, 16, 24, .35);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --sidebar-w: 264px;
}

html[data-theme="dark"] {
  --bg: #0b0b0e;
  --bg-elev: #131318;
  --surface: #15151b;
  --surface-2: #1b1b22;
  --line: #26262f;
  --line-strong: #33333e;
  --text: #f1f1f4;
  --text-2: #b4b4bf;
  --text-3: #7c7c88;
  --sidebar: #08080a;
  --sidebar-2: #131317;
  --red-soft: rgba(230, 40, 70, .16);
  --green-soft: rgba(30, 190, 100, .16);
  --yellow-soft: rgba(242, 183, 5, .18);
  --yellow-pale: rgba(242, 183, 5, .09);
  --shadow: 0 8px 28px -10px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  transition: background .25s var(--ease), color .25s var(--ease);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; line-height: 1.2; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--red); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.inline { display: inline; margin: 0; }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.mt { margin-top: 18px; } .mt-sm { margin-top: 10px; } .mb { margin-bottom: 18px; }

/* ---------- Estructura ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: var(--sidebar-w); flex: none; position: sticky; top: 0; height: 100vh; height: 100dvh;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: var(--sidebar-text); display: flex; flex-direction: column; z-index: 40;
  border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--red), #ff3d5a, var(--red)); }
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 22px 18px 18px; }
.brand-link { display: flex; align-items: center; gap: 12px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { color: #fff; font-size: 17px; letter-spacing: .06em; font-weight: 800; }
.brand-text small { color: var(--red); font-weight: 700; letter-spacing: .32em; font-size: 10.5px; margin-top: 4px; }
.logo-slot { display: grid; place-items: center; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 14px rgba(200,16,46,.35); }
.logo-slot img { width: 100%; height: 100%; object-fit: contain; }
.logo-sm { width: 44px; height: 44px; padding: 4px; }
.nav { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 11px;
  color: var(--sidebar-text); font-weight: 500; font-size: 14.5px; position: relative;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(200,16,46,.22), rgba(200,16,46,.04)); color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--red); }
.nav-item.active .ic { color: #ff4d67; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.version { font-size: 11px; color: #5d5d68; padding: 8px 14px 2px; }
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px;
  padding: 12px 26px; background: color-mix(in srgb, var(--bg-elev) 86%, transparent);
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.topbar-title .company { font-weight: 800; letter-spacing: .04em; font-size: 14px; white-space: nowrap; }
.topbar-title .clock { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.global-search { position: relative; flex: 1; max-width: 520px; margin-left: auto; display: flex; align-items: center; }
.global-search > .ic { position: absolute; left: 13px; color: var(--text-3); width: 18px; height: 18px; pointer-events: none; }
.global-search input {
  width: 100%; height: 42px; padding: 0 14px 0 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
.global-search input:focus { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); background: var(--surface); }
.search-pop {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; max-height: 70vh; overflow-y: auto; z-index: 50;
}
.search-pop a { display: flex; gap: 12px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.search-pop a:last-child { border-bottom: 0; }
.search-pop a:hover, .search-pop a.focus { background: var(--surface-2); }
.search-pop .sp-main { flex: 1; min-width: 0; }
.search-pop .sp-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-pop .sp-main small { color: var(--text-3); }
.search-pop .sp-empty { padding: 16px; color: var(--text-3); text-align: center; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: linear-gradient(135deg, var(--red), #ff4560); flex: none; }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta strong { font-size: 13.5px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { font-size: 11.5px; color: var(--red); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.icon-btn {
  width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; color: var(--text-2); transition: all .18s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); transform: translateY(-1px); }
.icon-btn.danger-hover:hover { color: #fff; background: var(--red); border-color: var(--red); }
.sidebar .icon-btn { background: transparent; border-color: rgba(255,255,255,.1); color: #fff; }
.theme-toggle .when-dark { display: none; }
html[data-theme="dark"] .theme-toggle .when-light { display: none; }
html[data-theme="dark"] .theme-toggle .when-dark { display: grid; }
.content { padding: 26px; flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; animation: fadeUp .35s var(--ease); }
.foot { padding: 16px 26px; color: var(--text-3); font-size: 12.5px; text-align: center; border-top: 1px solid var(--line); }
.only-mobile { display: none !important; }
.nav-backdrop { display: none; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Migas de pan ---------- */
.crumbbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.breadcrumbs a:hover { color: var(--red); }
.breadcrumbs [aria-current] { color: var(--text); font-weight: 700; }
.breadcrumbs .sep { width: 14px; height: 14px; opacity: .6; }

/* ---------- Encabezados ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 27px; font-weight: 800; }
.page-head .sub { color: var(--text-3); margin-top: 5px; font-size: 14px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--red); margin-bottom: 6px; }
.section-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.section-title .ic { color: var(--red); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 11px; border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s, border-color .2s, color .2s;
  user-select: none;
}
.btn .ic { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: linear-gradient(180deg, #d81636, var(--red)); color: #fff; box-shadow: 0 6px 18px -6px rgba(200,16,46,.6), inset 0 1px 0 rgba(255,255,255,.18); }
.btn-primary:hover { background: linear-gradient(180deg, #e41c3d, var(--red-600)); box-shadow: 0 10px 24px -8px rgba(200,16,46,.7); }
.btn-dark { background: #121216; color: #fff; }
html[data-theme="dark"] .btn-dark { background: #f1f1f4; color: #111; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: var(--red-600); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(1.06); }
.btn-warning { background: var(--yellow-strong); color: #1d1600; }
.btn-warning:hover { filter: brightness(1.05); }
.btn-whatsapp { background: #1fa855; color: #fff; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-xs { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 8px; gap: 5px; }
.btn-xs .ic { width: 15px; height: 15px; }
.btn-icon { width: 34px; padding: 0; }
.btn-block { width: 100%; }
.btn[disabled], .btn.loading { opacity: .65; pointer-events: none; }
.btn.loading::after { content: ""; width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-lg { height: 50px; font-size: 15px; padding: 0 24px; border-radius: 13px; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-body { padding: 22px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.stat {
  position: relative; overflow: hidden; padding: 20px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat .stat-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); margin-bottom: 14px; }
.stat .stat-label { font-size: 12.5px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.stat .stat-value { font-size: 28px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .stat-foot { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.stat.green .stat-ic { background: var(--green-soft); color: var(--green); }
.stat.yellow .stat-ic { background: var(--yellow-soft); color: var(--yellow); }
.stat.dark .stat-ic { background: rgba(120,120,135,.14); color: var(--text); }
.stat.hero { background: linear-gradient(135deg, #18181d 0%, #0d0d10 60%, #2a0610 100%); color: #fff; border-color: #222; }
.stat.hero .stat-label, .stat.hero .stat-foot { color: #a9a9b4; }
.stat.hero .stat-ic { background: rgba(200,16,46,.28); color: #ff5470; }
.stat.hero::after { content: ""; position: absolute; right: -40px; bottom: -40px; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle, rgba(200,16,46,.45), transparent 70%); }
a.stat { display: block; }

.welcome {
  position: relative; overflow: hidden; border-radius: 18px; padding: 26px 28px; margin-bottom: 22px; color: #fff;
  background: radial-gradient(1200px 300px at 100% 0%, rgba(200,16,46,.55), transparent 60%), linear-gradient(120deg, #101014, #1a1a20);
  border: 1px solid #23232a; display: flex; gap: 22px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.welcome h1 { font-size: 26px; font-weight: 800; }
.welcome p { color: #b9b9c4; margin-top: 6px; }
.welcome .welcome-logo { width: 74px; height: 74px; padding: 6px; }
.welcome .wl { display: flex; align-items: center; gap: 18px; }
.welcome .live-date { text-align: right; }
.welcome .live-date strong { font-size: 30px; font-variant-numeric: tabular-nums; display: block; letter-spacing: -.02em; }
.welcome .live-date span { color: #b9b9c4; text-transform: capitalize; }

/* ---------- Accesos ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); min-height: 140px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.tile .tile-ic { width: 46px; height: 46px; border-radius: 13px; background: linear-gradient(135deg, var(--red), #ff4560); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 18px -8px rgba(200,16,46,.7); }
.tile h3 { font-size: 17px; font-weight: 700; }
.tile p { color: var(--text-3); font-size: 13.5px; }
.tile .tile-meta { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.tile .tile-arrow { position: absolute; right: 18px; top: 22px; color: var(--text-3); }
.tile.archived { opacity: .72; }
.tile.archived .tile-ic { background: #6b6b76; box-shadow: none; }

/* ---------- Tarjetas de participante (estado visual) ---------- */
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.pcard {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 14px 20px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.pcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: #9a9aa6; }
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pcard .pc-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.pcard .seat { font-family: var(--mono); font-weight: 700; font-size: 12px; padding: 3px 8px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line); }
.pcard h4 { font-size: 15.5px; font-weight: 700; }
.pcard .pc-meta { font-size: 12.5px; color: var(--text-3); display: flex; flex-direction: column; gap: 2px; }
.pcard .pc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.pcard.pc-ok::before { background: var(--green); }
.pcard.pc-ok { background: linear-gradient(90deg, var(--green-soft), var(--surface) 55%); }
.pcard.pc-late::before { background: var(--yellow-strong); }
.pcard.pc-late { background: linear-gradient(90deg, var(--yellow-soft), var(--surface) 55%); }
.pcard.pc-idle::before { background: #9a9aa6; }

/* ---------- Insignias ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.pc-ok.badge, .badge.st-paid, .badge.green { background: var(--green-soft); color: var(--green); }
.pc-late.badge, .badge.st-overdue, .badge.yellow { background: var(--yellow-soft); color: #a77800; }
html[data-theme="dark"] .pc-late.badge, html[data-theme="dark"] .badge.st-overdue, html[data-theme="dark"] .badge.yellow { color: var(--yellow-strong); }
.badge.st-partial { background: var(--yellow-pale); color: #b38600; border-color: rgba(242,183,5,.35); }
html[data-theme="dark"] .badge.st-partial { color: #f5cc4f; }
.pc-idle.badge, .badge.st-future, .badge.gray { background: rgba(130,130,145,.14); color: var(--text-2); }
.badge.st-error, .badge.red { background: var(--red-soft); color: var(--red); }
.badge.dark { background: #121216; color: #fff; }

/* ---------- Tablas ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  text-align: left; padding: 12px 14px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions-cell { white-space: nowrap; text-align: right; }
.table .actions-cell .btn + .btn, .table .actions-cell form + .btn, .table .actions-cell .btn + form { margin-left: 4px; }
.cell-strong { font-weight: 600; }
.cell-sub { display: block; font-size: 12px; color: var(--text-3); }

/* Tabla de cuotas tipo hoja de cálculo */
.sheet td, .sheet th { border-right: 1px solid var(--line); }
.sheet td:last-child, .sheet th:last-child { border-right: 0; }
.sheet tr.st-paid td { background: var(--green-soft); }
.sheet tr.st-overdue td { background: var(--yellow-soft); }
.sheet tr.st-partial td { background: var(--yellow-pale); }
.sheet tr.st-future td { background: transparent; color: var(--text-2); }
.sheet tr.st-error td { background: var(--red-soft); }
.sheet tr td:first-child { box-shadow: inset 4px 0 0 #9a9aa6; }
.sheet tr.st-paid td:first-child { box-shadow: inset 4px 0 0 var(--green); }
.sheet tr.st-overdue td:first-child { box-shadow: inset 4px 0 0 var(--yellow-strong); }
.sheet tr.st-partial td:first-child { box-shadow: inset 4px 0 0 #f5d36b; }
.sheet tr.st-error td:first-child { box-shadow: inset 4px 0 0 var(--red); }
.sheet tr.clickable { cursor: pointer; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--red); }
.field .hint { font-size: 12px; color: var(--text-3); }
.input, .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 11px; border: 1px solid var(--line-strong);
  background: var(--surface); outline: none; transition: border-color .2s, box-shadow .2s;
}
.field textarea { min-height: 92px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.field input:user-invalid, .field select:user-invalid { border-color: var(--red); }
.field.error input, .field.error select, .field.error textarea { border-color: var(--red); }
.field .err { color: var(--red); font-size: 12.5px; font-weight: 500; }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8a95' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 38px; }
.input-icon { position: relative; }
.input-icon input { padding-right: 48px !important; }
.input-icon .toggle-pass { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: transparent; border-radius: 9px; cursor: pointer; color: var(--text-3); display: grid; place-items: center; }
.input-icon .toggle-pass:hover { color: var(--text); background: var(--surface-2); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.checks .check { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.filters .field label { font-size: 12px; }
.filters .field input, .filters .field select { min-height: 40px; padding-top: 8px; padding-bottom: 8px; }
.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid; font-size: 14px; align-items: flex-start; }
.alert .ic { margin-top: 1px; }
.alert-error { background: var(--red-soft); border-color: rgba(200,16,46,.3); color: var(--red); }
.alert-warning { background: var(--yellow-soft); border-color: rgba(242,183,5,.35); color: #8a6400; }
html[data-theme="dark"] .alert-warning { color: var(--yellow-strong); }
.alert-success { background: var(--green-soft); border-color: rgba(18,161,80,.3); color: var(--green); }
.alert-info { background: var(--surface-2); border-color: var(--line); color: var(--text-2); }

/* ---------- Ficha del participante ---------- */
.profile { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.profile-head { display: flex; align-items: center; gap: 16px; padding: 22px; border-bottom: 1px solid var(--line); }
.profile-head .avatar { width: 58px; height: 58px; font-size: 20px; border-radius: 16px; }
.profile-head h2 { font-size: 21px; font-weight: 800; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kv > div { padding: 13px 22px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.kv > div:nth-child(odd) { border-right: 1px solid var(--line); }
.kv .ic { color: var(--red); width: 18px; height: 18px; margin-top: 2px; }
.kv dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); font-weight: 600; }
.kv dd { margin: 2px 0 0; font-weight: 600; word-break: break-word; }
.kv .full { grid-column: 1 / -1; border-right: 0 !important; }
.docs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 18px; }
.doc { border: 1px dashed var(--line-strong); border-radius: 13px; overflow: hidden; background: var(--surface-2); display: flex; flex-direction: column; }
.doc.has { border-style: solid; border-color: var(--line); background: var(--surface); }
.doc .doc-preview { aspect-ratio: 4 / 3; display: grid; place-items: center; background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 10px, var(--surface) 10px, var(--surface) 20px); color: var(--text-3); overflow: hidden; }
.doc .doc-preview img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; transition: transform .3s var(--ease); }
.doc .doc-preview img:hover { transform: scale(1.03); }
.doc .doc-preview .ic { width: 38px; height: 38px; }
.doc .doc-info { padding: 10px 12px; }
.doc .doc-info strong { font-size: 13.5px; display: block; }
.doc .doc-info small { color: var(--text-3); font-size: 11.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .doc-actions { display: flex; gap: 6px; padding: 0 12px 12px; flex-wrap: wrap; }
.summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.summary .sbox { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.summary .sbox small { font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.summary .sbox strong { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.summary .sbox.green strong { color: var(--green); }
.summary .sbox.yellow strong { color: #b38600; }
html[data-theme="dark"] .summary .sbox.yellow strong { color: var(--yellow-strong); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs a { padding: 13px 14px; font-weight: 600; font-size: 14px; color: var(--text-3); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active, .tabs a:hover { color: var(--text); border-bottom-color: var(--red); }

/* ---------- Ventanas modales ---------- */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 18px; background: rgba(8, 8, 12, .55); backdrop-filter: blur(4px); animation: fadeIn .2s var(--ease); }
.modal-card { width: 100%; max-width: 720px; max-height: calc(100dvh - 36px); display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); animation: pop .25s var(--ease); }
.modal-sm { max-width: 460px; }
.modal-lg { max-width: 980px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 18px; font-weight: 800; }
.modal-head h3 .ic { color: var(--red); vertical-align: -4px; margin-right: 6px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.confirm-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--yellow-soft); color: var(--yellow); margin-bottom: 14px; }
.confirm-icon .ic { width: 28px; height: 28px; }
#confirmText { color: var(--text-2); white-space: pre-line; }
#confirmTypeWrap { margin-top: 16px; }
.lightbox img { max-height: 78vh; margin: 0 auto; border-radius: 10px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
body.modal-open { overflow: hidden; }

/* ---------- Notificaciones ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 36px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: slideIn .3s var(--ease); border-left: 4px solid var(--text-3); }
.toast.success { border-left-color: var(--green); } .toast.success .ic { color: var(--green); }
.toast.error { border-left-color: var(--red); } .toast.error .ic { color: var(--red); }
.toast.warning { border-left-color: var(--yellow-strong); } .toast.warning .ic { color: var(--yellow); }
.toast p { flex: 1; font-size: 14px; }
.toast.hide { opacity: 0; transform: translateX(20px); transition: all .3s; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } }
.loader-overlay { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; background: rgba(8,8,12,.45); backdrop-filter: blur(2px); }
.loader-overlay .spinner { width: 54px; height: 54px; border-radius: 50%; border: 4px solid rgba(255,255,255,.25); border-top-color: var(--red); animation: spin .8s linear infinite; }
.loader-overlay p { color: #fff; margin-top: 14px; font-weight: 600; text-align: center; }

/* ---------- Paginación y vacíos ---------- */
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 16px 0 4px; }
.pagination .page { min-width: 36px; height: 36px; padding: 0 10px; border-radius: 10px; display: inline-grid; place-items: center; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13.5px; }
.pagination .page.active { background: var(--red); border-color: var(--red); color: #fff; }
.pagination .page.disabled { opacity: .4; }
.pagination .page.dots { border: 0; background: none; }
.pagination .page-info { margin-left: auto; color: var(--text-3); font-size: 13px; }
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .ic { width: 46px; height: 46px; color: var(--line-strong); margin: 0 auto 12px; }
.empty h3 { color: var(--text); font-size: 17px; margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.login-hero {
  position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(900px 500px at 110% -10%, rgba(200,16,46,.65), transparent 60%), radial-gradient(700px 400px at -20% 120%, rgba(200,16,46,.35), transparent 60%), linear-gradient(160deg, #0c0c0f, #17171c);
}
.login-hero::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 46px 46px; mask-image: linear-gradient(180deg, transparent, #000 40%, transparent); pointer-events: none; }
.login-hero .brand { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.login-hero h1 { font-size: clamp(34px, 4vw, 54px); font-weight: 900; line-height: 1.02; letter-spacing: -.03em; position: relative; z-index: 1; }
.login-hero h1 span { color: #ff3d5a; }
.login-hero p { color: #b8b8c3; max-width: 460px; margin-top: 16px; font-size: 16px; position: relative; z-index: 1; }
.login-hero .hero-feats { display: flex; gap: 22px; flex-wrap: wrap; position: relative; z-index: 1; color: #d0d0d8; font-size: 13.5px; }
.login-hero .hero-feats span { display: flex; align-items: center; gap: 8px; }
.login-hero .hero-feats .ic { color: #ff3d5a; }
.login-side { display: grid; place-items: center; padding: 32px 22px; position: relative; }
.login-card { width: 100%; max-width: 420px; }
.login-card .logo-slot { width: 96px; height: 96px; padding: 8px; margin: 0 auto 18px; border-radius: 22px; }
.login-card h2 { font-size: 26px; font-weight: 800; text-align: center; }
.login-card .sub { text-align: center; color: var(--text-3); margin: 6px 0 26px; }
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.login-card .field input { min-height: 50px; border-radius: 13px; font-size: 15px; }
.login-theme { position: absolute; top: 18px; right: 18px; }
.login-foot { text-align: center; color: var(--text-3); font-size: 12.5px; margin-top: 26px; }

/* ---------- Recibo (vista) ---------- */
.receipt-view { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.receipt-img { background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 50% / 22px 22px; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); }
.receipt-img img { margin: 0 auto; max-height: 82vh; border-radius: 8px; box-shadow: var(--shadow); background: #fff; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .profile { grid-template-columns: 1fr; }
  .receipt-view { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .only-mobile { display: inline-grid !important; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-102%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .user-meta { display: none; }
  .user-chip { padding: 3px; }
  .content { padding: 18px 16px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .global-search { display: none; }
  .topbar-title { margin-right: auto; }
  .topbar-title .company { font-size: 12.5px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 22px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat .stat-value { font-size: 21px; }
  .stat .stat-ic { width: 36px; height: 36px; margin-bottom: 10px; }
  .welcome { padding: 20px; }
  .welcome .live-date { text-align: left; }
  .welcome h1 { font-size: 21px; }
  .kv { grid-template-columns: 1fr; }
  .kv > div:nth-child(odd) { border-right: 0; }
  .docs { grid-template-columns: 1fr 1fr; padding: 12px; gap: 10px; }
  .card-head, .card-body, .card-pad { padding: 16px; }
  .modal { padding: 0; place-items: end center; }
  .modal-card { border-radius: 18px 18px 0 0; max-height: 92dvh; }
  .modal-foot .btn { flex: 1; }
  .form-actions .btn { flex: 1; }
  .pagination .page-info { width: 100%; margin: 6px 0 0; }
  .login-page { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .topbar-actions .user-chip { display: none; }

  /* Tablas → tarjetas en teléfonos */
  table.responsive, table.responsive thead, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive thead { display: none; }
  table.responsive tr { border: 1px solid var(--line); border-radius: 13px; margin-bottom: 10px; overflow: hidden; background: var(--surface); }
  table.responsive td { display: flex; justify-content: space-between; gap: 14px; padding: 9px 14px; border-bottom: 1px solid var(--line); text-align: right; border-right: 0 !important; }
  table.responsive td::before { content: attr(data-label); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; text-align: left; flex: none; max-width: 45%; }
  table.responsive td:last-child { border-bottom: 0; }
  table.responsive td.actions-cell { justify-content: flex-end; flex-wrap: wrap; }
  table.responsive td.actions-cell::before { display: none; }
  table.responsive td[data-label=""]::before { display: none; }
  .sheet.responsive tr td:first-child { box-shadow: none; }
  .sheet.responsive tr { border-left-width: 5px; }
  .sheet.responsive tr.st-paid { border-left-color: var(--green); }
  .sheet.responsive tr.st-overdue { border-left-color: var(--yellow-strong); }
  .sheet.responsive tr.st-partial { border-left-color: #f5d36b; }
  .sheet.responsive tr.st-error { border-left-color: var(--red); }
  .table-wrap { overflow: visible; }
}
@media (max-width: 420px) {
  .docs { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat .stat-label { font-size: 10.5px; }
}
@media print {
  .sidebar, .topbar, .foot, .crumbbar, .toasts, .no-print { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Ajuste de la hoja de cuotas para que las 8 columnas quepan en laptops */
@media (min-width: 761px) {
  .sheet th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
  .sheet th, .sheet td { padding: 10px 10px; font-size: 13.5px; }
  .sheet td .nowrap { white-space: normal; }
}

/* Hoja de cuotas compacta en teléfonos: cada semana es una tarjeta de 2 columnas */
@media (max-width: 760px) {
  table.sheet.responsive tr { display: grid; grid-template-columns: 1fr 1fr; }
  table.sheet.responsive td { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 1px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
  table.sheet.responsive td::before { max-width: none; font-size: 10.5px; }
  table.sheet.responsive td:first-child { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; font-weight: 700; }
  table.sheet.responsive td:first-child::before { display: none; }
  table.sheet.responsive td:nth-child(2) { display: none; }
  table.sheet.responsive td:last-child { border-bottom: 1px solid var(--line); }
}
