/* ==========================================================================
   Montaje de Eventos · Alpha Social — sistema de diseño
   Celular primero (360 px), modo oscuro automático.
   ========================================================================== */

:root {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --surface-3: #F2F4F7;
  --ink: #0B1220;
  --ink-2: #344054;
  --muted: #667085;
  --faint: #98A2B3;
  --border: #E4E7EC;
  --border-strong: #D0D5DD;
  --primary: #4F46E5;
  --primary-ink: #FFFFFF;
  --primary-hover: #4338CA;
  --primary-soft: #EEF2FF;
  --primary-soft-ink: #3730A3;
  --success: #12B76A;
  --success-soft: #ECFDF3;
  --success-ink: #027A48;
  --warning: #F79009;
  --warning-soft: #FFFAEB;
  --warning-ink: #B54708;
  --danger: #F04438;
  --danger-soft: #FEF3F2;
  --danger-ink: #B42318;
  --info-soft: #EFF8FF;
  --info-ink: #175CD3;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .25);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --sidebar: 256px;
  --topbar: 56px;
  --bottombar: 64px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0F17;
    --surface: #121826;
    --surface-2: #161D2D;
    --surface-3: #1C2436;
    --ink: #F2F4F7;
    --ink-2: #D0D5DD;
    --muted: #98A2B3;
    --faint: #667085;
    --border: #232C3F;
    --border-strong: #2F3A52;
    --primary: #6366F1;
    --primary-hover: #818CF8;
    --primary-soft: #1E1B4B;
    --primary-soft-ink: #C7D2FE;
    --success-soft: #052E1C;
    --success-ink: #6CE9A6;
    --warning-soft: #33200A;
    --warning-ink: #FEC84B;
    --danger-soft: #3A1210;
    --danger-ink: #FDA29B;
    --info-soft: #0B2541;
    --info-ink: #84CAFF;
    --shadow-lg: 0 20px 40px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--surface);
}

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], input[type=tel], input:not([type]), select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font-size: 16px; /* evita zoom automático en iPhone */
}
textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
select { appearance: none; padding-right: 34px;
  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='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---------- Alertas, chips, badges ---------- */
.alert { padding: 10px 12px; border-radius: 10px; font-size: 14px; border: 1px solid transparent; }
.alert-danger { background: var(--danger-soft); color: var(--danger-ink); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-warning { background: var(--warning-soft); color: var(--warning-ink); }
.alert-info { background: var(--info-soft); color: var(--info-ink); }
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.badge-danger { background: var(--danger-soft); color: var(--danger-ink); }
.badge-warning { background: var(--warning-soft); color: var(--warning-ink); }
.badge-success { background: var(--success-soft); color: var(--success-ink); }
.badge-info { background: var(--info-soft); color: var(--info-ink); }
.badge-primary { background: var(--primary-soft); color: var(--primary-soft-ink); }
.badge .i { width: 13px; height: 13px; }
.serie-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .count { font-weight: 700; opacity: .7; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-size: 11px; font-weight: 700; color: #fff; letter-spacing: .02em;
}
.avatar-lg { width: 36px; height: 36px; font-size: 13px; }
.avatar-empty { background: transparent; border: 1.5px dashed var(--border-strong); color: var(--faint); }

/* ---------- Estructura (shell) ---------- */
.app { min-height: 100vh; }
.content { min-width: 0; }
@media (max-width: 620px) { [data-cambiar-evento] span { display: none; } [data-cambiar-evento] { padding: 0 8px; } }
.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar);
  display: flex; align-items: center; gap: 6px; padding: 0 8px 0 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; }
.main { padding: 16px 16px calc(var(--bottombar) + 28px); max-width: 1180px; margin: 0 auto; }
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--bottombar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
}
.bottombar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11.5px; font-weight: 600; position: relative;
}
.bottombar a .i { width: 22px; height: 22px; }
.bottombar a.on { color: var(--primary); }
.bottombar a .dot { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }

.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-lockup strong { display: block; font-size: 15px; letter-spacing: -0.01em; }
.brand-lockup small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #111827 0%, #4F46E5 100%); color: #fff; font-weight: 800; font-size: 17px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}

@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: var(--sidebar) 1fr; }
  .sidebar {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
    background: var(--surface); border-right: 1px solid var(--border); padding: 18px 14px; gap: 18px; overflow-y: auto;
  }
  .bottombar { display: none; }
  .topbar { padding: 0 20px 0 28px; height: 64px; }
  .topbar .only-mobile { display: none; }
  .main { padding: 24px 28px 48px; }
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav button {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: 9px; border: 0; background: none;
  color: var(--ink-2); font-weight: 550; font-size: 14px; cursor: pointer; text-align: left; width: 100%;
}
.nav a:hover, .nav button:hover { background: var(--surface-3); }
.nav a.on { background: var(--primary-soft); color: var(--primary-soft-ink); }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); }
.nav-label { font-size: 11.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; padding: 0 10px 6px; }
.nav-event { height: auto !important; min-height: 38px; padding: 7px 10px !important; }
.nav-event .ellipsis { font-size: 13.5px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }

/* ---------- Encabezados de página ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head p { margin-top: 4px; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.section-title .badge { text-transform: none; letter-spacing: 0; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 16px; }
.cards { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 680px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1180px) { .cards { grid-template-columns: repeat(3, 1fr); } }

.event-card { display: flex; flex-direction: column; gap: 14px; padding: 16px; cursor: pointer; transition: box-shadow .15s, transform .15s; position: relative; overflow: hidden; }
.event-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.event-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--serie, var(--primary)); }
.event-card .countdown { text-align: right; flex: none; }
.event-card .countdown b { display: block; font-size: 24px; font-weight: 750; line-height: 1; letter-spacing: -0.02em; }
.event-card .countdown span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.kpi b { display: block; font-size: 17px; font-weight: 700; }
.kpi span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.kpi.bad b { color: var(--danger); }
.kpi.warn b { color: var(--warning-ink); }

.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width .4s; }
.progress.ok > i { background: var(--success); }
.progress-sm { height: 5px; }

/* ---------- Encabezado de evento ---------- */
.event-hero { padding: 18px; display: grid; gap: 16px; position: relative; overflow: hidden; }
.event-hero::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--serie, var(--primary)); }
.event-hero h1 { font-size: 21px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 13.5px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 5px; }
.hero-meta .i { width: 15px; height: 15px; }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--surface-3) 0); }
.ring > span { width: 50px; height: 50px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 750; font-size: 14px; }
.phase-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.phase-strip button { border: 0; background: none; padding: 0; cursor: pointer; text-align: left; }
.phase-strip .progress { height: 6px; }
.phase-strip small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .phase-strip small { display: none; } }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 18px 0 14px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 12px; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--ink); }

/* ---------- Barra de herramientas de tareas ---------- */
.toolbar { display: flex; flex-direction: column; gap: 10px; position: sticky; top: var(--topbar); z-index: 20; background: var(--bg); padding: 8px 0 10px; margin-top: -8px; }
@media (min-width: 960px) { .toolbar { top: 64px; } }
.search { position: relative; flex: 1; }
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { padding-left: 38px; background: var(--surface); }

/* ---------- Fases y tareas ---------- */
.phase { margin-bottom: 14px; }
.phase-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; user-select: none;
  border-bottom: 1px solid transparent;
}
.phase.open .phase-head { border-bottom-color: var(--border); }
.phase-num { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; font-size: 12.5px; font-weight: 750; color: var(--ink-2); flex: none; }
.phase-head .chev { transition: transform .2s; color: var(--faint); }
.phase.open .phase-head .chev { transform: rotate(90deg); }
.phase-head .progress { width: 64px; }
.phase-body { display: none; }
.phase.open .phase-body { display: block; }
.area-label { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.area-add { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--primary); font: inherit; font-size: 12px; font-weight: 700; text-transform: none; letter-spacing: 0; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.area-add:hover { background: var(--primary-soft); }
.area-add .i { width: 14px; height: 14px; }
.quick-area { border-top: 1px dashed var(--primary); background: var(--primary-soft); }
.area-label { padding: 10px 14px 4px; font-size: 11.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }

.task {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px 10px 14px; position: relative;
  border-top: 1px solid var(--border); background: var(--surface); cursor: pointer;
}
.area-label + .task { border-top-color: transparent; }
.task:hover { background: var(--surface-2); }
.task::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.task.p-alta::before { background: var(--danger); }
.task.p-media::before { background: var(--warning); opacity: .55; }
.task.done .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.task.na .task-title { color: var(--faint); }
.task-check {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface);
  display: grid; place-items: center; flex: none; cursor: pointer; margin-top: 1px; color: transparent; padding: 0;
  transition: background .15s, border-color .15s, transform .1s;
}
.task-check:hover { border-color: var(--success); color: var(--success); }
.task-check:active { transform: scale(.9); }
.task-check .i { width: 14px; height: 14px; stroke-width: 3; }
.task.done .task-check { background: var(--success); border-color: var(--success); color: #fff; }
.task.na .task-check { background: var(--surface-3); border-color: var(--border-strong); color: var(--faint); }
.task.s-en_proceso .task-check { border-color: var(--info-ink); border-style: dashed; }
.task.s-bloqueada .task-check { border-color: var(--danger); }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 14.5px; font-weight: 550; line-height: 1.35; word-break: break-word; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.task-meta .m { display: inline-flex; align-items: center; gap: 4px; }
.task-meta .m .i { width: 13px; height: 13px; }
.task-right { display: flex; align-items: center; gap: 4px; flex: none; }
.grip { color: var(--faint); cursor: grab; touch-action: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; border: 0; background: none; padding: 0; }
.grip:hover { background: var(--surface-3); color: var(--ink-2); }
.task.dragging { opacity: .95; box-shadow: var(--shadow-lg); z-index: 50; border-radius: 10px; }
.drop-placeholder { height: 52px; background: var(--primary-soft); border: 2px dashed var(--primary); border-radius: 10px; margin: 2px 8px; }
.sel-box { width: 20px; height: 20px; margin: 3px 2px 0 0; accent-color: var(--primary); flex: none; }
.selecting .task-check { display: none; }
.task.selected { background: var(--primary-soft); }

.quick-add { display: flex; align-items: center; gap: 8px; padding: 8px 12px 10px 14px; border-top: 1px solid var(--border); }
.quick-add .plus { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--primary); flex: none; }
.quick-add input { border: 0; background: transparent; min-height: 38px; padding: 6px 0; box-shadow: none; }
.quick-add input:focus { outline: none; }
.quick-add:focus-within { background: var(--surface-2); }
.quick-hint { font-size: 11.5px; color: var(--faint); padding: 0 14px 10px 46px; margin-top: -6px; display: none; }
.quick-add:focus-within + .quick-hint { display: block; }

.due { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.due.over { color: var(--danger-ink); }
.due.today { color: var(--warning-ink); }
.due.soon { color: var(--info-ink); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .i { width: 40px; height: 40px; color: var(--faint); stroke-width: 1.5; margin-bottom: 8px; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }

/* Barra de acciones al seleccionar varias tareas */
.bulkbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--bottombar) + 12px + env(safe-area-inset-bottom)); z-index: 45;
  background: var(--ink); color: var(--bg); border-radius: 14px; padding: 8px 8px 8px 16px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 6px; max-width: 720px; margin: 0 auto;
}
.bulkbar .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 25%, transparent); box-shadow: none; min-height: 36px; padding: 0 10px; }
.bulkbar .actions { display: flex; gap: 6px; overflow-x: auto; margin-left: auto; scrollbar-width: none; }
@media (min-width: 960px) { .bulkbar { bottom: 20px; left: calc(var(--sidebar) + 20px); } }

/* ---------- Panel lateral / hoja inferior (detalle de tarea) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(11, 18, 32, .45); z-index: 60; opacity: 0; transition: opacity .2s; }
.scrim.show { opacity: 1; }
.sheet {
  position: fixed; z-index: 61; background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  left: 0; right: 0; bottom: 0; max-height: 92vh; border-radius: 18px 18px 0 0; transform: translateY(100%); transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.sheet.show { transform: none; }
.sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: var(--border-strong); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--border); flex: none; }
.sheet-body { overflow-y: auto; padding: 16px; flex: 1; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); flex: none; display: flex; gap: 8px; justify-content: flex-end; }
@media (min-width: 760px) {
  .sheet.side { left: auto; top: 0; bottom: 0; width: 520px; max-height: none; border-radius: 0; transform: translateX(100%); }
  .sheet.side.show { transform: none; }
  .sheet.side .sheet-handle { display: none; }
  .sheet.modal { left: 50%; top: 50%; bottom: auto; right: auto; width: min(560px, calc(100vw - 32px)); max-height: 88vh; border-radius: 18px; transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: transform .2s, opacity .2s; }
  .sheet.modal.show { transform: translate(-50%, -50%); opacity: 1; }
  .sheet.modal .sheet-handle { display: none; }
}

.detail-title { width: 100%; border: 1px solid transparent; background: transparent; font-size: 19px; font-weight: 700; padding: 6px 8px; margin: -6px -8px 0; border-radius: 8px; resize: none; min-height: 0; line-height: 1.3; }
.detail-title:hover { border-color: var(--border); }
.detail-title:focus { border-color: var(--primary); background: var(--surface); outline: none; }
.props { display: grid; grid-template-columns: 1fr; gap: 2px; margin: 14px 0 6px; }
.prop { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 10px; min-height: 44px; }
.prop > label { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.prop > label .i { width: 15px; height: 15px; }
.prop select, .prop input { min-height: 38px; padding-top: 6px; padding-bottom: 6px; border-color: var(--border); background-color: var(--surface-2); }
.seg { display: flex; gap: 4px; flex-wrap: wrap; }
.seg button { height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.seg button.on.st-completo { background: var(--success); border-color: var(--success); color: #fff; }
.seg button.on.st-bloqueada { background: var(--danger); border-color: var(--danger); color: #fff; }
.seg button.on.st-en_proceso { background: var(--info-ink); border-color: var(--info-ink); color: #fff; }
.seg button.on.pr-alta { background: var(--danger); border-color: var(--danger); color: #fff; }
.seg button.on.pr-media { background: var(--warning); border-color: var(--warning); color: #fff; }
.seg button.on.pr-baja { background: var(--muted); border-color: var(--muted); color: #fff; }
.block-title { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 20px 0 8px; display: flex; align-items: center; gap: 7px; }
.block-title .i { width: 16px; height: 16px; color: var(--muted); }
.subtask { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.subtask input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--success); flex: none; }
.subtask.done span { color: var(--muted); text-decoration: line-through; }
.subtask .icon-btn { width: 30px; height: 30px; margin-left: auto; opacity: .5; }
.comment { display: flex; gap: 10px; padding: 8px 0; }
.comment .bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 12px 12px 12px; padding: 8px 12px; flex: 1; min-width: 0; }
.comment .bubble p { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.mention { color: var(--primary); font-weight: 600; }
.composer { display: flex; gap: 8px; align-items: flex-end; position: relative; }
.composer textarea { min-height: 42px; height: 42px; }
.suggest { position: absolute; bottom: 48px; left: 0; right: 50px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); overflow: hidden; z-index: 5; }
.suggest button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 0; background: none; cursor: pointer; font-size: 14px; text-align: left; }
.suggest button:hover, .suggest button.on { background: var(--surface-3); }
.history li { font-size: 12.5px; color: var(--muted); padding: 5px 0; border-bottom: 1px dashed var(--border); }
.history { list-style: none; padding: 0; margin: 0; }

/* ---------- Toast ---------- */
.toasts { position: fixed; z-index: 90; left: 12px; right: 12px; bottom: calc(var(--bottombar) + 16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
@media (min-width: 960px) { .toasts { bottom: 24px; left: auto; right: 24px; align-items: flex-end; } }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px; max-width: 460px; animation: toast-in .2s ease-out; }
.toast.error { background: var(--danger); color: #fff; }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; padding: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Listas y tablas de administración ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); cursor: pointer; }
.list-item:first-child { border-top: 0; }
.list-item:hover { background: var(--surface-2); }
.role-matrix { display: flex; flex-direction: column; gap: 8px; }
.role-row { display: grid; grid-template-columns: 1fr 150px; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.role-row select { min-height: 36px; background-color: var(--surface); }
.role-row-2 { grid-template-columns: 1fr 1fr; }
.role-row-2 > .row { grid-column: 1 / -1; }
.role-row select:disabled { opacity: .5; }
.notif { display: flex; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--border); cursor: pointer; }
.notif:first-child { border-top: 0; }
.notif.unread { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.notif .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }

/* ---------- Pantalla de acceso ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 28px 24px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 16px; }
.auth-card h1 { margin-top: 8px; }

/* Cargando */
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-pad { display: grid; place-items: center; padding: 60px 0; }

.alert-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--danger-soft); color: var(--danger-ink); border: 1px solid color-mix(in srgb, var(--danger) 20%, transparent); cursor: pointer; }
.alert-card + .alert-card { margin-top: 8px; }
.greet { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat-row.cuatro { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .stat-row.cuatro { grid-template-columns: repeat(4, 1fr); } }
.stat-row > * { min-width: 0; }
.stat { padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.stat b { display: block; font-size: 24px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat.bad b { color: var(--danger); }
.stat.warn b { color: var(--warning-ink); }
.presentes { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--success-soft); color: var(--success-ink); font-size: 12.5px; font-weight: 600; max-width: 100%; }
.presentes .pila { display: inline-flex; }
.presentes .pila .avatar { box-shadow: 0 0 0 2px var(--surface); }
.presentes .pila .avatar + .avatar { margin-left: -8px; }
.punto-vivo { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex: none; box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent); animation: latido 2s infinite; }
@keyframes latido { 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.en-linea { position: relative; }
.en-linea::after { content: ''; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--success); border: 2px solid var(--surface); }
.interruptor { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); }
.interruptor:first-child { border-top: 0; }
.interruptor input { width: 42px; height: 24px; appearance: none; border-radius: 99px; background: var(--border-strong); position: relative; cursor: pointer; flex: none; transition: background .15s; }
.interruptor input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: var(--shadow-sm); }
.interruptor input:checked { background: var(--primary); }
.interruptor input:checked::after { transform: translateX(18px); }
.interruptor input:disabled { opacity: .6; cursor: not-allowed; }
.codigo { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; word-break: break-all; user-select: all; }
/* Actividad */
.actividad { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--border); }
.section-title + .actividad, .actividad:first-child { border-top: 0; }
.actividad p { font-size: 14px; line-height: 1.4; word-break: break-word; }
.act-icono { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; }
.act-icono .i { width: 15px; height: 15px; }
.actividad.ok .act-icono { background: var(--success); color: #fff; }
.actividad.ok .act-icono .i { stroke-width: 3; }
.actividad.novedad { background: var(--warning-soft); border-radius: 10px; padding: 8px; margin: 4px 0; border-top: 0; }
.actividad.novedad .act-icono { background: var(--warning); color: #fff; }

/* Día de carrera: todo grande y fácil de tocar */
.carrera-momentos { margin-bottom: 12px; }
.carrera-momentos .chip { height: 42px; font-size: 14px; padding: 0 16px; }
.carrera-cabeza { margin-bottom: 14px; }
.carrera-num { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.carrera-num span { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.carrera-pct { font-size: 28px; font-weight: 800; color: var(--primary); }
.carrera-pct.ok { color: var(--success); }
.carrera-zona { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 15px; }
.carrera-tarea { display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 14px; min-height: 64px; border-top: 1px solid var(--border); cursor: pointer; user-select: none; }
.carrera-zona + .carrera-tarea { border-top: 0; }
.carrera-tarea:active { background: var(--surface-3); }
.carrera-check { width: 38px; height: 38px; border-radius: 50%; border: 2.5px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; color: transparent; flex: none; padding: 0; cursor: pointer; }
.carrera-check .i { width: 20px; height: 20px; stroke-width: 3; }
.carrera-titulo { font-size: 16px; font-weight: 600; line-height: 1.3; word-break: break-word; }
.carrera-tarea.hecha { background: color-mix(in srgb, var(--success-soft) 70%, transparent); }
.carrera-tarea.hecha .carrera-check { background: var(--success); border-color: var(--success); color: #fff; }
.carrera-tarea.hecha .carrera-titulo { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.carrera-tarea.na { opacity: .55; }
.carrera-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 1020px) { .carrera-grid { grid-template-columns: 1fr 340px; align-items: start; } .carrera-actividad { position: sticky; top: 80px; } }

.tabla { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
.tabla th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.tabla td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: 0; }
.event-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; max-width: 100%; }
