
:root{
  --bg:#f7f8fb;
  --surface:#ffffff;
  --surface-2:#f3f4f6;
  --text:#0f172a;
  --muted:#475569;
  --primary:#2563eb;
  --primary-700:#1d4ed8;
  --accent:#0ea5e9;
  --border:#e5e7eb;
  --success:#16a34a;
}

*{ box-sizing: border-box }
html, body{ height:100% }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial;
  background: linear-gradient(180deg, #ffffff 0%, #f7f8fb 100%);
  color: var(--text);
}

/* Layout general */
.app{
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100svh;
}
header{
  grid-column: 1 / -1;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(120%) blur(6px);
  background: linear-gradient(90deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand{
  display:flex; align-items:center; gap:10px;
  font-weight: 700; letter-spacing: .3px;
}
.brand .dot{
  width: 12px; height: 12px; border-radius: 50%;
  background: conic-gradient(from 210deg, var(--accent), var(--primary));
  box-shadow: 0 0 10px rgba(14,165,233,.4);
}
.title{ font-size: clamp(16px, 2.2vw, 20px) }
.spacer{ flex:1 }
.btn{
  border:1px solid var(--border);
  background: #ffffff; color: var(--text);
  padding:8px 10px; border-radius: 10px; cursor:pointer;
}
.btn:hover{ background:#f8fafc }

aside.sidebar{
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #ffffff 60%, #f8fafc 100%);
  overflow:auto;
  padding: 12px;
}

main.content{
  padding: 18px;
  background:
    radial-gradient(1200px 500px at -200px -100px, rgba(37,99,235,.08), transparent 60%),
    radial-gradient(1000px 600px at 120% -20%, rgba(14,165,233,.08), transparent 55%);
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,1), rgba(255,255,255,.96));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 10px 25px rgba(0,0,0,.05), inset 0 1px 0 rgba(255,255,255,.6);
}

/* Menú 2 niveles con <details> */
.nav{ display:flex; flex-direction:column; gap:8px }

details.group{
  border:1px solid var(--border);
  border-radius: 14px;
  overflow:hidden;
  background: linear-gradient(180deg, #ffffff, #f9fafb);
}
summary{
  list-style: none; cursor: pointer;
  padding: 12px 12px;
  display:flex; align-items:center; gap:10px;
  font-weight: 600; color: var(--text);
  position: relative;
}
summary::-webkit-details-marker{ display:none }
.chev{
  width:18px; height:18px; display:inline-grid; place-items:center;
  border-radius: 8px; border:1px solid var(--border);
  background:#ffffff; color: #64748b;
  transition: transform .18s ease;
  font-size: 12px;
}
details[open] .chev{ transform: rotate(90deg) }
.badge{
  margin-left:auto;
  font-size: 11px; color:#475569;
  background: #ffffff; border:1px solid var(--border);
  padding:2px 8px; border-radius: 999px;
}

ul.sub{
  margin: 10; padding: 4px;
  display:flex; flex-direction:column; gap:4px;
  border-top:2px solid var(--border);
  background: #ffffff;
}
.nav-link{
  display:flex; align-items:center; gap:10px;
  padding:10px 10px; border-radius: 10px;
  color: var(--text); text-decoration:none;
  border:1px solid transparent;
  transition: background .15s, border-color .15s;
}
.nav-link .dot{
  width:7px; height:7px; border-radius:50%;
  background: #94a3b8;
  box-shadow: 0 0 0 0 rgba(14,165,233,0);
  transition: all .2s ease;
}
.nav-link:hover{
  background: #f1f5f9;
  border-color: var(--border);
}
.nav-link.active{
  background: linear-gradient(180deg, rgba(37,99,235,.12), rgba(37,99,235,.06));
  border-color: #bfdbfe;
  box-shadow: 0 0 0 1px rgba(29,78,216,.15);
}
.nav-link.active .dot{
  background: var(--accent);
  box-shadow: 0 0 8px rgba(14,165,233,.6);
}

/* Encabezados y tipografía */
h1, h2, h3{ margin: 0 0 10px 0 }
h1{ font-size: clamp(18px, 2.6vw, 24px) }
h2{ font-size: clamp(16px, 2.2vw, 20px); color:#0f172a }
p{ color: #334155; line-height: 1.65; margin: 8px 0 }

/* Bloques decorativos */
.kpi{
  display:grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr));
  gap: 12px; margin-top: 8px;
}
.kpi .box{
  background:#ffffff; border:1px solid var(--border);
  padding:14px; border-radius: 14px;
}
.muted{ color: #64748b }

/* Visor de documentos */
.doc-frame{
  width: 100%;
  height: min(78vh, 900px);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
}
.doc-actions{
  display:flex; gap:8px; align-items:center; margin: 8px 0 12px 0;
}
.doc-actions a{ color: var(--primary); text-decoration: none; }
.doc-actions a:hover{ text-decoration: underline; }

/* Responsive: sidebar colapsable en móviles */
#menuToggle{ display:none }
@media (max-width: 900px){
  .app{ grid-template-columns: 1fr }
  aside.sidebar{
    position: fixed; inset: 56px 0 0 0;
    width: min(88vw, 320px);
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,.15);
    z-index: 30;
  }
  body.show-sidebar aside.sidebar{ transform: translateX(0) }
  #menuToggle{ display:inline-flex; align-items:center; justify-content:center }
  main.content{ padding: 16px }
}

/* Accesibilidad foco */
:focus-visible{
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Footer simple */
footer{ margin-top: 14px; font-size: 12px; color: #64748b }
