/* EmailHub · tema oscuro con acento verde brillante. Todo en rem con raíz fluida. */
:root {
  --bg: #0a0a0b; --card: #101011; --card-2: #141415; --line: #1e1e20; --line-2: #2a2a2d;
  --tx: #f1f1f2; --tx-2: #c4c4c8; --mut: #8a8a90; --mut-2: #5d5d63;
  --ac: #3dff6e; --ac-soft: rgba(61, 255, 110, 0.1); --ac-line: rgba(61, 255, 110, 0.35);
  --warn: #ffb020; --bad: #ff5d5d;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; margin: 0; }
html { font-size: clamp(11px, calc(4px + 0.5vw), 16px); }
body { background: var(--bg); color: var(--tx); font-family: var(--sans); font-size: 1rem; line-height: 1.4; min-height: 100vh; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--tx); background: #0d0d0e; border: 1px solid var(--line-2); border-radius: 0.6rem; padding: 0.55rem 0.75rem; min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--ac); outline-offset: 1px; }
a { color: var(--ac); text-decoration: none; } a:hover { text-decoration: underline; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.mut { color: var(--mut); }

/* ───── ingreso ───── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(60rem 30rem at 50% -10%, rgba(61, 255, 110, 0.08), transparent 60%), var(--bg); }
.login form { width: min(26rem, 100%); background: var(--card); border: 1px solid var(--line-2); border-radius: 1.1rem; padding: 2rem; display: flex; flex-direction: column; gap: 0.9rem; box-shadow: 0 2rem 5rem rgba(0, 0, 0, 0.6); }
.login h1 { font-size: 1.5rem; letter-spacing: -0.02em; }
.login p.sub { color: var(--mut); font-size: 0.95rem; margin-top: -0.4rem; }
.marca { display: flex; align-items: center; gap: 0.7rem; }
.marca img { width: 2.2rem; height: 2.2rem; }
label.campo { display: flex; flex-direction: column; gap: 0.3rem; color: var(--mut); font-size: 0.85rem; }
.err { color: var(--bad); font-size: 0.9rem; min-height: 1.2rem; }

/* ───── botones ───── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; height: 2.4rem; padding: 0 1rem; border-radius: 0.65rem; background: #1a1a1c; border: 1px solid var(--line-2); font-weight: 500; transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.2s; white-space: nowrap; }
.btn:hover { background: #222225; border-color: var(--ac-line); }
.btn:active { transform: translateY(1px); }
a.btn, a.btn:hover { color: var(--tx); text-decoration: none; }
.btn.pri { background: var(--ac); color: #04130a; border-color: var(--ac); font-weight: 600; }
a.btn.pri, a.btn.pri:hover { color: #04130a; }
.btn.pri:hover { background: #7dffa0; box-shadow: 0 0 1.5rem rgba(61, 255, 110, 0.35); }
.btn.sm { height: 2rem; padding: 0 0.75rem; font-size: 0.9rem; }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.bad:hover { border-color: rgba(255, 93, 93, 0.5); color: var(--bad); }

/* ───── marco ───── */
.shell { display: grid; grid-template-columns: 16rem minmax(0, 1fr); min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 1.1rem 0.9rem; display: flex; flex-direction: column; gap: 1.4rem; position: sticky; top: 0; height: 100vh; }
.side .marca b { font-size: 1.1rem; letter-spacing: -0.01em; } .side .marca small { display: block; color: var(--mut); font-size: 0.8rem; }
.nav { display: flex; flex-direction: column; gap: 0.15rem; }
.nav a { display: flex; align-items: center; gap: 0.7rem; height: 2.5rem; padding: 0 0.8rem; border-radius: 0.6rem; color: var(--tx-2); transition: background 0.15s, color 0.15s, box-shadow 0.15s; }
.nav a:hover { background: #151516; color: var(--tx); text-decoration: none; box-shadow: inset 2px 0 0 var(--ac-line); }
.nav a.on { background: var(--card-2); color: var(--tx); box-shadow: inset 2px 0 0 var(--ac); }
.nav svg { width: 1.15rem; height: 1.15rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav .n { margin-left: auto; background: var(--ac-soft); color: var(--ac); border-radius: 99px; padding: 0 0.5rem; font-size: 0.78rem; font-weight: 600; }
.yo { margin-top: auto; border: 1px solid var(--line); border-radius: 0.8rem; padding: 0.7rem 0.8rem; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.88rem; }
.yo b { display: block; font-weight: 500; } .yo span { color: var(--mut); font-size: 0.8rem; word-break: break-all; }
.main { padding: 1.6rem 2rem 3rem; min-width: 0; }
.cab { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.cab h1 { font-size: 1.6rem; letter-spacing: -0.025em; }
.cab .sp { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid var(--line-2); border-radius: 99px; padding: 0.15rem 0.65rem; font-size: 0.82rem; color: var(--tx-2); }
.pill i { width: 0.42rem; height: 0.42rem; border-radius: 50%; background: var(--ac); box-shadow: 0 0 0.6rem var(--ac); }

/* ───── tarjetas y KPIs ───── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 1rem; transition: border-color 0.2s; }
.card:hover { border-color: #2a2a2d; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 1.2rem; overflow: hidden; }
.kpi { padding: 1.2rem 1.4rem; border-left: 1px solid var(--line); cursor: pointer; transition: background 0.2s; position: relative; text-align: left; }
.kpi:first-child { border-left: 0; }
.kpi:hover, .kpi.on { background: #131a15; }
.kpi.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--ac); }
.kpi small { color: var(--mut); font-size: 0.85rem; display: block; }
.kpi b { display: block; font-size: 1.7rem; font-weight: 600; letter-spacing: -0.03em; margin-top: 0.35rem; }
.kpi span { color: var(--mut); font-size: 0.85rem; }
.kpi.bad b { color: var(--bad); } .kpi.warn b { color: var(--warn); } .kpi.ok b { color: var(--ac); }

.tabs { display: flex; gap: 0.3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button { padding: 0.6rem 0.9rem; color: var(--mut); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.15s; }
.tabs button:hover { color: var(--tx); }
.tabs button.on { color: var(--tx); border-bottom-color: var(--ac); }
.tabs .n { background: var(--ac-soft); color: var(--ac); border-radius: 99px; padding: 0 0.45rem; font-size: 0.75rem; margin-left: 0.3rem; }
.filtros { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.9rem; align-items: center; }
.filtros input[type=search] { width: 16rem; }

/* ───── tablas ───── */
.tabla-w { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.t th { text-align: left; font-weight: 500; color: var(--mut); font-size: 0.8rem; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tbody tr { transition: background 0.15s, box-shadow 0.15s; }
.t tbody tr.cl { cursor: pointer; }
.t tbody tr.cl:hover { background: #121614; box-shadow: inset 2px 0 0 var(--ac-line); }
.t tbody tr.sel { background: #14241a; box-shadow: inset 2px 0 0 var(--ac); }
.t td.r, .t th.r { text-align: right; }
.t .prov b { font-weight: 500; display: block; } .t .prov small { color: var(--mut); font-size: 0.8rem; }
.vacio { padding: 2.5rem 1rem; text-align: center; color: var(--mut); }
.tg { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--line-2); border-radius: 99px; padding: 0.08rem 0.6rem; font-size: 0.8rem; color: var(--tx-2); white-space: nowrap; }
.tg i { width: 0.38rem; height: 0.38rem; border-radius: 50%; background: var(--mut); }
.tg.ok { color: var(--ac); border-color: var(--ac-line); background: var(--ac-soft); } .tg.ok i { background: var(--ac); }
.tg.alta { color: var(--bad); border-color: rgba(255, 93, 93, 0.4); background: rgba(255, 93, 93, 0.08); } .tg.alta i { background: var(--bad); }
.tg.media { color: var(--warn); border-color: rgba(255, 176, 32, 0.4); background: rgba(255, 176, 32, 0.08); } .tg.media i { background: var(--warn); }
.tg.info { color: #8ab4ff; border-color: rgba(138, 180, 255, 0.35); background: rgba(138, 180, 255, 0.08); } .tg.info i { background: #8ab4ff; }
td select { height: 2rem; padding: 0 0.5rem; font-size: 0.88rem; }

/* ───── bloques ───── */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.bloque { padding: 1.1rem 1.2rem; }
.bloque h2 { font-size: 1.05rem; margin-bottom: 0.8rem; letter-spacing: -0.01em; }
.bloque p.ayuda { color: var(--mut); font-size: 0.9rem; margin-bottom: 0.8rem; }
.fila { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: end; }
.propuesta { display: flex; align-items: center; gap: 0.8rem; padding: 0.8rem 1rem; border: 1px solid var(--ac-line); background: var(--ac-soft); border-radius: 0.8rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.propuesta div { flex: 1; min-width: 12rem; } .propuesta small { color: var(--mut); display: block; }
.cuentas { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.cuenta { padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.cuenta b { font-weight: 500; } .cuenta .dir { font-family: var(--mono); font-size: 0.82rem; color: var(--mut); word-break: break-all; }
.subir { border: 1.5px dashed var(--line-2); border-radius: 0.9rem; padding: 1.2rem; text-align: center; color: var(--mut); transition: border-color 0.2s, background 0.2s; }
.subir.on, .subir:hover { border-color: var(--ac); background: var(--ac-soft); color: var(--tx); }
.aviso { border: 1px solid rgba(255, 176, 32, 0.35); background: rgba(255, 176, 32, 0.07); color: var(--tx-2); padding: 0.75rem 1rem; border-radius: 0.8rem; font-size: 0.9rem; margin-bottom: 1rem; }
.lista-al { display: flex; flex-direction: column; gap: 0.5rem; }
.al { display: flex; align-items: center; gap: 0.9rem; padding: 0.8rem 1rem; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.al:hover { background: #121614; border-color: var(--ac-line); }
.al .txt { flex: 1; min-width: 0; } .al small { color: var(--mut); display: block; font-size: 0.82rem; }

/* ───── ventana de detalle ───── */
dialog { margin: auto; padding: 0; border: 1px solid var(--line-2); border-radius: 1.1rem; background: #121213; color: var(--tx); width: min(46rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); box-shadow: 0 2.5rem 6rem rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(61, 255, 110, 0.08); animation: ovin 0.22s var(--ease); overflow: auto; }
dialog::backdrop { background: rgba(0, 0, 0, 0.66); backdrop-filter: blur(3px); }
@keyframes ovin { from { opacity: 0; transform: translateY(0.8rem) scale(0.98); } to { opacity: 1; transform: none; } }
.dlg { padding: 1.4rem 1.5rem 1.2rem; display: flex; flex-direction: column; gap: 1rem; }
.dlg h3 { font-size: 1.25rem; letter-spacing: -0.02em; } .dlg .lead { color: var(--mut); font-size: 0.92rem; margin-top: 0.2rem; }
.dlg .top { display: flex; align-items: flex-start; gap: 0.8rem; justify-content: space-between; }
.nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line-2); border-radius: 0.8rem; overflow: hidden; }
.nums > div { padding: 0.7rem 0.85rem; border-left: 1px solid var(--line-2); } .nums > div:first-child { border-left: 0; }
.nums small { color: var(--mut); font-size: 0.78rem; display: block; } .nums b { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.02em; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.1rem 1.4rem; }
.kv > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.kv span { color: var(--mut); } .kv b { font-weight: 500; text-align: right; word-break: break-word; }
.sec { border: 1px solid var(--line); border-radius: 0.8rem; padding: 0.8rem 0.95rem; display: flex; flex-direction: column; gap: 0.6rem; }
.sec h4 { font-size: 0.82rem; color: var(--mut); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.chk { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--tx-2); }
.chk input { width: 1rem; height: 1rem; accent-color: var(--ac); padding: 0; }
.cufe { font-family: var(--mono); font-size: 0.76rem; color: var(--mut); word-break: break-all; }
ul.pl { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--tx-2); }
ul.pl li::before { content: "•"; color: var(--ac); margin-right: 0.5rem; }
.dlg .pie { display: flex; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; }

#toast { position: fixed; left: 50%; bottom: 1.6rem; transform: translate(-50%, 1rem); background: #1b1b1d; border: 1px solid var(--ac-line); color: var(--tx); padding: 0.7rem 1.1rem; border-radius: 0.8rem; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 99999; max-width: min(34rem, calc(100vw - 2rem)); box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.6); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.err { border-color: rgba(255, 93, 93, 0.5); }

@media (max-width: 62rem) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi:nth-child(3) { border-left: 0; } .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 48rem) {
  html { font-size: 15px; }
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); gap: 0.6rem; padding: 0.7rem; }
  .nav { flex-direction: row; flex-wrap: wrap; } .nav a { height: 2.2rem; padding: 0 0.6rem; } .nav a span.t { display: none; } .nav a.on span.t { display: inline; }
  .yo { margin: 0 0 0 auto; flex-direction: row; align-items: center; } .yo span { display: none; }
  .main { padding: 1rem 1rem 3rem; }
  .nums { grid-template-columns: repeat(2, minmax(0, 1fr)); } .nums > div:nth-child(3) { border-left: 0; }
  .kv { grid-template-columns: 1fr; }
  .filtros input[type=search] { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
