:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --ink: #0b1b34;
  --ink-2: #4a5872;
  --line: #e3e8f1;
  --navy: #0b1b34;
  --navy-2: #13294d;
  --primary: #12a36b;
  --primary-dark: #0c8456;
  --primary-soft: #e3f7ee;
  --excel: #107c41;
  --pbi: #b8860b;
  --pbi-bg: #fff5d1;
  --ia: #6d3fe0;
  --ia-bg: #efe8ff;
  --danger: #d93a3a;
  --warn-bg: #fff7e0;
  --warn-line: #f3d27a;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(11, 27, 52, 0.06), 0 8px 24px rgba(11, 27, 52, 0.08);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; line-height: 1.5; }
body > main { flex: 1; }
[hidden] { display: none !important; }
img { max-width: 100%; }
a { color: var(--primary-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; }
p { margin: 0 0 0.75rem; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 880px; }
.muted { color: var(--ink-2); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }

/* ---------- Barra superior ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 1.25rem; font-weight: 600; }
.brand strong { color: #4ee0a2; font-weight: 800; }
.admin-tag { font-style: normal; font-size: 0.7rem; background: #ffffff22; padding: 2px 8px; border-radius: 99px; margin-left: 6px; vertical-align: middle; }
.session-box { display: flex; align-items: center; gap: 12px; }
.session-box .muted { color: #b8c4da; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 20px; font: inherit; font-weight: 700;
  cursor: pointer; text-decoration: none; transition: transform 0.08s, background 0.15s, box-shadow 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(18, 163, 107, 0.35); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: inherit; border: 1.5px solid currentColor; opacity: 0.9; }
.btn-ghost:hover { opacity: 1; background: rgba(127, 127, 127, 0.08); }
.btn-danger { background: #fdecec; color: var(--danger); }
.btn-danger:hover { background: #fbd8d8; }
.btn-sm { padding: 7px 12px; font-size: 0.85rem; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 1rem; padding: 6px; border-radius: 8px; color: var(--ink-2); }
.icon-btn:hover { background: #f0f2f7; color: var(--danger); }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary-dark); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }

/* ---------- Tarjetas y formularios ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-weight: 600; font-size: 0.92rem; }
.field > span { color: var(--ink); }
input, select, textarea {
  font: inherit; font-weight: 500; color: var(--ink); width: 100%;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus, .cp-trigger:focus-visible {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(18, 163, 107, 0.15);
}
.input-sm { padding: 9px 12px; font-size: 0.9rem; width: auto; min-width: 200px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.form-msg { min-height: 0; margin: 0 0 12px; font-size: 0.9rem; font-weight: 600; }
.form-msg:empty { display: none; }
.form-msg-error { color: var(--danger); background: #fdecec; padding: 10px 12px; border-radius: 10px; }
.form-msg-info { color: #7a5200; background: var(--warn-bg); padding: 10px 12px; border-radius: 10px; }

.phone-input { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.phone-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(18, 163, 107, 0.15); }
.phone-input input { border: 0; border-radius: 0; box-shadow: none !important; }
.phone-prefix { display: flex; align-items: center; gap: 6px; padding: 0 12px; background: #f4f6fb; border-right: 1.5px solid var(--line); font-weight: 700; white-space: nowrap; }

.flag { border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08); object-fit: cover; vertical-align: middle; }

/* ---------- Selector de país ---------- */
.country-picker { position: relative; }
.cp-trigger {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  font: inherit; font-weight: 600; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 14px; cursor: pointer;
}
.cp-name { flex: 1; }
.cp-caret { color: var(--ink-2); }
.cp-pop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 8px;
}
.cp-search { margin-bottom: 6px; padding: 10px 12px; }
.cp-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.cp-list li[data-iso] { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-weight: 500; }
.cp-list li[data-iso] span:first-of-type { flex: 1; }
.cp-list li[data-iso]:hover, .cp-list li.active { background: var(--primary-soft); }
.cp-list li.selected { font-weight: 700; }
.cp-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.cp-empty { padding: 10px; }

/* ---------- Landing ---------- */
#view-landing { background: radial-gradient(1200px 600px at 10% -10%, #1d4f7a 0%, transparent 60%), linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; }
.hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 56px; align-items: center; padding-top: 64px; padding-bottom: 72px; }
.hero h1 { font-size: clamp(2rem, 4.2vw, 3.3rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 18px; }
.hl { background: linear-gradient(90deg, #4ee0a2, #f2c811); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.12rem; color: #c9d4e8; max-width: 38em; }
.pill { display: inline-block; background: #ffffff1a; border: 1px solid #ffffff2e; color: #fff; padding: 6px 14px; border-radius: 99px; font-weight: 700; font-size: 0.9rem; margin-bottom: 18px; }
.chips { list-style: none; padding: 0; margin: 22px 0; display: flex; gap: 10px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 5px 12px; border-radius: 99px; font-weight: 700; font-size: 0.8rem; background: #eef1f6; color: var(--ink); }
.chip-excel { background: #e2f4ea; color: var(--excel); }
.chip-pbi { background: var(--pbi-bg); color: var(--pbi); }
.chip-ia { background: var(--ia-bg); color: var(--ia); }
.steps { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.steps li { display: flex; align-items: center; gap: 14px; color: #e0e7f3; font-weight: 500; }
.steps b { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: #4ee0a2; color: var(--navy); font-weight: 800; }

.auth-card { color: var(--ink); padding: 28px; }
.auth-card h2 { font-size: 1.35rem; margin: 18px 0 16px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: #eef1f6; border-radius: 12px; padding: 4px; }
.tab { border: 0; background: none; font: inherit; font-weight: 700; padding: 10px; border-radius: 9px; cursor: pointer; color: var(--ink-2); }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(11, 27, 52, 0.12); }
.segmented { display: inline-flex; background: #eef1f6; border-radius: 10px; padding: 3px; margin-bottom: 16px; }
.seg { border: 0; background: none; font: inherit; font-weight: 600; padding: 7px 16px; border-radius: 8px; cursor: pointer; color: var(--ink-2); }
.seg.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(11, 27, 52, 0.12); }
.notice { display: flex; gap: 10px; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: 0.88rem; }
.notice p { margin: 0; color: #5c4400; }
.notice-icon { font-size: 1.1rem; }

/* ---------- Zona de descargas ---------- */
.search-hero { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; padding: 56px 0 72px; text-align: center; }
.search-hero h1 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); font-weight: 800; }
.search-hero .lead { margin: 0 auto 26px; }
.search-box { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 18px; padding: 8px 8px 8px 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3); max-width: 640px; margin: 0 auto; }
.search-icon { color: var(--ink-2); display: flex; }
.search-box input { border: 0; box-shadow: none !important; font-size: 1.15rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 12px 6px; }
.search-box input::placeholder { text-transform: none; letter-spacing: 0; font-weight: 500; }
.search-msg { min-height: 1.5em; margin-top: 14px; color: #c9d4e8; font-weight: 600; }
.search-msg-error { color: #ffc2c2; }
#search-result { margin-top: 28px; scroll-margin-top: 90px; }
#search-result:empty { margin: 0; }
#search-result .section-title { margin-top: 0; }
.section-title { font-size: 1.3rem; margin: 36px 0 16px; }

.resource-grid { display: grid; gap: 16px; margin-bottom: 56px; }
.resource h3 { font-size: 1.15rem; margin: 10px 0 6px; }
.resource-expanded { border: 2px solid var(--primary); }
.resource-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.resource-head > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.code-tag { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-weight: 700; font-size: 0.82rem; background: var(--navy); color: #4ee0a2; padding: 3px 9px; border-radius: 7px; letter-spacing: 0.03em; }
details summary { cursor: pointer; font-weight: 700; color: var(--primary-dark); margin-top: 6px; }
.file-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-badge { flex: none; min-width: 48px; text-align: center; font-size: 0.7rem; font-weight: 800; padding: 6px 6px; border-radius: 8px; color: #fff; }
.fb-xls { background: var(--excel); }
.fb-doc { background: #185abd; }
.fb-ppt { background: #c43e1c; }
.fb-pbi { background: #e8b100; color: #2b2100; }
.fb-zip { background: #5b6478; }
.empty { text-align: center; color: var(--ink-2); padding: 32px; background: var(--surface); border-radius: var(--radius); border: 2px dashed var(--line); }

.footer { text-align: center; padding: 24px; color: var(--ink-2); font-size: 0.85rem; }

/* ---------- Carga y avisos ---------- */
.loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 50; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--primary); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60; padding: 12px 20px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100% - 32px); color: #fff; background: var(--navy); }
.toast-error { background: var(--danger); }
.toast-info { background: #2a4f8a; }

/* ---------- Administración ---------- */
.admin-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-btn { background: none; border: 0; color: #b8c4da; font: inherit; font-weight: 700; padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.nav-btn:hover { color: #fff; }
.nav-btn.active { background: #ffffff1a; color: #fff; }
#admin-logout { margin-left: 10px; color: #fff; }
.center-view { display: grid; place-items: center; padding: 48px 16px; }
.login-card { width: 100%; max-width: 400px; }
.login-card h1 { font-size: 1.4rem; }
.admin-view { padding-top: 28px; padding-bottom: 48px; }
.page-title { font-size: 1.7rem; font-weight: 800; margin-bottom: 20px; }
.card-title { font-size: 1.1rem; margin-bottom: 14px; }
.subhead { font-size: 0.95rem; margin: 22px 0 8px; color: var(--ink-2); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 20px 22px; }
.kpi-label { color: var(--ink-2); font-weight: 600; font-size: 0.88rem; }
.kpi-value { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-users { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.top-file { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--primary-soft); border-radius: 12px; }
.top-file > div { flex: 1; min-width: 0; }
.big-num { font-size: 1.8rem; font-weight: 800; text-align: right; line-height: 1; font-variant-numeric: tabular-nums; }
.big-num small { display: block; font-size: 0.75rem; font-weight: 600; color: var(--ink-2); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-2); padding: 8px 10px; border-bottom: 1.5px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-click tbody tr[data-iso] { cursor: pointer; }
.table-click tbody tr[data-iso]:hover { background: #f4f6fb; }
.table-click tbody tr.selected { background: var(--primary-soft); font-weight: 700; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.toolbar .btn-ghost { color: var(--primary-dark); margin-left: auto; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.span-2 { grid-column: span 2; }
.field small { font-weight: 500; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 28px; border: 2px dashed #b9c4d8; border-radius: 14px; cursor: pointer; background: #fafbfd; transition: border-color 0.15s, background 0.15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input { display: none; }
.picked-files { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; }
.picked-files li { display: flex; align-items: center; gap: 10px; }
.picked-files li span:nth-child(2) { flex: 1; font-weight: 600; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 10px 0 14px; }
.progress-bar { height: 100%; width: 0; background: var(--primary); transition: width 0.2s; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-resources { display: grid; gap: 14px; }
.admin-resource h3 { margin-top: 10px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 40px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-users { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { padding: 12px 16px; }
  .container { padding: 0 16px; }
  .auth-card, .card { padding: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .search-box { flex-wrap: wrap; padding: 8px; }
  .search-box .search-icon { display: none; }
  .search-box .btn { width: 100%; }
  .file-row { flex-wrap: wrap; }
  .file-row .btn { width: 100%; }
  .session-box .muted { display: none; }
  .input-sm { min-width: 0; width: 100%; }
  .toolbar .btn-ghost { margin-left: 0; }
}

/* ---------- Banners de eventos ---------- */
.banner-stack { display: grid; gap: 12px; }
.banner-stack:empty { display: none; }
#banners-landing { padding-top: 24px; }
#banners-landing:empty { padding: 0; }
#banners-app { margin-top: 28px; }
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 18px 22px; border-radius: 16px; text-decoration: none; color: #fff;
  box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.15s; position: relative; overflow: hidden;
}
a.banner:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(11, 27, 52, 0.22); }
.banner-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 320px; }
.banner-title { font-size: 1.12rem; font-weight: 800; line-height: 1.3; }
.banner-msg { opacity: 0.9; font-size: 0.95rem; }
.banner-cta { flex: none; background: #fff; color: var(--navy); font-weight: 800; padding: 10px 18px; border-radius: 11px; font-size: 0.92rem; }
.banner-navy { background: linear-gradient(110deg, #0b1b34, #1d4f7a); border: 1px solid #ffffff22; }
.banner-green { background: linear-gradient(110deg, #0c8456, #12a36b 60%, #37c48a); }
.banner-yellow { background: linear-gradient(110deg, #f5c518, #ffd84d); color: #1f1a00; }
.banner-yellow .banner-cta { background: #0d1628; color: #f5c518; }
.banner-purple { background: linear-gradient(110deg, #4b23b8, #7c4dff); }
.banner-red { background: linear-gradient(110deg, #b3121b, #e5252f); }
.banner-red .banner-title::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #fff; margin-right: 8px; vertical-align: middle; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.banner-image { padding: 0; display: block; background: #0b1b34; }
.banner-image img { display: block; width: 100%; height: auto; max-height: 320px; object-fit: cover; }

.status { font-size: 0.78rem; font-weight: 800; padding: 4px 10px; border-radius: 99px; }
.st-live { background: #e2f4ea; color: var(--excel); }
.st-scheduled { background: #e6efff; color: #2a55b8; }
.st-ended { background: #eef1f6; color: var(--ink-2); }
.st-paused { background: var(--warn-bg); color: #7a5200; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-top: 6px; }
.check input { width: auto; }
.admin-banner .banner-stack { margin: 14px 0 10px; }
.admin-banner a.banner:hover { transform: none; }

/* ---------- Canales de YouTube ---------- */
.channels { padding: 56px 0 40px; background: var(--bg); }
.channels-title { text-align: center; font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 800; }
.channels-sub { text-align: center; margin-bottom: 28px; }
.channel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 1000px; margin: 0 auto; }
.channel { border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.channel h3 { font-size: 1.6rem; font-weight: 800; margin: 6px 0 0; }
.channel-top { display: flex; align-items: center; gap: 10px; }
.channel-handle { font-weight: 700; font-size: 0.9rem; opacity: 0.75; }
.channel-tag { font-weight: 700; font-size: 1.02rem; margin: 0; }
.channel-desc { opacity: 0.85; font-size: 0.93rem; margin: 4px 0 6px; }
.channel-chips { list-style: none; padding: 0; margin: 4px 0 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.channel-chips li { font-size: 0.78rem; font-weight: 700; padding: 5px 11px; border-radius: 99px; }
.channel-note { font-size: 0.88rem; font-weight: 700; margin: 0 0 16px; }
.channel .btn { margin-top: auto; align-self: flex-start; }

.channel-edu { background: linear-gradient(135deg, #e3eff6 0%, #cfe3ef 100%); color: #0f1f33; }
.channel-edu .channel-tag { color: #2b3a67; }
.channel-edu .channel-chips li { background: #ffffffb3; color: #2b3a67; border: 1px solid #b9d0e0; }
.btn-yt { background: #ff0000; color: #fff; box-shadow: 0 4px 14px rgba(255, 0, 0, 0.3); }
.btn-yt:hover { background: #d90000; }

.channel-ia { background: radial-gradient(500px 240px at 90% 0%, #3a2f0a 0%, transparent 70%), #0d1628; color: #fff; }
.channel-ia h3 span { color: #f5c518; }
.channel-ia .channel-tag { color: #f5c518; }
.channel-ia .channel-chips li { border: 1px solid #ffffff33; color: #dfe6f3; }
.btn-yt-ia { background: #f5c518; color: #0d1628; box-shadow: 0 4px 14px rgba(245, 197, 24, 0.3); }
.btn-yt-ia:hover { background: #ffd84d; }

@media (max-width: 760px) {
  .channel-grid { grid-template-columns: 1fr; }
  .channel .btn { align-self: stretch; }
  .banner-cta { width: 100%; text-align: center; }
}

/* ---------- Campos obligatorios ---------- */
.req { color: var(--danger); font-weight: 800; }
.req-note { margin: -8px 0 14px; }
.field-hint { font-weight: 500; }
input.invalid, .phone-input:has(input.invalid) { border-color: var(--danger) !important; box-shadow: 0 0 0 4px rgba(217, 58, 58, 0.14) !important; }
.phone-input input.invalid { box-shadow: none !important; }
.greeting { color: #4ee0a2; font-weight: 800; font-size: 1.1rem; margin-bottom: 6px; }
.greeting:empty { display: none; }

/* ---------- Vista previa del administrador ---------- */
.preview-bar {
  position: sticky; top: 0; z-index: 25; display: flex; align-items: center; justify-content: space-between;
  gap: 10px 18px; flex-wrap: wrap; padding: 9px 20px; background: #f5c518; color: #1f1a00; font-size: 0.9rem;
}
.preview-bar:not([hidden]) ~ .topbar { top: 40px; }
.preview-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.preview-actions a { color: #1f1a00; font-weight: 700; text-decoration: none; padding: 4px 10px; border-radius: 8px; }
.preview-actions a:hover { background: #0000001a; }
.preview-actions a.active { background: #1f1a00; color: #f5c518; }
.preview-menu { position: relative; }
.preview-menu summary { list-style: none; }
.preview-menu summary::-webkit-details-marker { display: none; }
.preview-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 290px; background: #fff; color: var(--ink);
  border-radius: 14px; box-shadow: var(--shadow); padding: 6px; display: grid;
}
.preview-pop a { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 700; }
.preview-pop a:hover { background: var(--primary-soft); }
.preview-pop small { font-weight: 500; color: var(--ink-2); font-size: 0.8rem; }
@media (max-width: 560px) { .preview-bar:not([hidden]) ~ .topbar { top: 0; position: relative; } .preview-pop { right: auto; left: 0; } }

/* ---------- Comunidad de WhatsApp (fija) ---------- */
.wa-card {
  display: flex; align-items: center; gap: 18px; margin-top: 28px; padding: 20px 22px; border-radius: 18px;
  background: linear-gradient(110deg, #075e54 0%, #128c7e 55%, #25d366 130%); color: #fff; text-decoration: none;
  box-shadow: 0 10px 28px rgba(7, 94, 84, 0.35); scroll-margin-top: 100px; transition: transform 0.15s, box-shadow 0.15s;
}
.wa-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(7, 94, 84, 0.45); }
.wa-card + .banner-stack { margin-top: 12px; }
.wa-icon { flex: none; width: 56px; height: 56px; border-radius: 16px; background: #25d366; display: grid; place-items: center; box-shadow: inset 0 0 0 2px #ffffff33; }
.wa-text { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wa-title { font-size: 1.15rem; font-weight: 800; line-height: 1.25; }
.wa-msg { font-size: 0.93rem; color: #e3fff4; }
.wa-msg b { color: #fff; }
.wa-cta { flex: none; background: #fff; color: #075e54; font-weight: 800; padding: 11px 18px; border-radius: 12px; white-space: nowrap; }
.wa-highlight { animation: wa-pulse 1.6s ease-out 4; }
@keyframes wa-pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.75), 0 10px 28px rgba(7, 94, 84, 0.35); }
  100% { box-shadow: 0 0 0 18px rgba(37, 211, 102, 0), 0 10px 28px rgba(7, 94, 84, 0.35); }
}
@media (max-width: 640px) {
  .wa-card { flex-wrap: wrap; }
  .wa-icon { width: 46px; height: 46px; }
  .wa-text { flex-basis: calc(100% - 70px); }
  .wa-cta { width: 100%; text-align: center; }
}

/* ---------- Etiquetas de usuarios ---------- */
.side-stack { display: grid; gap: 20px; align-content: start; }
.tag { display: inline-flex; align-items: center; font-size: 0.75rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; border: 1px solid transparent; }
.tag-gray { background: #eef1f6; color: #4a5872; border-color: #dbe1ea; }
.tag-blue { background: #e6efff; color: #2a55b8; border-color: #c9dafc; }
.tag-green { background: #e2f4ea; color: #107c41; border-color: #bfe5cf; }
.tag-yellow { background: #fff5d1; color: #8a6500; border-color: #f3e0a0; }
.tag-orange { background: #ffeadb; color: #b4520f; border-color: #f8cfb1; }
.tag-red { background: #fdecec; color: #c02b2b; border-color: #f6c9c9; }
.tag-purple { background: #efe8ff; color: #6d3fe0; border-color: #d9cafc; }
.tag-pink { background: #fde8f3; color: #b8307a; border-color: #f5c6de; }
.tag-row { display: flex; flex-wrap: wrap; gap: 4px; }

.tag-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 4px; }
.tag-list li[data-id] { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 6px; border-radius: 10px; }
.tag-list li[data-id]:hover { background: #f4f6fb; }
.tag-list li.selected { background: var(--primary-soft); }
.tag-filter { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 2px; cursor: pointer; font: inherit; min-width: 0; }
.tag-actions { display: flex; flex: none; }
.tag-actions .icon-btn { font-size: 0.85rem; padding: 4px; }
.tag-form .input-sm { width: 100%; min-width: 0; }
.color-picker { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.color-picker .swatch { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; padding: 0; border: 2px solid #fff; background: currentColor; box-shadow: 0 0 0 1px var(--line); }
.color-picker .swatch.active { outline: 3px solid var(--ink); outline-offset: 2px; }

.edit-btn { font-size: 0.95rem; }
.edit-btn:hover { background: var(--primary-soft); }

/* ---------- Ventana de edición ---------- */
.dialog { border: 0; border-radius: 18px; padding: 24px; width: min(480px, calc(100% - 32px)); box-shadow: 0 24px 60px rgba(11, 27, 52, 0.35); color: var(--ink); }
.dialog::backdrop { background: rgba(11, 27, 52, 0.55); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dialog-head h2 { font-size: 1.25rem; margin: 0; }
.dialog-actions { justify-content: flex-end; margin-top: 6px; }
.dialog .btn-ghost { color: var(--ink-2); }
.tag-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-choice { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 500; padding: 4px 8px 4px 6px; border: 1.5px solid var(--line); border-radius: 99px; }
.tag-choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.tag-choice input { width: auto; margin: 0; accent-color: var(--primary); }
