:root {
  /* Manual de marca: naranja mandarina #FF914D y rosa intenso #FF4DB8 (+ apoyos del manual) */
  --negro: #16110e;
  --negro-2: #2a211b;
  --negro-ink: #f6e9e4;
  --beige: #fff4f1;           /* fondo: rosa/beige muy suave */
  --superficie: #ffffff;
  --linea: #f1dcd8;
  --linea-fuerte: #dcbfb9;
  --texto: #1d1612;
  --apagado: #6e5b57;
  --naranja: #ff914d;         /* marca */
  --naranja-osc: #a8420a;     /* texto/enlaces sobre claro (contraste AA) */
  --naranja-claro: #ffe6d4;
  --magenta: #ff4db8;         /* marca: decorativo, barras, bordes */
  --magenta-txt: #b8157c;     /* texto y botones sobre claro (contraste AA) */
  --magenta-claro: #ffdde8;
  --rosa-1: #ff5277; --rosa-2: #ff97b1; --rosa-3: #ffdbe1;
  --ambar: #8a5a00;
  --ambar-claro: #fff1c8;
  --radio: 8px;
  --f-titulo: 'Cooper BT', 'Cooper Black', 'Fraunces', Georgia, serif;
  --f-texto: 'Poppins', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--beige); color: var(--texto); font: 400 14px/1.5 var(--f-texto); }
h1, h2, h3 { font-family: var(--f-titulo); font-weight: 800; letter-spacing: 0; margin: 0; }
h1 { color: var(--magenta-txt); }
h1 { font-size: 1.7rem; line-height: 1.15; }
h2 { font-size: 1.2rem; margin-bottom: .6rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6rem; }
a { color: var(--naranja-osc); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--naranja); outline-offset: 2px; }
.boot { padding: 3rem; color: var(--apagado); }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.neg { color: var(--magenta-txt); }
.muted { color: var(--apagado); }
.small { font-size: .85rem; }
.right { margin-left: auto; }
.hide { display: none !important; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 1rem; }

/* ---------- estructura ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--negro); color: var(--negro-ink); padding: 1.1rem .8rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.side { border-right: 4px solid var(--magenta); }
.marca { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; padding: .2rem .5rem .9rem; border-bottom: 1px solid rgba(255,255,255,.14); }
.marca img { display: block; width: 100%; max-width: 200px; height: auto; }
.marca span { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: .55rem; color: var(--negro-ink); text-decoration: none; padding: .5rem .6rem; border-radius: var(--radio); cursor: pointer; }
.nav a:hover { background: var(--negro-2); }
.nav a[aria-current="page"] { background: var(--naranja); color: #16110e; font-weight: 600; }
.nav .grupo { font-size: .72rem; opacity: .6; padding: .7rem .6rem .2rem; }
.nav .lock { margin-left: auto; opacity: .75; font-size: .75rem; }
.yo { margin-top: auto; font-size: .82rem; border-top: 1px solid rgba(255,255,255,.14); padding: .8rem .5rem 0; }
.yo b { color: #fff; display: block; word-break: break-all; }
.yo button { margin-top: .5rem; }
.main { padding: 1.4rem 1.8rem 4rem; min-width: 0; }
.cabecera { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1.1rem; }
.cabecera p { margin: .2rem 0 0; color: var(--apagado); max-width: 70ch; }
.menu-btn { display: none; }

/* ---------- controles ---------- */
.btn { border: 1px solid var(--linea-fuerte); background: var(--superficie); border-radius: var(--radio); padding: .42rem .8rem; cursor: pointer; font-weight: 500; }
.btn:hover { border-color: var(--texto); }
.btn.primario { background: var(--magenta-txt); border-color: var(--magenta-txt); color: #fff; }
.btn.primario:hover { background: #96106a; border-color: #96106a; }
.btn.suave { background: transparent; border-color: transparent; color: var(--naranja-osc); }
.btn.peligro { color: var(--magenta-txt); }
.btn.mini { padding: .15rem .5rem; font-size: .82rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.side .btn { background: transparent; color: var(--negro-ink); border-color: rgba(255,255,255,.3); }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=month], input[type=search], select, textarea {
  border: 1px solid var(--linea-fuerte); border-radius: var(--radio); background: var(--superficie); padding: .38rem .55rem; min-width: 0; }
textarea { width: 100%; min-height: 4.5rem; }
label.campo { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--apagado); }
label.campo > input, label.campo > select { color: var(--texto); font-size: 1rem; }
.chk { display: inline-flex; gap: .4rem; align-items: center; }

/* ---------- tarjetas y tablas ---------- */
.panel { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: 1rem 1.1rem; }
.panel.flat { padding: 0; overflow: hidden; }
.panel > h2:first-child, .panel > .panel-h { margin-top: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: .8rem 1rem; }
.kpi .t { font-size: .82rem; color: var(--apagado); }
.kpi .v { font-family: var(--f-titulo); font-weight: 700; font-size: 1.75rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: .82rem; color: var(--apagado); }
.kpi.clave { background: var(--naranja-claro); border-color: #ffc59c; }
.tabla-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: .42rem .65rem; border-bottom: 1px solid var(--linea); vertical-align: middle; text-align: left; }
th { font-weight: 600; font-size: .82rem; color: var(--apagado); background: #fdebe6; position: sticky; top: 0; white-space: nowrap; }
th.num { text-align: right; }
tbody tr:hover { background: #fff8f5; }
tr.sub td { background: var(--naranja-claro); font-weight: 600; border-top: 1px solid #ffc59c; }
tr.sub.mayor td { font-size: 1.02rem; background: #ffd2b0; }
tr.pct td { color: var(--apagado); font-size: .85rem; }
tr.sec td { background: #fbe5df; font-weight: 600; font-size: .85rem; color: var(--apagado); }
tr.sin-datos td { color: var(--apagado); }
td input, td select { width: 100%; padding: .25rem .4rem; border-color: transparent; background: transparent; }
td input:hover, td select:hover { border-color: var(--linea-fuerte); background: #fff; }
td input:focus, td select:focus { border-color: var(--naranja); background: #fff; }
td input.num { text-align: right; font-variant-numeric: tabular-nums; }
td.est { white-space: nowrap; }
td.guardando input { background: var(--ambar-claro); }
td.error input { background: var(--magenta-claro); border-color: var(--magenta-txt); }
.etq { display: inline-block; padding: .05rem .5rem; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.etq.ok { background: var(--naranja-claro); color: var(--naranja-osc); }
.etq.parcial { background: var(--ambar-claro); color: var(--ambar); }
.etq.sin { background: #f6e4de; color: var(--apagado); }
.etq.mal { background: var(--magenta-claro); color: var(--magenta-txt); }
.aviso { border-left: 4px solid var(--ambar); background: var(--ambar-claro); padding: .6rem .8rem; border-radius: 0 var(--radio) var(--radio) 0; }
.aviso.mal { border-color: var(--magenta-txt); background: var(--magenta-claro); }
.aviso.ok { border-color: var(--naranja); background: var(--naranja-claro); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--linea-fuerte); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: .5rem .9rem; cursor: pointer; font-weight: 500; color: var(--apagado); }
.tabs button[aria-selected="true"] { border-color: var(--magenta); color: var(--texto); }
.split { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; align-items: start; }
.split.split-b { grid-template-columns: minmax(0, 1fr) 330px; }
.lista { max-height: 70vh; overflow-y: auto; }
.lista button { display: flex; width: 100%; justify-content: space-between; gap: .5rem; text-align: left; border: 0; border-bottom: 1px solid var(--linea); background: none; padding: .5rem .7rem; cursor: pointer; }
.lista button:hover { background: #fff8f5; }
.lista button[aria-current="true"] { background: var(--naranja-claro); font-weight: 600; }
.barras { display: flex; align-items: flex-end; gap: .5rem; height: 150px; padding: .5rem .2rem 0; }
.barras .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .25rem; height: 100%; font-size: .75rem; color: var(--apagado); }
.barras .b i { display: block; width: 100%; max-width: 54px; background: var(--naranja); border-radius: 3px 3px 0 0; min-height: 2px; }
.barras .b i.neg { background: var(--magenta); }
.permisos { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .75rem; }
.permisos fieldset { border: 1px solid var(--linea); border-radius: var(--radio); padding: .5rem .8rem .7rem; margin: 0; }
.permisos legend { font-weight: 600; padding: 0 .3rem; }
.permisos label { display: flex; gap: .5rem; align-items: flex-start; padding: .15rem 0; }

/* ---------- modal, toast ---------- */
.velo { position: fixed; inset: 0; background: rgba(39,27,24,.55); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.modal { background: var(--superficie); border-radius: 10px; padding: 1.3rem 1.4rem; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal.ancho { width: min(820px, 100%); }
.modal h2 { margin-bottom: .8rem; }
.modal .acciones { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.1rem; }
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 60; }
.toast { background: var(--negro); color: #fff; padding: .6rem .9rem; border-radius: var(--radio); max-width: 380px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.mal { background: var(--magenta-txt); }

/* ---------- acceso ---------- */
.acceso { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, 1fr) minmax(320px, 440px); }
/* portada: fondo rosa y ondas como en el manual de marca */
.acceso .portada { position: relative; overflow: hidden; background: var(--rosa-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 600' preserveAspectRatio='none'%3E%3Cpath d='M300 0H120C170 120 70 220 150 330S120 520 190 600H300Z' fill='%23ff97b1'/%3E%3Cpath d='M300 0H170C215 130 125 230 195 335S175 520 235 600H300Z' fill='%23ff5277' fill-opacity='.9'/%3E%3Cpath d='M300 0H220C255 130 195 230 245 335S235 520 270 600H300Z' fill='%23ff4db8'/%3E%3C/svg%3E") no-repeat right top / auto 100%; padding: 3rem; display: flex; flex-direction: column; justify-content: center; gap: 1rem; }
.acceso .logo-grande { width: min(520px, 78%); height: auto; }
.acceso .slogan { font-family: var(--f-titulo); font-style: italic; font-weight: 800; font-size: clamp(1.1rem, 2.2vw, 1.6rem); color: var(--magenta-txt); margin: .5rem 0 0; text-transform: uppercase; }
.acceso .bajada { max-width: 34ch; color: var(--texto); }
.acceso .form { padding: 3rem 2.2rem; display: flex; flex-direction: column; justify-content: center; gap: 1rem; background: var(--superficie); }
.qr { background: #fff; padding: .6rem; border: 1px solid var(--linea); border-radius: var(--radio); width: 190px; height: 190px; }
.qr img { width: 100%; height: 100%; display: block; }
code.sec { background: #fbe5df; padding: .15rem .4rem; border-radius: 4px; word-break: break-all; }
.codigo { font-size: 1.6rem !important; letter-spacing: .35em; text-align: center; width: 12rem; font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav .grupo { display: none; }
  .main { padding: 1rem .9rem 3rem; }
  .split, .split.split-b { grid-template-columns: minmax(0, 1fr); }
  .acceso { grid-template-columns: 1fr; }
  .acceso .portada { padding: 1.5rem; background-size: auto 100%; background-position: right -120px top; min-height: 280px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .side, .btn, .tabs { display: none; } .shell { display: block; } }

.split > *, .main { min-width: 0; }
