:root {
    --orange: #FF8800;
    --orange-d: #e07700;
    --bg: #0f1115;
    --panel: #181b22;
    --panel-2: #1f232c;
    --line: #2a2f3a;
    --text: #e8eaed;
    --muted: #9aa0aa;
}
* { box-sizing: border-box; }
/* El atributo [hidden] debe ganar siempre, incluso sobre display:flex/grid. */
[hidden] { display: none !important; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Login ---------- */
.login {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 30% 20%, #20242e 0%, #0c0e12 70%);
}
.login-card {
    background: var(--panel); padding: 40px 34px; border-radius: 16px;
    width: 360px; max-width: 90%; text-align: center;
    box-shadow: 0 24px 70px rgba(0,0,0,.55); border: 1px solid var(--line);
}
.login-logo { font-size: 30px; font-weight: 800; letter-spacing: 1.5px; color: var(--orange); margin: 0 0 4px; }
.login-sub { color: var(--muted); font-size: 14px; margin: 0 0 26px; }
.btn-google {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
    background: #fff; color: #222; border: none; border-radius: 10px;
    padding: 12px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-google:hover { background: #f1f1f1; }
.login-msg { color: #ff6b6b; font-size: 13px; min-height: 18px; margin: 16px 0 0; }

/* ---------- Topbar ---------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; font-size: 18px; letter-spacing: .5px; }
.brand em { color: var(--orange); font-style: normal; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-email { color: var(--muted); font-size: 13px; margin-right: 6px; }
.btn-primary, .btn-ghost {
    border-radius: 8px; padding: 9px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer;
    border: 1px solid var(--line);
}
.btn-primary { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-primary:hover { background: var(--orange-d); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--panel-2); }

/* ---------- Content ---------- */
.content { padding: 24px; max-width: 1400px; margin: 0 auto; }
.loading, .error { padding: 40px; text-align: center; color: var(--muted); }
.error { color: #ff8a8a; }
.section-h { font-size: 16px; margin: 30px 0 14px; font-weight: 700; }
.pill { background: var(--panel-2); color: var(--muted); font-size: 12px; padding: 2px 9px; border-radius: 999px; margin-left: 6px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi {
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px;
}
.kpi .v { font-size: 30px; font-weight: 800; color: #fff; }
.kpi .l { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.kpi.accent .v { color: var(--orange); }

/* Cards / charts */
.card {
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
}
.card h3 { margin: 0 0 12px; font-size: 13.5px; font-weight: 600; color: var(--text); }
.card canvas { max-height: 240px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* Tables */
.table-card { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: var(--panel-2); position: sticky; top: 0; }
td { color: var(--text); }
tr:hover td { background: var(--panel-2); }
.empty { padding: 24px; text-align: center; color: var(--muted); }

/* Opiniones y conversaciones */
.op-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
.op-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.op-meta { color: var(--muted); font-size: 11.5px; margin-bottom: 10px; letter-spacing: .3px; }
.op-block { margin-bottom: 12px; }
.op-tag {
    display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; color: #9ad0ff; background: rgba(58,160,255,.12);
    padding: 3px 9px; border-radius: 999px; margin-bottom: 8px;
}
.op-tag--exp { color: var(--orange); background: rgba(255,136,0,.14); }
.op-q { margin: 4px 0; color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.45; }
.op-a { margin: 4px 0 10px; color: var(--muted); font-size: 13.5px; line-height: 1.5;
    border-left: 2px solid var(--line); padding-left: 10px; }
