/* ═══════════════════════════════════════════════════════════════
   NeoMeet · sistema de diseño (tokens + componentes compartidos)
   ═══════════════════════════════════════════════════════════════ */
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #eef2f8;
  --line: #e3e8f1;
  --line-strong: #cfd7e4;
  --text: #0f1b33;
  --text-2: #4a5873;
  --muted: #7a879e;
  --primary: #3461f5;
  --primary-600: #2a50d6;
  --primary-50: #edf2ff;
  --primary-100: #dbe5ff;
  --accent: #14b8a6;
  --success: #16a34a;
  --success-50: #e9f8ef;
  --warning: #d97706;
  --warning-50: #fff5e6;
  --danger: #e5484d;
  --danger-600: #c93338;
  --danger-50: #fdeced;
  --live: #10b981;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 51, .06);
  --shadow: 0 1px 2px rgba(15, 27, 51, .05), 0 6px 18px rgba(15, 27, 51, .06);
  --shadow-lg: 0 20px 50px rgba(15, 27, 51, .18), 0 4px 12px rgba(15, 27, 51, .08);
  --ring: 0 0 0 3px rgba(52, 97, 245, .25);
  --ease: cubic-bezier(.2, .8, .2, 1);
  /* colores por tipo de reunión */
  --t-demo: #6d4aff;
  --t-training: #0d9488;
  --t-meeting: #3461f5;
  --t-support: #e08a00;
  --t-presentation: #d63384;
  --t-other: #64748b;
  color-scheme: light;
}

*, *::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;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.015em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg, video { display: block; max-width: 100%; }
:focus-visible { outline: none; box-shadow: var(--ring); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ─── Iconos (sprite SVG) ─── */
.i { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 24px; height: 24px; }

/* ─── Botones ─── */
.btn {
  --b-bg: var(--surface); --b-fg: var(--text); --b-line: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--b-line); border-radius: var(--radius);
  background: var(--b-bg); color: var(--b-fg);
  font-weight: 600; font-size: 14px; white-space: nowrap; cursor: pointer;
  transition: background .15s var(--ease), border-color .15s, box-shadow .15s, transform .1s, color .15s;
  text-decoration: none !important; user-select: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { --b-bg: var(--primary); --b-fg: #fff; --b-line: var(--primary); box-shadow: 0 1px 2px rgba(52,97,245,.3), inset 0 1px 0 rgba(255,255,255,.15); }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-danger { --b-bg: var(--danger); --b-fg: #fff; --b-line: var(--danger); }
.btn-danger:hover { background: var(--danger-600); border-color: var(--danger-600); }
.btn-danger-soft { --b-bg: var(--danger-50); --b-fg: var(--danger-600); --b-line: transparent; }
.btn-danger-soft:hover { background: #fbd9db; border-color: transparent; }
.btn-ghost { --b-bg: transparent; --b-line: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text); }
.btn-soft { --b-bg: var(--primary-50); --b-fg: var(--primary-600); --b-line: transparent; }
.btn-soft:hover { background: var(--primary-100); border-color: transparent; }
.btn-success { --b-bg: var(--success); --b-fg: #fff; --b-line: var(--success); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; gap: 6px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; border-radius: 14px; }
.btn-xl { min-height: 56px; padding: 0 28px; font-size: 16px; border-radius: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--b-fg) transparent var(--b-fg) transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Formularios ─── */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--danger-600); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
.select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237a879e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.field.is-invalid .input, .field.is-invalid .select, .field.is-invalid .textarea { border-color: var(--danger); }
.input-icon { position: relative; }
.input-icon .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 40px; }

/* Interruptor */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; }
.switch strong { display: block; font-size: 14px; }
.switch small { display: block; color: var(--muted); font-size: 12.5px; }
.switch input { appearance: none; flex: 0 0 auto; width: 42px; height: 24px; border-radius: 99px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(18px); }

/* Selector de tipo (chips) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-2); transition: all .15s; }
.chip:hover { border-color: var(--muted); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { border-color: var(--c, var(--primary)); background: color-mix(in srgb, var(--c, var(--primary)) 10%, #fff); color: var(--c, var(--primary)); box-shadow: inset 0 0 0 1px var(--c, var(--primary)); }
.chip:has(input:focus-visible) { box-shadow: var(--ring); }
.chip .i { color: var(--c); }

/* Control segmentado (Hoy / Semana / Mes / Todas) */
.segmented { display: inline-flex; padding: 4px; gap: 2px; background: var(--surface-3); border-radius: 12px; }
.segmented button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--text-2); cursor: pointer; transition: all .15s; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ─── Tarjetas y etiquetas ─── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge-scheduled { background: var(--primary-50); color: var(--primary-600); }
.badge-ready { background: #f1ebff; color: #5b3fd6; }
.badge-live { background: var(--success-50); color: #0f8a5f; }
.badge-live::before { animation: pulse 1.6s infinite; }
.badge-ended { background: var(--surface-3); color: var(--text-2); }
.badge-cancelled { background: var(--danger-50); color: var(--danger-600); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.type-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--c); }
.type-tag .i { width: 15px; height: 15px; }
[data-type="demo"] { --c: var(--t-demo); }
[data-type="training"] { --c: var(--t-training); }
[data-type="meeting"] { --c: var(--t-meeting); }
[data-type="support"] { --c: var(--t-support); }
[data-type="presentation"] { --c: var(--t-presentation); }
[data-type="other"] { --c: var(--t-other); }

/* ─── Tooltips (atributo data-tip) ─── */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translate(-50%, 4px);
  padding: 6px 10px; border-radius: 8px; background: #0f1b33; color: #fff; font-size: 12px; font-weight: 500; line-height: 1.3;
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s, transform .15s; z-index: 50;
}
@media (hover: hover) { [data-tip]:hover::after { opacity: 1; transform: translate(-50%, 0); transition-delay: .35s; } }
[data-tip-pos="bottom"]::after { bottom: auto; top: calc(100% + 8px); }

/* ─── Skeleton ─── */
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 8px; color: transparent !important; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 12px; margin: 6px 0; }

/* ─── Modales ─── */
.modal-backdrop { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 20px; background: rgba(10, 18, 36, .5); backdrop-filter: blur(3px); animation: fade .18s var(--ease); }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); animation: pop .22s var(--ease); overflow: hidden; }
.modal.modal-wide { width: min(720px, 100%); }
.modal.modal-sm { width: min(420px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 22px 24px 6px; }
.modal-head h2 { font-size: 19px; font-weight: 750; }
.modal-head p { margin-top: 4px; color: var(--muted); font-size: 14px; }
.modal-head .btn-icon { margin: -6px -8px 0 auto; }
.modal-body { padding: 16px 24px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 24px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
.modal-icon { flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--primary-50); color: var(--primary); }
.modal-icon.danger { background: var(--danger-50); color: var(--danger); }
.modal-icon.success { background: var(--success-50); color: var(--success); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (max-width: 600px) {
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; animation: sheet .25s var(--ease); }
  .modal-foot { flex-wrap: wrap; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }

/* ─── Toasts ─── */
.toasts { position: fixed; z-index: 1000; top: 16px; right: 16px; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 14px; background: #0f1b33; color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; pointer-events: auto; animation: toastIn .25s var(--ease); }
.toast .i { margin-top: 1px; }
.toast-success .i { color: #4ade80; }
.toast-error .i { color: #fb7185; }
.toast-warning .i { color: #fbbf24; }
.toast-info .i { color: #93c5fd; }
.toast.leaving { animation: toastOut .2s var(--ease) forwards; }
.toast button { margin-left: auto; background: none; border: 0; color: #9fb0d0; cursor: pointer; padding: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }
@media (max-width: 600px) { .toasts { left: 16px; right: 16px; width: auto; } }

/* ─── Menú desplegable ─── */
.menu { position: fixed; z-index: 950; min-width: 210px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .15s var(--ease); }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: none; text-align: left; font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface-3); }
.menu .danger { color: var(--danger-600); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

/* ─── Varios ─── */
.empty { display: grid; place-items: center; gap: 10px; padding: 44px 20px; text-align: center; color: var(--muted); }
.empty .i { width: 40px; height: 40px; color: var(--line-strong); }
.empty strong { color: var(--text); font-size: 15px; }
.link-box { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface-2); }
.link-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; color: var(--text); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); font-size: 14px; }
.alert-error { background: var(--danger-50); color: var(--danger-600); }
.alert-info { background: var(--primary-50); color: var(--primary-600); }
.alert-warning { background: var(--warning-50); color: #9a5600; }
.muted { color: var(--muted); }
.avatar { --size: 36px; width: var(--size); height: var(--size); flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; font-size: calc(var(--size) * .4); background: var(--av, var(--primary)); letter-spacing: .02em; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
