/* GSC · Administración — estilos de la herramienta interna (los tokens de marca están en tokens.css) */

/* ───────────── Base ───────────── */
/* Ancho útil del contenido: cambiar aquí para hacer la web más ancha o más estrecha */
:root { --page-inner: 1496px; }
*, *::before, *::after { box-sizing: border-box; }

/* Barras de desplazamiento finas y discretas; el hueco reservado evita saltos entre páginas cortas y largas */
html { scrollbar-gutter: stable; }
* { scrollbar-width: thin; scrollbar-color: #c3cddd transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c3cddd; border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--brand-3); }
::-webkit-scrollbar-corner { background: transparent; }
body.auth-mode { scrollbar-color: rgba(255,255,255,.35) transparent; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column; overflow-x: clip;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }

/* ───────────── Cabecera ───────────── */
.site-header { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.header-inner { max-width: calc(var(--page-inner) + 64px); margin: 0 auto; padding: 0 32px; height: 68px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none !important; color: var(--brand); flex: none; }
.brand img { height: 38px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 19px; font-weight: 700; letter-spacing: .04em; }
.brand-text small { font-size: 11px; color: var(--text-3); font-weight: 500; letter-spacing: .01em; }
.admin-badge { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); background: var(--brand-soft); padding: 4px 9px; border-radius: 999px; }
.main-nav { margin-left: auto; }
.menu { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; }
.menu > li { position: relative; }
.menu .top {
  display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0 13px; border: 0; background: none;
  font-size: 13.5px; font-weight: 500; color: var(--text); border-radius: 8px; cursor: pointer; text-decoration: none; position: relative;
}
.menu .top:hover { color: var(--brand); background: var(--brand-softer); text-decoration: none; }
.menu .top.active { color: var(--brand); }
.menu .top.active::after { content: ''; position: absolute; left: 13px; right: 13px; bottom: -14px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }
.menu .caret { width: 14px; height: 14px; transform: rotate(90deg); transition: transform .15s; opacity: .7; }
.menu li.open .caret { transform: rotate(-90deg); }
.sub {
  position: absolute; top: calc(100% + 12px); left: -8px; min-width: 300px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px;
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .15s, transform .15s, visibility .15s;
}
.menu li.open .sub { opacity: 1; visibility: visible; transform: none; }
.sub-title { display: flex; align-items: center; gap: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; color: var(--text-3); padding: 6px 10px 8px; }
.sub-title svg.i { width: 14px; height: 14px; }
.sub a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: 13.5px; text-decoration: none; }
.sub a:hover { background: var(--brand-softer); color: var(--brand); text-decoration: none; }
.sub a.active { background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.sub-ic { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.sub-ic svg.i { width: 16px; height: 16px; }
.sub-lbl { flex: 1; }
.count { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; margin-left: auto; }
.burger { display: none; margin-left: auto; width: 42px; height: 42px; border: 0; border-radius: 10px; background: var(--brand-softer); color: var(--brand); cursor: pointer; place-items: center; }
.mobile-nav { display: none; }

/* ───────────── Contenido ───────────── */
.content { flex: 1; width: 100%; padding: 0 32px 56px; }
.content > * { max-width: var(--page-inner); margin-left: auto; margin-right: auto; }

/* Banda de título (a sangre, como en i2t, en azul GSC con los anillos del logo) */
.page-head {
  position: relative; overflow: hidden; isolation: isolate;
  max-width: none; margin: 0 -32px 26px; padding: 30px max(32px, calc((100% + 64px - var(--page-inner)) / 2));
  background: linear-gradient(115deg, var(--brand-strong) 0%, var(--brand) 48%, var(--brand-2) 100%);
  color: #fff; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; min-height: 128px;
}
.page-head::before, .page-head::after { content: ''; position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; }
.page-head::before { width: 520px; height: 520px; right: -120px; top: -230px; border: 46px solid rgba(255,255,255,.06); box-shadow: 0 0 0 38px rgba(255,255,255,.035), 0 0 0 80px rgba(255,255,255,.02); }
.page-head::after { width: 260px; height: 260px; right: 220px; bottom: -190px; background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.16), transparent 65%); }
.page-head h1 { font-size: 27px; line-height: 1.2; margin: 0; font-weight: 600; letter-spacing: -.01em; }
.page-head .eyebrow { font-size: 11.5px; color: rgba(255,255,255,.72); text-transform: uppercase; letter-spacing: .1em; font-weight: 500; margin-bottom: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hero-icon { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.14); box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); display: grid; place-items: center; flex: none; }
.hero-icon svg.i { width: 25px; height: 25px; color: #fff; stroke-width: 1.7; }

/* Encabezados de sección con subrayado (estilo i2t) */
.section-h, .panel h2 { position: relative; font-size: 15.5px; font-weight: 600; margin: 0 0 16px; padding-bottom: 9px; color: var(--text); }
.section-h::after, .panel h2::after { content: ''; position: absolute; left: 0; bottom: 0; width: 34px; height: 3px; border-radius: 3px; background: var(--brand-3); }
.section-h { font-size: 17px; margin: 30px 0 16px; }
.section-h:first-child { margin-top: 4px; }

/* ───────────── Controles ───────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s; text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); border-color: var(--brand-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.sm { height: 31px; padding: 0 11px; font-size: 12.5px; }
.btn.icon { width: 38px; padding: 0; justify-content: center; }
.btn[disabled] { opacity: .55; pointer-events: none; }
/* Botones sobre la banda azul */
.page-head .btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.35); color: #fff; }
.page-head .btn:hover { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.6); }
.page-head .btn.primary { background: #fff; border-color: #fff; color: var(--brand); }
.page-head .btn.primary:hover { background: var(--brand-soft); }

.input, select.input, textarea.input {
  height: 38px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface);
  padding: 0 12px; min-width: 0; width: 100%; transition: border-color .15s, box-shadow .15s;
}
.input:focus, textarea.input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.input { height: auto; min-height: 78px; padding: 9px 12px; resize: vertical; line-height: 1.5; }
select.input { padding-right: 30px; appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237c8798' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.search { position: relative; flex: 1 1 280px; min-width: 200px; }
.search svg.i { position: absolute; left: 12px; top: 10px; color: var(--text-3); }
.search .input { padding-left: 38px; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.seg button:hover { color: var(--brand); }
.seg button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.page-head .seg { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); }
.page-head .seg button { color: rgba(255,255,255,.85); }
.page-head .seg button:hover { color: #fff; }
.page-head .seg button.on { background: #fff; color: var(--brand); box-shadow: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.pot { background: var(--pot); } .dot.ecg { background: var(--ecg); } .dot.ambos { background: linear-gradient(90deg, var(--pot) 50%, var(--ecg) 50%); }
.page-head .dot.pot { background: #ffc261; } .page-head .dot.ecg { background: #ff8fab; }

/* ───────────── Tarjetas ───────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel { padding: 22px 24px; }
.panel .sub { color: var(--text-3); font-size: 12.5px; margin: -8px 0 16px; }
.panel-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.panel-head > div:first-child { flex: 1; min-width: 0; }
.panel-head h2 { margin-bottom: 14px; }
.panel-head .sub { margin: -6px 0 0; }

.grid { display: grid; gap: 18px; }
.kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 18px; }
.kpi { padding: 18px; position: relative; overflow: hidden; display: block; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.kpi:hover { border-color: var(--brand-3); box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi .lbl { color: var(--text-2); font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 9px; line-height: 1.3; }
.kpi .lbl svg.i { width: 30px; height: 30px; padding: 7px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
.kpi .val { font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin-top: 12px; font-variant-numeric: tabular-nums; line-height: 1.1; color: var(--brand-strong); }
.kpi .note { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.kpi .note b { color: var(--ok); font-weight: 600; }
.dash-row { grid-template-columns: 1.65fr 1fr; margin-bottom: 18px; }
.dash-row.two { grid-template-columns: 1fr 1fr; }

/* ───────────── Gráficos ───────────── */
.chart { display: block; overflow: visible; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .bar { transition: opacity .15s; }
.chart:hover .bar { opacity: .5; }
.chart .bar:hover { opacity: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.donut-wrap { display: flex; align-items: center; gap: 26px; }
.donut-wrap svg.chart { width: 168px; height: 168px; }
.donut-wrap .legend { flex: 1; min-width: 0; max-width: 260px; flex-direction: column; gap: 9px; }
.donut-wrap .legend span { width: 100%; }
.donut-wrap .legend b { margin-left: auto; font-variant-numeric: tabular-nums; padding-left: 10px; }
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: grid; grid-template-columns: 92px 1fr 44px; align-items: center; gap: 10px; font-size: 12.5px; }
.hbar .track { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; display: flex; }
.hbar .fill { height: 100%; }
.hbar .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.tip { position: fixed; pointer-events: none; z-index: 100; background: var(--brand-strong); color: #fff; font-size: 12px; padding: 7px 10px; border-radius: 8px; box-shadow: var(--shadow-lg); white-space: nowrap; opacity: 0; transition: opacity .1s; }
.tip.show { opacity: 1; }

/* ───────────── Listas ───────────── */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { padding: 11px 0; border-top: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.mini-list li:first-child { border-top: 0; padding-top: 2px; }
.mini-list .t { font-size: 13.5px; line-height: 1.4; color: var(--text); font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-list .s { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.mini-list a { text-decoration: none; display: block; flex: 1; min-width: 0; }
.mini-list a:hover .t { color: var(--brand); }
.mini-list .yr { color: var(--brand-2); font-variant-numeric: tabular-nums; font-weight: 600; min-width: 40px; font-size: 13px; }
.todo { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 9px; border: 1px solid var(--border); text-decoration: none !important; color: var(--text); margin-bottom: 9px; transition: border-color .15s, background .15s; }
.todo:hover { border-color: var(--brand-3); background: var(--brand-softer); }
.todo .n { font-weight: 600; font-size: 19px; min-width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); font-variant-numeric: tabular-nums; font-size: 14px; flex: none; }
.todo.warn .n { background: var(--warn-soft); color: var(--warn); }
.todo small { display: block; color: var(--text-3); font-size: 12px; }
.todo svg.i { margin-left: auto; color: var(--text-3); }

.filters { padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filters .f { display: flex; align-items: center; gap: 6px; }
.filters select.input { width: auto; min-width: 120px; }
.filters .years select.input { min-width: 96px; }
.filters .years span { color: var(--text-3); }
.result-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 0 2px; color: var(--text-3); font-size: 12.5px; flex-wrap: wrap; }
.result-bar .chip-x { display: inline-flex; align-items: center; gap: 4px; background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 3px 7px 3px 11px; font-size: 12px; font-weight: 500; border: 0; cursor: pointer; }
.result-bar .chip-x svg.i { width: 13px; height: 13px; }
.result-bar .sort { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.result-bar .sort select.input { height: 31px; font-size: 12.5px; width: auto; }

.items { display: flex; flex-direction: column; }
.item { display: grid; grid-template-columns: 66px 1fr auto; gap: 18px; align-items: start; padding: 16px 20px; border-top: 1px solid var(--border); cursor: pointer; transition: background .12s; text-decoration: none !important; color: inherit; position: relative; }
.item:first-child { border-top: 0; }
.item:hover { background: var(--brand-softer); }
.item:hover::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.item .year { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--brand); font-size: 15px; line-height: 1.3; }
.item .year small { display: block; font-weight: 400; color: var(--text-3); font-size: 11.5px; }
.item .title { font-size: 14.5px; font-weight: 500; line-height: 1.45; color: var(--text); }
.item:hover .title { color: var(--brand-strong); }
.item .meta { margin-top: 5px; font-size: 12.5px; color: var(--text-3); display: flex; flex-wrap: wrap; gap: 3px 12px; align-items: center; }
.item .meta .src { color: var(--brand-2); font-weight: 500; }
.item .right { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }
.empty { padding: 56px 20px; text-align: center; color: var(--text-3); }
.empty svg.i { width: 34px; height: 34px; stroke-width: 1.4; margin-bottom: 8px; }

.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.tag.pot { background: var(--pot-soft); color: var(--pot); }
.tag.ecg { background: var(--ecg-soft); color: var(--ecg); }
.tag.q1 { background: var(--ok-soft); color: var(--q1); }
.tag.q2 { background: #ebf5ee; color: #3f8a55; }
.tag.q3 { background: var(--warn-soft); color: var(--warn); }
.tag.q4 { background: var(--danger-soft); color: var(--q4); }
.tag.oa { background: var(--brand-soft); color: var(--brand); }
.tag.live { background: var(--ok-soft); color: var(--ok); }
.tags { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }

/* Avatares / fotos */
.avatars { display: flex; }
.av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; border: 2px solid var(--surface); margin-left: -7px; flex: none; overflow: hidden; }
.av:first-child { margin-left: 0; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.more { background: var(--surface-3); color: var(--text-2); }
.av.lg { width: 56px; height: 56px; font-size: 19px; border: 0; }
.av.xl { width: 76px; height: 76px; font-size: 24px; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border), var(--shadow-sm); margin: 0; }
.av.hero { width: 96px; height: 96px; font-size: 30px; border: 3px solid rgba(255,255,255,.9); box-shadow: 0 8px 24px rgba(0,0,0,.2); margin: 0; }

/* ───────────── Panel lateral (drawer) ───────────── */
.scrim { position: fixed; inset: 0; background: rgba(0, 30, 60, .38); backdrop-filter: blur(2px); z-index: 40; opacity: 0; transition: opacity .2s; }
.scrim.show { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(660px, 100vw); background: var(--surface); z-index: 50; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(102%); transition: transform .26s cubic-bezier(.2,.8,.2,1); }
.drawer.show { transform: none; }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 22px 24px 18px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, var(--brand-softer), var(--surface)); }
.drawer-head .k { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--brand-2); font-weight: 600; }
.drawer-head h2 { margin: 5px 0 0; font-size: 19px; line-height: 1.35; font-weight: 600; color: var(--text); }
.drawer-head .btn.icon { margin-left: auto; flex: none; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 28px; }
.drawer-foot { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; background: var(--surface); padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.drawer-foot .spacer { flex: 1; }

.dl { display: grid; grid-template-columns: 175px 1fr; margin: 0; }
.dl dt, .dl dd { padding: 10px 0; border-top: 1px solid var(--border); margin: 0; font-size: 13.5px; }
.dl dt { color: var(--text-3); padding-right: 14px; font-size: 12.5px; }
.dl dd { word-break: break-word; white-space: pre-line; }
.dl dt:first-of-type, .dl dd:first-of-type { border-top: 0; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--brand-2); font-weight: 600; margin: 24px 0 11px; }
.people-list { display: flex; flex-wrap: wrap; gap: 8px; }
.person-chip { display: inline-flex; align-items: center; gap: 7px; padding: 3px 12px 3px 3px; border-radius: 999px; background: var(--surface-2); font-size: 13px; color: var(--text); text-decoration: none !important; border: 1px solid var(--border); }
.person-chip .av { width: 24px; height: 24px; font-size: 9.5px; border: 0; margin: 0; }
a.person-chip:hover { border-color: var(--brand-3); color: var(--brand); }
button.person-chip { cursor: pointer; background: var(--surface); }
button.person-chip.on { background: var(--brand-soft); border-color: var(--brand-2); color: var(--brand-strong); font-weight: 500; }
button.person-chip:not(.on) .av { filter: grayscale(1); opacity: .45; }
.notes { background: var(--warn-soft); border-radius: 8px; padding: 11px 14px; font-size: 13px; white-space: pre-line; }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form .fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.form .fld.wide { grid-column: 1 / -1; }
.form label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.form label .req { color: var(--danger); }
.form .check { display: flex; align-items: center; gap: 8px; height: 38px; font-size: 13.5px; }
.form .check input { width: 17px; height: 17px; accent-color: var(--brand); }
.doi-box { background: var(--brand-softer); border: 1px solid var(--brand-soft); border-radius: 10px; padding: 14px; margin-bottom: 18px; }
.doi-box .row { display: flex; gap: 8px; }
.doi-box p { margin: 0 0 9px; font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.doi-box p svg.i { color: var(--brand); }
.doi-box .msg { margin: 9px 0 0; }
.msg { font-size: 12.5px; }
.msg.err { color: var(--danger); } .msg.ok { color: var(--ok); } .msg.warn { color: var(--warn); }
.filled { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--ok-soft); border-color: var(--ok); } }

/* Foto en el formulario de investigador */
.photo-drop { display: flex; gap: 18px; align-items: center; padding: 16px; border: 1.5px dashed var(--border-strong); border-radius: 12px; margin-bottom: 20px; cursor: pointer; transition: border-color .15s, background .15s; }
.photo-drop:hover, .photo-drop.over { border-color: var(--brand-2); background: var(--brand-softer); }
.photo-drop b { display: block; font-size: 13.5px; font-weight: 600; }
.photo-drop > div > span { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.photo-preview { width: 88px; height: 88px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; color: #fff; font-size: 26px; font-weight: 600; flex: none; box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--border); }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* ───────────── Investigadores ───────────── */
.people-cards { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.pcard { padding: 18px; text-decoration: none !important; color: inherit; display: flex; gap: 18px; align-items: center; transition: border-color .15s, box-shadow .15s, transform .15s; }
.pcard:hover { border-color: var(--brand-3); box-shadow: var(--shadow); transform: translateY(-1px); }
.pcard .pbody { flex: 1; min-width: 0; }
.pcard h3 { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--brand); line-height: 1.3; }
.pcard .code { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.pcard .stats { display: flex; gap: 12px; margin-top: 9px; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.pcard .stats b { color: var(--text); font-weight: 600; }
.pcard .more { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--brand-2); margin-top: 8px; font-weight: 500; }
.pcard .more svg.i { width: 14px; height: 14px; }
.pcard.inactive { opacity: .65; }
.profile-head { min-height: 180px; }
.profile-head .crumb { position: absolute; top: 14px; left: max(32px, calc((100% - var(--page-inner)) / 2)); color: rgba(255,255,255,.8); font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px; }
.profile-head .crumb svg.i { width: 15px; height: 15px; }
.profile-head .crumb:hover { color: #fff; }
.profile-head { padding-top: 44px; }
.photo-btn { position: relative; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; }
.photo-btn > span:last-child { position: absolute; right: 0; bottom: 2px; width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--brand); display: grid; place-items: center; box-shadow: var(--shadow); opacity: 0; transition: opacity .15s; }
.photo-btn:hover > span:last-child, .photo-btn:focus-visible > span:last-child { opacity: 1; }
.photo-btn svg.i { width: 15px; height: 15px; }
.orcid { color: rgba(255,255,255,.85); font-size: 12.5px; display: inline-flex; gap: 5px; align-items: center; margin-top: 4px; }
.orcid svg.i { width: 13px; height: 13px; }
.orcid:hover { color: #fff; }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-strip a { padding: 14px 16px; text-decoration: none !important; color: inherit; transition: border-color .15s, box-shadow .15s; }
.stat-strip a:hover { border-color: var(--brand-3); box-shadow: var(--shadow); }
.stat-strip b { display: block; font-size: 24px; font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }
.stat-strip span { font-size: 12px; color: var(--text-3); }

/* Pie */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); }
.footer-inner { max-width: calc(var(--page-inner) + 64px); margin: 0 auto; padding: 22px 32px; display: flex; gap: 14px; align-items: center; font-size: 12.5px; color: var(--text-3); }
.footer-inner img { width: 44px; height: auto; }
.footer-inner b { display: block; color: var(--text-2); font-weight: 500; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--brand-strong); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow-lg); opacity: 0; transition: all .2s; z-index: 80; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 6px; }
@keyframes sk { to { background-position: -200% 0; } }
.page-head .skeleton { background: rgba(255,255,255,.15); }

/* ───────────── Responsive ───────────── */
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Menú compacto: lo activa main.ts (clase nav-compact) cuando la cabecera completa no cabe */
body.nav-compact .main-nav, body.nav-compact .admin-badge { display: none; }
body.nav-compact .burger { display: grid; }
body.nav-compact .mobile-nav { display: block; max-height: 0; overflow: hidden; transition: max-height .25s ease; background: var(--surface); padding: 0 24px; }
body.nav-compact.nav-open .mobile-nav { max-height: calc(100vh - 68px); overflow-y: auto; border-top: 1px solid var(--border); padding: 10px 24px 20px; }
.mobile-nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: var(--text); font-size: 14px; text-decoration: none; }
.mobile-nav a svg.i { color: var(--brand-2); }
.mobile-nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.mobile-nav .m-title { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; color: var(--text-3); padding: 14px 10px 4px; }
/* Ahorro de espacio antes de pasar al menú compacto */
@media (max-width: 1440px) { .admin-badge, .brand-text small { display: none; } }
@media (max-width: 1100px) { .dash-row, .dash-row.two { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .header-inner { padding: 0 16px; height: 60px; }
  .brand img { height: 32px; }
  .brand-text small { display: none; }
  body.nav-compact.nav-open .mobile-nav { max-height: calc(100vh - 60px); padding: 8px 12px 18px; }
  .content { padding: 0 16px 40px; }
  .page-head { padding: 22px 16px; margin: 0 -16px 18px; min-height: 0; gap: 14px; }
  .page-head h1 { font-size: 22px; }
  .hero-icon { width: 44px; height: 44px; }
  .hero-icon svg.i { width: 21px; height: 21px; }
  .page-head .actions { width: 100%; margin-left: 0; }
  .page-head .actions .btn, .page-head .actions .seg { flex: 1; justify-content: center; }
  .page-head .seg button { flex: 1; justify-content: center; padding: 6px 6px; }
  .profile-head { padding-top: 46px; }
  .profile-head .crumb { left: 16px; }
  .av.hero { width: 76px; height: 76px; font-size: 24px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .val { font-size: 23px; }
  .grid { gap: 12px; }
  .panel { padding: 18px 16px; }
  .panel-head { flex-direction: column; gap: 4px; }
  .item { grid-template-columns: 1fr; gap: 6px; padding: 14px 16px; }
  .item .year { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
  .item .year small { display: inline; }
  .item .right { flex-direction: row; align-items: center; justify-content: space-between; }
  .filters { padding: 12px; }
  .filters .f, .filters .search { flex: 1 1 100%; }
  .filters select.input { width: 100%; }
  .filters .seg { width: 100%; }
  .filters .seg button { flex: 1; justify-content: center; }
  .form { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { padding-bottom: 0; }
  .dl dd { border-top: 0; padding-top: 2px; }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut-wrap svg.chart { margin: 0 auto; }
  .donut-wrap .legend { max-width: none; }
  .people-cards { grid-template-columns: 1fr; }
  .photo-drop { flex-direction: column; text-align: center; }
  .photo-actions { justify-content: center; }
  .footer-inner { padding: 18px 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Barra de filtro del panel (fuera de la banda de título) */
.dash-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-bottom: 16px; font-size: 12.5px; color: var(--text-3); }
.dash-toolbar .seg { background: var(--surface); }
@media (max-width: 720px) {
  .dash-toolbar { flex-direction: column; align-items: stretch; gap: 6px; }
  .dash-toolbar .seg button { flex: 1; justify-content: center; }
}

/* ───────────── Acceso ───────────── */
body.auth-mode { background: linear-gradient(125deg, var(--brand-strong) 0%, var(--brand) 50%, var(--brand-2) 100%); }
.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; position: relative; overflow: hidden; isolation: isolate; }
.auth-rings { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.auth-rings::before, .auth-rings::after { content: ''; position: absolute; border-radius: 50%; }
.auth-rings::before { width: 900px; height: 900px; left: 50%; top: 50%; transform: translate(-50%, -50%); border: 70px solid rgba(255,255,255,.045); box-shadow: 0 0 0 60px rgba(255,255,255,.03), 0 0 0 130px rgba(255,255,255,.02), inset 0 0 0 60px rgba(255,255,255,.025); }
.auth-rings::after { width: 520px; height: 520px; right: -160px; top: -200px; background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.14), transparent 65%); }
.auth-card { width: 100%; max-width: 410px; background: var(--surface); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 20, 50, .35); padding: 34px 34px 28px; text-align: center; }
.auth-logo { width: 112px; height: auto; display: block; margin: 0 auto 14px; }
.auth-card h1 { margin: 0; font-size: 22px; font-weight: 600; color: var(--brand-strong); }
.auth-sub { margin: 4px 0 24px; color: var(--text-3); font-size: 13px; }
.auth-icon { width: 60px; height: 60px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin: 0 auto 14px; }
.auth-icon svg.i { width: 26px; height: 26px; }
.auth-form { text-align: left; display: flex; flex-direction: column; gap: 14px; }
.auth-form .fld { display: flex; flex-direction: column; gap: 5px; }
.auth-form label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.auth-form small { font-size: 11.5px; color: var(--text-3); }
.auth-form .input { height: 44px; font-size: 14.5px; }
.auth-msg { margin: 0; min-height: 18px; font-size: 12.5px; color: var(--danger); }
.btn.block { width: 100%; justify-content: center; height: 46px; font-size: 14.5px; }
.auth-link { margin-top: 16px; background: none; border: 0; color: var(--text-3); font-size: 12.5px; cursor: pointer; text-decoration: underline; }
.auth-link:hover { color: var(--brand); }
.auth-foot { margin: 22px 0 0; color: rgba(255,255,255,.7); font-size: 12px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: none; color: var(--text-3); border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--brand); background: var(--brand-softer); }
.pw-rules { list-style: none; margin: -2px 0 0; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-3); }
.pw-rules li { display: flex; align-items: center; gap: 8px; }
.pw-rules svg.i { width: 15px; height: 15px; }
.pw-rules li.ok { color: var(--ok); }
.pw-drawer { max-width: 420px; }
.pw-drawer .input { height: 40px; }

/* Menú de usuario */
.user-menu { position: relative; flex: none; }
.user-btn { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 10px 0 5px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text); }
.user-btn:hover { border-color: var(--brand-3); }
.user-btn .av { width: 30px; height: 30px; border: 0; margin: 0; }
.user-btn .caret { width: 14px; height: 14px; transform: rotate(90deg); opacity: .6; }
.user-menu .user-sub { left: auto; right: 0; min-width: 250px; }
.user-menu.open .user-sub { opacity: 1; visibility: visible; transform: none; }
.user-head { padding: 8px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-head b { display: block; font-size: 13.5px; font-weight: 600; }
.user-head span { font-size: 12px; color: var(--text-3); }
.reset-box { margin-top: 24px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; display: flex; gap: 14px; align-items: center; background: var(--surface-2); }
.reset-box b { display: block; font-size: 13px; }
.reset-box span { font-size: 12px; color: var(--text-3); }
.reset-box .btn { flex: none; }
body.nav-compact .user-menu { margin-left: auto; }
body.nav-compact .burger { margin-left: 0; }
@media (max-width: 720px) {
  .user-btn .caret { display: none; }
  .user-btn { padding: 0 4px; }
  .user-menu .user-sub { min-width: 260px; }
  .auth-card { padding: 28px 22px 22px; }
  .reset-box { flex-direction: column; align-items: stretch; }
}

@media (max-width: 1480px) { .user-btn .user-name { display: none; } .user-btn { padding-right: 8px; } .menu .top { padding: 0 11px; } }

/* ───────────── Contacto de investigadores ───────────── */
.pcard { align-items: flex-start; }
.pcard:hover { transform: none; }
.pcard .pav { flex: none; border-radius: 50%; }
.pcard .pav:hover { text-decoration: none; }
.pcard .ptop { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.pcard h3 a { color: inherit; }
.pcard h3 a:hover { color: var(--brand-strong); }
.btn.icon-sm { width: 31px; padding: 0; justify-content: center; flex: none; }
.btn.icon-sm svg.i { width: 15px; height: 15px; }
.contact { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.contact.muted { color: var(--text-3); font-style: italic; }
.cline { display: grid; grid-template-columns: 15px minmax(0, 1fr); column-gap: 7px; row-gap: 2px; align-items: baseline; min-width: 0; }
.cline > svg.i { align-self: center; }
.cline > span, .cline > a:not(.tel) { min-width: 0; overflow-wrap: anywhere; }
.cline > svg.i { width: 15px; height: 15px; color: var(--brand-2); flex: none; }
.cline a { color: var(--brand); word-break: break-all; }
.cline b { font-weight: 600; color: var(--text); }
.cline .tel { grid-column: 2; justify-self: start; display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); white-space: nowrap; }
.cline .tel svg.i { width: 13px; height: 13px; }
.cline .tel:hover { color: var(--brand); }
.contact-panel { margin-bottom: 16px; }
.contact-panel .contact { margin-top: 0; font-size: 13.5px; gap: 9px; }
.contact-panel .cline > svg.i { width: 17px; height: 17px; }
.contact-panel .cline { grid-template-columns: 17px minmax(0, max-content) auto; column-gap: 10px; }
.contact-panel .cline .tel { grid-column: auto; }

/* Listas repetibles del formulario */
.rep-list { display: flex; flex-direction: column; gap: 8px; }
.rep-row { display: flex; align-items: center; gap: 8px; position: relative; }
.rep-ic { width: 34px; height: 38px; display: grid; place-items: center; color: var(--text-3); flex: none; }
.rep-row.principal .rep-ic { color: var(--brand); }
.rep-row.principal::after { content: 'Principal'; position: absolute; right: 48px; top: 50%; transform: translateY(-50%); font-size: 10.5px; font-weight: 600; color: var(--brand); background: var(--brand-soft); padding: 2px 8px; border-radius: 999px; pointer-events: none; }
.rep-row.principal .input { padding-right: 86px; }
.ubic-row { border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.ubic-head { display: flex; gap: 8px; align-items: center; }
.ubic-head select.input { width: auto; min-width: 190px; font-weight: 500; }
.ubic-head .btn { margin-left: auto; }
.ubic-fields { display: grid; grid-template-columns: 1fr 190px; gap: 8px; }
.add-btn { margin-top: 10px; }
.hint { margin: 6px 0 0; font-size: 11.5px; color: var(--text-3); }
@media (max-width: 720px) {
  .contact-panel .cline { grid-template-columns: 15px minmax(0, 1fr); }
  .contact-panel .cline .tel { grid-column: 2; }
  .pcard { gap: 14px; }
  .pcard .av.xl { width: 56px; height: 56px; font-size: 18px; }
  .ubic-fields { grid-template-columns: 1fr; }
  .ubic-head select.input { min-width: 0; flex: 1; }
}

/* Zona de peligro (eliminar investigador) */
.danger-zone { margin-top: 28px; padding: 14px 16px; border: 1px solid #f1c4c8; border-radius: 10px; background: #fff8f8; display: flex; gap: 14px; align-items: center; }
.danger-zone b { display: block; font-size: 13px; color: var(--danger); }
.danger-zone span { font-size: 12px; color: var(--text-3); }
.danger-zone .btn { flex: none; }
.dz-body { flex: 1; }
.dz-body ul { margin: 8px 0 12px; padding-left: 18px; font-size: 12.5px; color: var(--text-2); display: flex; flex-direction: column; gap: 3px; }
.dz-label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.dz-label code { background: var(--danger-soft); color: var(--danger); padding: 1px 6px; border-radius: 5px; font-weight: 600; }
.dz-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.solid:hover { background: #a32a33; }
.btn.danger.solid[disabled] { opacity: .45; }
@media (max-width: 720px) { .danger-zone { flex-direction: column; align-items: stretch; } .dz-actions .btn { flex: 1; justify-content: center; } }

/* Rol de administrador */
.role-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 8px; margin-left: 7px; white-space: nowrap; position: relative; top: -1px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 600; letter-spacing: .03em; vertical-align: middle; }
.form .fld small.hint { margin: 0; }
.form .input:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
.form .check:has(input:disabled) { color: var(--text-3); }
.user-head b { display: flex; align-items: center; gap: 0; white-space: nowrap; }
.user-menu .user-sub { min-width: 280px; }

/* Las columnas de las rejillas y los gráficos pueden encogerse (el gráfico se redibuja con el nuevo ancho) */
.grid > * { min-width: 0; }
.panel > div:has(> svg.chart) { min-width: 0; overflow: hidden; }
svg.chart { max-width: 100%; }

/* Cabecera: nada se encoge ni parte su texto; si no cabe, main.ts activa el menú compacto */
.header-inner > *, .menu > li, .brand, .brand-text { flex-shrink: 0; }
.admin-badge, .brand-text b, .brand-text small, .menu .top { white-space: nowrap; }
/* La píldora «Sitio» siempre en blanco sobre azul (el encabezado del menú de usuario pinta sus span en gris) */
.user-head .role-tag, .pcard .code .role-tag { color: #fff; font-size: 10px; }
.pcard .code .role-tag { margin-left: 4px; }

/* Cambio de contraseña dentro de «Editar mi perfil» */
.pw-section { padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); display: flex; gap: 14px; align-items: center; }
.pw-section > div:first-child b { display: block; font-size: 13px; }
.pw-section > div:first-child span { font-size: 12px; color: var(--text-3); }
.pw-section > .btn { flex: none; }
.pw-section .pw-body { flex: 1; }
.pw-section .pw-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pw-section .pw-head b { font-size: 13px; }
.pw-section .auth-form { gap: 12px; }
.pw-section .auth-form .input { height: 40px; font-size: 14px; }
.pw-section .btn.block { height: 40px; }
@media (max-width: 720px) { .pw-section { flex-direction: column; align-items: stretch; } }

/* El contenedor de la aplicación ocupa todo el alto: el contenido crece y el pie queda abajo aunque haya poco contenido */
#app { flex: 1 0 auto; display: flex; flex-direction: column; min-height: 100vh; }
#app > .content { flex: 1 0 auto; }
#app > .site-footer { margin-top: auto; }

/* Píldora de coordinación del grupo (dorada, para distinguirla de «Sitio») */
.role-tag.coord { background: #fdf0d5; color: #8a5a00 !important; box-shadow: inset 0 0 0 1px #f0cf8a; }
.role-tag.coord.on-dark { background: rgba(255, 255, 255, .16); color: #fff !important; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45); font-size: 11px; height: 22px; padding: 0 10px; margin-left: 12px; top: -4px; }
.pcard .code .role-tag + .role-tag { margin-left: 4px; }
