/* Sistema de préstamos As Termas — tablet (quiosco) y panel de gestión */
:root {
  --brand: #008C8B;
  --brand-600: #007372;
  --brand-700: #0B4A4B;
  --brand-50: #E6F4F4;
  --brand-100: #CDE9E8;
  --ink: #10292B;
  --muted: #5B6F72;
  --line: #DCE8E8;
  --bg: #F3F7F7;
  --card: #FFFFFF;
  --ok: #2F7D4F;
  --info: #2B6CB0;
  --warn: #A86500;
  --danger: #C0392B;
  --shadow: 0 1px 2px rgba(16, 41, 43, .05), 0 8px 24px rgba(16, 41, 43, .06);
  --radius: 16px;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); line-height: 1.45; }
a { color: var(--brand-600); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, white); outline-offset: 2px; }
.icon { width: 24px; height: 24px; flex: none; }
.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 14px; height: 14px; }
.muted { color: var(--muted); }
.right { text-align: right; }
[hidden] { display: none !important; }

/* ================================================================ QUIOSCO */
body.kiosk {
  min-height: 100dvh;
  font-size: 18px;
  background:
    radial-gradient(1100px 560px at 105% -15%, #d4eeed 0%, transparent 60%),
    radial-gradient(900px 520px at -15% 115%, #e1f2f1 0%, transparent 60%),
    #F6FAFA;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
body.kiosk input, body.kiosk textarea { -webkit-user-select: text; user-select: text; }

/* Pantalla de bienvenida */
body.is-splash { background: #008C8B; color: #fff; overflow: hidden; }
.splash {
  position: relative; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px; color: #fff; text-decoration: none; text-align: center;
}
.splash-logo { width: min(72vw, 640px); position: relative; z-index: 1; mix-blend-mode: lighten; /* el fondo verde del JPG se funde con la pantalla */ animation: rise .9s cubic-bezier(.2, .8, .2, 1) both; }
.splash-welcome { position: relative; z-index: 1; font-size: clamp(1.3rem, 3vw, 2.1rem); font-weight: 500; opacity: .92; animation: rise .9s .15s both; }
.splash-tap {
  position: relative; z-index: 1; margin-top: 28px; padding: 18px 36px; border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .55); font-size: clamp(1.1rem, 2.4vw, 1.5rem); font-weight: 600;
  animation: rise .9s .3s both, breathe 2.6s 1.2s ease-in-out infinite;
}
.ripples { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.ripples i {
  grid-area: 1 / 1; width: min(60vw, 520px); aspect-ratio: 1; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .22); animation: ripple 6s linear infinite;
}
.ripples i:nth-child(2) { animation-delay: 2s; }
.ripples i:nth-child(3) { animation-delay: 4s; }
@keyframes ripple { from { transform: scale(.55); opacity: 1; } to { transform: scale(2.4); opacity: 0; } }
@keyframes breathe { 50% { background: rgba(255, 255, 255, .14); transform: scale(1.04); } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.langs { display: flex; gap: 6px; }
.langs a {
  padding: 10px 16px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .95rem;
  color: var(--muted); background: transparent;
}
.langs a[aria-current] { background: var(--brand); color: #fff; }
.is-splash .langs { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 2; background: rgba(255, 255, 255, .12); padding: 6px; border-radius: 999px; }
.is-splash .langs a { color: #fff; padding: 12px 22px; font-size: 1.05rem; }
.is-splash .langs a[aria-current] { background: #fff; color: var(--brand-600); }

.staff-btn {
  position: fixed; right: 18px; bottom: 18px; z-index: 3; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; color: var(--muted); opacity: .4; text-decoration: none;
}
.is-splash .staff-btn { color: #fff; }

/* Cabecera con pasos */
.k-top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 3vw, 36px); background: rgba(255, 255, 255, .82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.k-logo img { height: 52px; border-radius: 10px; display: block; }
.steps { display: flex; gap: 10px; list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); font-size: .95rem; }
.steps li + li::before { content: ""; width: 28px; height: 2px; background: var(--line); margin-right: 2px; }
.steps span {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: .9rem;
  background: #fff; border: 2px solid var(--line);
}
.steps .current { color: var(--ink); }
.steps .current span { background: var(--brand); border-color: var(--brand); color: #fff; }
.steps .done span { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-600); }

.k-main { max-width: 1120px; margin: 0 auto; padding: clamp(24px, 4vw, 52px) clamp(16px, 3vw, 36px) 96px; }
.k-narrow { max-width: 880px; }
.k-title { margin: 0; text-align: center; font-size: clamp(2rem, 4.6vw, 3.3rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.12; }
.k-title-sm { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: 20px; }
.k-sub { text-align: center; color: var(--muted); font-size: 1.2rem; margin: 10px 0 clamp(24px, 4vw, 44px); }

/* Tarjetas de servicios */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(16px, 2.4vw, 28px); }
.card-svc {
  --c: var(--brand);
  position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 22px;
  min-height: clamp(190px, 26vh, 260px); padding: clamp(22px, 3vw, 34px); border-radius: 28px;
  background: var(--card); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(16, 41, 43, .08);
  color: var(--ink); text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
  animation: rise .55s calc(var(--i, 0) * 80ms) cubic-bezier(.2, .8, .2, 1) both;
}
.card-svc::before {
  content: ""; position: absolute; right: -70px; top: -70px; width: 220px; height: 220px; border-radius: 50%;
  background: var(--c); opacity: .07;
}
a.card-svc:active { transform: scale(.975); box-shadow: 0 4px 14px rgba(16, 41, 43, .1); }
.svc-icon {
  width: 84px; height: 84px; flex: none; border-radius: 24px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c, var(--brand)) 13%, white); color: var(--c, var(--brand));
}
.svc-icon .icon { width: 48px; height: 48px; }
.svc-icon.sm { width: 44px; height: 44px; border-radius: 12px; }
.svc-icon.sm .icon { width: 24px; height: 24px; }
.svc-name { margin-top: auto; font-size: clamp(1.35rem, 2.4vw, 1.75rem); font-weight: 750; line-height: 1.2; padding-right: 64px; }
.svc-go {
  position: absolute; right: clamp(20px, 3vw, 30px); bottom: clamp(20px, 3vw, 30px); width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; background: var(--c); color: #fff;
}
.svc-go .icon { width: 28px; height: 28px; }
.card-svc.is-off { opacity: .55; filter: grayscale(.7); }
.svc-meta { font-weight: 600; color: var(--muted); margin-top: -12px; }
/* Tablet en vertical: filas compactas en vez de tarjetas altas */
@media (orientation: portrait) {
  .cards { grid-template-columns: 1fr; gap: 14px; }
  .card-svc { flex-direction: row; align-items: center; min-height: 0; padding: 16px 20px; gap: 18px; border-radius: 22px; }
  .card-svc .svc-icon { width: 64px; height: 64px; border-radius: 18px; }
  .card-svc .svc-icon .icon { width: 36px; height: 36px; }
  .svc-name { margin-top: 0; padding-right: 0; }
  .svc-go { position: static; margin-left: auto; flex: none; }
  .svc-meta { margin: 0 0 0 auto; }
}

/* Panel de formulario */
.k-panel { background: var(--card); border: 1px solid var(--line); border-radius: 28px; padding: clamp(22px, 4vw, 40px); box-shadow: 0 12px 32px rgba(16, 41, 43, .07); }
.k-panel-head { display: flex; gap: 20px; align-items: center; margin-bottom: 28px; }
.k-panel-head h1 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -.01em; }
.k-panel-head p { margin: 4px 0 0; color: var(--muted); }
.k-panel-head .eyebrow { margin: 0; color: var(--brand-600); font-weight: 700; text-transform: uppercase; font-size: .85rem; letter-spacing: .06em; }
.k-form { display: grid; gap: 22px; }
/* El teclado de la tablet tapa la mitad de abajo sin encoger la página: mientras se escribe, se deja sitio para subir el campo */
@media (orientation: landscape) { .kiosk.typing .k-main { padding-bottom: 50vh; } }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.k-form .field > span { font-size: 1.05rem; }
.k-form .field input {
  height: 66px; padding: 0 20px; font-size: 1.35rem; border: 2px solid var(--line); border-radius: 16px; background: #FBFDFD;
}
.k-form .field input:focus { border-color: var(--brand); background: #fff; outline: none; box-shadow: 0 0 0 4px var(--brand-50); }
.field.has-error input { border-color: var(--danger); }
.field em { color: var(--danger); font-style: normal; font-weight: 600; font-size: .95rem; }

.seg { display: inline-flex; gap: 6px; padding: 6px; background: var(--bg); border-radius: 18px; justify-self: start; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 14px 26px; border-radius: 14px; font-weight: 650; font-size: 1.1rem; color: var(--muted); cursor: pointer; }
.seg input:checked + span { background: #fff; color: var(--brand-600); box-shadow: 0 2px 8px rgba(16, 41, 43, .1); }
.seg input:focus-visible + span { outline: 3px solid var(--brand-100); }

.k-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 28px; }
.kbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 68px; padding: 0 34px;
  border-radius: 18px; font-size: 1.25rem; font-weight: 700; text-decoration: none; border: 2px solid transparent; cursor: pointer;
}
.kbtn .icon { width: 26px; height: 26px; }
.kbtn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 20px rgba(0, 140, 139, .28); }
.kbtn-primary:active { background: var(--brand-600); transform: translateY(1px); }
.kbtn-primary:disabled { opacity: .6; }
.kbtn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.kbtn-light { background: #fff; color: var(--brand-600); min-width: 200px; }

/* Contrato */
.paper {
  background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 44px); max-height: 52vh; overflow: auto; -webkit-overflow-scrolling: touch;
  font-size: 1rem; -webkit-user-select: text; user-select: text;
}
.admin .paper { max-height: none; }
/* Tablet: barra de scroll siempre visible y sombra abajo mientras quede texto, para que se vea que hay más páginas */
.kiosk .paper {
  background:
    linear-gradient(rgba(255, 255, 255, 0), #fff 70%) 0 100% / 100% 48px no-repeat local,
    radial-gradient(farthest-side at 50% 100%, rgba(16, 41, 43, .22), transparent) 0 100% / 100% 22px no-repeat scroll,
    #fff;
}
.kiosk .paper::-webkit-scrollbar { width: 14px; }
.kiosk .paper::-webkit-scrollbar-track { background: var(--brand-50); border-radius: 0 20px 20px 0; }
.kiosk .paper::-webkit-scrollbar-thumb { background: var(--brand); border-radius: 10px; border: 3px solid var(--brand-50); min-height: 60px; }
.contract .c-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--brand); padding-bottom: 12px; }
.contract .c-logo { height: 52px; border-radius: 8px; }
.contract .c-ref { color: var(--muted); font-size: .9rem; }
.contract .c-title { text-align: center; color: var(--brand-600); text-transform: uppercase; font-size: clamp(1.05rem, 2vw, 1.3rem); margin: 22px 0 16px; letter-spacing: .02em; }
.contract table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.contract th, .contract td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
.contract th { background: var(--brand-50); color: var(--brand-700); font-size: .88rem; width: 24%; }
.contract h3 { color: var(--brand-600); font-size: 1.08rem; margin: 22px 0 6px; }
.contract p { margin: 0 0 10px; }
.contract ul { margin: 0 0 10px; padding-left: 22px; }

.k-sign { margin-top: 24px; display: grid; gap: 18px; }
/* «Firmar y enviar» siempre a la vista: hay quien no baja hasta el final */
.k-sign .k-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; margin: 0;
  padding: 14px max(16px, calc((100% - 880px) / 2 + 36px)); background: rgba(243, 247, 247, .96); box-shadow: 0 -6px 20px rgba(16, 41, 43, .1);
}
.k-main:has(.k-sign) { padding-bottom: 130px; }
.check {
  display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-radius: 18px; background: #fff;
  border: 2px solid var(--line); font-size: 1.2rem; font-weight: 600; cursor: pointer;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box { width: 38px; height: 38px; flex: none; border-radius: 10px; border: 2px solid var(--brand-100); display: grid; place-items: center; color: transparent; background: #fff; }
.check input:checked + .box { background: var(--brand); border-color: var(--brand); color: #fff; }
.check:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }

.sigpad {
  position: relative; height: 280px; border-radius: 20px; background: #fff; border: 2px dashed color-mix(in srgb, var(--brand) 45%, white);
  overflow: hidden;
}
.sigpad canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.sigpad::after { content: ""; position: absolute; left: 8%; right: 8%; bottom: 26%; border-bottom: 2px solid var(--line); pointer-events: none; }
.sig-hint { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 1.3rem; pointer-events: none; }
.sigpad.has-ink .sig-hint { display: none; }
.sig-clear {
  position: absolute; top: 12px; right: 12px; z-index: 1; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; font-weight: 600; cursor: pointer;
}
.sigpad-sm { height: 190px; }
.sigpad-sm .sig-hint { font-size: 1rem; }

.k-error { margin: 12px 0 0; padding: 14px 18px; border-radius: 14px; background: #FDECEA; color: #9B2C2C; font-weight: 600; }

/* Gracias */
body.is-thanks { background: linear-gradient(160deg, #009C9B, #007372); color: #fff; }
.thanks { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 18px; padding: 24px; }
.thanks .tick { width: 150px; height: 150px; border-radius: 50%; background: #fff; color: var(--brand); display: grid; place-items: center; animation: pop .6s cubic-bezier(.2, 1.4, .4, 1) both; }
.thanks .tick .icon { width: 84px; height: 84px; stroke-width: 2.6; }
.thanks h1 { margin: 10px 0 0; font-size: clamp(2.2rem, 5vw, 3.4rem); animation: rise .6s .15s both; }
.thanks p { max-width: 660px; font-size: clamp(1.15rem, 2.3vw, 1.45rem); margin: 0; opacity: .95; animation: rise .6s .25s both; }
.thanks .muted { color: rgba(255, 255, 255, .75); font-size: 1rem; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* PIN del personal */
.people { display: flex; flex-wrap: wrap; gap: 10px; }
.people input { position: absolute; opacity: 0; pointer-events: none; }
.people span { display: block; padding: 14px 22px; border-radius: 14px; border: 2px solid var(--line); font-weight: 600; cursor: pointer; background: #fff; }
.people input:checked + span { border-color: var(--brand); background: var(--brand-50); color: var(--brand-600); }
.pin-input { height: 78px; text-align: center; font-size: 2.4rem; letter-spacing: .5em; border: 2px solid var(--line); border-radius: 18px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.keypad button { height: 78px; border-radius: 18px; border: none; background: var(--bg); font-size: 1.9rem; font-weight: 600; cursor: pointer; }
.keypad button:active { background: var(--brand-100); }
.keypad .ok { background: var(--brand); color: #fff; font-size: 1.3rem; }

@media (max-width: 760px) {
  .cards, .grid2 { grid-template-columns: 1fr; }
  .steps { display: none; }
  .k-actions { flex-direction: column-reverse; align-items: stretch; }
}

/* ================================================================ PANEL */
body.admin { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; font-size: 15px; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 20px 14px;
  background: linear-gradient(180deg, #0B4A4B, #083A3B); color: #fff; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; padding: 0 6px; }
.brand img { height: 38px; border-radius: 8px; }
.side nav { display: grid; gap: 2px; }
.side nav a { padding: 10px 14px; border-radius: 10px; color: rgba(255, 255, 255, .78); text-decoration: none; font-weight: 500; }
.side nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side nav a.active { background: rgba(255, 255, 255, .15); color: #fff; font-weight: 650; }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.side .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .28); }
.side .btn-ghost:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .5); color: #fff; }
.me { display: grid; color: #fff; text-decoration: none; padding: 8px 6px 0; border-top: 1px solid rgba(255, 255, 255, .12); }
.me small { color: rgba(255, 255, 255, .65); }
.link { background: none; border: none; padding: 0 6px; color: rgba(255, 255, 255, .7); cursor: pointer; text-align: left; text-decoration: underline; }

.main { padding: 28px clamp(16px, 3vw, 36px) 60px; max-width: 1320px; width: 100%; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.top h1 { margin: 0; font-size: 1.6rem; letter-spacing: -.01em; }
.top form { display: inline; }
.top > :not(h1) { display: flex; gap: 8px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; font-size: 1.08rem; }
.card h2 small { color: var(--muted); font-weight: 400; font-size: .85rem; }
.narrow { max-width: 860px; }
.empty { color: var(--muted); margin: 6px 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); display: grid; gap: 4px; }
.kpi span { color: var(--muted); font-size: .88rem; font-weight: 600; }
.kpi strong { font-size: 2.1rem; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi.warn { border-left: 4px solid var(--warn); }
.kpi.warn strong { color: var(--warn); }
.kpi.danger { border-left: 4px solid var(--danger); }
.kpi.danger strong { color: var(--danger); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #F8FBFB; }
.admin .table tbody tr:has(a[href], [data-row]) { cursor: pointer; }
.table tr.is-late td { background: #FFF5F3; }
.table tr.is-off td { opacity: .55; }
.table td.right { white-space: nowrap; position: relative; }
.table a { font-weight: 600; text-decoration: none; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 650; white-space: nowrap; }
.badge-ok { background: #E6F4EC; color: var(--ok); }
.badge-info { background: #E8F0FA; color: var(--info); }
.badge-warn { background: #FFF3DC; color: var(--warn); }
.badge-danger { background: #FDECEA; color: var(--danger); }
.badge-muted { background: #EEF2F2; color: var(--muted); }
.danger-text { color: var(--danger); }

.chip {
  --c: var(--brand);
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 7px; margin-right: 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--c) 11%, white); color: color-mix(in srgb, var(--c) 85%, black); font-size: .82rem; font-weight: 650; white-space: nowrap;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid transparent; font-size: .92rem; font-weight: 650; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand-100); background: var(--brand-50); }
.btn-danger { background: var(--danger); color: #fff; margin-right: auto; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: .84rem; }
.btn-block { width: 100%; }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 500; }
.flash-ok { background: #E6F4EC; color: #22603F; }
.flash-error { background: #FDECEA; color: #9B2C2C; }
.flash-warn { background: #FFF5DE; color: #7A5200; }
.flash-info { background: #E8F0FA; color: #24527A; }

.form { display: grid; gap: 16px; }
.form h2 { margin: 10px 0 0; }
.field { display: grid; gap: 6px; margin: 0; }
.field > span, fieldset.field legend { font-size: .88rem; font-weight: 650; }
.field small { color: var(--muted); font-weight: 400; }
.admin .field input:not([type=checkbox]):not([type=radio]):not([type=color]), .admin .field select, .admin .field textarea, .login .field input {
  min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%;
}
.admin .field input:focus, .admin .field select:focus, .admin .field textarea:focus, .login .field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.admin input[type=color] { width: 64px; height: 42px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
fieldset.field { border: 0; padding: 0; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 8px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices input { position: absolute; opacity: 0; pointer-events: none; }
.choices span { display: inline-flex; align-items: center; padding: 10px 16px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; font-weight: 550; }
.choices input:checked + span { border-color: var(--brand); background: var(--brand-50); color: var(--brand-600); font-weight: 650; }
.choices input:focus-visible + span { outline: 3px solid var(--brand-100); }
.choices.icons span { padding: 10px; }
.choices.icons .icon { width: 30px; height: 30px; }
.check-line { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check-line input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9rem; line-height: 1.55; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters .grow { flex: 1 1 240px; }
.filter-actions { display: flex; gap: 8px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .grid-2, .grid-2 + .card, .card + .grid-2 { margin-top: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.row-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.row-item:last-child { border-bottom: 0; }
.row-item strong { margin-right: 8px; }
.row-item small { color: var(--muted); }
.row-actions { display: flex; gap: 8px; }

.stock { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.stock-item { --c: var(--brand); display: flex; align-items: center; gap: 12px; }
.stock-item > div { flex: 1; display: grid; gap: 4px; }
.stock-item small { color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: #EDF3F3; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c); border-radius: 99px; }

.hbar { --c: var(--brand); position: relative; height: 26px; border-radius: 6px; background: #F0F5F5; min-width: 120px; }
.hbar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c); border-radius: 6px; opacity: .8; }
.hbar b { position: relative; padding-left: 9px; line-height: 26px; font-size: .85rem; font-variant-numeric: tabular-nums; }
.w-bar { width: 40%; }
.bl-row { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: center; margin-bottom: 6px; font-size: .88rem; }

.dl { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; margin: 0; }
.dl dt { color: var(--muted); font-size: .9rem; }
.dl dd { margin: 0; }
.sigs { display: flex; gap: 20px; flex-wrap: wrap; }
.sigs figure { margin: 0; display: grid; gap: 6px; }
.sigs img { max-height: 120px; max-width: 280px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.sigs figcaption { color: var(--muted); font-size: .85rem; }
.doc { display: grid; gap: 6px; justify-items: start; margin: 0 0 12px; }
.hash { font-family: ui-monospace, Consolas, monospace; font-size: .72rem; color: var(--muted); word-break: break-all; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 6px; }
.summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--brand-50); margin-bottom: 18px; }
.summary span { color: var(--muted); }
.sig-current { display: flex; align-items: center; gap: 16px; margin: 0 0 8px; }
.sig-current img { max-height: 70px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tabs a { padding: 8px 14px; border-radius: 10px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .92rem; }
.tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tabs-sm a { padding: 5px 12px; font-size: .84rem; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.help ul { padding-left: 18px; margin: 0 0 14px; }
.help li { margin-bottom: 4px; }
.help code { background: #EEF5F5; padding: 1px 6px; border-radius: 6px; font-size: .84rem; }
.versions { list-style: none; padding: 0 !important; font-size: .88rem; }

.pager { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.pager a, .pager span { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; }
.pager span { background: var(--brand); border-color: var(--brand); color: #fff; }

.modal { width: min(440px, calc(100% - 32px)); padding: 24px; border: 0; border-radius: var(--radius); box-shadow: 0 20px 60px rgba(16, 41, 43, .3); text-align: left; color: var(--ink); }
.modal::backdrop { background: rgba(16, 41, 43, .45); }
.modal h2 { margin: 0 0 16px; font-size: 1.15rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Acceso */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(900px 500px at 80% -10%, #00A3A1, transparent 60%), linear-gradient(160deg, #008C8B, #0B4A4B); }
.login .ripples { position: fixed; overflow: hidden; }
.login-card { position: relative; z-index: 1; width: min(420px, 100%); background: #fff; border-radius: 22px; padding: 30px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.login-card img { width: 100%; border-radius: 14px; display: block; }
.login-card h1 { font-size: 1.05rem; text-align: center; color: var(--muted); margin: 18px 0 20px; font-weight: 600; }

@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  body.admin { grid-template-columns: 1fr; }
  .side { position: sticky; z-index: 10; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; }
  .side nav { order: 3; width: 100%; display: flex; overflow-x: auto; gap: 4px; }
  .side nav a { white-space: nowrap; padding: 8px 12px; }
  .side-foot { margin: 0 0 0 auto; display: flex; align-items: center; gap: 8px; }
  .side-foot .btn-block { width: auto; }
  .me { border: 0; padding: 0; }
  .me small { display: none; }
  .grid-2, .grid-3, .perm-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .main { padding: 18px 16px 48px; }
}
