/* ============================================================
   Redes — tema oscuro moderno (base reutilizada de Tareas):
   gradiente rojo→violeta, paneles "glass", animaciones.
   ============================================================ */
:root {
  --bg: #0b0e1a;
  --bg-2: #0f1322;
  --panel: rgba(26, 31, 53, 0.72);
  --panel-solid: #1a1f35;
  --panel-2: #12162a;
  --border: #2a3152;
  --border-soft: rgba(99, 118, 190, 0.18);
  --text: #eef0ff;
  --muted: #98a2c8;
  --accent: #e11d48;
  --accent-2: #fb7185;
  --violet: #8b5cf6;
  --grad: linear-gradient(135deg, #e11d48 0%, #8b5cf6 100%);
  --danger: #f43f5e;
  --ok: #34d399;
  --warn: #fbbf24;
  --info: #60a5fa;
  --shadow: 0 10px 32px rgba(3, 6, 20, 0.45);
  --r: 14px;
}
:root[data-theme="light"] {
  --bg: #f5f4fb;
  --bg-2: #ffffff;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-solid: #ffffff;
  --panel-2: #f0eff8;
  --border: #dcdaf0;
  --border-soft: rgba(120, 90, 190, 0.16);
  --text: #1a1a33;
  --muted: #5f6385;
  --shadow: 0 10px 32px rgba(60, 30, 90, 0.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(139, 92, 246, 0.14), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, rgba(225, 29, 72, 0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Inter", system-ui, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s, color 0.25s;
}
:root[data-theme="light"] body {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(139, 92, 246, 0.08), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, rgba(225, 29, 72, 0.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
:root[data-theme="light"] .topbar { background: rgba(245, 244, 251, 0.8); }
:root[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c9c6e2; }
:root[data-theme="light"] .modal-wrap { background: rgba(40, 30, 90, 0.35); }
:root[data-theme="light"] .drop { background: rgba(255, 255, 255, 0.6); }
:root[data-theme="light"] pre.code { background: #f0eff8; }
.hidden { display: none !important; }
button { font-family: inherit; }
a { color: var(--accent-2); }
::selection { background: rgba(225, 29, 72, 0.35); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3152; border-radius: 8px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes pulse { 50% { opacity: 0.45; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Botones ---------- */
.btn {
  border: 1px solid var(--border); background: var(--panel-solid); color: var(--text);
  border-radius: 11px; padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  transition: border-color 0.18s, transform 0.12s, box-shadow 0.18s, background 0.18s;
}
.btn:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 4px 18px rgba(225, 29, 72, 0.35); }
.btn.primary:hover { box-shadow: 0 6px 24px rgba(225, 29, 72, 0.5); filter: brightness(1.08); }
.btn.danger { background: transparent; border-color: rgba(244, 63, 94, 0.5); color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: rgba(244, 63, 94, 0.08); }
.btn.ghost { background: transparent; border-color: var(--border-soft); }
.btn.wide { width: 100%; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.icon-btn { padding: 9px 11px; }

/* ---------- Formularios ---------- */
input, select, textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 11px; padding: 10px 13px; font-size: 14px; font-family: inherit;
  transition: border-color 0.18s, box-shadow 0.18s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.18); }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 13px 0 5px; font-weight: 500; }
label.inline { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 14px; cursor: pointer; }
textarea { resize: vertical; min-height: 90px; }
.msg { min-height: 18px; font-size: 13px; color: var(--muted); text-align: center; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* ---------- Conexión ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card {
  width: 100%; max-width: 390px; background: var(--panel); backdrop-filter: blur(18px);
  border: 1px solid var(--border-soft); border-radius: 20px; padding: 34px 30px; box-shadow: var(--shadow);
  animation: pop 0.4s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.brand { font-size: 23px; font-weight: 800; text-align: center; letter-spacing: -0.4px; }
.brand .logo {
  display: inline-grid; place-items: center; width: 36px; height: 36px; background: var(--grad); color: #fff;
  border-radius: 11px; vertical-align: -8px; margin-right: 6px; box-shadow: 0 4px 14px rgba(225, 29, 72, 0.45);
}
.brand .logo svg { width: 20px; height: 20px; fill: #fff; }
.brand.small { font-size: 17px; }
.brand.small .logo { width: 28px; height: 28px; vertical-align: -7px; border-radius: 9px; }
.brand.small .logo svg { width: 15px; height: 15px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 8px 0 20px; }
.auth-card .locked {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 11px; padding: 9px 13px; font-size: 14px;
  color: var(--muted); display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px;
}
.auth-card .locked a { color: var(--accent-2); font-size: 12.5px; text-decoration: none; cursor: pointer; }
.auth-card .btn { margin-top: 16px; }

/* ---------- Estructura ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 11px 18px; border-bottom: 1px solid var(--border-soft);
  background: rgba(11, 14, 26, 0.75); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 20;
}
.topbar .spacer { flex: 1; }
.top-actions { display: flex; gap: 8px; }
.layout { display: flex; min-height: calc(100vh - 59px); }
.sidebar { width: 236px; flex-shrink: 0; border-right: 1px solid var(--border-soft); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%; background: transparent; border: 1px solid transparent; color: var(--text);
  padding: 9px 13px; border-radius: 11px; font-size: 14px; cursor: pointer; text-align: left; font-weight: 500;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.nav-item:hover { background: rgba(225, 29, 72, 0.08); transform: translateX(2px); }
.nav-item.active { background: linear-gradient(135deg, rgba(225, 29, 72, 0.16), rgba(139, 92, 246, 0.14)); border-color: rgba(251, 113, 133, 0.35); }
.nav-item .count { margin-left: auto; color: var(--muted); font-size: 11.5px; font-weight: 600; background: rgba(99, 118, 190, 0.14); border-radius: 999px; padding: 1px 8px; min-width: 14px; text-align: center; }
.nav-item .count:empty { display: none; }
.side-foot { margin-top: auto; }
#main { flex: 1; padding: 22px 24px; overflow-x: auto; min-width: 0; }
.view { animation: fadeUp 0.3s both; max-width: 1100px; }
.view-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.view-head h1 { font-size: 21px; margin: 0; display: flex; align-items: center; gap: 10px; letter-spacing: -0.3px; }
.view-head .spacer { flex: 1; }
.view-head .sub { color: var(--muted); font-size: 13px; }
h2.sec { font-size: 15px; margin: 26px 0 10px; display: flex; align-items: center; gap: 8px; }
h2.sec:first-child { margin-top: 0; }
p.lead { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 0 14px; }

/* ---------- Paneles y tarjetas ---------- */
.panel { background: var(--panel); backdrop-filter: blur(12px); border: 1px solid var(--border-soft); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.vcard {
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: 12px; padding: 14px 15px;
  display: flex; flex-direction: column; gap: 8px; animation: fadeUp 0.3s both; transition: transform 0.15s, border-color 0.15s;
}
.vcard:hover { border-color: rgba(251, 113, 133, 0.45); transform: translateY(-2px); }
.vcard .t { font-weight: 600; font-size: 14px; line-height: 1.4; word-break: break-word; display: flex; align-items: center; gap: 8px; }
.vcard .t svg { flex: none; color: var(--accent-2); }
.vcard .meta { color: var(--muted); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.vcard .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.vcard .err { color: var(--danger); font-size: 12.5px; }
.vcard .note { color: var(--warn); font-size: 12.5px; }
.vcard a.link { font-size: 13px; font-weight: 600; word-break: break-all; }
.empty { color: var(--muted); text-align: center; padding: 46px 10px; font-size: 14px; }
.empty .big { display: block; margin-bottom: 10px; }
.empty .big svg { width: 46px; height: 46px; opacity: 0.45; }

/* Chips de estado */
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.2px; border: 1px solid transparent; }
.chip.ready, .chip.done { background: rgba(52, 211, 153, 0.14); color: var(--ok); border-color: rgba(52, 211, 153, 0.3); }
.chip.downloading, .chip.uploading, .chip.queued { background: rgba(96, 165, 250, 0.14); color: var(--info); border-color: rgba(96, 165, 250, 0.3); }
.chip.uploading, .chip.downloading { animation: pulse 1.4s infinite; }
.chip.error { background: rgba(244, 63, 94, 0.14); color: var(--danger); border-color: rgba(244, 63, 94, 0.3); }
.chip.cancelled, .chip.published, .chip.expired { background: rgba(152, 162, 200, 0.14); color: var(--muted); border-color: rgba(152, 162, 200, 0.3); }
.chip.warn { background: rgba(251, 191, 36, 0.14); color: var(--warn); border-color: rgba(251, 191, 36, 0.3); }

/* Barras de progreso */
.bar { height: 8px; background: rgba(99, 118, 190, 0.18); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--grad); border-radius: 999px; transition: width 0.4s; }
.bar.warn > i { background: var(--warn); }
.bar.danger > i { background: var(--danger); }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.bar-row .bar { flex: 1; }

/* Zona de subida */
.drop {
  border: 2px dashed var(--border); border-radius: var(--r); padding: 30px 20px; text-align: center; cursor: pointer;
  background: rgba(18, 22, 42, 0.45); transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.over { border-color: var(--accent-2); background: rgba(225, 29, 72, 0.06); }
.drop svg { width: 38px; height: 38px; color: var(--accent-2); margin-bottom: 8px; }
.drop b { display: block; font-size: 15px; }
.drop span { color: var(--muted); font-size: 13px; }
.drop input { display: none; }
.url-row { display: flex; gap: 8px; margin-top: 12px; }
.url-row input { flex: 1; }
.url-row .btn { flex: none; }

/* Aviso */
.banner { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.55; border: 1px solid; margin-bottom: 16px; }
.banner svg { flex: none; margin-top: 2px; }
.banner.warn { background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.35); color: var(--text); }
.banner.info { background: rgba(96, 165, 250, 0.1); border-color: rgba(96, 165, 250, 0.35); }
.banner.danger { background: rgba(244, 63, 94, 0.1); border-color: rgba(244, 63, 94, 0.35); }

/* Cuentas */
.acc-card { display: flex; align-items: center; gap: 14px; background: var(--panel-solid); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.acc-card img, .acc-card .avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: var(--grad); display: grid; place-items: center; color: #fff; flex: none; }
.acc-card .info { flex: 1; min-width: 0; }
.acc-card .info b { display: block; font-size: 15px; }
.acc-card .info span { color: var(--muted); font-size: 12.5px; }
.prov-logo { width: 40px; height: 40px; border-radius: 10px; background: #ff0000; color: #fff; display: grid; place-items: center; flex: none; }

/* Código / claves */
pre.code {
  background: #0a0d18; border: 1px solid var(--border); border-radius: 11px; padding: 12px 14px; font-size: 12.5px; overflow-x: auto;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; color: var(--text); margin: 8px 0; white-space: pre; line-height: 1.55;
}
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row pre { flex: 1; margin: 0; }
.key-full { font-family: ui-monospace, Consolas, monospace; font-size: 14px; word-break: break-all; background: var(--panel-2); border: 1px dashed var(--accent-2); border-radius: 11px; padding: 12px; }
.krow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.krow:last-child { border-bottom: 0; }
.krow code { font-family: ui-monospace, Consolas, monospace; color: var(--accent-2); }
.krow .muted { color: var(--muted); font-size: 12px; }
.krow .spacer { flex: 1; }
ol.steps { padding-left: 20px; line-height: 1.7; font-size: 14px; }
ol.steps li { margin: 4px 0; }

/* Tabla */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.6px; padding: 8px 10px; border-bottom: 1px solid var(--border-soft); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }

/* ---------- Modales ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(4, 6, 16, 0.7); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 50; padding: 18px; overflow-y: auto; }
.modal-card {
  width: 100%; max-width: 580px; background: var(--panel-solid); border: 1px solid var(--border); border-radius: 18px; padding: 26px;
  max-height: calc(100vh - 60px); overflow-y: auto; box-shadow: var(--shadow); animation: pop 0.28s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.modal-card h2 { margin: 0 0 6px; font-size: 18px; display: flex; align-items: center; gap: 8px; letter-spacing: -0.2px; }
.modal-card h2 .x { margin-left: auto; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; justify-content: flex-end; align-items: center; }
.modal-actions .left { margin-right: auto; }
.mini { border: 1px solid transparent; background: transparent; color: var(--muted); width: 28px; height: 28px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; transition: all 0.15s; flex-shrink: 0; }
.mini:hover { color: var(--text); background: rgba(251, 113, 133, 0.12); }
.counter { float: right; font-weight: 400; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--panel-solid); border: 1px solid rgba(251, 113, 133, 0.5);
  color: var(--text); border-radius: 12px; padding: 12px 22px; font-size: 14px; font-weight: 500; z-index: 100; box-shadow: 0 10px 36px rgba(3, 6, 20, 0.6);
  animation: slideIn 0.3s cubic-bezier(0.2, 0.7, 0.3, 1) both; max-width: min(90vw, 520px);
}
.toast.err { border-color: var(--danger); }

/* ---------- Iconos ---------- */
svg.lucide { width: 1.05em; height: 1.05em; vertical-align: -0.18em; display: inline-block; flex: none; }
.nav-item svg.lucide { width: 1.15em; height: 1.15em; }
.mini svg.lucide, .icon-btn svg.lucide { margin: 0; }
.spin { animation: spin 1s linear infinite; }

/* ---------- Móvil ---------- */
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border-soft); padding: 10px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin: 0; }
  .nav-item .name { font-size: 13px; }
  #main { padding: 16px 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .url-row { flex-direction: column; }
}
