/* Cerquita · Portal
   Usa SOLO los tokens de tokens.css (generados desde la misma fuente que la app).
   Guía: docs/GUIA_VISUAL.md */

@font-face {
  font-family: 'Robotog';
  src: url('../fonts/Robotog.woff2') format('woff2'), url('../fonts/Robotog.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --cq-radius-card: var(--md-sys-shape-corner-extra-large);
  --cq-radius-panel: var(--md-sys-shape-corner-large);
  --cq-rail: 96px;
  --cq-topbar: 64px;
  --cq-max: 1240px;
  --cq-dur: var(--md-sys-motion-duration-medium);
  --cq-ease: var(--md-sys-motion-easing);
  font-synthesis: none;
}
[data-motion="off"] { --cq-dur: 0ms; }
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after {
  animation-duration: 0ms !important; transition-duration: 0ms !important; scroll-behavior: auto !important;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--cq-font);
  font-size: var(--md-sys-typescale-body-large-size);
  line-height: var(--md-sys-typescale-body-large-line-height);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  min-height: 100dvh;
}
img, svg { display: block; }
a { color: var(--md-sys-color-primary); text-underline-offset: 3px; }
h1, h2, h3, h4 { font-weight: 400; margin: 0; letter-spacing: 0; }
h1 { font-size: var(--md-sys-typescale-headline-large-size); line-height: var(--md-sys-typescale-headline-large-line-height); }
h2 { font-size: var(--md-sys-typescale-headline-small-size); line-height: var(--md-sys-typescale-headline-small-line-height); }
h3 { font-size: var(--md-sys-typescale-title-large-size); line-height: var(--md-sys-typescale-title-large-line-height); }
p { margin: 0; }
.muted { color: var(--md-sys-color-on-surface-variant); }
.small { font-size: var(--md-sys-typescale-body-medium-size); line-height: var(--md-sys-typescale-body-medium-line-height); }
.label { font-size: var(--md-sys-typescale-label-large-size); letter-spacing: .02em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 2px; border-radius: 8px; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100; padding: 12px 20px;
  background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface);
  border-radius: var(--md-sys-shape-corner-full); text-decoration: none;
}
.skip-link:focus { top: 12px; }
.noscript { padding: 24px; }

md-icon { --md-icon-size: 24px; flex: none; }
md-filled-button, md-outlined-button, md-text-button, md-filled-tonal-button {
  --md-filled-button-container-height: 48px; --md-outlined-button-container-height: 48px;
  --md-text-button-container-height: 48px; --md-filled-tonal-button-container-height: 48px;
  --md-filled-button-label-text-font: var(--cq-font); --md-outlined-button-label-text-font: var(--cq-font);
  --md-text-button-label-text-font: var(--cq-font); --md-filled-tonal-button-label-text-font: var(--cq-font);
  --md-filled-button-label-text-size: 16px; --md-outlined-button-label-text-size: 16px;
  --md-text-button-label-text-size: 16px; --md-filled-tonal-button-label-text-size: 16px;
}
md-outlined-text-field, md-outlined-select { width: 100%; --md-outlined-text-field-container-shape: 14px; --md-outlined-select-text-field-container-shape: 14px; }
md-dialog { --md-dialog-container-shape: 28px; max-width: min(560px, calc(100vw - 32px)); }
md-dialog [slot="headline"] { font-family: var(--cq-font); }

/* ---------- Arranque y estados ---------- */
.boot { display: grid; place-items: center; gap: 16px; min-height: 100dvh; align-content: center; color: var(--md-sys-color-on-surface-variant); }
.boot img { animation: cq-breathe 1.6s var(--cq-ease) infinite alternate; }
@keyframes cq-breathe { from { transform: scale(.94); } to { transform: scale(1.04); } }

.state {
  display: grid; justify-items: center; text-align: center; gap: 12px;
  padding: 48px 24px; border-radius: var(--cq-radius-card);
  background: var(--md-sys-color-surface-container-low);
}
.state .state-art {
  width: 96px; height: 96px; border-radius: 32px; display: grid; place-items: center;
  background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container);
}
.state .state-art md-icon { --md-icon-size: 48px; }
.state.error .state-art { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.state.offline .state-art { background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface-variant); }
.state.locked .state-art { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }
.state p { max-width: 46ch; }
.state .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.skeleton { border-radius: var(--cq-radius-card); background: linear-gradient(90deg, var(--md-sys-color-surface-container) 0%, var(--md-sys-color-surface-container-high) 50%, var(--md-sys-color-surface-container) 100%); background-size: 200% 100%; animation: cq-shimmer 1.4s linear infinite; min-height: 180px; }
@keyframes cq-shimmer { to { background-position: -200% 0; } }

.offline-banner {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; justify-content: center;
  padding: 10px 16px; background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface);
}

/* ---------- Estructura adaptable (barra / riel / cajón) ---------- */
.shell { display: grid; grid-template-columns: var(--cq-rail) 1fr; min-height: 100dvh; background: linear-gradient(to right, var(--md-sys-color-surface-container) var(--cq-rail), transparent var(--cq-rail)); }
.rail {
  position: sticky; top: 0; height: 100dvh; align-self: start; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 0; background: var(--md-sys-color-surface-container); border-right: 1px solid var(--md-sys-color-outline-variant);
}
.rail .brand { margin-bottom: 20px; }
.nav-item {
  display: grid; justify-items: center; gap: 4px; width: 80px; padding: 4px 0 8px; text-decoration: none;
  color: var(--md-sys-color-on-surface-variant); font-size: var(--md-sys-typescale-label-medium-size); border-radius: 16px; position: relative;
}
.nav-item .pill { width: 56px; height: 32px; border-radius: 16px; display: grid; place-items: center; transition: background var(--cq-dur) var(--cq-ease); }
.nav-item:hover .pill { background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }
.nav-item[aria-current="page"] { color: var(--md-sys-color-on-surface); }
.nav-item[aria-current="page"] .pill { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.nav-item .badge {
  position: absolute; top: 0; left: 50%; margin-left: 10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--md-sys-color-error); color: var(--md-sys-color-on-error); font-size: 11px; display: grid; place-items: center;
}
.rail .spacer { flex: 1; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--cq-topbar); display: flex; align-items: center; gap: 8px;
  padding: 0 24px; background: color-mix(in srgb, var(--md-sys-color-surface) 92%, transparent); backdrop-filter: blur(10px);
}
.topbar h1 { font-size: var(--md-sys-typescale-title-large-size); line-height: 1.2; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { width: 100%; max-width: var(--cq-max); margin: 0 auto; padding: 8px 24px 96px; }
.bottom-nav { display: none; }
.brand-mark { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark span { font-size: 22px; letter-spacing: -.01em; }

@media (max-width: 839px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .rail { display: none; }
  .content { padding: 8px 16px 112px; }
  .topbar { padding: 0 8px 0 16px; }
  .bottom-nav {
    display: flex; position: fixed; inset: auto 0 0 0; z-index: 35; height: calc(80px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: var(--md-sys-color-surface-container);
    border-top: 1px solid var(--md-sys-color-outline-variant); justify-content: space-around; align-items: center;
  }
  .bottom-nav .nav-item { width: auto; flex: 1; }
}

/* ---------- Componentes de página ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; justify-content: space-between; margin: 16px 0 24px; }
.page-head .eyebrow { color: var(--md-sys-color-primary); font-size: var(--md-sys-typescale-label-large-size); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.panel {
  background: var(--md-sys-color-surface-container-low); border-radius: var(--cq-radius-panel); padding: 20px;
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 60%, transparent);
}
.panel > h3, .panel > header { margin-bottom: 12px; }
.panel header { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.panel header h3 { display: flex; align-items: center; gap: 10px; }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.form { display: grid; gap: 16px; max-width: 520px; }
.form .hint { color: var(--md-sys-color-on-surface-variant); font-size: var(--md-sys-typescale-body-medium-size); }
.field-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; min-height: 56px; }
.field-switch .txt { display: grid; }
.err-text { color: var(--md-sys-color-error); font-size: var(--md-sys-typescale-body-medium-size); display: flex; gap: 6px; align-items: center; }
.divider { height: 1px; background: var(--md-sys-color-outline-variant); margin: 8px 0; border: 0; }

/* Píldora de estado: icono + palabra + color (nunca solo color) */
.status {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 10px; border-radius: var(--md-sys-shape-corner-full);
  font-size: var(--md-sys-typescale-label-large-size); white-space: nowrap;
}
.status md-icon { --md-icon-size: 20px; }
.status.ok { background: var(--md-sys-color-ok-container); color: var(--md-sys-color-on-ok-container); }
.status.attention { background: var(--md-sys-color-warn-container); color: var(--md-sys-color-on-warn-container); }
.status.urgent { background: var(--md-sys-color-urgent); color: var(--md-sys-color-on-urgent); }
.fresh { display: inline-flex; align-items: center; gap: 6px; font-size: var(--md-sys-typescale-body-medium-size); color: var(--md-sys-color-on-surface-variant); }
.fresh md-icon { --md-icon-size: 18px; }
.fresh.stale { color: var(--md-sys-color-on-warn-container); background: var(--md-sys-color-warn-container); padding: 2px 10px 2px 8px; border-radius: 999px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--md-sys-color-ok); box-shadow: 0 0 0 0 var(--md-sys-color-ok); animation: cq-pulse 1.8s infinite; }
@keyframes cq-pulse { 70% { box-shadow: 0 0 0 10px transparent; } }

/* ---------- Tablero ---------- */
.elder-card {
  position: relative; display: grid; grid-template-rows: auto auto 1fr auto; gap: 16px; padding: 20px; border-radius: var(--cq-radius-card);
  background: var(--md-sys-color-surface-container-low); color: inherit; text-decoration: none; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 60%, transparent);
  transition: transform var(--cq-dur) var(--cq-ease), box-shadow var(--cq-dur) var(--cq-ease);
}
.elder-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px -14px color-mix(in srgb, var(--md-sys-color-shadow) 45%, transparent); }
.elder-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--md-sys-color-ok); }
.elder-card.attention::before { background: var(--md-sys-color-warn); }
.elder-card.urgent::before { background: var(--md-sys-color-urgent); height: 10px; }
.elder-card .who { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 56px; height: 56px; border-radius: 20px; display: grid; place-items: center; flex: none;
  background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); font-size: 24px;
}
.elder-card .who h3 { font-size: var(--md-sys-typescale-headline-small-size); line-height: 1.15; }
.reasons { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.reasons li { display: flex; gap: 8px; align-items: flex-start; }
.reasons li md-icon { --md-icon-size: 20px; margin-top: 2px; color: var(--md-sys-color-on-surface-variant); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fact { display: grid; gap: 2px; padding: 12px; border-radius: 18px; background: var(--md-sys-color-surface-container); min-width: 0; }
.fact md-icon { color: var(--md-sys-color-secondary); }
.fact .v { font-size: var(--md-sys-typescale-title-medium-size); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact .k { font-size: var(--md-sys-typescale-label-medium-size); color: var(--md-sys-color-on-surface-variant); }
.fact.bad { background: var(--md-sys-color-warn-container); color: var(--md-sys-color-on-warn-container); }
.fact.bad md-icon, .fact.bad .k { color: inherit; }
.elder-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Detalle ---------- */
.tabs-wrap { position: sticky; top: var(--cq-topbar); z-index: 20; background: var(--md-sys-color-surface); margin: 0 -24px 16px; padding: 0 24px; }
@media (max-width: 839px) { .tabs-wrap { margin: 0 -16px 16px; padding: 0 4px; } }
.tabs-wrap md-tabs { --md-primary-tab-label-text-font: var(--cq-font); --md-primary-tab-container-color: var(--md-sys-color-surface); overflow-x: auto; }
.hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: stretch;
}
@media (max-width: 1023px) { .hero { grid-template-columns: 1fr; } }
.map { height: 420px; border-radius: var(--cq-radius-panel); overflow: hidden; background: var(--md-sys-color-surface-container); z-index: 0; }
.map.small { height: 240px; }
.leaflet-container { font-family: var(--cq-font); }
.cq-pin { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50% 50% 50% 8px; transform: rotate(-45deg); background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); box-shadow: 0 4px 12px rgba(0,0,0,.3); border: 3px solid var(--md-sys-color-on-primary); }
.cq-pin > * { transform: rotate(45deg); }
.cq-pin.stale { background: var(--md-sys-color-outline); }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.metric { padding: 16px; border-radius: 20px; background: var(--md-sys-color-surface-container); display: grid; gap: 6px; align-content: start; }
.metric .top { display: flex; align-items: center; gap: 8px; color: var(--md-sys-color-on-surface-variant); }
.metric .big { font-size: var(--md-sys-typescale-headline-medium-size); line-height: 1.1; }
.metric.bad { background: var(--md-sys-color-warn-container); color: var(--md-sys-color-on-warn-container); }
.metric.bad .top { color: inherit; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--md-sys-color-on-surface-variant); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.chart { width: 100%; height: auto; max-height: 260px; }
.chart .grid-line { stroke: var(--md-sys-color-outline-variant); stroke-width: 1; }
.chart .axis { fill: var(--md-sys-color-on-surface-variant); font-size: 13px; font-family: var(--cq-font); }
.chart .line { fill: none; stroke: var(--md-sys-color-primary); stroke-width: 2.5; stroke-linejoin: round; }
.chart .area { fill: color-mix(in srgb, var(--md-sys-color-primary) 14%, transparent); }
.chart .charge { fill: color-mix(in srgb, var(--md-sys-color-ok) 22%, transparent); }
.chart .threshold { stroke: var(--md-sys-color-warn); stroke-dasharray: 6 5; stroke-width: 1.5; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: var(--md-sys-typescale-body-medium-size); color: var(--md-sys-color-on-surface-variant); }
.legend i { display: inline-block; width: 14px; height: 6px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

/* Hacer sonar */
.ring-panel { display: grid; gap: 16px; }
.ring-big {
  --md-filled-button-container-color: var(--md-sys-color-tertiary); --md-filled-button-label-text-color: var(--md-sys-color-on-tertiary);
  --md-filled-button-container-height: 72px; --md-filled-button-label-text-size: 20px; --md-filled-button-container-shape: 24px;
  --md-filled-button-icon-size: 28px; width: 100%;
}
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; counter-reset: s; }
.steps li { display: grid; justify-items: center; gap: 6px; text-align: center; font-size: var(--md-sys-typescale-label-large-size); color: var(--md-sys-color-on-surface-variant); position: relative; }
.steps li .dot { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--md-sys-color-surface-container-highest); }
.steps li.done .dot { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.steps li.now .dot { background: var(--md-sys-color-tertiary); color: var(--md-sys-color-on-tertiary); animation: cq-ring 0.9s ease-in-out infinite alternate; }
.steps li.now, .steps li.done { color: var(--md-sys-color-on-surface); }
.steps li.fail .dot { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
@keyframes cq-ring { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 18px; background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.notice.warn { background: var(--md-sys-color-warn-container); color: var(--md-sys-color-on-warn-container); }
.notice.error { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.notice.ok { background: var(--md-sys-color-ok-container); color: var(--md-sys-color-on-ok-container); }
.notice > div { display: grid; gap: 4px; }

/* ---------- Listas ---------- */
.list { display: grid; gap: 2px; border-radius: var(--cq-radius-panel); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 10px 16px; background: var(--md-sys-color-surface-container-low); }
.list-row .grow { flex: 1; min-width: 0; display: grid; }
.list-row .grow > * { overflow: hidden; text-overflow: ellipsis; }
.list-row .lead { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); flex: none; overflow: hidden; }
.list-row .lead img { width: 40px; height: 40px; object-fit: cover; }
.list-row.urgent .lead { background: var(--md-sys-color-urgent); color: var(--md-sys-color-on-urgent); }
.list-row.attention .lead { background: var(--md-sys-color-warn-container); color: var(--md-sys-color-on-warn-container); }
.search { margin-bottom: 12px; }

/* ---------- Diseñador ---------- */
.designer { display: grid; grid-template-columns: minmax(300px, 380px) 1fr minmax(280px, 360px); gap: 20px; align-items: start; }
@media (max-width: 1279px) { .designer { grid-template-columns: minmax(300px, 380px) 1fr; } .designer .props { grid-column: 1 / -1; } }
@media (max-width: 839px) { .designer { grid-template-columns: 1fr; } }
.phone-wrap { position: sticky; top: calc(var(--cq-topbar) + 64px); display: grid; justify-items: center; gap: 12px; }
.phone {
  --scale: 1; width: 340px; max-width: 100%; aspect-ratio: 9 / 19; border-radius: 44px; padding: 12px;
  background: #1d1b1a; box-shadow: 0 24px 48px -24px rgba(0,0,0,.5), inset 0 0 0 2px #3a3634;
}
.screen {
  height: 100%; border-radius: 34px; overflow: hidden; display: grid; grid-template-rows: auto auto 1fr auto auto;
  background: var(--p-surface); color: var(--p-on-surface); font-size: calc(14px * var(--scale));
}
.screen .s-status { display: flex; justify-content: space-between; padding: 10px 22px 0; font-size: 11px; opacity: .8; }
.screen .s-clock { padding: 8px 18px 6px; }
.screen .s-clock .t { font-size: calc(44px * var(--scale)); line-height: 1; }
.screen .s-clock .d { font-size: calc(14px * var(--scale)); margin-top: 4px; }
.screen .s-battery { font-size: calc(12px * var(--scale)); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.screen .s-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 12px; align-content: start; overflow: hidden; }
.p-card {
  border-radius: 20px; min-height: calc(86px * var(--scale)); padding: 10px; display: grid; align-content: end; gap: 2px;
  background: var(--c-bg); color: var(--c-fg); position: relative; overflow: hidden; cursor: grab; border: 2px solid transparent;
}
.p-card.large { grid-column: span 2; min-height: calc(96px * var(--scale)); }
.p-card .p-title { font-size: calc(15px * var(--scale)); line-height: 1.15; overflow-wrap: anywhere; }
.p-card .p-sub { font-size: calc(11px * var(--scale)); opacity: .9; }
.p-card .p-ic { position: absolute; top: 10px; left: 10px; }
.p-card .p-ic md-icon { --md-icon-size: calc(24px * var(--scale)); }
.p-card .p-photo { position: absolute; top: 8px; right: 8px; width: calc(40px * var(--scale)); height: calc(40px * var(--scale)); border-radius: 14px; object-fit: cover; }
.p-card.selected { border-color: var(--p-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--p-focus) 35%, transparent); }
.p-card.dragging { opacity: .4; }
.p-card.drop-before { box-shadow: -4px 0 0 0 var(--p-focus); }
.screen .s-pager { display: flex; justify-content: space-between; align-items: center; padding: 4px 12px; font-size: 11px; }
.screen .s-pager button { all: unset; cursor: pointer; padding: 6px 10px; border-radius: 12px; background: var(--p-container); color: var(--p-on-container); font-size: 11px; }
.screen .s-pager button:disabled { opacity: .35; cursor: default; }
.screen .s-home { margin: 6px 12px 12px; padding: 10px; border-radius: 18px; text-align: center; background: var(--p-primary); color: var(--p-on-primary); display: flex; gap: 8px; justify-content: center; align-items: center; font-size: calc(14px * var(--scale)); }
.card-list { display: grid; gap: 8px; }
.card-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 4px; border-radius: 18px; background: var(--md-sys-color-surface-container);
  border: 2px solid transparent; cursor: pointer;
}
.card-item.selected { border-color: var(--md-sys-color-primary); background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.card-item.hidden-level { opacity: .62; }
.card-item .grow { flex: 1; min-width: 0; display: grid; }
.card-item .drag { cursor: grab; color: var(--md-sys-color-on-surface-variant); padding: 8px 4px; }
.card-item .chip-mini { font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 48px; height: 48px; border-radius: 16px; border: 3px solid transparent; cursor: pointer; display: grid; place-items: center; }
.swatch[aria-checked="true"] { border-color: var(--md-sys-color-on-surface); }
.levels { display: grid; gap: 8px; }
.level-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 18px; background: var(--md-sys-color-surface-container); cursor: pointer; }
.level-opt[aria-checked="true"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); outline: 2px solid var(--md-sys-color-secondary); }
.publish-bar {
  position: sticky; bottom: 0; z-index: 25; margin-top: 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 12px 16px; border-radius: 24px; background: var(--md-sys-color-surface-container-high);
  box-shadow: 0 -6px 24px -18px rgba(0,0,0,.4);
}
@media (max-width: 839px) { .publish-bar { bottom: calc(88px + env(safe-area-inset-bottom)); } }

/* ---------- Inicio de sesión ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
  position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container);
}
.auth-art h1 { font-size: clamp(36px, 4.4vw, 60px); line-height: 1.05; max-width: 12ch; }
.auth-art .blob { position: absolute; border-radius: 42% 58% 61% 39% / 44% 38% 62% 56%; opacity: .9; }
.auth-art .b1 { width: 340px; height: 340px; right: -80px; bottom: -60px; background: var(--md-sys-color-tertiary-container); }
.auth-art .b2 { width: 180px; height: 180px; right: 160px; bottom: 150px; background: var(--md-sys-color-secondary-container); border-radius: 50%; }
.auth-art .points { display: grid; gap: 14px; position: relative; z-index: 1; max-width: 34ch; }
.auth-art .points div { display: flex; gap: 12px; align-items: center; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth-form .box { width: min(440px, 100%); display: grid; gap: 20px; }
@media (max-width: 839px) { .auth { grid-template-columns: 1fr; } .auth-art { padding: 28px 24px; min-height: 0; } .auth-art .points, .auth-art .blob { display: none; } .auth-art h1 { font-size: 34px; } }

/* ---------- QR ---------- */
.qr-box { display: grid; justify-items: center; gap: 16px; padding: 24px; border-radius: var(--cq-radius-card); background: #fff; color: #1d1b1a; }
.qr-box svg { width: min(280px, 70vw); height: auto; }
.code-digits { font-size: 44px; letter-spacing: .18em; font-variant-numeric: tabular-nums; }
.timer-bar { width: 100%; height: 8px; border-radius: 4px; background: #eee; overflow: hidden; }
.timer-bar > i { display: block; height: 100%; background: var(--md-sys-color-secondary); transition: width 1s linear; }

/* ---------- Snackbar ---------- */
.snackbar {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; max-width: min(560px, calc(100vw - 32px));
  padding: 14px 20px; border-radius: 14px; background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface);
  box-shadow: 0 8px 28px rgba(0,0,0,.3); display: flex; gap: 12px; align-items: center;
}
@media (max-width: 839px) { .snackbar { bottom: calc(96px + env(safe-area-inset-bottom)); } }
.snackbar.error { background: var(--md-sys-color-error); color: var(--md-sys-color-on-error); }

/* ---------- Página de aterrizaje del QR ---------- */
.landing { display: grid; place-items: center; min-height: 100dvh; padding: 24px; background: var(--md-sys-color-primary-container); }
.landing-card { max-width: 480px; display: grid; gap: 16px; justify-items: center; text-align: center; padding: 40px 28px; border-radius: 32px; background: var(--md-sys-color-surface); }

@media print { .rail, .bottom-nav, .topbar, .publish-bar { display: none !important; } }
