/* ==========================================================================
   HootSocial — hoja de estilos principal
   ========================================================================== */
:root {
  --brand: #143059;
  --brand-ink: #ffffff;
  --brand-hover: #0d2342;
  --accent: #ff4c46;
  --highlight: #ffd18c;
  --highlight-soft: #fff1da;
  --bg: #f6f4f1;
  --surface: #ffffff;
  --surface-2: #f1eeea;
  --surface-3: #e8e4de;
  --border: #e2ddd6;
  --border-strong: #c9c2b8;
  --text: #1c1c1c;
  --text-2: #4b4b4b;
  --muted: #7a756e;
  --link: #1b5fb4;
  --green: #1f8a4c;
  --green-bg: #e3f5ea;
  --red: #d93025;
  --red-bg: #fde8e6;
  --amber: #b26a00;
  --amber-bg: #fff2d6;
  --blue: #1b5fb4;
  --blue-bg: #e4eefb;
  --purple: #6b4fbb;
  --purple-bg: #eee8fb;
  --gray-bg: #eeebe7;
  --shadow: 0 1px 2px rgba(20, 20, 20, .06), 0 2px 8px rgba(20, 20, 20, .05);
  --shadow-lg: 0 10px 40px rgba(20, 20, 20, .16);
  --radius: 12px;
  --radius-sm: 8px;
  --rail-w: 76px;
  --subnav-w: 252px;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948; --series-prev: #a3a19b;
  --sent-pos: #1f8a4c; --sent-neu: #a3a19b; --sent-neg: #e34948;
  --font: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #8fb4ff; --brand-ink: #0c1424; --brand-hover: #a9c5ff; --highlight: #5a4520; --highlight-soft: #3a2f1e;
    --bg: #121315; --surface: #1b1d20; --surface-2: #23262a; --surface-3: #2c3035; --border: #30343a; --border-strong: #454a52;
    --text: #ececec; --text-2: #c9c9c9; --muted: #9a9a9a; --link: #8fb4ff;
    --green-bg: #173323; --red-bg: #3a1c1a; --amber-bg: #3a2c12; --blue-bg: #1a2a44; --purple-bg: #2a2340; --gray-bg: #2a2d31;
    --green: #5fd38d; --red: #ff7b72; --amber: #f0b44c; --blue: #8fb4ff; --purple: #b9a4f5;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767; --series-prev: #6f6d68;
    --sent-pos: #3fb46f; --sent-neu: #6f6d68; --sent-neg: #e66767;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #8fb4ff; --brand-ink: #0c1424; --brand-hover: #a9c5ff; --highlight: #5a4520; --highlight-soft: #3a2f1e;
  --bg: #121315; --surface: #1b1d20; --surface-2: #23262a; --surface-3: #2c3035; --border: #30343a; --border-strong: #454a52;
  --text: #ececec; --text-2: #c9c9c9; --muted: #9a9a9a; --link: #8fb4ff;
  --green-bg: #173323; --red-bg: #3a1c1a; --amber-bg: #3a2c12; --blue-bg: #1a2a44; --purple-bg: #2a2340; --gray-bg: #2a2d31;
  --green: #5fd38d; --red: #ff7b72; --amber: #f0b44c; --blue: #8fb4ff; --purple: #b9a4f5;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767; --series-prev: #6f6d68;
  --sent-pos: #3fb46f; --sent-neu: #6f6d68; --sent-neg: #e66767;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; font-weight: 700; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 18px; } h4 { font-size: 15px; }
p { margin: 0 0 .8em; }
img, video { max-width: 100%; display: block; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hidden { display: none !important; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--rail-w); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; padding: 10px 0; z-index: 50; overflow-y: auto; overflow-x: hidden;
}
.rail-logo { display: grid; place-items: center; margin-bottom: 6px; }
.rail-logo svg { width: 40px; height: 40px; }
.rail-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%; padding: 7px 2px; color: var(--text);
  font-size: 12px; background: none; border: 0; cursor: pointer; font-family: inherit; position: relative; text-decoration: none !important;
}
.rail-item .ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 19px; transition: background .15s; }
.rail-item:hover .ico { background: var(--surface-2); }
.rail-item.active .ico { background: var(--brand); color: var(--brand-ink); }
.rail-item .count { position: absolute; top: 4px; right: 12px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px; padding: 0 5px; min-width: 16px; text-align: center; }
.rail-spacer { flex: 1; }
.rail-avatar { margin-top: 6px; cursor: pointer; background: none; border: 0; padding: 0; }
.main { margin-left: var(--rail-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page { padding: 28px 32px 48px; max-width: 1400px; width: 100%; }
.page-narrow { max-width: 980px; }

/* ---------- Encabezados ---------- */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-header h1 { margin: 0; }
.page-header .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.eyebrow { text-transform: uppercase; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 28px; display: flex; align-items: center; gap: 24px; min-height: 64px; flex-wrap: wrap; }
.topbar h1 { font-size: 26px; margin: 0; }
.topbar .spacer { flex: 1; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 22px; border-bottom: 0; }
.tabs a { color: var(--text-2); font-weight: 600; padding: 20px 0 18px; border-bottom: 3px solid transparent; text-decoration: none; white-space: nowrap; }
.tabs a.active { color: var(--text); border-bottom-color: var(--brand); }
.tabs a:hover { color: var(--text); }
.pill-tabs { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.pill-tabs a, .pill-tabs button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; font-weight: 700; color: var(--text-2); cursor: pointer; font: inherit; font-weight: 700; text-decoration: none; }
.pill-tabs .active { background: var(--brand); color: var(--brand-ink); }
.line-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.line-tabs a { padding: 8px 0; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; }
.line-tabs a.active { color: var(--text); border-bottom-color: var(--text); }

/* ---------- Módulo con sub-navegación ---------- */
.module { display: flex; min-height: 100vh; }
.subnav { width: var(--subnav-w); flex-shrink: 0; background: var(--surface-2); border-right: 1px solid var(--border); padding: 20px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; transition: width .2s; }
.subnav-head { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 14px 20px; }
.subnav-head h2 { margin: 0; font-size: 24px; }
.subnav-head .sub { font-size: 13px; color: var(--muted); font-weight: 400; }
.subnav-toggle { border: 0; background: var(--surface); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; color: var(--text); }
.subnav-section { padding: 18px 20px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text); display: flex; justify-content: space-between; align-items: center; }
.subnav a.item { display: flex; align-items: center; gap: 10px; padding: 11px 20px 11px 34px; color: var(--text); text-decoration: none; font-size: 15px; }
.subnav a.item.top { padding-left: 34px; }
.subnav a.item:hover { background: var(--surface-3); }
.subnav a.item.active { background: var(--highlight); font-weight: 700; }
.subnav a.item .count { margin-left: auto; font-size: 12px; background: var(--surface); border-radius: 10px; padding: 0 7px; }
.subnav hr { margin: 8px 20px; }
.subnav .foot { margin-top: auto; padding: 16px 20px 0; }
.module-body { flex: 1; min-width: 0; }
.module.collapsed .subnav { width: 0; padding: 0; overflow: hidden; border: 0; }
.btn.subnav-open { display: none; position: fixed; left: calc(var(--rail-w) + 8px); top: 14px; z-index: 30; }
.module.collapsed .btn.subnav-open { display: inline-grid; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none !important; white-space: nowrap; line-height: 1.2;
  background: var(--surface-2); color: var(--text); transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-outline { background: var(--surface); border-color: var(--text); color: var(--text); border-radius: 2px; }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(.95); background: var(--red); }
.btn-success { background: #2e7d32; color: #fff; }
.btn-success:hover { background: #27692a; }
.btn-yellow { background: #f7b500; color: #1c1c1c; border-radius: 2px; }
.btn-yellow:hover { background: #e5a800; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-lg { padding: 12px 20px; font-size: 16px; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 50%; }
.btn-icon.btn-sm { width: 30px; height: 30px; }
.btn-pill { border-radius: 999px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; }
.btn-group .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-group .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 1px solid rgba(255,255,255,.25); }
.link-btn { background: none; border: 0; color: var(--link); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.link-btn.danger { color: var(--red); }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; }
.card + .card { margin-top: 20px; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-header h2, .card-header h3 { margin: 0; }
.card-flat { box-shadow: none; border: 1px solid var(--border); }
.card-muted { background: var(--surface-2); box-shadow: none; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2.2fr) minmax(300px, 1fr); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wrap { flex-wrap: wrap; }
.gap-sm { gap: 6px; } .gap-lg { gap: 24px; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 36px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.w-100 { width: 100%; }
.flex-1 { flex: 1; min-width: 0; }

/* ---------- KPIs ---------- */
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; text-align: center; }
.kpi-title { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 16px; text-align: left; }
.kpi-value { font-size: 30px; font-weight: 700; margin-top: 14px; }
.kpi-label { color: var(--text-2); font-weight: 600; }
.kpi-change { font-weight: 700; font-size: 14px; }
.kpi-change.up { color: var(--green); } .kpi-change.down { color: var(--red); }
.kpi-big { font-size: 46px; font-weight: 700; line-height: 1; }
.trend { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; }
.trend.up { color: var(--green); } .trend.down { color: var(--red); }

/* ---------- Badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-gray { background: var(--gray-bg); color: var(--text-2); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-new { background: var(--purple-bg); color: var(--purple); border-radius: 4px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14px; color: var(--text); cursor: pointer; text-decoration: none !important; }
.chip:hover { background: var(--surface-3); }
.chip.active { background: var(--brand); color: var(--brand-ink); }
.chip-outline { background: var(--surface); border-color: var(--border); }
.chip-sm { padding: 4px 10px; font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ---------- Avatares ---------- */
.avatar { --av: #555; position: relative; display: inline-grid; place-items: center; border-radius: 50%; background: var(--av); color: #fff; font-weight: 700; flex-shrink: 0; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 38px; height: 38px; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl { width: 84px; height: 84px; font-size: 30px; }
.avatar-net { position: absolute; right: -4px; bottom: -3px; width: 17px; height: 17px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 10px; box-shadow: 0 0 0 1px var(--border); }

/* ---------- Formularios ---------- */
label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.field { margin-bottom: 16px; }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  font: inherit; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--link); box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 18%, transparent); }
textarea.input { resize: vertical; min-height: 90px; }
.input-sm { padding: 6px 10px; font-size: 14px; }
.input-group { display: flex; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon .input { padding-left: 38px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; margin: 0; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.error-text { color: var(--red); font-size: 13px; margin-top: 4px; }

/* Interruptor */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; margin: 0; }
.switch input { appearance: none; width: 40px; height: 22px; background: var(--border-strong); border-radius: 999px; position: relative; cursor: pointer; transition: background .2s; margin: 0; flex-shrink: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .2s; }
.switch input:checked { background: #1c1c1c; }
:root[data-theme="dark"] .switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(18px); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Alertas / flash ---------- */
.flashes { position: fixed; top: 16px; right: 16px; z-index: 300; display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-lg); border-left: 4px solid var(--blue); animation: slideIn .25s ease; }
.flash.success { border-color: var(--green); } .flash.error { border-color: var(--red); } .flash.warning { border-color: var(--amber); }
.flash button { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 16px; }
@keyframes slideIn { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.alert { padding: 12px 16px; border-radius: 10px; display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
.alert-info { background: var(--blue-bg); color: var(--text); }
.alert-warning { background: var(--amber-bg); }
.alert-danger { background: var(--red-bg); }
.alert-success { background: var(--green-bg); }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 220px; background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 8px 0; z-index: 120; display: none; border: 1px solid var(--border);
}
.dropdown.open > .dropdown-menu { display: block; }
.dropdown-menu.left { left: 0; right: auto; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; color: var(--text); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; text-decoration: none !important;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); }
.dropdown-menu i { font-size: 17px; width: 20px; }
.dropdown-menu hr { margin: 6px 0; }
.dropdown-menu .danger { color: var(--red); }
.dropdown-menu .label { padding: 6px 16px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }

/* Popover del menú Crear */
.popover { position: fixed; z-index: 200; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px 0; min-width: 320px; display: none; border: 1px solid var(--border); }
.popover.open { display: block; }
.popover a { display: flex; align-items: center; gap: 14px; padding: 12px 18px; color: var(--text); text-decoration: none; font-size: 16px; }
.popover a:hover { background: var(--surface-2); }
.popover a i { font-size: 20px; width: 22px; }
.popover hr { margin: 6px 16px; }
.popover .tag { margin-left: auto; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 18, 25, .5); z-index: 400; display: none; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal.open { display: flex; }
.modal-box { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; animation: pop .18s ease; }
.modal-box.lg { max-width: 820px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.close-btn { background: var(--surface-2); border: 0; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 18px; color: var(--text); display: inline-grid; place-items: center; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Estados vacíos ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty .icon { font-size: 44px; color: var(--muted); margin-bottom: 10px; }
.empty h3 { color: var(--text); }

/* ---------- Paginación ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.pagination .current { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(150deg, #143059 0%, #1f4a86 55%, #ff4c46 140%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { font-size: 38px; max-width: 460px; }
.auth-side ul { list-style: none; padding: 0; margin: 24px 0 0; }
.auth-side li { display: flex; gap: 12px; margin-bottom: 14px; font-size: 17px; }
.auth-form { display: grid; place-items: center; padding: 32px 16px; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 30px; }
.brand-mark { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; }
.brand-mark svg { width: 40px; height: 40px; }

/* ---------- Inicio ---------- */
.hero { background: var(--surface); padding: 26px 32px; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.hero h1 { font-size: 34px; margin: 6px 0 0; }
.quick-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; padding: 40px 32px 30px; }
.quick-card { text-align: center; color: var(--text); text-decoration: none !important; padding: 18px 10px; border-radius: 14px; transition: background .15s, transform .15s; }
.quick-card:hover { background: var(--surface); transform: translateY(-2px); }
.quick-card h3 { font-size: 17px; font-weight: 600; min-height: 44px; }
.quick-card svg { width: 130px; height: 110px; margin: 0 auto; }
.score-ring { position: relative; width: 170px; height: 170px; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.rec { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.rec:last-child { border-bottom: 0; }
.rec i { font-size: 18px; margin-top: 2px; }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: 14px; position: relative; padding-bottom: 18px; }
.steps li:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--border); }
.steps li.done:not(:last-child)::before { background: var(--green); }
.step-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); font-weight: 700; flex-shrink: 0; background: var(--surface); }
.steps li.done .step-dot { background: var(--green); border-color: var(--green); color: #fff; }
.post-mini { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.post-mini:last-child { border-bottom: 0; }
.post-mini .when { min-width: 62px; text-align: center; background: var(--surface-2); border-radius: 8px; padding: 6px; font-size: 12px; font-weight: 700; }
.post-mini .when b { display: block; font-size: 18px; }

/* ---------- Calendario ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: var(--surface); flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.cal-toolbar .range { font-weight: 700; font-size: 16px; }
.cal-toolbar .spacer { flex: 1; }
.view-switch { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.view-switch a { width: 38px; height: 34px; display: grid; place-items: center; border-radius: 8px; color: var(--text); }
.view-switch a.active { background: var(--surface); box-shadow: var(--shadow); }
.cal-week { display: grid; grid-template-columns: 64px repeat(7, minmax(0, 1fr)); background: var(--surface); min-height: calc(100vh - 140px); }
.cal-week .col-head { text-align: center; padding: 12px 6px 8px; border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal-week .col-head .dow { font-size: 13px; color: var(--text-2); }
.cal-week .col-head .num { font-size: 20px; font-weight: 700; width: 38px; height: 38px; display: grid; place-items: center; margin: 2px auto 6px; border-radius: 50%; }
.cal-week .col-head.today .num { background: var(--brand); color: var(--brand-ink); }
.cal-week .tz { font-size: 11px; color: var(--muted); padding: 12px 6px; border-bottom: 1px solid var(--border); text-align: center; }
.day-event { background: #3a6f8f; color: #fff; font-size: 12px; font-weight: 700; padding: 6px 8px; border-radius: 6px; margin: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-week .gutter { border-bottom: 1px solid var(--border); }
.cal-week .day-col { border-left: 1px solid var(--border); padding: 8px 6px; min-height: 420px; transition: background .15s; }
.cal-week .day-col.past { background: repeating-linear-gradient(135deg, transparent 0 8px, var(--surface-2) 8px 9px); }
.cal-week .day-col.drop-over { background: var(--highlight-soft); }
.post-chip { display: block; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 8px; padding: 7px 8px; margin-bottom: 8px; font-size: 13px; color: var(--text); text-decoration: none !important; cursor: pointer; box-shadow: var(--shadow); }
.post-chip:hover { border-color: var(--border-strong); }
.post-chip[draggable="true"] { cursor: grab; }
.post-chip .meta { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.post-chip .meta .time { font-weight: 700; color: var(--text); margin-right: auto; }
.post-chip.st-published { border-left-color: var(--green); }
.post-chip.st-pending_approval { border-left-color: var(--amber); }
.post-chip.st-failed, .post-chip.st-rejected { border-left-color: var(--red); }
.post-chip.st-draft { border-left-color: var(--muted); border-style: dashed; }
.post-chip img.thumb { width: 100%; height: 70px; object-fit: cover; border-radius: 5px; margin-top: 5px; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); }
.cal-month .mh { text-align: center; padding: 10px; font-size: 13px; color: var(--text-2); border-bottom: 1px solid var(--border); font-weight: 600; }
.cal-month .cell { min-height: 128px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; }
.cal-month .cell.other { background: var(--surface-2); color: var(--muted); }
.cal-month .cell .n { font-weight: 700; font-size: 13px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-month .cell.today .n { background: var(--brand); color: var(--brand-ink); }
.cal-month .post-chip { padding: 3px 6px; margin-bottom: 4px; font-size: 12px; box-shadow: none; }
.cal-month .ev { font-size: 11px; background: #3a6f8f; color: #fff; border-radius: 4px; padding: 1px 5px; margin-bottom: 4px; }
.promo-card { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; margin: 4px 0; }
.promo-card .art { background: linear-gradient(140deg, #143059, #2f6db5); height: 90px; display: grid; place-items: center; color: #fff; font-size: 38px; }
.promo-card .body { padding: 10px; font-size: 13px; }

/* ---------- Compositor ---------- */
.composer { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); min-height: calc(100vh - 64px - 74px); }
.composer-form { padding: 24px 28px 120px; border-right: 1px solid var(--border); background: var(--surface); overflow-y: auto; }
.composer-preview { background: var(--surface-2); padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.composer-bar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 14px 28px; display: flex; justify-content: flex-end; align-items: center; gap: 12px; z-index: 20; flex-wrap: wrap; }
.acc-picker { border: 2px solid var(--link); border-radius: 6px; }
.acc-picker .selected { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; min-height: 46px; align-items: center; }
.acc-picker .selected .tag { display: inline-flex; align-items: center; gap: 6px; background: #fde0d5; color: #1c1c1c; border-radius: 999px; padding: 4px 10px; font-weight: 700; font-size: 14px; }
:root[data-theme="dark"] .acc-picker .selected .tag { background: #4a2d24; color: #fff; }
.acc-picker .selected .tag button { background: none; border: 0; cursor: pointer; font-size: 14px; color: inherit; padding: 0; }
.acc-picker .list { border-top: 1px solid var(--border); max-height: 280px; overflow-y: auto; }
.acc-group { padding: 10px 14px 4px; font-size: 13px; font-weight: 700; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.acc-row { display: flex; align-items: center; gap: 12px; padding: 9px 14px 9px 36px; cursor: pointer; margin: 0; font-weight: 600; }
.acc-row:hover { background: var(--surface-2); }
.acc-row.checked { background: var(--highlight); }
.acc-row input { width: 17px; height: 17px; accent-color: var(--brand); }
.editor-box { border: 1px solid var(--border-strong); border-radius: 8px; margin-top: 18px; }
.editor-box textarea { border: 0; width: 100%; min-height: 170px; padding: 14px; font: inherit; font-size: 16px; resize: vertical; background: transparent; color: var(--text); }
.editor-box textarea:focus { outline: none; }
.editor-tools { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.editor-tools .btn-icon { background: transparent; }
.editor-tools .btn-icon:hover { background: var(--surface-2); }
.char-counts { margin-left: auto; display: flex; gap: 10px; font-size: 13px; color: var(--text-2); }
.char-counts .over { color: var(--red); font-weight: 700; }
.media-drop { border: 2px dashed var(--border-strong); border-radius: 10px; padding: 18px; text-align: center; color: var(--text-2); cursor: pointer; margin-top: 14px; }
.media-drop.has { border-style: solid; padding: 8px; }
.media-drop img, .media-drop video { max-height: 200px; margin: 0 auto; border-radius: 6px; }
.phone { width: 300px; border-radius: 28px; background: #000; padding: 12px; box-shadow: var(--shadow-lg); }
.phone-screen { border-radius: 18px; overflow: hidden; background: #fff; color: #111; min-height: 460px; display: flex; flex-direction: column; }
.pv-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-size: 13px; }
.pv-head b { display: block; }
.pv-text { padding: 0 12px 10px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.pv-media { background: #e9e9e9; min-height: 220px; display: grid; place-items: center; color: #999; font-size: 40px; }
.pv-media img, .pv-media video { width: 100%; max-height: 320px; object-fit: cover; }
.pv-actions { display: flex; gap: 18px; padding: 10px 12px; font-size: 18px; color: #333; }
.pv-tiktok { background: linear-gradient(#6b7a8c, #2f3a47); color: #fff; position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; padding: 16px; min-height: 460px; }
.pv-tiktok .side { position: absolute; right: 12px; bottom: 90px; display: flex; flex-direction: column; gap: 18px; font-size: 26px; align-items: center; }
.pv-tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.suggest-box { background: var(--highlight-soft); border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-top: 10px; }

/* ---------- Inbox ---------- */
.inbox { display: grid; grid-template-columns: 370px minmax(0, 1fr) 300px; height: 100vh; }
.inbox.no-contact { grid-template-columns: 370px minmax(0, 1fr) 54px; }
.inbox-list { border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.inbox-list .head { padding: 16px 18px 0; }
.inbox-list .items { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none !important; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--highlight-soft); box-shadow: inset 3px 0 0 var(--brand); }
.conv .who { font-weight: 700; }
.conv .time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.conv.unread .who::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: middle; }
.thread { display: flex; flex-direction: column; background: var(--bg); min-height: 0; }
.thread-head { background: var(--surface); padding: 12px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.thread-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 70%; padding: 10px 14px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); white-space: pre-wrap; word-break: break-word; }
.msg.out { align-self: flex-end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 4px; }
.msg.in { border-bottom-left-radius: 4px; }
.msg.note { align-self: center; background: var(--amber-bg); box-shadow: none; font-size: 14px; max-width: 85%; }
.msg .meta { font-size: 11px; opacity: .75; margin-top: 4px; }
.thread-reply { background: var(--surface); border-top: 1px solid var(--border); padding: 12px 16px; }
.thread-reply textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px; font: inherit; min-height: 70px; resize: vertical; background: var(--surface); color: var(--text); }
.contact-panel { border-left: 1px solid var(--border); background: var(--surface); padding: 18px; overflow-y: auto; }
.center-empty { display: grid; place-items: center; text-align: center; height: 100%; color: var(--text-2); padding: 20px; }

/* ---------- Chat IA ---------- */
.ai-wrap { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.ai-history { background: var(--surface-2); border-right: 1px solid var(--border); padding: 18px 12px; overflow-y: auto; height: 100vh; position: sticky; top: 0; }
.ai-history a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14px; }
.ai-history a.active, .ai-history a:hover { background: var(--surface-3); }
.ai-main { display: flex; flex-direction: column; min-height: 100vh; }
.ai-center { max-width: 760px; width: 100%; margin: 0 auto; padding: 0 20px; }
.ai-hero { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 40px 0; }
.ai-hero h1 { text-align: center; font-size: 30px; font-weight: 600; }
.ai-box { border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); padding: 12px; box-shadow: var(--shadow); }
.ai-box textarea { width: 100%; border: 0; resize: none; font: inherit; font-size: 16px; min-height: 48px; max-height: 220px; background: transparent; color: var(--text); }
.ai-box textarea:focus { outline: none; }
.ai-suggestions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 24px; }
.ai-messages { flex: 1; padding: 28px 0; display: flex; flex-direction: column; gap: 22px; }
.ai-msg { display: flex; gap: 12px; }
.ai-msg .bubble { flex: 1; min-width: 0; line-height: 1.6; }
.ai-msg.user .bubble { background: var(--surface); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); }
.ai-msg .bubble p { margin: 0 0 .6em; }
.ai-msg .bubble ul, .ai-msg .bubble ol { margin: 0 0 .6em; padding-left: 22px; }
.ai-msg .tools { display: flex; gap: 6px; margin-top: 6px; }
.ai-composer { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 20px 0 22px; }
.typing span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin-right: 4px; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* ---------- Analíticas / Listening ---------- */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 200px; }
.chart-box.lg { height: 340px; }
.range-pill { display: inline-flex; align-items: center; gap: 10px; background: var(--surface-3); border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: 14px; }
.legend-dot { display: inline-flex; align-items: center; gap: 6px; }
.report-tile { display: flex; flex-direction: column; gap: 14px; }
.report-tile .desc { display: flex; gap: 12px; flex: 1; }
.heatmap { display: grid; grid-template-columns: 90px repeat(24, minmax(22px, 1fr)); gap: 3px; font-size: 11px; }
.heatmap .h { text-align: center; color: var(--muted); }
.heatmap .d { font-weight: 600; font-size: 13px; display: flex; align-items: center; }
.heatmap .c { height: 30px; border-radius: 4px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 10px; }
.search-hero { padding: 54px 0 20px; }
.search-hero h1 { font-size: 36px; color: var(--brand); }
:root[data-theme="dark"] .search-hero h1 { color: var(--text); }
.big-search { display: flex; gap: 10px; }
.big-search .input-icon { flex: 1; }
.big-search .input { padding-top: 13px; padding-bottom: 13px; font-size: 16px; border-radius: 2px; }
.trend-list { list-style: none; padding: 0; margin: 0; }
.trend-list li { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; font-size: 15px; }
.trend-list a { color: var(--text); }
.sent-big { font-size: 52px; font-weight: 700; line-height: 1; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 70px 70px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 14px; }
.bar { height: 26px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 4px; }
.word-cloud { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: center; padding: 20px; }
.word-cloud span { font-weight: 700; color: var(--brand); }
.upsell { background: var(--surface); border-radius: 10px; padding: 14px; font-size: 14px; }

/* ---------- Ads ---------- */
.ads-hero { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: center; padding: 40px; }
.ads-hero h2 { font-size: 28px; }
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); }

/* ---------- Roles ---------- */
.perm-module { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.perm-module h4 { display: flex; justify-content: space-between; align-items: center; }

/* ---------- Bio pública ---------- */
.bio-public { min-height: 100vh; display: flex; justify-content: center; padding: 50px 16px; }
.bio-card { width: 100%; max-width: 480px; text-align: center; color: #fff; }
.bio-card a.link { display: block; background: rgba(255,255,255,.95); color: #111; padding: 15px; border-radius: 12px; margin-top: 12px; font-weight: 700; text-decoration: none; transition: transform .15s; }
.bio-card a.link:hover { transform: scale(1.02); }

/* ---------- Notificaciones ---------- */
.notif-panel { position: fixed; left: calc(var(--rail-w) + 8px); bottom: 16px; width: 380px; max-height: 70vh; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 210; display: none; flex-direction: column; border: 1px solid var(--border); }
.notif-panel.open { display: flex; }
.notif-panel .items { overflow-y: auto; }
.notif { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none !important; }
.notif.unread { background: var(--highlight-soft); }
.notif i { font-size: 18px; color: var(--brand); }

/* ---------- Responsivo ---------- */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inbox { grid-template-columns: 320px minmax(0, 1fr); }
  .inbox .contact-panel { display: none; }
  .composer { grid-template-columns: 1fr; }
  .composer-preview { display: none; }
}
@media (max-width: 960px) {
  .grid-2, .grid-3, .grid-main { grid-template-columns: 1fr; }
  .quick-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subnav { position: fixed; left: var(--rail-w); z-index: 40; box-shadow: var(--shadow-lg); }
  .module:not(.open-nav) .subnav { width: 0; padding: 0; overflow: hidden; border: 0; }
  .module .btn.subnav-open { display: inline-grid; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .ai-wrap { grid-template-columns: 1fr; }
  .ai-history { display: none; }
  .ads-hero { grid-template-columns: 1fr; }
  .cal-week { grid-template-columns: 40px repeat(7, minmax(110px, 1fr)); overflow-x: auto; }
}
@media (max-width: 640px) {
  :root { --rail-w: 60px; }
  .rail-item { font-size: 10px; }
  .rail-item .ico { width: 36px; height: 36px; font-size: 17px; }
  .page { padding: 18px 16px 40px; }
  .grid-4, .form-grid { grid-template-columns: 1fr; }
  .quick-cards { padding: 24px 16px; gap: 10px; }
  .hero { padding: 20px 16px; }
  .inbox, .inbox.no-contact { grid-template-columns: 1fr; }
  .inbox .thread { display: none; }
  .inbox.has-conv .inbox-list { display: none; }
  .inbox.has-conv .thread { display: flex; }
  .topbar { padding: 0 16px; }
  .cal-toolbar { padding: 12px 16px; }
  .notif-panel { width: calc(100vw - var(--rail-w) - 16px); }
}

@media print {
  .rail, .subnav, .no-print, .flashes { display: none !important; }
  .main { margin: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
