/* ====== THEMES (light/dark) ====== */
:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --card: #ffffff;
  --border: #e8e8ef;
  --fg: #1d2233;
  --muted: #717a8c;
  --primary: #7367f0;        /* indigo/purple */
  --primary-2: #7c8cfb;
  --ghost: #f1f3fb;
  --ok: #28c76f;
  --danger: #ea5455;
  --focus: rgba(115,103,240,.35);
  --shadow: 0 8px 24px rgba(27, 31, 59, .08);
}

html[data-theme="dark"] {
  --bg:#0b1020;
  --panel:#0f1529;
  --card:#111629;
  --border:#20263a;
  --fg:#e6e8f2;
  --muted:#a8b0c5;
  --primary:#8b7bff;
  --primary-2:#a49bff;
  --ghost:#1b2337;
  --ok:#39d39f;
  --danger:#ff5d7a;
  --focus:rgba(108,160,255,.25);
  --shadow: 0 8px 24px rgba(0,0,0,.25);
}

/* ====== BASE ====== */
*{box-sizing:border-box} html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--fg);font:400 15px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Inter,Helvetica,Arial}

/* ====== SIDEBAR ====== */
.sidebar{
  position:fixed;inset:0 auto 0 0;width:280px;background:var(--panel);
  border-right:1px solid var(--border);display:flex;flex-direction:column;padding:18px;gap:16px;
}
.brand{display:flex;gap:12px;align-items:center}
.logo{width:36px;height:36px}
.brand-title{font-weight:700}
.brand-sub{font-size:12px;color:var(--muted)}

.tabs{display:flex;gap:8px}
.tab{
  flex:1;border:1px solid var(--border);background:var(--ghost);color:inherit;border-radius:10px;padding:10px;
  cursor:pointer;transition:all .15s ease;box-shadow:var(--shadow);
}
.tab.active{border-color:var(--primary);outline:2px solid var(--focus);background:linear-gradient(180deg,var(--ghost),#fff00);}

.side-title{font-size:13px;color:var(--muted);margin:6px 0}
.side-list{border:1px dashed var(--border);border-radius:12px;padding:12px;min-height:48px;background:var(--panel)}
.spacer{flex:1}
.side-foot{display:flex;justify-content:space-between;gap:8px}
.btn{
  border:1px solid var(--border);background:var(--panel);color:inherit;border-radius:10px;padding:10px 14px;cursor:pointer;
  transition:box-shadow .15s ease, transform .05s ease; box-shadow:var(--shadow);
}
.btn:hover{transform:translateY(-1px)}
.btn-primary{border-color:var(--primary);background:linear-gradient(180deg,var(--primary),var(--primary-2));color:#fff}
.btn-ghost{background:transparent;border-style:dashed}
.btn:focus{outline:none;box-shadow:0 0 0 4px var(--focus)}
.input, select{
  width:100%;padding:10px;border-radius:10px;border:1px solid var(--border);background:#fff;color:inherit
}
html[data-theme="dark"] .input, html[data-theme="dark"] select{background:#0e1426;color:#fff}
.label{display:block;margin:6px 0 6px 2px;color:var(--muted)}
.alert{border:1px solid var(--danger);background:rgba(234,84,85,.08);color:inherit;border-radius:10px;padding:10px;margin:10px 0}

/* ====== MAIN + TOPBAR ====== */
.main{margin-left:280px;min-height:100%;display:flex;flex-direction:column}
.topbar{
  position:sticky;top:0;z-index:6;border-bottom:1px solid var(--border);
  background:var(--panel);display:flex;align-items:center;justify-content:space-between;padding:14px 18px;box-shadow:var(--shadow)
}
.top-title{font-weight:700}
.top-actions{display:flex;gap:12px;align-items:center}
.searchbox{display:flex;gap:8px;align-items:center}
.searchbox input{
  width:360px;max-width:56vw;padding:10px 12px;border-radius:10px;border:1px solid var(--border);
  background:var(--ghost);
}
html[data-theme="dark"] .searchbox input{background:#0e1426;color:#fff}

/* ====== TOOLBAR ====== */
.toolbar{position:sticky;top:64px;background:linear-gradient(180deg,rgba(255,255,255,.97),rgba(255,255,255,.94));z-index:5;border-bottom:1px solid var(--border)}
html[data-theme="dark"] .toolbar{background:linear-gradient(180deg,rgba(11,16,32,.95),rgba(11,16,32,.9))}
.filters{display:flex;gap:12px;flex-wrap:wrap;align-items:flex-end;padding:12px 18px}
.filter{min-width:160px}
.filter.grow{flex:1}
.row{display:flex;gap:8px}
.actions{display:flex;gap:8px;margin-left:auto}

/* ====== GRID & CARDS ====== */
.grid{display:grid;gap:16px;padding:30px 0px;grid-template-columns:repeat(4,1fr)}
@media (max-width:1200px){.grid{grid-template-columns:repeat(3,1fr)}}
@media (max-width:900px){.grid{grid-template-columns:repeat(2,1fr)}}
@media (max-width:620px){
  .sidebar{position:static;width:auto;border-right:0}
  .main{margin-left:0}
  .topbar{position:static}
  .toolbar{top:0}
  .grid{grid-template-columns:1fr}
}

.card{
  background:var(--card);border:1px solid var(--border);border-radius:16px;overflow:hidden;box-shadow:var(--shadow);
  transition:transform .06s ease, box-shadow .2s ease;
}
.card:hover{transform:translateY(-2px)}
.card .thumb{width:100%;aspect-ratio:16/9;object-fit:cover;background:#eef1f7}
html[data-theme="dark"] .card .thumb{background:#0c1224}
.card .meta{padding:12px}
.card .title{font-weight:700;margin:2px 0 6px}
.card .sub{font-size:12px;color:var(--muted)}
.badges{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.badge{border:1px solid var(--border);border-radius:999px;padding:4px 8px;font-size:12px;background:var(--ghost)}
.row-btns{display:flex;gap:8px;margin-top:10px}
.kpi{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.kpi .tag{font-size:12px;border:1px solid var(--border);border-radius:8px;padding:4px 6px;background:var(--ghost)}

.loadmore{display:flex;justify-content:center;padding:12px}

@keyframes pulse{0%{opacity:.6}50%{opacity:.3}100%{opacity:.6}}

/* Contenedor centrado con aire */
.container{
  width:100%;
  max-width:90%;
  margin:40px auto;      /* antes 24px */
  padding:0 10px;        /* antes 20px */
}

/* Card genérica + card de filtros */
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow);
  transition:transform .06s ease, box-shadow .2s ease;
}
.card:hover{ transform:translateY(-1px); }

.filter-card{
  padding:12px;          /* antes 16px 16px 12px */
  margin-bottom:12px;    /* antes 18px */
  box-shadow:0 2px 8px rgba(0,0,0,.05);
}
.filter-title{ margin:4px 6px 10px; color:var(--muted); font-weight:600 }

/* Filtros “pill” */
.filters{display:flex;gap:14px;flex-wrap:wrap;align-items:flex-end}
.filter{min-width:180px}
.filter.grow{flex:1}
.row{display:flex;gap:8px}

input[type="text"], input[type="number"], input[type="datetime-local"], select{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--ghost);
  color:inherit;
  box-shadow:var(--shadow);
  outline:none;
}
input:focus, select:focus{
  box-shadow:0 0 0 4px var(--focus);
  border-color:var(--primary);
  background:#fff;
}
html[data-theme="dark"] input, html[data-theme="dark"] select{
  background:#0e1426; color:#fff;
}

/* Buscador top “chip” */
.searchbox input{
  height:40px;
  border-radius:999px;
  background:var(--ghost);
  border:1px solid var(--border);
  padding:0 14px;
}

/* Grid con más separación */
.grid{
  display:grid;
  gap:18px;
  grid-template-columns:repeat(4,1fr);
}
@media (max-width:1200px){.grid{grid-template-columns:repeat(3,1fr)}}
@media (max-width:900px){.grid{grid-template-columns:repeat(2,1fr)}}
@media (max-width:620px){.grid{grid-template-columns:1fr}}



/* Variante canal */
.avatar{
  width:44px; height:44px; border-radius:50%; border:1px solid var(--border);
  background:var(--ghost); object-fit:cover
}

/* Pequeños helpers */
.dot::before{ content:"•"; margin:0 6px; color:var(--border) }

/* ===== Tarjetas minimal ===== */
.card.item {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: transform .08s ease, box-shadow .2s ease;
}
.card.item:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(27,31,59,.10); }

.item-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--ghost); }

.item-body { padding: 12px 12px 14px; display: grid; gap: 8px; }
.item-title {
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--title-color);
}

/* Definir el color según el tema */
html[data-theme="light"] {
  --title-color: #000000;
}
html[data-theme="dark"] {
  --title-color: #ffffff;
}
.item-meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.item-meta .dot::before { content:"•"; color: var(--border); margin: 0 6px; }

.item-stats { display: grid; grid-auto-flow: column; gap: 8px; align-items: center; }
.stat {
  font-size: 12px; padding: 6px 8px; border-radius: 10px;
  background: var(--ghost); border: 1px solid var(--border);
}
.stat--primary { border-color: var(--primary); }

.item-actions { display: flex; gap: 8px; }
.btn-sm { padding: 7px 10px; border-radius: 10px; }
.btn-plain { background: transparent; border-style: dashed; }

.card.item.channel .item-head { display: flex; gap: 10px; align-items: center; padding: 12px 12px 0; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); background: var(--ghost); }
