/* Panel Maneja Nica — barra lateral oscura, tarjetas claras, modo oscuro y móvil. */
:root {
  --bg: #f3f5fa; --card: #ffffff; --text: #18213a; --muted: #6c7590; --line: #e5e9f2; --soft: #f6f8fc;
  --side: #0b1a3d; --side-2: #12244f; --side-text: #aab6d3; --side-active: #ffffff;
  --primary: #1f5fd6; --primary-2: #00a5bf; --primary-ink: #ffffff; --ring: rgba(31, 95, 214, .18);
  --ok: #1e8e4a; --ok-bg: rgba(30, 142, 74, .12); --bad: #d23b3b; --bad-bg: rgba(210, 59, 59, .1);
  --warn: #e0a100; --radius: 16px; --shadow: 0 1px 2px rgba(16, 24, 48, .05), 0 6px 20px rgba(16, 24, 48, .06);
  --side-w: 264px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1220; --card: #151c2e; --text: #e6ebf5; --muted: #8e98b3; --line: #232d44; --soft: #1a2236;
    --side: #080d1a; --side-2: #0f1730; --primary: #4d8bff; --primary-2: #2cc6dc; --ring: rgba(77, 139, 255, .25);
    --ok-bg: rgba(46, 182, 99, .15); --bad-bg: rgba(240, 90, 90, .14); --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .9rem; }
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .88em; }
code { background: var(--soft); border: 1px solid var(--line); padding: 2px 7px; border-radius: 7px; word-break: break-all; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.bad { color: var(--bad); font-weight: 700; }
.ico { flex: none; }

/* ---------- Estructura: barra lateral + contenido ---------- */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 30;
  background: linear-gradient(180deg, var(--side) 0%, var(--side-2) 100%); color: var(--side-text);
  display: flex; flex-direction: column; padding: 18px 14px; transition: transform .25s ease;
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 8px 10px 18px; color: #fff; text-decoration: none !important; }
.side-brand img { width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }
.side-brand b { display: block; font-size: 1.05rem; letter-spacing: .01em; }
.side-brand small { display: block; color: var(--side-text); font-size: .78rem; }
.side-label { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: #6f7ea3; padding: 6px 12px 8px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  color: var(--side-text); font-weight: 600; text-decoration: none; transition: background .15s, color .15s;
}
.side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav a.on {
  color: var(--side-active); background: linear-gradient(135deg, var(--primary), #3b7bf0);
  box-shadow: 0 6px 18px rgba(31, 95, 214, .45);
}
.side-foot { margin-top: auto; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .06); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-weight: 800;
}
.who { flex: 1; min-width: 0; }
.who b { display: block; color: #fff; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--side-text); font-size: .75rem; }
.side-out { color: var(--side-text); display: grid; place-items: center; padding: 6px; border-radius: 8px; }
.side-out:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.side-ver { text-align: center; font-size: .72rem; color: #5e6c90; padding-top: 10px; letter-spacing: .08em; text-transform: uppercase; }

.content { margin-left: var(--side-w); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 14px 32px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-weight: 700; color: var(--muted); font-size: .95rem; }
.menu-btn { display: none; background: none; border: 0; color: var(--text); padding: 6px; border-radius: 10px; cursor: pointer; }
.shade { display: none; }
main { max-width: 1240px; padding: 26px 32px 64px; }

/* ---------- Tarjetas y rejillas ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.card.flush { padding: 0; overflow-x: auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi { margin: 0; display: flex; align-items: center; gap: 14px; }
.kpi-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none; color: #fff; }
.kpi-ico.c1 { background: linear-gradient(135deg, #1f5fd6, #4d8bff); }
.kpi-ico.c2 { background: linear-gradient(135deg, #0aa37f, #2ecc9a); }
.kpi-ico.c3 { background: linear-gradient(135deg, #7b3fe4, #a26bff); }
.kpi-ico.c4 { background: linear-gradient(135deg, #f08c00, #ffb43a); }
.kpi-ico.c5 { background: linear-gradient(135deg, #e0435b, #ff7a8c); }
.kpi-v { font-size: 1.7rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.kpi-l { color: var(--muted); font-size: .84rem; }

.hero {
  display: flex; align-items: center; gap: 18px; padding: 22px 24px; margin-bottom: 18px; border-radius: var(--radius); color: #fff;
  background: linear-gradient(120deg, #0b3d91 0%, #1f5fd6 55%, #00a5bf 100%); box-shadow: 0 10px 30px rgba(31, 95, 214, .25);
}
.hero img { width: 86px; height: 86px; object-fit: contain; flex: none; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .25)); }
.hero h1 { color: #fff; margin: 0 0 4px; }
.hero p { margin: 0; color: rgba(255, 255, 255, .85); }
.hero .chip { display: inline-block; margin-top: 10px; background: rgba(255, 255, 255, .18); padding: 4px 12px; border-radius: 99px; font-size: .82rem; font-weight: 600; }

/* ---------- Tablas ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; background: var(--soft); }
.card.flush th:first-child { border-top-left-radius: var(--radius); }
.card.flush th:last-child { border-top-right-radius: var(--radius); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--soft); }
tr:last-child td { border-bottom: 0; }
tr.dim td, .dim { opacity: .55; }
.actions { white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.actions form { display: inline-flex; gap: 6px; }

/* ---------- Botones y etiquetas ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; transition: transform .08s, box-shadow .15s, background .15s; text-decoration: none !important;
}
.btn:hover { background: var(--soft); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), #3b7bf0); border-color: transparent; color: var(--primary-ink);
  box-shadow: 0 6px 16px rgba(31, 95, 214, .3);
}
.btn.primary:hover { box-shadow: 0 8px 22px rgba(31, 95, 214, .4); background: linear-gradient(135deg, #1a54c2, #3471e4); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: transparent; }
.btn.sm { padding: 5px 11px; font-size: .82rem; border-radius: 9px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: .76rem; font-weight: 700; background: var(--soft); color: var(--muted); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.tag { display: inline-block; padding: 2px 9px; margin: 2px 3px 2px 0; border-radius: 7px; font-size: .76rem; font-weight: 600; background: var(--soft); border: 1px solid var(--line); }
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 5px; vertical-align: -3px; }
.bar { display: inline-block; width: 90px; height: 8px; background: var(--soft); border-radius: 9px; overflow: hidden; vertical-align: middle; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), #2ecc9a); border-radius: 9px; }

/* ---------- Formularios ---------- */
.form label, .auth-card label { display: block; margin-bottom: 14px; font-weight: 600; font-size: .88rem; }
input, select, textarea {
  width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--soft); color: var(--text); font: inherit; font-weight: 400; transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); background: var(--card); }
input[type=color] { height: 44px; padding: 4px; cursor: pointer; }
input[type=radio], input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
textarea { resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 0 0 14px; }
legend { font-weight: 700; font-size: .88rem; padding: 0 6px; }
.opt { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.opt input[name="options[]"] { margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 20px; }
label.check { display: inline-flex; align-items: center; gap: 9px; font-weight: 500; }
label.check.top { margin-top: 30px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px; }
.filters input, .filters select { margin: 0; flex: 1 1 200px; width: auto; }
.inline { display: flex; gap: 10px; flex-wrap: wrap; }
ul.plain { list-style: none; padding: 0; margin: 0 0 12px; }
ul.plain li { padding: 6px 0; border-bottom: 1px dashed var(--line); }

.flash { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.flash.err { background: var(--bad-bg); color: var(--bad); }
.notice { border-left: 4px solid var(--primary); }
.notice.promo { border-left-color: var(--warn); }
.notice.alert { border-left-color: var(--bad); }
.notice p { margin: .4rem 0; }
.q-preview { display: block; max-height: 140px; margin-top: 10px; padding: 8px; background: #f3f5f8; border-radius: 12px; border: 1px solid var(--line); }

/* Anuncios */
.ads-form h2.sec { margin: 28px 0 12px; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.ads-form .note { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; background: var(--soft); }
.ads-form .unit { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.ads-form .unit input.mono { margin: 8px 0 4px; }
.ads-form .unit p { margin: 0; }
.ads-form select.status-on { color: var(--ok); font-weight: 800; }
.ads-form select.status-off { color: var(--bad); font-weight: 800; }
.ads-form label span.small { display: block; font-weight: 400; margin-top: 4px; }

/* ---------- Login / instalación ---------- */
body.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 18px;
  background: radial-gradient(1200px 600px at 10% -10%, #1f5fd6 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 110%, #00a5bf 0%, transparent 55%), #0b1a3d;
}
.auth-wrap { width: 100%; max-width: 860px; display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border-radius: 24px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.auth-art { background: linear-gradient(150deg, #0b3d91, #1f5fd6 60%, #00a5bf); color: #fff; padding: 34px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art img.chepe { width: 100%; max-width: 260px; align-self: center; filter: drop-shadow(0 12px 20px rgba(0, 0, 0, .3)); }
.auth-art h2 { color: #fff; font-size: 1.4rem; margin: 0 0 6px; }
.auth-art p { margin: 0; color: rgba(255, 255, 255, .85); }
.auth-card { padding: 38px 34px; margin: 0; border: 0; box-shadow: none; border-radius: 0; }
.auth-card.solo { max-width: 420px; width: 100%; border-radius: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.auth-card .btn { width: 100%; margin-top: 8px; padding: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.brand.big { font-size: 1.3rem; margin-bottom: 4px; }
.brand img { width: 40px; height: 40px; border-radius: 11px; }
.logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #1f5fd6, #00a5bf); color: #fff; font-size: .8rem; }

/* ---------- Móvil ---------- */
@media (max-width: 900px) {
  .side { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  body.menu-open .side { transform: none; }
  body.menu-open .shade { display: block; position: fixed; inset: 0; background: rgba(5, 10, 25, .5); z-index: 20; }
  .content { margin-left: 0; }
  .menu-btn { display: inline-grid; place-items: center; }
  .topbar { padding: 12px 16px; }
  main { padding: 18px 16px 48px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  th:nth-child(3), td:nth-child(3) { display: none; }
  .hero img { width: 64px; height: 64px; }
}

/* Notificaciones */
.push-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.push-item:last-child { border-bottom: 0; }
.push-item p { margin: 4px 0; }
.note-box { border-left: 4px solid var(--warn); }
.note-box ol { margin: 0; padding-left: 20px; }
.note-box li { margin-bottom: 6px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
