/* =====================================================================
   PANEL DE GESTIÓN — Malbúger Centro Deportivo
   Paleta real de marca: rojo #e20b22 / negro #1a171b (extraída del logo).
   ===================================================================== */
:root {
  --red: #e20b22;
  --red-dark: #b40817;
  --red-soft: #fbe4e6;
  --black: #1a171b;
  --ink: #1a171b;
  --white: #ffffff;

  --bg: #f7f5f4;
  --panel: #ffffff;
  --border: #e8e3e0;
  --muted: #79736e;
  --muted-2: #a39d95;

  --ok: #2f8f5b;
  --ok-soft: #e7f3ec;
  --warn: #b5790a;
  --warn-soft: #f7ecd9;
  --info: #3b6ea5;
  --info-soft: #e7eef6;

  --radius: 12px;
  --sidebar-w: 256px;
  --shadow: 0 1px 2px rgba(26,23,27,.06), 0 4px 16px rgba(26,23,27,.05);

  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; }
.muted { color: var(--muted); }
code { background: rgba(255,255,255,.12); padding: 1px 6px; border-radius: 5px; font-size: 12px; }

.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* ===================== SIDEBAR ===================== */
.sidebar { background: var(--black); color: #d6d8de; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 12px; padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.logo-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 19px; letter-spacing: -1px; box-shadow: 0 4px 14px rgba(226,11,34,.45); }
.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-name { font-weight: 800; font-size: 14px; letter-spacing: .3px; color: #fff; }
.logo-sub { font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 1px; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 16px 12px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: transparent; border: 0; color: #b5b8c0; cursor: pointer; padding: 11px 14px; border-radius: 9px; font-size: 14px; font-weight: 500; font-family: inherit; transition: background .15s, color .15s; }
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--red); color: #fff; box-shadow: 0 4px 14px rgba(226,11,34,.35); }

.sidebar-foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); }
.foot-phase { display: inline-block; font-size: 12px; font-weight: 600; color: #fff; background: rgba(255,255,255,.08); padding: 5px 11px; border-radius: 999px; margin-bottom: 10px; }
.foot-note { font-size: 11px; color: var(--muted-2); }

/* ===================== ÁREA PRINCIPAL ===================== */
.main-area { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 32px; background: var(--white); border-bottom: 1px solid var(--border); }
.topbar h1 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.3px; }
.crumb { margin: 3px 0 0; font-size: 13px; }
.crumb #complejo-nombre-top { font-weight: 600; color: var(--ink); }
.fase { background: var(--red-soft); color: var(--red-dark); border: 1px solid #f3c9cc; padding: 7px 15px; border-radius: 999px; font-size: 13px; font-weight: 700; }

main { padding: 28px 32px; flex: 1; }
.view { display: none; }
.view.active { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.section-intro { margin-bottom: 18px; max-width: 760px; }

/* KPI cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 22px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--red); }
.card .k { font-size: 34px; font-weight: 800; letter-spacing: -1px; }
.card .l { font-size: 13px; color: var(--muted); margin-top: 4px; font-weight: 500; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 22px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 22px; }
.panel h2 { margin: 0 0 18px; font-size: 15px; font-weight: 700; letter-spacing: -.2px; }

/* Hitos */
.hitos { display: flex; flex-direction: column; gap: 10px; }
.hito { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--bg); border-radius: 10px; border: 1px solid var(--border); }
.hito .badge { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; border: 2px solid var(--border); color: transparent; flex-shrink: 0; }
.hito.done .badge { background: var(--red); color: #fff; border-color: var(--red); }
.hito .htxt { font-weight: 500; }
.hito.done .htxt { color: var(--muted); text-decoration: line-through; }
.hito .fecha { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }

/* ===================== ÁREAS ===================== */
.areas { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.area-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border-top: 4px solid var(--area-color, var(--red)); cursor: pointer; transition: transform .15s; }
.area-card:hover { transform: translateY(-2px); }
.area-card h3 { margin: 0 0 8px; font-size: 15.5px; font-weight: 700; }
.area-card p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.area-card .stats { display: flex; gap: 18px; }
.area-card .stat .sv { font-size: 20px; font-weight: 800; }
.area-card .stat .sl { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

/* ===================== TAREAS (kanban) ===================== */
.board-filters { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-chip { border: 1px solid var(--border); background: var(--panel); color: var(--ink); padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.filter-chip.active { background: var(--red); border-color: var(--red); color: #fff; }

.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .board { grid-template-columns: 1fr; } }
.col { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.col h3 { margin: 0 0 14px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; display: flex; justify-content: space-between; align-items: center; }
.col h3 .count { color: #fff; background: var(--ink); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.col.done h3 .count { background: var(--red); }
.task { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 13px; margin-bottom: 10px; border-left: 3px solid var(--muted-2); }
.task.alta { border-left-color: var(--red); }
.task.media { border-left-color: var(--ink); }
.task.baja { border-left-color: var(--muted-2); }
.task .area { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); background: var(--bg); border: 1px solid var(--border); padding: 2px 7px; border-radius: 5px; margin-bottom: 8px; }
.task .t { font-size: 14px; font-weight: 700; }
.task .problema { font-size: 12px; color: var(--muted); margin-top: 6px; }
.task .solucion { font-size: 12.5px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.task .solucion b { color: var(--red); }
.task .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); }
.pill { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.pill .pdot { width: 7px; height: 7px; border-radius: 50%; }

/* Footer */
.foot { display: flex; justify-content: space-between; padding: 18px 32px; border-top: 1px solid var(--border); font-size: 12px; background: var(--white); flex-wrap: wrap; gap: 8px; }
.foot code { background: var(--bg); color: var(--red-dark); border: 1px solid var(--border); }

/* Responsive: sidebar colapsa arriba en móvil */
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; flex-direction: column; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item span { display: none; }
  .nav-item { padding: 11px; }
}
