:root {
  --bg: #0a0e14;
  --bg-soft: #0f151d;
  --panel: #121a24;
  --panel-2: #16202c;
  --line: #1f2c3a;
  --text: #e6eef8;
  --muted: #8b9db3;
  --accent: #35d39a;
  --accent-dim: rgba(53, 211, 154, .12);
  --blue: #5aa9f8;
  --warn: #f4b740;
  --bad: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -200px, #12202c 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .88em;
  background: #0c1219;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  color: #b9cbe0;
}

/* ------------------------------- topbar -------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 14px 28px;
  background: rgba(10, 14, 20, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; letter-spacing: -.2px; }
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}
.brand .tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 999px;
}
.tabs { display: flex; gap: 4px; background: var(--panel); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 14px; border-radius: 9px; cursor: pointer;
  font: inherit; font-size: 14px;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

/* -------------------------------- layout ------------------------------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 22px 80px; }
.view { display: none; animation: fade .22s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.columns { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-top: 18px; }
@media (max-width: 980px) { .columns, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: linear-gradient(180deg, var(--panel) 0%, #101822 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card h2 { font-size: 15px; margin: 0; letter-spacing: -.1px; }
.card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 22px 0 8px; }

/* --------------------------------- kpis -------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
@media (max-width: 1080px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px;
}
.kpi.accent { border-color: rgba(53, 211, 154, .35); background: linear-gradient(180deg, rgba(53,211,154,.07), var(--panel)); }
.kpi.accent .kpi-value { color: var(--accent); }
.kpi.muted .kpi-value { color: var(--muted); }
.kpi-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.kpi-value { font-size: 26px; font-weight: 650; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: 12px; color: var(--muted); }

/* -------------------------------- chart -------------------------------- */
.chart { height: 190px; display: flex; align-items: flex-end; gap: 6px; padding-top: 8px; }
.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.chart .stack { width: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; height: 100%; }
.chart .seg { border-radius: 3px 3px 0 0; min-height: 0; transition: height .3s ease; }
.chart .seg.human { background: linear-gradient(180deg, #46e6ac, #23a97c); }
.chart .seg.probable { background: linear-gradient(180deg, #6fb6ff, #2f77c9); border-radius: 0; }
.chart .day { font-size: 10px; color: var(--muted); white-space: nowrap; }
.chart .bar-wrap:hover .stack { filter: brightness(1.15); }
.chart > .empty { width: 100%; align-self: center; padding: 0; }

/* --------------------------------- feed -------------------------------- */
.feed { display: flex; flex-direction: column; gap: 2px; }
.feed-row { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 9px; }
.feed-row:hover { background: var(--panel-2); }
.feed-row .who { flex: 1; min-width: 0; }
.feed-row .who b { display: block; font-weight: 550; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-row .who span { font-size: 11.5px; color: var(--muted); }
.feed-row .when { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* -------------------------------- badges ------------------------------- */
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid; }
.badge.humano { color: var(--accent); border-color: rgba(53,211,154,.35); background: var(--accent-dim); }
.badge.probable { color: var(--blue); border-color: rgba(90,169,248,.3); background: rgba(90,169,248,.1); }
.badge.bot { color: var(--muted); border-color: var(--line); background: #0d1319; }
.pill {
  font-size: 11.5px; color: var(--muted); border: 1px solid var(--line);
  background: #0d1319; padding: 2px 9px; border-radius: 999px;
}
.pill.ok { color: var(--accent); border-color: rgba(53,211,154,.35); }

/* -------------------------------- forms -------------------------------- */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
@media (max-width: 620px) { .fields { grid-template-columns: 1fr; } }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
label.block { margin-bottom: 6px; }
input[type=text], input[type=email], input[type=search], input[type=password], select, textarea {
  width: 100%; background: #0c131a; border: 1px solid var(--line);
  color: var(--text); border-radius: 9px; padding: 9px 11px;
  font: inherit; font-size: 14px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: rgba(53,211,154,.5); box-shadow: 0 0 0 3px var(--accent-dim); }
textarea { resize: vertical; font-family: inherit; }
select { cursor: pointer; }

.switch { display: flex; flex-direction: row; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
input[type=checkbox] {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; margin: 0; flex: none;
  border: 1px solid var(--line); border-radius: 4px; background: #0c131a;
  cursor: pointer; position: relative;
}
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after {
  content: ""; position: absolute; left: 5px; top: 1px;
  width: 4px; height: 9px; border: solid #04140e; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.switch input { accent-color: var(--accent); }

.editor-wrap { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: #0c131a; }
.toolbar { display: flex; align-items: center; gap: 4px; padding: 7px 9px; border-bottom: 1px solid var(--line); background: #0f1720; flex-wrap: wrap; }
.toolbar button {
  min-width: 28px; height: 26px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer; font-size: 13px;
}
.toolbar button:hover { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.toolbar .sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }
.editor { min-height: 190px; padding: 14px; outline: none; font-size: 14.5px; line-height: 1.6; }
.editor:empty::before { content: attr(data-placeholder); color: #516072; }
.editor a { color: var(--blue); }
.opts { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }

.actions { display: flex; align-items: center; gap: 9px; margin-top: 14px; flex-wrap: wrap; }
.actions.tight { margin-top: 0; }
.btn {
  border-radius: 9px; padding: 9px 15px; font: inherit; font-size: 13.5px;
  cursor: pointer; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  transition: transform .05s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #3ee0a6, #22a97a); border-color: #2fbf8e; color: #04140e; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }

.hint { font-size: 12px; color: var(--muted); }
.hint code { font-size: 11px; }

/* -------------------------------- result ------------------------------- */
.empty { padding: 26px 10px; text-align: center; color: var(--muted); font-size: 13.5px; }
.pixel-info { display: flex; gap: 18px; flex-wrap: wrap; margin: 12px 0; font-size: 12px; }
.pixel-info .k { color: var(--muted); margin-right: 6px; text-transform: uppercase; font-size: 10.5px; letter-spacing: .6px; }
.code {
  max-height: 260px; overflow: auto; background: #080d13; border: 1px solid var(--line);
  border-radius: 9px; padding: 12px; font-size: 11.5px; color: #9fb4c9;
  white-space: pre-wrap; word-break: break-all;
}
.bulk-items { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow: auto; }
.bulk-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; }
.bulk-row .mail { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.bulk-row button { padding: 5px 10px; font-size: 12px; }

/* -------------------------------- table -------------------------------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select, .filters input { width: auto; min-width: 140px; font-size: 13px; padding: 7px 10px; }
.filters input[type=search] { min-width: 200px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 500; font-size: 11px; text-transform: uppercase;
  letter-spacing: .6px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 10px; border-bottom: 1px solid rgba(31,44,58,.6); vertical-align: middle; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--panel-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .to { font-weight: 550; }
.table .sub { display: block; color: var(--muted); font-size: 11.5px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .zero { color: #45535f; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.abierto { color: var(--accent); border-color: rgba(53,211,154,.35); background: var(--accent-dim); }
.chip.actividad { color: var(--blue); border-color: rgba(90,169,248,.3); }
.chip.enviado { color: #c9d6e4; }

/* -------------------------------- modal -------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(3, 7, 11, .72); backdrop-filter: blur(4px); padding: 20px;
}
.modal.hidden { display: none; }
.modal-box {
  width: min(720px, 100%); max-height: 86vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: var(--panel); border-radius: 16px 16px 0 0;
}
.modal-head h2 { font-size: 15px; margin: 0; }
.modal-body { padding: 16px 18px 24px; }
.icon { background: transparent; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; }
.icon:hover { color: var(--text); }

.timeline { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.tl { display: grid; grid-template-columns: 152px 128px 1fr; gap: 10px; align-items: baseline;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 12.5px; }
.tl .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.tl .r { color: var(--muted); font-size: 11.5px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.legend li { display: flex; gap: 10px; align-items: baseline; }
.steps { padding-left: 20px; font-size: 13px; display: flex; flex-direction: column; gap: 8px; color: #c3d1e0; }

.banner {
  border: 1px solid rgba(244,183,64,.3); background: rgba(244,183,64,.08);
  color: #f0d9a7; padding: 11px 14px; border-radius: 11px; font-size: 13px; margin-bottom: 16px;
}
.banner.warn { margin-top: 16px; margin-bottom: 0; }
.banner strong { color: #f8e6bd; }
.hidden { display: none !important; }
.link { font-size: 12.5px; cursor: pointer; }

/* -------------------------------- login -------------------------------- */
.lock {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: radial-gradient(900px 500px at 50% 0%, #12202c 0%, #070b10 70%);
  padding: 20px;
}
.lock.hidden { display: none; }
.lock-box {
  width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 26px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.lock-brand { display: flex; align-items: center; gap: 10px; font-size: 18px; margin-bottom: 4px; }
.lock-brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim);
}
.lock-box input { width: 100%; }
.lock-box .btn { width: 100%; }
