/* =========================================================
   YC GLOBAL CONSULTING — Panel de administración
   ========================================================= */
:root {
  --navy-900: #060a1a;
  --navy-800: #0a0f24;
  --navy-700: #101633;
  --navy-600: #161d44;
  --ink: #0a0f24;
  --gold: #e7b64c;
  --gold-deep: #c7902a;
  --emerald: #39c6a3;
  --sky: #6aa8ff;
  --rose: #f0719b;
  --text: #eef1fb;
  --text-soft: #b7bedb;
  --text-dim: #8089ad;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --card: rgba(255, 255, 255, 0.035);
  --radius: 18px;
  --grad-gold: linear-gradient(120deg, #f3cd73, #e7b64c 45%, #c7902a);
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  background: var(--navy-800); color: var(--text); line-height: 1.55;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
h1,h2,h3,h4,.brand-text { font-family: "Sora", system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
svg { display: block; }
[hidden] { display: none !important; }

.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--grad-gold); color: var(--ink); font-family: "Sora"; font-weight: 800; box-shadow: 0 8px 18px -8px rgba(231,182,76,.7); }
.brand-text { font-size: 1.05rem; }
.brand-accent { color: var(--gold); }

/* ================= LOGIN ================= */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.login-wrap::before, .login-wrap::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(80px); z-index: 0;
}
.login-wrap::before { width: 460px; height: 460px; background: radial-gradient(circle, rgba(231,182,76,.4), transparent 70%); top: -140px; right: -120px; }
.login-wrap::after { width: 420px; height: 420px; background: radial-gradient(circle, rgba(57,198,163,.35), transparent 70%); bottom: -160px; left: -120px; }
.login-card {
  position: relative; z-index: 1; width: 100%; max-width: 410px;
  background: linear-gradient(165deg, rgba(22,29,68,.85), rgba(10,15,36,.95));
  border: 1px solid var(--line-strong); border-radius: 24px; padding: 40px 34px;
  box-shadow: var(--shadow); backdrop-filter: blur(16px);
}
.login-card .brand { margin-bottom: 26px; }
.login-card h1 { font-size: 1.5rem; margin-bottom: 6px; }
.login-card .muted { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 26px; }
.field { margin-bottom: 16px; display: flex; flex-direction: column; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--text-soft); margin-bottom: 7px; }
.field input, .field select, .field textarea {
  background: rgba(255,255,255,.04); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 12px 14px; color: var(--text); font-size: 0.95rem;
  transition: border-color .25s, box-shadow .25s, background .25s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold); background: rgba(255,255,255,.06);
  box-shadow: 0 0 0 4px rgba(231,182,76,.1);
}
.field select option { background: var(--navy-700); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 22px; border-radius: 12px; font-weight: 600; font-size: 0.95rem;
  transition: transform .25s var(--ease), box-shadow .25s, background .25s, opacity .25s;
}
.btn-primary { background: var(--grad-gold); color: var(--ink); box-shadow: 0 12px 28px -12px rgba(231,182,76,.6); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }
.btn-ghost { background: rgba(255,255,255,.05); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-danger { background: rgba(240,113,155,.15); color: var(--rose); border: 1px solid rgba(240,113,155,.3); }
.btn-danger:hover { background: rgba(240,113,155,.25); }
.form-error { color: var(--rose); font-size: 0.88rem; margin-top: 12px; min-height: 1.2em; }
.login-foot { margin-top: 20px; text-align: center; font-size: 0.82rem; color: var(--text-dim); }
.login-foot a { color: var(--gold); }

/* ================= APP LAYOUT ================= */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--navy-900); border-right: 1px solid var(--line); padding: 24px 18px;
  display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 6px 8px 22px; }
.nav-btn {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
  color: var(--text-soft); font-weight: 500; font-size: 0.95rem; width: 100%; text-align: left;
  transition: background .2s, color .2s;
}
.nav-btn svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-btn:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav-btn.active { background: rgba(231,182,76,.12); color: var(--gold); }
.sidebar-spacer { flex: 1; }
.logout-btn { color: var(--text-dim); }
.logout-btn:hover { color: var(--rose); }

.main { padding: 30px 34px 60px; overflow-x: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; gap: 16px; flex-wrap: wrap; }
.topbar h1 { font-size: 1.6rem; }
.topbar .user-pill { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); padding: 8px 8px 8px 14px; border-radius: 999px; font-size: 0.85rem; color: var(--text-soft); }
.user-pill .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--grad-gold); color: var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 0.8rem; }
.role-chip { font-size: 0.7rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.role-chip.desarrollador { background: rgba(231,182,76,.16); color: var(--gold); }
.role-chip.administrador { background: rgba(106,168,255,.16); color: var(--sky); }

.view { animation: fade .4s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } }

/* ---- Stat cards ---- */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; transition: transform .3s var(--ease), border-color .3s; }
.stat-card:hover { transform: translateY(-4px); border-color: rgba(231,182,76,.3); }
.stat-card .sc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat-card .sc-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; }
.sc-ico.g { background: rgba(231,182,76,.14); color: var(--gold); }
.sc-ico.e { background: rgba(57,198,163,.14); color: var(--emerald); }
.sc-ico.b { background: rgba(106,168,255,.14); color: var(--sky); }
.sc-ico.r { background: rgba(240,113,155,.14); color: var(--rose); }
.stat-card .sc-ico svg { width: 20px; height: 20px; }
.stat-card .sc-val { font-family: "Sora"; font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-card .sc-label { color: var(--text-dim); font-size: 0.85rem; margin-top: 5px; }
.stat-card .sc-trend { font-size: 0.78rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.sc-trend.up { background: rgba(57,198,163,.14); color: var(--emerald); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 22px; }
.panel h3 { font-size: 1.1rem; margin-bottom: 4px; }
.panel .panel-sub { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 20px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; }

/* ---- Chart ---- */
.chart { width: 100%; }
.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 10px; }
.chart-bars .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart-bars .bar {
  width: 100%; max-width: 30px; border-radius: 6px 6px 0 0; min-height: 3px;
  background: linear-gradient(180deg, var(--gold), rgba(231,182,76,.25));
  transition: height .8s var(--ease); position: relative;
}
.chart-bars .bar:hover { background: linear-gradient(180deg, #f3cd73, var(--gold)); }
.chart-bars .bar[data-v]:hover::after {
  content: attr(data-v); position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  background: var(--navy-700); border: 1px solid var(--line-strong); padding: 2px 8px; border-radius: 7px;
  font-size: 0.72rem; white-space: nowrap;
}
.chart-bars .bar-label { font-size: 0.66rem; color: var(--text-dim); }

/* ---- Breakdown list ---- */
.breakdown { display: flex; flex-direction: column; gap: 14px; }
.breakdown-row { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 12px; }
.breakdown-row .bd-label { font-size: 0.86rem; color: var(--text-soft); text-transform: capitalize; }
.bd-track { height: 9px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; }
.bd-fill { height: 100%; border-radius: 999px; background: var(--grad-gold); transition: width .9s var(--ease); }
.bd-fill.e { background: linear-gradient(90deg, var(--emerald), #1e8f74); }
.bd-fill.b { background: linear-gradient(90deg, var(--sky), #3b6fd4); }
.bd-fill.r { background: linear-gradient(90deg, var(--rose), #c4477a); }
.breakdown-row .bd-count { font-size: 0.86rem; font-weight: 700; text-align: right; }
.empty-hint { color: var(--text-dim); font-size: 0.9rem; padding: 20px 0; text-align: center; }

/* ---- Leads table ---- */
.toolbar { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { background: rgba(255,255,255,.04); border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 13px; color: var(--text); font-size: 0.9rem; }
.toolbar input { flex: 1; min-width: 180px; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--gold); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
thead th { text-align: left; font-size: 0.76rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--navy-900); position: sticky; top: 0; }
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 0.9rem; vertical-align: middle; }
tbody tr { transition: background .2s; }
tbody tr:hover { background: rgba(255,255,255,.02); }
tbody tr:last-child td { border-bottom: none; }
.lead-name { font-weight: 600; }
.lead-contact { color: var(--text-soft); font-size: 0.82rem; }
.goal-tag { display: inline-block; font-size: 0.74rem; padding: 4px 10px; border-radius: 999px; background: rgba(231,182,76,.12); color: var(--gold); }
.status-select { background: rgba(255,255,255,.04); border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 10px; font-size: 0.82rem; color: var(--text); }
.status-select.s-nuevo { border-color: rgba(106,168,255,.5); color: var(--sky); }
.status-select.s-contactado { border-color: rgba(231,182,76,.5); color: var(--gold); }
.status-select.s-ganado { border-color: rgba(57,198,163,.5); color: var(--emerald); }
.status-select.s-perdido { border-color: rgba(240,113,155,.5); color: var(--rose); }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--text-dim); transition: background .2s, color .2s; }
.icon-btn:hover { background: rgba(240,113,155,.15); color: var(--rose); }
.icon-btn.key:hover { background: rgba(231,182,76,.15); color: var(--gold); }
.icon-btn svg { width: 16px; height: 16px; }
.cell-date { color: var(--text-dim); font-size: 0.82rem; white-space: nowrap; }

/* ---- Settings ---- */
.settings-form { max-width: 640px; }
.settings-form .field { margin-bottom: 20px; }
.settings-form textarea { resize: vertical; min-height: 90px; }
.key-row { display: flex; gap: 10px; }
.key-row input { flex: 1; }
.key-status { display: inline-flex; align-items: center; gap: 7px; font-size: 0.82rem; margin-top: 8px; }
.key-status.ok { color: var(--emerald); }
.key-status.no { color: var(--text-dim); }
.save-note { font-size: 0.82rem; margin-top: 4px; min-height: 1.2em; }
.save-note.ok { color: var(--emerald); }
.hint-box { background: rgba(106,168,255,.08); border: 1px solid rgba(106,168,255,.2); border-radius: 12px; padding: 14px 16px; font-size: 0.85rem; color: var(--text-soft); margin-bottom: 22px; }
.hint-box a { color: var(--sky); text-decoration: underline; }

/* ================= NOTIFICACIONES ================= */
.topbar-right { display: flex; align-items: center; gap: 14px; }
.notif-wrap { position: relative; }
.notif-btn { position: relative; width: 44px; height: 44px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); display: grid; place-items: center; color: var(--text-soft); transition: background .2s, color .2s; }
.notif-btn:hover { background: rgba(255,255,255,.07); color: var(--text); }
.notif-btn svg { width: 20px; height: 20px; }
.notif-badge { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--rose); color: #fff; font-size: 0.7rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--navy-800); }
.notif-panel {
  position: absolute; right: 0; top: 54px; width: min(360px, calc(100vw - 32px));
  background: linear-gradient(170deg, rgba(22,29,68,.98), rgba(10,15,36,.99));
  border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: var(--shadow);
  z-index: 70; overflow: hidden; opacity: 0; transform: translateY(-8px); pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.notif-panel.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.notif-head strong { font-size: 0.95rem; }
.notif-clear { font-size: 0.76rem; color: var(--gold); }
.notif-clear:hover { text-decoration: underline; }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .2s; text-align: left; width: 100%; }
.notif-item:hover { background: rgba(255,255,255,.03); }
.notif-item:last-child { border-bottom: none; }
.notif-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.notif-ico.lead { background: rgba(231,182,76,.14); color: var(--gold); }
.notif-ico.appt { background: rgba(57,198,163,.14); color: var(--emerald); }
.notif-ico svg { width: 17px; height: 17px; }
.notif-item .ni-title { font-size: 0.88rem; font-weight: 600; }
.notif-item .ni-sub { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }
.notif-empty { padding: 34px 16px; text-align: center; color: var(--text-dim); font-size: 0.88rem; }

/* ================= AGENDA / CALENDARIO ================= */
.agenda-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; align-items: start; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.cal-title { display: flex; align-items: center; gap: 10px; }
.cal-title h3 { font-size: 1.15rem; min-width: 160px; text-align: center; text-transform: capitalize; }
.cal-nav { width: 34px; height: 34px; border-radius: 9px; background: var(--card); border: 1px solid var(--line-strong); font-size: 1.2rem; color: var(--text-soft); transition: background .2s; }
.cal-nav:hover { background: rgba(255,255,255,.08); color: var(--text); }
.cal-actions { display: flex; gap: 10px; }
.cal-actions .btn { padding: 9px 16px; font-size: 0.85rem; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-weekdays span { text-align: center; font-size: 0.72rem; color: var(--text-dim); font-weight: 600; text-transform: uppercase; padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell { aspect-ratio: 1 / 1; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.02); padding: 6px 8px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; transition: background .2s, border-color .2s; overflow: hidden; position: relative; }
.cal-cell:hover { background: rgba(255,255,255,.05); border-color: var(--line-strong); }
.cal-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.cal-cell.today { border-color: var(--gold); }
.cal-cell.today .cal-day { color: var(--gold); font-weight: 800; }
.cal-day { font-size: 0.8rem; color: var(--text-soft); font-weight: 600; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.cal-event { font-size: 0.64rem; padding: 2px 5px; border-radius: 5px; background: rgba(231,182,76,.18); color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cal-event.s-confirmada { background: rgba(57,198,163,.18); color: var(--emerald); }
.cal-event.s-cancelada { background: rgba(240,113,155,.15); color: var(--rose); text-decoration: line-through; }
.cal-event.s-completada { background: rgba(255,255,255,.08); color: var(--text-dim); }
.cal-more { font-size: 0.62rem; color: var(--text-dim); }

.upcoming-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.up-item { display: flex; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.02); cursor: pointer; transition: background .2s, border-color .2s; text-align: left; width: 100%; }
.up-item:hover { background: rgba(255,255,255,.05); border-color: var(--line-strong); }
.up-date { flex-shrink: 0; width: 52px; text-align: center; border-radius: 10px; background: rgba(231,182,76,.1); padding: 6px 0; }
.up-date .ud-day { font-family: "Sora"; font-size: 1.3rem; font-weight: 800; color: var(--gold); line-height: 1; }
.up-date .ud-mon { font-size: 0.68rem; color: var(--text-dim); text-transform: uppercase; }
.up-info { flex: 1; min-width: 0; }
.up-info .ui-title { font-weight: 600; font-size: 0.92rem; }
.up-info .ui-meta { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }
.up-badge { align-self: flex-start; font-size: 0.68rem; padding: 3px 8px; border-radius: 999px; font-weight: 600; }
.up-badge.pendiente { background: rgba(106,168,255,.14); color: var(--sky); }
.up-badge.confirmada { background: rgba(57,198,163,.14); color: var(--emerald); }
.up-badge.completada { background: rgba(255,255,255,.08); color: var(--text-dim); }
.up-badge.cancelada { background: rgba(240,113,155,.14); color: var(--rose); }

/* ================= MODAL ================= */
.modal-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(4,6,16,.72); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fade .25s var(--ease); }
.modal { width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: linear-gradient(170deg, rgba(22,29,68,.98), rgba(10,15,36,.99)); border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: var(--shadow); animation: modalIn .3s var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 1.15rem; }
.modal-close { width: 34px; height: 34px; border-radius: 9px; color: var(--text-dim); font-size: 1.5rem; }
.modal-close:hover { background: rgba(255,255,255,.06); color: var(--text); }
.modal-body { padding: 22px 24px; }
.modal-body .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-body input[type="date"], .modal-body input[type="time"] { color-scheme: dark; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 12px; }
.modal-foot-right { display: flex; gap: 10px; margin-left: auto; }

.switch-row { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 0.92rem; color: var(--text-soft); margin-top: 6px; }
.switch-row input { width: 18px; height: 18px; accent-color: var(--gold); cursor: pointer; }
.hint-box code { background: rgba(255,255,255,.08); padding: 1px 6px; border-radius: 5px; font-size: 0.82em; }

/* ================= SUBMENÚ DE CONFIGURACIÓN ================= */
.settings-menu { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.set-tab { padding: 9px 18px; border-radius: 999px; font-weight: 600; font-size: 0.9rem; color: var(--text-soft); background: var(--card); border: 1px solid var(--line); transition: background .2s, color .2s, border-color .2s; }
.set-tab:hover { background: rgba(255,255,255,.06); color: var(--text); }
.set-tab.active { background: var(--grad-gold); color: var(--ink); border-color: transparent; }

/* ================= USUARIOS / ROLES ================= */
.users-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.02); }
.user-av { width: 38px; height: 38px; border-radius: 50%; background: var(--grad-gold); color: var(--ink); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.user-meta { flex: 1; min-width: 0; }
.um-email { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; }
.um-sub { font-size: 0.76rem; color: var(--text-dim); }
.role-badge { font-size: 0.72rem; font-weight: 700; padding: 4px 11px; border-radius: 999px; text-transform: capitalize; }
.role-badge.desarrollador { background: rgba(231,182,76,.15); color: var(--gold); border: 1px solid rgba(231,182,76,.3); }
.role-badge.administrador { background: rgba(106,168,255,.14); color: var(--sky); border: 1px solid rgba(106,168,255,.3); }
.you-tag { font-size: 0.7rem; color: var(--text-dim); padding: 4px 8px; }
.user-create { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.uc-title { font-size: 0.95rem; margin-bottom: 14px; color: var(--text-soft); }
.user-create .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ================= CHATBOT ================= */
.chat-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 80;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--grad-gold); color: var(--ink);
  display: grid; place-items: center; box-shadow: 0 14px 34px -10px rgba(231,182,76,.6);
  transition: transform .3s var(--ease);
}
.chat-fab:hover { transform: scale(1.08) rotate(-6deg); }
.chat-fab svg { width: 28px; height: 28px; }

.chat-panel {
  position: fixed; right: 24px; bottom: 96px; z-index: 81;
  width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 140px));
  background: linear-gradient(170deg, rgba(22,29,68,.97), rgba(10,15,36,.98));
  border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden; backdrop-filter: blur(16px);
  transform: translateY(20px) scale(.96); opacity: 0; pointer-events: none;
  transition: transform .3s var(--ease), opacity .3s;
}
.chat-panel.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.chat-head .ch-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--grad-gold); color: var(--ink); display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.chat-head .ch-name { font-weight: 700; font-size: 0.95rem; }
.chat-head .ch-status { font-size: 0.74rem; color: var(--emerald); display: flex; align-items: center; gap: 5px; }
.chat-head .ch-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }
.chat-head .ch-close { margin-left: auto; color: var(--text-dim); font-size: 1.4rem; width: 32px; height: 32px; border-radius: 8px; }
.chat-head .ch-close:hover { background: rgba(255,255,255,.06); color: var(--text); }

.chat-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-body::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; }
.msg { max-width: 82%; padding: 11px 14px; border-radius: 15px; font-size: 0.9rem; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; animation: msgIn .3s var(--ease); }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.msg.bot { align-self: flex-start; background: rgba(255,255,255,.06); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.user { align-self: flex-end; background: var(--grad-gold); color: var(--ink); border-bottom-right-radius: 5px; font-weight: 500; }
.msg.err { align-self: flex-start; background: rgba(240,113,155,.12); border: 1px solid rgba(240,113,155,.3); color: #ffc0d4; border-bottom-left-radius: 5px; }
.typing { align-self: flex-start; display: flex; gap: 4px; padding: 13px 15px; background: rgba(255,255,255,.06); border-radius: 15px; border-bottom-left-radius: 5px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,60%,100%{opacity:.25;transform:translateY(0);} 30%{opacity:1;transform:translateY(-3px);} }

.chat-foot { padding: 14px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-end; }
.chat-foot textarea {
  flex: 1; resize: none; max-height: 100px; background: rgba(255,255,255,.05); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 11px 13px; color: var(--text); font-size: 0.9rem; line-height: 1.4;
}
.chat-foot textarea:focus { outline: none; border-color: var(--gold); }
.chat-send { width: 44px; height: 44px; border-radius: 12px; background: var(--grad-gold); color: var(--ink); display: grid; place-items: center; flex-shrink: 0; transition: transform .2s, opacity .2s; }
.chat-send:hover { transform: scale(1.06); }
.chat-send:disabled { opacity: .5; cursor: not-allowed; }
.chat-send svg { width: 20px; height: 20px; }

/* ================= RESPONSIVE ================= */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 90; left: 0; top: 0; width: 240px; transform: translateX(-100%);
    transition: transform .3s var(--ease);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: grid !important; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .agenda-grid { grid-template-columns: 1fr; }
  .main { padding: 20px 18px 80px; }
}
.menu-toggle { display: none; width: 42px; height: 42px; border-radius: 11px; background: var(--card); border: 1px solid var(--line); place-items: center; }
.menu-toggle svg { width: 20px; height: 20px; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 85; opacity: 0; pointer-events: none; transition: opacity .3s; }
.scrim.show { opacity: 1; pointer-events: auto; }
@media (min-width: 861px) { .scrim { display: none; } }

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
}
