/* MultiPublisher — panel de control interno
   Tokens: fondo grafito, panel pizarra, acento ámbar "al aire",
   estados con punto-señal (la firma visual del tablero). */
:root {
  --bg: #101318;
  --panel: #171c24;
  --panel-2: #1d242e;
  --line: #2a3340;
  --text: #e8ecf1;
  --muted: #8b97a5;
  --accent: #f0a832;        /* señal "al aire" */
  --accent-ink: #1a1205;
  --ok: #41c97a;
  --warn: #f0a832;
  --err: #ee5d5d;
  --info: #5aa7e8;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-size: 0.86em; }
.muted { color: var(--muted); }
.center { text-align: center; }
.error { color: var(--err); }
.dim { opacity: 0.45; }

/* ---- layout ---- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; padding: 20px 14px;
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh;
}
.brand { font-weight: 700; letter-spacing: 0.2px; display: flex; align-items: center; gap: 8px; }
.brand.big { font-size: 1.3rem; justify-content: center; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px 1px color-mix(in srgb, var(--accent) 70%, transparent);
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  color: var(--muted); padding: 9px 12px; border-radius: 8px; font-weight: 500;
}
.sidebar nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.sidebar nav a.on {
  color: var(--text); background: var(--panel-2);
  box-shadow: inset 3px 0 0 var(--accent);
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.me { font-size: 0.9rem; }
.me .role {
  margin-left: 6px; font-size: 0.7rem; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--line);
  border-radius: 99px; padding: 1px 7px;
}
.content { flex: 1; padding: 26px 32px; max-width: 1200px; }

/* ---- cabecera de página ---- */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 18px; flex-wrap: wrap;
}
.page-head h1 { font-size: 1.35rem; margin: 0; }
.head-actions { display: flex; gap: 10px; align-items: center; }

/* ---- panels y tablas ---- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 18px; overflow: hidden;
}
.panel.pad { padding: 18px 20px; }
.panel h3 { margin: 0 0 10px; font-size: 1rem; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th {
  text-align: left; padding: 10px 14px; color: var(--muted);
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 1px solid var(--line);
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--panel-2); }
.row-actions { white-space: nowrap; text-align: right; }

/* ---- chips de estado (firma del tablero) ---- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 600;
  border: 1px solid var(--line); background: var(--panel-2);
}
.chip::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
.chip.scheduled  { color: var(--info); }
.chip.queued     { color: var(--muted); }
.chip.uploading,
.chip.processing { color: var(--warn); }
.chip.uploading::before,
.chip.processing::before { animation: pulse 1.1s ease-in-out infinite; }
.chip.published,
.chip.active     { color: var(--ok); }
.chip.failed     { color: var(--err); }
.chip.cancelled,
.chip.revoked,
.chip.expired    { color: var(--muted); }
.chip.mock       { color: var(--accent); }
@keyframes pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) {
  .chip::before { animation: none !important; }
}

.pbadge {
  font-size: 0.78rem; font-weight: 700; padding: 2px 9px;
  border-radius: 6px; border: 1px solid var(--line);
}
.pbadge.tiktok  { color: #6be3dc; }
.pbadge.youtube { color: #ff7d7d; }
.pbadge.meta    { color: #7ea8ff; }

/* ---- stats ---- */
.stats-row { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 18px; min-width: 110px;
}
.stat-num { font-size: 1.5rem; font-weight: 700; display: block; font-family: var(--mono); }
.stat-label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; }

/* ---- formularios ---- */
.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 5px; font-size: 0.86rem; color: var(--muted); }
.input, select.input, textarea.input {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px 12px; font: inherit;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.input.wide { width: 100%; }
textarea.input { resize: vertical; }
.btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 0.82rem; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.danger { color: var(--err); }

.form-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; }
.form-grid h3 { margin-top: 18px; }
.form-grid h3:first-child { margin-top: 0; }
.when-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.radio, .check { display: flex; gap: 7px; align-items: center; cursor: pointer; }
.account-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 6px; }
.acc-group { display: flex; flex-direction: column; gap: 7px; }
.connect-row { display: flex; gap: 10px; flex-wrap: wrap; }
.connect-row .input { flex: 1; min-width: 160px; }
.connect-row.wrap .input { min-width: 140px; }

/* ---- subida ---- */
.upload-zone {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 26px; text-align: center; transition: border-color 0.15s, background 0.15s;
}
.upload-zone.over { border-color: var(--accent); background: var(--panel-2); }
.progress {
  margin: 14px auto 0; max-width: 420px; height: 18px; position: relative;
  background: var(--panel-2); border-radius: 99px; overflow: hidden;
  border: 1px solid var(--line);
}
.progress .bar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.progress span {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 0.72rem; font-family: var(--mono);
}

/* ---- login ---- */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  width: min(380px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 30px; display: flex; flex-direction: column; gap: 10px;
}

/* ---- dialog / logs / toast ---- */
.dlg {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 14px; width: min(680px, 94vw); padding: 20px;
}
.dlg::backdrop { background: rgba(0,0,0,0.6); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.dlg-head h2 { margin: 0; font-size: 1.05rem; }
.kv { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; font-size: 0.92rem; }
.kv b { color: var(--muted); font-weight: 600; margin-right: 6px; }
.log-list {
  max-height: 320px; overflow: auto; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); font-size: 0.85rem;
}
.log-row {
  display: grid; grid-template-columns: 150px 150px 1fr; gap: 10px;
  padding: 7px 12px; border-bottom: 1px solid var(--line);
}
.log-row:last-child { border-bottom: none; }
.log-row.warn .log-event { color: var(--warn); }
.log-row.error .log-event { color: var(--err); }
.log-time { color: var(--muted); }
.log-event { font-weight: 600; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 11px 20px; border-radius: 10px; font-weight: 600; z-index: 50;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.toast.err { border-color: var(--err); color: var(--err); }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row;
             align-items: center; flex-wrap: wrap; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .content { padding: 18px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .log-row { grid-template-columns: 1fr; gap: 2px; }
}
