/* Storie Insights · ABMedia — comparte paleta y patrones con Sequence Builder */
:root {
  --bg: #0c0a09; --bg-2: #141110; --panel: #1a1614; --panel-2: #211b18;
  --border: #2b2420; --text: #f4efe9; --muted: #9a8f85; --faint: #6b6258;
  --orange: #ff6a1a; --orange-2: #ff8a3d; --orange-dk: #d4520c;
  --orange-soft: rgba(255,106,26,0.14);
  --green: #6ee79a; --blue: #7cb1ff; --red: #ff6b6e;
  --radius: 14px; --shadow: 0 18px 50px rgba(0,0,0,0.45);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'Poppins', system-ui, sans-serif;
  background: radial-gradient(1200px 800px at 80% -10%, #1c1512 0%, var(--bg) 55%);
  color: var(--text); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }

.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--border);
  padding: 26px 20px; display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { width: 44px; height: 44px; display: grid; place-items: center;
  filter: drop-shadow(0 6px 14px rgba(255,106,26,0.35)); flex-shrink: 0; }
.brand .logo .logo-img { width: 100%; height: 100%; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 17px; font-weight: 800; letter-spacing: -.2px; line-height: 1.1; }
.brand-text small { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { font-size: 14px; color: var(--muted); padding: 11px 13px; border-radius: 10px;
  cursor: pointer; transition: .15s; display: flex; align-items: center; gap: 10px; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--orange-soft); color: var(--orange-2); font-weight: 600; }
.nav-item .ni { width: 20px; height: 20px; flex-shrink: 0; fill: var(--orange-2); stroke: var(--orange-2);
  fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-item .ni rect { fill: var(--orange-2); stroke: none; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.user-mini { display: flex; align-items: center; gap: 10px; font-size: 12px;
  color: var(--muted); padding: 8px 4px; border-top: 1px solid var(--border); }
.user-mini #userEmail { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Botones */
.btn { font-family: inherit; font-size: 14px; font-weight: 600; border: none;
  border-radius: 10px; cursor: pointer; padding: 11px 18px; transition: .15s;
  color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  text-decoration: none; }
.btn.sm { padding: 8px 13px; font-size: 13px; }
.btn.xs { padding: 7px 10px; font-size: 12px; }
.btn.full { width: 100%; }
.btn-primary { background: linear-gradient(135deg, var(--orange-2), var(--orange));
  color: #1a0f08; box-shadow: 0 8px 22px rgba(255,106,26,0.30); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-ghost { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--orange); color: var(--orange-2); }

/* Content */
.content { padding: 30px 36px 48px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.topbar h1 { font-size: 28px; font-weight: 800; letter-spacing: -.4px; }
.topbar p { color: var(--muted); font-size: 14px; margin-top: 6px; }

.pill { font-size: 12px; font-weight: 600; color: var(--orange-2);
  background: var(--orange-soft); padding: 6px 12px; border-radius: 999px; }
.status-select { font-family: inherit; font-size: 13px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; cursor: pointer; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; gap: 14px; }
.empty-state .es-icon { font-size: 56px; }
.empty-state h2 { font-size: 22px; }
.empty-state p { color: var(--muted); font-size: 14px; max-width: 480px; }
.empty-state .es-sub { font-size: 12px; color: var(--faint); margin-top: 8px; }

/* KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 28px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi-lbl { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.kpi-val { font-size: 28px; font-weight: 800; color: var(--orange-2); letter-spacing: -.5px; }

/* Secciones */
.section { margin-bottom: 32px; }
.sect-h { font-size: 15px; font-weight: 700; margin-bottom: 14px; color: var(--text); }

/* Categorías breakdown */
.cat-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.cat-stat { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.cat-stat .name { font-size: 14px; font-weight: 700; color: var(--orange-2); margin-bottom: 10px; }
.cat-stat .rows { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.cat-stat .row { display: flex; justify-content: space-between; color: var(--muted); }
.cat-stat .row strong { color: var(--text); }

/* Lista de secuencias */
.seq-list { display: flex; flex-direction: column; gap: 8px; }
.seq-row { display: grid; grid-template-columns: 1fr 90px 90px 90px 60px;
  align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 18px; transition: .15s; }
.seq-row:hover { border-color: var(--orange); }
.seq-row .title { font-weight: 600; font-size: 14px; }
.seq-row .cat { font-size: 11px; color: var(--orange-2); text-transform: uppercase; font-weight: 700; }
.seq-row .metric { text-align: right; font-size: 13px; color: var(--text); }
.seq-row .metric small { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .5px; }
.seq-row .rank { font-size: 18px; font-weight: 800; color: var(--orange); text-align: center; }

/* Stories del día */
.story-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.story-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; }
.story-thumb { aspect-ratio: 9/16; background: #15110d; object-fit: cover; width: 100%; }
.story-meta { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.story-meta .time { font-size: 11px; color: var(--muted); }
.story-meta .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; }
.story-meta .stat { font-size: 11px; color: var(--muted); }
.story-meta .stat b { color: var(--orange-2); font-size: 13px; display: block; }
.completion-bar { height: 4px; background: var(--panel-2); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.completion-bar .fill { height: 100%; background: linear-gradient(90deg, var(--orange), var(--orange-2)); }

/* Histórico */
.history-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.hist-block { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.hist-block h3 { font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.chart-box { min-height: 200px; display: flex; align-items: end; gap: 4px; padding: 10px 0; }
.chart-bar { flex: 1; background: linear-gradient(180deg, var(--orange-2), var(--orange));
  border-radius: 4px 4px 0 0; min-height: 4px; position: relative; }
.chart-bar:hover::after { content: attr(data-v); position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%); background: var(--bg-2); color: var(--orange-2); font-size: 11px;
  padding: 3px 8px; border-radius: 6px; white-space: nowrap; border: 1px solid var(--border); }

/* Conexiones */
.conn-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 24px; }
.conn-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px;
  display: flex; flex-direction: column; gap: 10px; }
.conn-card .ig { display: flex; align-items: center; gap: 12px; }
.conn-card .ig-icon { width: 36px; height: 36px; background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  border-radius: 10px; display: grid; place-items: center; color: white; font-weight: 800; }
.conn-card .username { font-weight: 700; font-size: 15px; }
.conn-card .since { font-size: 11px; color: var(--muted); }
.conn-card .actions { display: flex; gap: 8px; margin-top: 8px; }

.info-block { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.info-block h3 { font-size: 14px; margin-bottom: 10px; color: var(--orange-2); }
.info-block ul { list-style: none; padding: 0; }
.info-block li { padding: 6px 0; padding-left: 22px; position: relative; color: var(--muted); font-size: 13px; line-height: 1.5; }
.info-block li::before { content: "•"; position: absolute; left: 6px; top: 6px; color: var(--orange); font-weight: 800; }

/* AI Insights */
.insight-list { display: flex; flex-direction: column; gap: 10px; }
.insight { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px;
  border-left: 3px solid var(--orange); }
.insight .ic { color: var(--orange-2); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.insight p { margin-top: 6px; font-size: 14px; line-height: 1.5; }

/* Login */
.login { position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(900px 600px at 70% -10%, #1c1410 0%, var(--bg) 65%); z-index: 100; padding: 20px; }
.login-box { width: min(420px, 92vw); background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px; }
.login-brand { margin-bottom: 4px; }
.login-box h2 { font-size: 22px; }
.login-sub { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.login-err { color: #ff6b6e; font-size: 12.5px; min-height: 16px; margin: -4px 0 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 12px; color: var(--muted); }
.field input { font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; }
.field input:focus { outline: none; border-color: var(--orange); }

@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 14px; padding: 16px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .history-grid { grid-template-columns: 1fr; }
  .seq-row { grid-template-columns: 1fr 70px 70px; }
  .seq-row .metric:nth-child(4), .seq-row .rank { display: none; }
}
