/* RiderPro — Liquid Glass
 * Material: translucencia + desenfoque + saturación, borde especular que sigue la luz,
 * sombra interior suave y (en Chromium) refracción real de los bordes vía SVG (glass.js).
 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace;

  --text: #0c1022;
  --text2: rgba(12, 16, 34, .68);
  --text3: rgba(12, 16, 34, .46);
  --accent: #0a84ff;
  --accent-deep: #0a63d6;
  --accent-soft: rgba(10, 132, 255, .16);
  --ok: #1f9d55;
  --warn: #c2680a;
  --err: #d6342b;

  --bg-base: #e6ebf8;
  --orb1: #ff8bd0; --orb2: #6fc3ff; --orb3: #b79cff; --orb4: #ffd38c;
  --orb-op: .85;

  --glass: rgba(255, 255, 255, .40);
  --glass-hi: rgba(255, 255, 255, .62);
  --sheen: radial-gradient(130% 100% at 0% 0%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 46%), linear-gradient(315deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 38%);
  --spec: rgba(255, 255, 255, .95);
  --spec-dim: rgba(255, 255, 255, .42);
  --inner-glow: rgba(255, 255, 255, .22);
  --rim-a: .95; --rim-b: .14;
  --drop: rgba(40, 52, 110, .22);
  --drop-soft: rgba(40, 52, 110, .10);
  --blur: 26px;

  --field: rgba(255, 255, 255, .50);
  --field-focus: rgba(255, 255, 255, .78);
  --field-line: rgba(255, 255, 255, .7);
  --field-shadow: rgba(20, 30, 70, .14);
  --hair: rgba(12, 16, 34, .09);
  --btn: rgba(255, 255, 255, .52);
  --ic-fill: #e9eefb;

  --r-card: 28px;
  --r-ctl: 14px;
  --nav-h: 60px;
  --tab-h: 68px;
  --ease: cubic-bezier(.32, .72, 0, 1);
}

body.dark {
  color-scheme: dark;
  --text: #f4f6fd;
  --text2: rgba(244, 246, 253, .70);
  --text3: rgba(244, 246, 253, .46);
  --accent: #3d9bff;
  --accent-deep: #1f7ae6;
  --accent-soft: rgba(61, 155, 255, .22);
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #ff6b62;

  --bg-base: #070812;
  --orb1: #6a3df0; --orb2: #0aa6cf; --orb3: #d02c9b; --orb4: #e5701c;
  --orb-op: .55;

  --glass: rgba(26, 28, 46, .42);
  --glass-hi: rgba(46, 49, 74, .56);
  --sheen: radial-gradient(130% 100% at 0% 0%, rgba(255, 255, 255, .20), rgba(255, 255, 255, 0) 46%), linear-gradient(315deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, 0) 38%);
  --spec: rgba(255, 255, 255, .55);
  --spec-dim: rgba(255, 255, 255, .16);
  --inner-glow: rgba(255, 255, 255, .06);
  --rim-a: .6; --rim-b: .07;
  --drop: rgba(0, 0, 0, .55);
  --drop-soft: rgba(0, 0, 0, .3);

  --field: rgba(255, 255, 255, .07);
  --field-focus: rgba(255, 255, 255, .13);
  --field-line: rgba(255, 255, 255, .10);
  --field-shadow: rgba(0, 0, 0, .45);
  --hair: rgba(255, 255, 255, .10);
  --btn: rgba(255, 255, 255, .10);
  --ic-fill: #2a2d46;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 15px; line-height: 1.45;
  background: var(--bg-base);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  transition: background-color .5s ease, color .3s ease;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
svg.ic, svg.il { display: block; flex-shrink: 0; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── ESCENA DE FONDO ─────────────────────────────────────────────────────── */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg-base); }
.orb { position: absolute; width: 62vmax; height: 62vmax; border-radius: 50%; filter: blur(70px); opacity: var(--orb-op); will-change: transform; }
.orb.o1 { background: radial-gradient(circle at 40% 40%, var(--orb1), transparent 68%); left: -22vmax; top: -24vmax; animation: drift1 38s ease-in-out infinite alternate; }
.orb.o2 { background: radial-gradient(circle at 50% 50%, var(--orb2), transparent 68%); right: -26vmax; top: -6vmax; animation: drift2 46s ease-in-out infinite alternate; }
.orb.o3 { background: radial-gradient(circle at 50% 50%, var(--orb3), transparent 68%); left: -10vmax; bottom: -34vmax; animation: drift3 52s ease-in-out infinite alternate; }
.orb.o4 { background: radial-gradient(circle at 50% 50%, var(--orb4), transparent 66%); right: -18vmax; bottom: -22vmax; width: 50vmax; height: 50vmax; animation: drift1 44s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate3d(9vmax, 7vmax, 0) scale(1.08); } }
@keyframes drift2 { to { transform: translate3d(-8vmax, 10vmax, 0) scale(.94); } }
@keyframes drift3 { to { transform: translate3d(12vmax, -8vmax, 0) scale(1.1); } }

/* ── MATERIAL: LIQUID GLASS ──────────────────────────────────────────────── */
.glass {
  position: relative;
  background: var(--sheen), var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(190%) brightness(1.04);
  backdrop-filter: blur(var(--blur)) saturate(190%) brightness(1.04);
  box-shadow:
    inset 1.5px 1.5px 1px -.5px var(--spec),
    inset -1.5px -1.5px 1px -.5px var(--spec-dim),
    inset 0 0 22px 2px var(--inner-glow),
    0 14px 36px -12px var(--drop),
    0 2px 6px var(--drop-soft);
}
/* Borde de luz: brilla en la esquina superior izquierda e inferior derecha, como el vidrio real. */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.1px; pointer-events: none;
  background: conic-gradient(from 215deg, rgba(255, 255, 255, var(--rim-a)), rgba(255, 255, 255, var(--rim-b)) 17%, rgba(255, 255, 255, .03) 46%, rgba(255, 255, 255, var(--rim-b)) 63%, rgba(255, 255, 255, var(--rim-a)) 86%, rgba(255, 255, 255, var(--rim-a)));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.glass.lens { /* glass.js agrega refracción real en Chromium */
  -webkit-backdrop-filter: blur(14px) saturate(200%) brightness(1.06);
  backdrop-filter: blur(14px) saturate(200%) brightness(1.06);
}

/* ── ENCABEZADO ──────────────────────────────────────────────────────────── */
.top {
  position: fixed; z-index: 100; left: 0; right: 0; margin: 0 auto;
  top: max(10px, env(safe-area-inset-top));
  width: min(1180px, calc(100% - 20px)); height: var(--nav-h);
  border-radius: 999px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 10px 0 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 0; white-space: nowrap; }
.top-actions { flex-shrink: 0; }
.desktop-nav { flex-shrink: 1; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, #5ab0ff, #7a5cff 60%, #c15cff);
  box-shadow: inset 1px 1px 1px rgba(255, 255, 255, .7), inset -1px -1px 1px rgba(255, 255, 255, .25), 0 6px 14px -4px rgba(95, 90, 255, .6);
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.02em; line-height: 1.1; }
.brand-sub { font-size: 10px; letter-spacing: .14em; color: var(--text3); font-weight: 600; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 6px; }

/* Controles segmentados con lente deslizante */
.seg { position: relative; display: flex; padding: 4px; border-radius: 999px; background: var(--field); box-shadow: inset 0 1px 3px var(--field-shadow), inset 0 0 0 1px var(--field-line); }
.seg-btn { position: relative; z-index: 1; display: flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 550; color: var(--text2); white-space: nowrap; transition: color .25s; }
.seg-btn.active { color: var(--text); }
.seg-btn:active { transform: scale(.96); }
.seg-lens {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 999px;
  background: var(--glass-hi);
  -webkit-backdrop-filter: blur(6px) saturate(200%) brightness(1.1); backdrop-filter: blur(6px) saturate(200%) brightness(1.1);
  box-shadow: inset 1.5px 1.5px 1px -.5px var(--spec), inset -1.5px -1.5px 1px -.5px var(--spec-dim), 0 6px 14px -6px var(--drop), 0 1px 3px var(--drop-soft);
  transition: transform .5s var(--ease), width .5s var(--ease), opacity .2s;
}
.seg-lens.snap { transition: none; }
.desktop-nav { display: none; }

/* ── BOTONES ─────────────────────────────────────────────────────────────── */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; white-space: nowrap; user-select: none; -webkit-user-select: none;
  background: var(--btn); color: var(--text);
  -webkit-backdrop-filter: blur(14px) saturate(190%); backdrop-filter: blur(14px) saturate(190%);
  box-shadow: inset 1.5px 1.5px 1px -.5px var(--spec), inset -1.5px -1.5px 1px -.5px var(--spec-dim), 0 8px 18px -8px var(--drop), 0 1px 3px var(--drop-soft);
  transition: transform .35s var(--ease), box-shadow .25s, background .2s, opacity .2s;
}
.btn:hover { background: var(--glass-hi); }
.btn:active { transform: scale(.94); transition-duration: .1s; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary {
  color: #fff; background: linear-gradient(180deg, rgba(70, 160, 255, .98), rgba(10, 112, 240, .96));
  box-shadow: inset 1.5px 1.5px 1px -.5px rgba(255, 255, 255, .9), inset -1.5px -1.5px 1px -.5px rgba(255, 255, 255, .35), inset 0 -8px 14px -6px rgba(0, 60, 200, .5), 0 10px 22px -8px rgba(10, 110, 240, .7);
  text-shadow: 0 1px 1px rgba(0, 40, 120, .3);
}
.btn-primary:hover { background: linear-gradient(180deg, rgba(95, 175, 255, 1), rgba(25, 125, 250, 1)); }
.btn-danger { color: var(--err); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; gap: 5px; }
.btn-icon { width: 40px; height: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; height: 32px; }
.btn-block { width: 100%; padding: 15px; font-size: 15px; }
.btn .lbl { display: none; }
.btn.spin svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; position: relative;
  background: linear-gradient(145deg, #ff8bd0, #7a5cff);
  box-shadow: inset 1.5px 1.5px 1px -.5px rgba(255, 255, 255, .85), inset -1.5px -1.5px 1px -.5px rgba(255, 255, 255, .3), 0 8px 18px -8px var(--drop);
  transition: transform .35s var(--ease);
}
.avatar:active { transform: scale(.92); }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--text3); border: 2px solid var(--bg-base); }
.avatar .dot.ok { background: var(--ok); } .avatar .dot.busy { background: var(--accent); animation: pulse 1.1s ease-in-out infinite; } .avatar .dot.warn { background: var(--warn); } .avatar .dot.err { background: var(--err); }
@keyframes pulse { 50% { opacity: .35; } }

/* ── BARRA INFERIOR (móvil) ──────────────────────────────────────────────── */
.tabbar {
  position: fixed; z-index: 100; left: 0; right: 0; margin: 0 auto;
  bottom: calc(10px + env(safe-area-inset-bottom)); width: min(520px, calc(100% - 20px)); height: var(--tab-h);
  border-radius: 999px; padding: 6px; display: flex;
}
.tabbar .seg-lens { top: 6px; bottom: 6px; }
.tab { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 999px; color: var(--text2); transition: color .25s, transform .3s var(--ease); }
.tab span { font-size: 10px; font-weight: 600; letter-spacing: .01em; }
.tab.active { color: var(--accent); }
.tab:active { transform: scale(.92); }

/* ── CONTENIDO ───────────────────────────────────────────────────────────── */
.main {
  max-width: 900px; margin: 0 auto;
  padding: calc(var(--nav-h) + max(10px, env(safe-area-inset-top)) + 22px) 14px calc(var(--tab-h) + env(safe-area-inset-bottom) + 34px);
}
.page { display: none; }
.page.active { display: block; animation: rise .5s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.99); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

.page-head { margin: 4px 6px 18px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.page-title { font-size: clamp(32px, 7vw, 44px); font-weight: 750; letter-spacing: -.035em; line-height: 1.04; margin-top: 4px; }

.progress { margin: 0 6px 20px; }
.progress-track { height: 8px; border-radius: 99px; background: var(--field); box-shadow: inset 0 1px 3px var(--field-shadow), inset 0 0 0 1px var(--field-line); overflow: hidden; }
.progress-fill { width: 100%; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #5ab0ff, #7a5cff, #e25cff); box-shadow: inset 0 1px 1px rgba(255, 255, 255, .6); clip-path: inset(0 84% 0 0 round 99px); transition: clip-path .7s var(--ease); }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; font-weight: 550; color: var(--text2); margin-top: 8px; }

.card { border-radius: var(--r-card); margin-bottom: 14px; --blur: 28px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 4px; }
.card-label { display: flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text2); }
.card-label .il { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .18)); }
.card-body { padding: 12px 18px 18px; }
.card-pad { padding: 16px; }

/* ── FORMULARIOS ─────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.row { display: flex; gap: 12px; }
.row > .field { flex: 1; min-width: 0; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin: 0 0 6px 4px; letter-spacing: .005em; }
.inp, input[type=text], input[type=email], input[type=number], select, textarea {
  width: 100%; font-family: var(--font); font-size: 16px; color: var(--text);
  background: var(--field); border: 0; border-radius: var(--r-ctl); padding: 12px 14px; outline: 0;
  box-shadow: inset 0 1.5px 3px var(--field-shadow), inset 0 0 0 1px var(--field-line);
  -webkit-appearance: none; appearance: none; transition: box-shadow .2s, background .2s;
}
::placeholder { color: var(--text3); }
input:focus, select:focus, textarea:focus { background: var(--field-focus); box-shadow: inset 0 1.5px 3px var(--field-shadow), inset 0 0 0 1px var(--field-line), 0 0 0 3.5px var(--accent-soft), 0 0 0 1.5px var(--accent); }
textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5l4.5 4.5 4.5-4.5' stroke='%238a90a8' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
option { color: #111; background: #fff; }
@media (min-width: 820px) { .inp, input[type=text], input[type=email], input[type=number], select, textarea { font-size: 14.5px; } }

/* Interruptor: el pulgar es una gota de vidrio que se estira al presionar. */
.toggle-wrap { display: flex; align-items: center; gap: 14px; padding: 18px; cursor: pointer; width: 100%; text-align: left; }
.toggle-title { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.toggle-sub { font-size: 13px; color: var(--text2); margin-top: 2px; }
.toggle-track { position: relative; margin-left: auto; width: 56px; height: 34px; border-radius: 99px; flex-shrink: 0; background: var(--field); box-shadow: inset 0 1.5px 4px var(--field-shadow), inset 0 0 0 1px var(--field-line); transition: background .3s var(--ease); }
.toggle-track.on { background: linear-gradient(180deg, #53d56f, #2cbf55); }
.toggle-thumb {
  position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 99px; background: rgba(255, 255, 255, .96);
  box-shadow: inset 1.5px 1.5px 1px -.5px #fff, inset -1px -1.5px 2px rgba(0, 0, 0, .1), 0 4px 10px -2px rgba(0, 0, 0, .35), 0 1px 2px rgba(0, 0, 0, .2);
  transition: transform .45s var(--ease), width .3s var(--ease);
}
.toggle-track.on .toggle-thumb { transform: translateX(22px); }
.toggle-wrap:active .toggle-thumb { width: 38px; }
.toggle-wrap:active .toggle-track.on .toggle-thumb { transform: translateX(12px); }

/* ── INPUT LIST ──────────────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 4px 6px 10px; }
.input-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 800px; font-size: 13px; }
.input-table th { text-align: left; padding: 10px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text3); white-space: nowrap; }
.input-table td { padding: 4px 3px; vertical-align: middle; border-top: 1px solid var(--hair); }
.input-table tbody tr { transition: background .2s, opacity .2s; }
.input-table tbody tr:hover { background: rgba(255, 255, 255, .12); }
.input-table input, .input-table select { font-size: 13px; padding: 9px 10px; border-radius: 11px; }
.input-table select { padding-right: 26px; background-position: right 9px center; }
.ch-num { display: block; width: 26px; text-align: center; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text3); }
.ch-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--field); box-shadow: inset 0 1px 3px var(--field-shadow), inset 0 0 0 1px var(--field-line); }
.drag-handle { display: inline-grid; place-items: center; width: 22px; height: 30px; color: var(--text3); cursor: grab; touch-action: none; }
.drag-handle:active { cursor: grabbing; }
#input-tbody tr.dragging { opacity: .35; }
#input-tbody tr.drag-over-top td { border-top: 2px solid var(--accent) !important; }
#input-tbody tr.drag-over-bot td { border-bottom: 2px solid var(--accent) !important; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 99px; font-size: 12px; font-weight: 650; background: var(--field); box-shadow: inset 0 0 0 1px var(--field-line); color: var(--text2); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── STAGE PLOT ──────────────────────────────────────────────────────────── */
.cats { margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px; }
.cats::-webkit-scrollbar { display: none; }
.cats .seg { width: max-content; }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; padding: 10px; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: 20px; background: var(--field);
  box-shadow: inset 1.5px 1.5px 1px -.5px var(--spec-dim), inset 0 0 0 1px var(--field-line);
  transition: transform .4s var(--ease), background .2s, box-shadow .2s;
}
.tile:hover { background: var(--glass-hi); transform: translateY(-3px); box-shadow: inset 1.5px 1.5px 1px -.5px var(--spec), inset 0 0 0 1px var(--field-line), 0 12px 22px -10px var(--drop); }
.tile:active { transform: scale(.92); transition-duration: .08s; }
.tile .il { filter: drop-shadow(0 4px 5px rgba(0, 0, 0, .16)); }
.tile b { font-size: 11.5px; font-weight: 600; color: var(--text2); text-align: center; line-height: 1.15; }
.custom-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 10px 12px; }
.custom-form .pick { width: 52px; height: 48px; border-radius: 14px; flex-shrink: 0; display: grid; place-items: center; background: var(--field); box-shadow: inset 0 1px 3px var(--field-shadow), inset 0 0 0 1px var(--field-line); }
.custom-form select { flex: 1 1 110px; width: auto; }
.custom-form input { flex: 2 1 150px; min-width: 0; width: auto; }

.stage-wrap {
  position: relative; width: 100%; height: 420px; border-radius: 28px; overflow: hidden; touch-action: none;
  background:
    radial-gradient(70% 55% at 50% 0%, rgba(255, 255, 255, .6), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, rgba(150, 165, 215, .30), rgba(90, 105, 170, .38));
  box-shadow: inset 1.5px 1.5px 1px -.5px var(--spec), inset -1.5px -1.5px 1px -.5px var(--spec-dim), inset 0 0 40px rgba(60, 80, 160, .2), 0 14px 36px -12px var(--drop);
}
body.dark .stage-wrap { background: radial-gradient(70% 55% at 50% 0%, rgba(150, 140, 255, .28), rgba(255, 255, 255, 0) 70%), linear-gradient(180deg, rgba(60, 65, 110, .35), rgba(20, 22, 44, .55)); }
.stage-grid { position: absolute; inset: 0 0 46px; pointer-events: none; background-image: linear-gradient(rgba(255, 255, 255, .28) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .28) 1px, transparent 1px); background-size: 44px 44px; -webkit-mask: radial-gradient(90% 100% at 50% 0%, #000 30%, transparent 100%); mask: radial-gradient(90% 100% at 50% 0%, #000 30%, transparent 100%); }
body.dark .stage-grid { background-image: linear-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .09) 1px, transparent 1px); }
.stage-cline { position: absolute; top: 0; bottom: 46px; left: 50%; border-left: 1px dashed rgba(255, 255, 255, .4); pointer-events: none; }
.stage-top { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 700; color: var(--text3); letter-spacing: .18em; text-transform: uppercase; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.stage-front { position: absolute; bottom: 0; left: 0; right: 0; height: 46px; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .08)); box-shadow: inset 0 1px 0 var(--spec-dim); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.stage-front span { font-size: 10px; font-weight: 700; color: var(--text2); letter-spacing: .4em; text-transform: uppercase; }

.s-el { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; z-index: 10; }
.s-el:active { cursor: grabbing; }
.s-icon {
  position: relative; width: 62px; height: 62px; border-radius: 20px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .50); -webkit-backdrop-filter: blur(8px) saturate(180%); backdrop-filter: blur(8px) saturate(180%);
  box-shadow: inset 1.5px 1.5px 1px -.5px rgba(255, 255, 255, .95), inset -1.5px -1.5px 1px -.5px rgba(255, 255, 255, .4), 0 12px 22px -8px rgba(30, 40, 100, .45), 0 2px 5px rgba(30, 40, 100, .2);
  transition: transform .35s var(--ease), box-shadow .25s;
}
body.dark .s-icon { background: rgba(255, 255, 255, .13); box-shadow: inset 1.5px 1.5px 1px -.5px rgba(255, 255, 255, .55), inset -1.5px -1.5px 1px -.5px rgba(255, 255, 255, .15), 0 12px 22px -8px rgba(0, 0, 0, .7), 0 2px 5px rgba(0, 0, 0, .4); }
.s-el:active .s-icon { transform: scale(1.1); }
.s-el.selected .s-icon { box-shadow: inset 1.5px 1.5px 1px -.5px #fff, 0 0 0 2.5px var(--accent), 0 0 0 7px var(--accent-soft), 0 14px 24px -8px rgba(30, 40, 100, .5); }
.s-icon .emoji { font-size: 28px; line-height: 1; }
.s-del { position: absolute; top: -9px; right: -9px; width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center; color: #fff; background: var(--err); box-shadow: inset 1px 1px 1px rgba(255, 255, 255, .6), 0 4px 10px rgba(214, 52, 43, .5); touch-action: manipulation; z-index: 5; }
.s-del::before { content: ''; position: absolute; inset: -9px; border-radius: 50%; }
.s-el.selected .s-del { display: grid; }
.s-label { font-size: 11px; font-weight: 650; color: var(--text); max-width: 84px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--glass-hi); padding: 2px 8px; border-radius: 99px; box-shadow: inset 0 0 0 1px var(--field-line); outline: 0; }
.s-label:focus { text-overflow: clip; box-shadow: 0 0 0 2px var(--accent); }
.hint { font-size: 12px; font-weight: 550; color: var(--text3); text-align: center; margin: 10px 0 14px; }

/* ── REQUERIMIENTOS / HOSPITALIDAD ───────────────────────────────────────── */
.req-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.req-row select, .req-row input { font-size: 14px; padding: 10px 12px; }
.cat-row { display: flex; gap: 8px; margin-bottom: 10px; }
.cat-row input:nth-child(2) { max-width: 84px; flex-shrink: 0; }
.list-pad { padding: 8px 18px 16px; }

/* ── BIBLIOTECA ──────────────────────────────────────────────────────────── */
.saved { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 22px; margin-bottom: 8px; background: var(--field); box-shadow: inset 1.5px 1.5px 1px -.5px var(--spec-dim), inset 0 0 0 1px var(--field-line); transition: transform .4s var(--ease), background .2s; }
.saved:hover { background: var(--glass-hi); }
.saved-main { flex: 1; min-width: 0; cursor: pointer; }
.saved-name { font-size: 16px; font-weight: 650; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-meta { font-size: 12px; color: var(--text2); margin-top: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack { display: flex; flex-shrink: 0; min-width: 54px; }
.stack .il { margin-left: -16px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .2)); }
.stack .il:first-child { margin-left: 0; }
.stack .none { width: 46px; height: 46px; display: grid; place-items: center; color: var(--text3); }
.saved-actions { display: flex; gap: 2px; }
.sync { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; }
.sync.ok { color: var(--ok); } .sync.pend { color: var(--warn); } .sync.local { color: var(--text3); }
.empty { text-align: center; padding: 38px 20px; color: var(--text3); font-size: 14px; font-weight: 550; }
.empty .ic { margin: 0 auto 10px; opacity: .55; }

/* ── DIÁLOGOS Y HOJAS ────────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 300; background: rgba(10, 14, 36, .30); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 18px; opacity: 0; pointer-events: none; transition: opacity .35s var(--ease); }
body.dark .scrim { background: rgba(0, 0, 0, .45); }
.scrim.open { opacity: 1; pointer-events: auto; }
.scrim.sheet-wrap { align-items: flex-end; padding: 0; }
.dialog { width: min(400px, 100%); border-radius: 34px; padding: 26px 22px 20px; --blur: 36px; transform: scale(.9) translateY(10px); filter: blur(8px); opacity: 0; transition: transform .5s var(--ease), filter .4s var(--ease), opacity .3s; }
.scrim.open .dialog { transform: none; filter: none; opacity: 1; }
.dialog h2 { font-size: 22px; font-weight: 750; letter-spacing: -.025em; margin-bottom: 6px; text-align: center; }
.dialog p.help { font-size: 14px; color: var(--text2); text-align: center; margin-bottom: 16px; }
.dialog .logo { width: 56px; height: 56px; border-radius: 18px; margin: 0 auto 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #5ab0ff, #7a5cff 60%, #c15cff); box-shadow: inset 1.5px 1.5px 1px rgba(255, 255, 255, .7), inset -1.5px -1.5px 1px rgba(255, 255, 255, .25), 0 12px 24px -8px rgba(95, 90, 255, .6); }
.dialog .actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.dialog .actions.row2 { flex-direction: row; } .dialog .actions.row2 .btn { flex: 1; }
.login-err { color: var(--err); font-size: 13px; font-weight: 600; min-height: 18px; margin-top: 8px; text-align: center; }
.code-inp { text-align: center; font-family: var(--mono); font-size: 28px; letter-spacing: .35em; padding: 14px 0 14px .35em; }

.sheet { width: min(760px, 100%); max-height: 92dvh; overflow: auto; border-radius: 34px 34px 0 0; padding: 0 18px calc(26px + env(safe-area-inset-bottom)); --blur: 40px; transform: translateY(100%); transition: transform .55s var(--ease); }
.scrim.open .sheet { transform: none; }
.grab { width: 38px; height: 5px; border-radius: 3px; background: var(--text3); opacity: .6; margin: 10px auto 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.sheet-title { font-size: 22px; font-weight: 750; letter-spacing: -.025em; }
@media (min-width: 820px) { .scrim.sheet-wrap { align-items: center; padding: 22px; } .sheet { border-radius: 34px; max-height: 90vh; } }
.user-row { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-top: 1px solid var(--hair); }
.user-row:first-child { border-top: 0; }
.user-row .who { flex: 1; min-width: 0; } .user-row b { display: block; font-weight: 650; } .user-row small { color: var(--text2); word-break: break-all; }

.toast { position: fixed; z-index: 400; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 26px); transform: translate(-50%, 24px) scale(.9); opacity: 0; filter: blur(6px); display: flex; align-items: center; gap: 9px; padding: 12px 18px; border-radius: 99px; font-size: 14px; font-weight: 600; max-width: calc(100% - 28px); pointer-events: none; transition: all .5s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); filter: none; }
.toast .ic { color: var(--accent); } .toast.warn .ic { color: var(--warn); } .toast.ok .ic { color: var(--ok); } .toast.err .ic { color: var(--err); }

/* ── DOCUMENTO PDF (papel blanco) ────────────────────────────────────────── */
.paper-wrap { border-radius: 14px; overflow: hidden; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .35); }
#rider-doc { background: #fff; color: #111; font-family: 'Sora', system-ui, sans-serif; padding: 40px; }
.doc-top { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #111; padding-bottom: 18px; margin-bottom: 22px; gap: 16px; }
.doc-band { font-size: 30px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.doc-band-sub { font-size: 10px; color: #888; margin-top: 5px; font-family: 'JetBrains Mono', monospace; }
.doc-band-venue { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #111; margin-top: 10px; font-weight: 500; background: #f7f7f7; padding: 5px 11px; border-radius: 6px; border-left: 3px solid #111; }
.doc-band-venue-tag { font-family: 'JetBrains Mono', monospace; font-size: 8px; color: #888; letter-spacing: 1.5px; text-transform: uppercase; }
.doc-meta { text-align: right; font-size: 10px; color: #aaa; font-family: 'JetBrains Mono', monospace; line-height: 1.9; flex-shrink: 0; }
.doc-section { break-inside: avoid; margin-bottom: 22px; }
.doc-table tr { break-inside: avoid; }
.pdf-page-break-before { margin-top: 30px; }
.doc-sec-label { font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: #aaa; border-bottom: 1px solid #e8e8e8; padding-bottom: 6px; margin-bottom: 12px; }
.doc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.doc-fl { font-size: 9px; color: #bbb; letter-spacing: .5px; text-transform: uppercase; font-family: 'JetBrains Mono', monospace; }
.doc-fv { font-size: 13px; font-weight: 500; margin-top: 2px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.doc-table th { background: #111; color: #fff; padding: 6px 8px; text-align: left; font-family: 'JetBrains Mono', monospace; font-size: 8px; letter-spacing: 1px; text-transform: uppercase; }
.doc-table td { padding: 4px 8px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.doc-table tr:nth-child(even) td { background: #fafafa; }
.doc-ch { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 12px; }
.doc-ico { display: inline-block; vertical-align: middle; margin-right: 6px; }
.doc-req-sub { font-size: 9px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: #aaa; font-family: 'JetBrains Mono', monospace; margin-bottom: 8px; }
.doc-req-row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid #f5f5f5; font-size: 11px; }
.doc-req-row span:last-child { font-weight: 500; }
.doc-footer { margin-top: 24px; padding-top: 12px; border-top: 1px solid #ddd; display: flex; justify-content: space-between; font-size: 9px; color: #ccc; font-family: 'JetBrains Mono', monospace; }

/* ── ESCRITORIO ──────────────────────────────────────────────────────────── */
@media (min-width: 820px) {
  .desktop-nav { display: flex; }
  .tabbar { display: none; }
  .main { padding: calc(var(--nav-h) + 40px) 20px 60px; }
  .toast { bottom: 28px; }
  .stage-wrap { height: 460px; }
}
@media (max-width: 420px) {
  .brand-sub { display: none; }
  .row { gap: 8px; }
}
@media (min-width: 820px) and (max-width: 1279px) { .seg-btn { padding: 7px 11px; } .seg-btn .ic { display: none; } .brand-name, .brand-sub { display: none; } }
@media (min-width: 1280px) { .btn .lbl { display: inline; } .btn-icon.has-lbl { width: auto; padding: 0 16px; height: 40px; } }

/* ── ACCESIBILIDAD ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .orb { animation: none; }
  .page.active { animation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; }
  .dialog, .sheet { transform: none; filter: none; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .glass, .btn, .seg-lens, .s-icon { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  :root { --glass: rgba(255, 255, 255, .9); --glass-hi: #fff; --btn: rgba(255, 255, 255, .95); }
  body.dark { --glass: rgba(30, 32, 52, .96); --glass-hi: rgba(48, 52, 80, 1); --btn: rgba(48, 52, 80, 1); }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass: rgba(255, 255, 255, .86); } body.dark { --glass: rgba(30, 32, 52, .92); }
}

/* utilidades */
svg.flip { transform: rotate(180deg); }
svg.spin { animation: spin .9s linear infinite; }
