:root {
  --blue: #2E3EDB; --blue-dark: #2330B8; --ink: #111827; --muted: #5B6472;
  --line: #E5E7EB; --soft: #F4F5FD; --paper: #FFFFFF; --bg: #F7F8FB;
  --ok: #0F8A4B; --bad: #C2362F; --warn: #B26B00;
  --c0: #2E3EDB; --c1: #F07A2D; --c2: #14A889;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .h3, .num, .brand-t { font-family: 'Epilogue', 'Poppins', sans-serif; font-weight: 600; letter-spacing: -0.01em; }
a { color: var(--blue); }
button, input, select { font: inherit; }
.hidden { display: none !important; }

/* Barra superior */
.top { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .in { max-width: 1240px; margin: 0 auto; padding: 0 20px; height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top img { height: 24px; display: block; }
.top .brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.top .brand-t { font-size: 14px; color: var(--muted); border-left: 1px solid var(--line); padding-left: 12px; }
.top .user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.top .user b { color: var(--ink); font-weight: 500; }
.lnk { background: none; border: 0; color: var(--blue); cursor: pointer; font-size: 13px; padding: 4px 6px; border-radius: 6px; text-decoration: none; }
.lnk:hover { background: var(--soft); }
@media (max-width: 640px) { .top .brand-t, .top .user .quien { display: none; } }

/* Botones y formularios */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; cursor: pointer; font-weight: 600; font-size: 14px; padding: 11px 18px; border-radius: 10px; background: var(--blue); color: #fff; transition: background .15s; }
.btn:hover { background: var(--blue-dark); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.sec { background: var(--paper); color: var(--ink); border: 1.5px solid var(--line); }
.btn.sec:hover { border-color: var(--blue); color: var(--blue); }
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.campo label { font-size: 13px; font-weight: 500; }
.campo input, .campo select { border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; background: var(--paper); color: var(--ink); width: 100%; }
.campo input:focus, .campo select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46,62,219,.12); }
.ayuda { font-size: 12px; color: var(--muted); }
.error { color: var(--bad); font-size: 13px; min-height: 1.2em; margin-bottom: 8px; }
.okmsg { color: var(--ok); font-size: 13px; }

/* Tarjeta de acceso */
.acceso-wrap { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 32px 16px; }
.acceso-card { width: 100%; max-width: 400px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; box-shadow: 0 8px 30px rgba(17,24,39,.06); }
.acceso-card h1 { font-size: 24px; margin-bottom: 4px; }
.acceso-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.acceso-card .btn { width: 100%; margin-top: 4px; }
.acceso-card .pie { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }

/* Panel */
.main { max-width: 1240px; margin: 0 auto; padding: 28px 20px 60px; display: flex; flex-direction: column; gap: 28px; }
.main h1 { font-size: clamp(22px, 3vw, 28px); }
.sub { color: var(--muted); font-size: 13px; }
.lede { margin-top: 8px; font-size: 15px; max-width: 75ch; }
.lede b { font-variant-numeric: tabular-nums; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.panel h2 { font-size: 18px; margin-bottom: 2px; }
.h3 { font-size: 15px; margin: 22px 0 2px; }

.ctrls { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin: 14px 0 10px; }
.quick { display: flex; flex-wrap: wrap; gap: 4px; }
.qb { font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; white-space: nowrap; }
.qb:hover { border-color: var(--blue); }
.qb.on { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 500; }
.qb.limpiar { background: transparent; color: var(--muted); }
.dl { font-size: 12px; color: var(--muted); display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.dl input, .dl select { font-size: 12px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.dl select { max-width: 170px; }
.periodo-lab { font-size: 14px; margin-bottom: 12px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.card .lab { font-size: 12px; color: var(--muted); }
.card .num { font-size: 30px; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }

.tw { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); padding: 7px 10px; white-space: nowrap; background: var(--paper); }
td { border-bottom: 1px solid var(--line); padding: 7px 10px; vertical-align: top; }
th.n, td.n { text-align: right; }
tr.total td { font-weight: 600; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); white-space: nowrap; }
.pill.realizada { color: var(--ok); border-color: #BFE5D0; background: #F0FAF4; }
.pill.noshow { color: var(--bad); border-color: #F2C9C6; background: #FDF3F2; }
.pill.sinmarcar { color: var(--warn); border-color: #F0DAB5; background: #FFF8EC; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 16px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.chart { position: relative; min-height: 240px; }
.chart text { fill: var(--muted); font-size: 11px; font-family: 'Poppins', sans-serif; }
.tip { position: absolute; pointer-events: none; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(17,24,39,.12); border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap; z-index: 5; }

#detalle .tw { max-height: 460px; overflow-y: auto; }
#detalle thead th { position: sticky; top: 0; z-index: 1; }
#detalle td { white-space: nowrap; }
.exp-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin: 4px 0 12px; }
.exp { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.exp .btn { padding: 8px 14px; font-size: 13px; }
.vacio { color: var(--muted); font-size: 13px; padding: 12px 0; }

.drops { display: flex; flex-direction: column; gap: 10px; }
details.drop { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
details.drop > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 16px 20px; }
details.drop > summary::-webkit-details-marker { display: none; }
details.drop > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; display: inline-block; }
details.drop[open] > summary::before { transform: rotate(90deg); }
details.drop > summary:hover { background: var(--bg); border-radius: 14px; }
.drop-t { font-family: 'Epilogue', sans-serif; font-weight: 600; font-size: 16px; }
.drop-c { font-size: 12px; color: var(--muted); }
details.drop > .cuerpo { padding: 0 20px 18px; }
details.def summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details.def li { font-size: 12px; color: var(--muted); margin: 4px 0 0 18px; }
.cargando { color: var(--muted); font-size: 14px; padding: 40px 0; text-align: center; }

/* Admin */
.fila-form { display: grid; grid-template-columns: 2fr 2fr 1fr auto; gap: 10px; align-items: end; }
.fila-form .campo { margin: 0; }
@media (max-width: 760px) { .fila-form { grid-template-columns: 1fr; } }
.temporal { margin-top: 14px; background: var(--soft); border: 1px solid #D5D9F8; border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.temporal code { font-size: 15px; font-weight: 600; background: var(--paper); padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); }
.acciones { display: flex; gap: 2px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--blue); }
.tag.off { background: #F3F4F6; color: var(--muted); }

.msel { position: relative; display: inline-block; }
.msel > summary { list-style: none; cursor: pointer; font-size: 12px; padding: 4px 26px 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); min-width: 150px; max-width: 230px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.msel > summary::-webkit-details-marker { display: none; }
.msel > summary::after { content: ''; position: absolute; right: 9px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-70%) rotate(45deg); }
.msel[open] > summary { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46,62,219,.12); }
.msel-pop { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 240px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(17,24,39,.12); padding: 6px; }
.msel-pop label { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; font-size: 13px; color: var(--ink); cursor: pointer; white-space: nowrap; }
.msel-pop label:hover { background: var(--bg); }
.msel-pop input { accent-color: var(--blue); width: 15px; height: 15px; margin: 0; }
.msel-pop i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.msel-ayuda { font-size: 11px; color: var(--muted); padding: 4px 8px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
