/* ==========================================================================
   DOMINO — Componentes y layout ("Ficha sobre fieltro", rediseño 2026-11-06)
   Mobile-first: las reglas base son el móvil; @media (min-width: 900px) agrega
   escritorio. Solo se animan transform/opacity (más sombras en estados de foco).
   ========================================================================== */

/* ------------------------------------------------------------------
   1. Reset y fundamentos
   ------------------------------------------------------------------ */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  margin: 0;
  background-color: var(--color-bg);
  min-height: 100%;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  text-rendering: optimizeLegibility;
}

/* Luz ambiental fija (compuesta, no se repinta al hacer scroll) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 12% -8%, var(--glow-a), transparent 70%),
    radial-gradient(760px 560px at 105% 105%, var(--glow-b), transparent 70%);
}

/* ------------------------------------------------------------------
   2. Tipografía
   ------------------------------------------------------------------ */
h1, h2, h3, h4, .ui-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

.display-num {
  font-family: var(--font-num);
  font-weight: 800;
  font-stretch: 108%;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  line-height: 1.05;
}

/* Antes etiqueta en mayúsculas; ahora texto de apoyo en minúsculas legibles */
.eyebrow {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--color-text-muted);
}

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  font-family: var(--font-num);
  font-stretch: 105%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
}

/* ------------------------------------------------------------------
   3. Movimiento: keyframes y entradas
   ------------------------------------------------------------------ */
@keyframes enter-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes tile-in {
  from { opacity: 0; transform: translateY(22px) rotate(-1.4deg) scale(0.965); }
  to   { opacity: 1; transform: none; }
}

@keyframes pip-in {
  from { opacity: 0; transform: scale(0.4); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes glint {
  from { transform: translateX(-130%) skewX(-18deg); opacity: 0; }
  18%  { opacity: 1; }
  to   { transform: translateX(260%) skewX(-18deg); opacity: 0; }
}

@keyframes drop-in {
  0%   { opacity: 0; transform: translateY(-34px) rotate(-22deg) scale(0.9); }
  60%  { opacity: 1; transform: translateY(3px) rotate(-3deg) scale(1); }
  100% { opacity: 1; transform: translateY(0) rotate(var(--mark-rot, -6deg)) scale(1); }
}

@keyframes sheet-up {
  from { opacity: 0.4; transform: translateY(36px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  45% { transform: translateX(5px); }
  70% { transform: translateX(-3px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse-radar {
  0%   { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(63, 199, 150, 0.6); }
  70%  { transform: scale(1);    box-shadow: 0 0 0 7px rgba(63, 199, 150, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(63, 199, 150, 0); }
}

@keyframes slide-drawer {
  from { transform: translateY(100%); opacity: 0.8; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(-14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.animate-enter {
  animation: enter-up 340ms var(--ease-settle) both;
}

.animate-stagger > *:nth-child(1) { animation: enter-up 340ms 20ms var(--ease-settle) both; }
.animate-stagger > *:nth-child(2) { animation: enter-up 340ms 65ms var(--ease-settle) both; }
.animate-stagger > *:nth-child(3) { animation: enter-up 340ms 110ms var(--ease-settle) both; }
.animate-stagger > *:nth-child(4) { animation: enter-up 340ms 155ms var(--ease-settle) both; }
.animate-stagger > *:nth-child(5) { animation: enter-up 340ms 200ms var(--ease-settle) both; }
.animate-stagger > *:nth-child(6) { animation: enter-up 340ms 245ms var(--ease-settle) both; }

/* Entrada coreografiada: cada pieza lleva su orden en --i */
[data-reveal] {
  animation: rise 520ms var(--ease-settle) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

/* El home orquesta su propia entrada; se anula el stagger genérico de <main> */
.app-main > .home { animation: none; }

/* Transición entre páginas (View Transitions, mejora progresiva) */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: vt-out 140ms var(--ease-out) both;
}

::view-transition-new(root) {
  animation: vt-in 300ms 40ms var(--ease-settle) both;
}

@keyframes vt-out {
  to { opacity: 0; }
}

@keyframes vt-in {
  from { opacity: 0; transform: translateY(10px); }
}

::view-transition-group(brand-mark) {
  animation-duration: 460ms;
  animation-timing-function: var(--ease-settle);
}

::view-transition-group(dock-pill) {
  animation-duration: 340ms;
  animation-timing-function: var(--ease-settle);
}

::view-transition-new(dock):only-child {
  animation: vt-dock-in 420ms 120ms var(--ease-settle) both;
}

::view-transition-new(app-header):only-child {
  animation: vt-header-in 360ms var(--ease-settle) both;
}

@keyframes vt-dock-in {
  from { opacity: 0; transform: translateY(24px); }
}

@keyframes vt-header-in {
  from { opacity: 0; transform: translateY(-12px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* ------------------------------------------------------------------
   4. Shell, encabezado compacto y contenedores
   ------------------------------------------------------------------ */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  view-transition-name: app-header;
  background: color-mix(in srgb, var(--color-bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  padding: 4px 12px;
  padding-top: calc(4px + env(safe-area-inset-top, 0px));
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
}

/* Línea inferior: hairline siempre, sombra de profundidad al hacer scroll */
.app-header::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--color-border);
}

.app-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 14px;
  background: linear-gradient(to bottom, rgb(var(--sh) / calc(0.35 * var(--sh-k))), transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out);
}

.app-header.is-scrolled::after {
  opacity: 1;
}

.header-container {
  max-width: 1024px;
  margin: 0 auto;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  width: var(--tap-min);
  height: var(--tap-min);
  margin-left: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  color: var(--color-text);
  transition: transform var(--duration-fast) var(--ease-press);
}

.brand-badge .mark {
  height: 30px;
  width: auto;
  display: block;
  view-transition-name: brand-mark;
  filter: drop-shadow(0 3px 5px rgb(var(--sh) / calc(0.55 * var(--sh-k))));
  transition: transform var(--duration-base) var(--ease-settle);
}

.brand-badge:active {
  transform: scale(0.92);
}

.brand-badge:active .mark {
  transform: rotate(-8deg);
}

@media (hover: hover) and (pointer: fine) {
  .brand-badge:hover .mark {
    transform: rotate(-7deg) translateY(-1px);
  }
}

.header-title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Navegación desktop (oculta en móvil) */
.desktop-nav {
  display: none;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.desktop-nav__link {
  min-height: var(--tap-min);
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-secondary);
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}

.desktop-nav__link:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.desktop-nav__link.is-active {
  background: var(--accent-primary-soft);
  color: var(--brass-ink);
  box-shadow: inset 0 0 0 1px var(--accent-primary-border);
}

.header-user-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: -4px;
}

.header-user-actions .btn-icon {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--color-text-secondary);
}

.header-user-actions .btn-icon:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: calc(var(--dock-height) + var(--dock-offset) * 2 + var(--safe-bottom) + 24px);
}

@media (min-width: 900px) {
  .header-title {
    flex: 0 0 auto;
  }
  .app-header {
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    padding-bottom: 8px;
  }
  .app-main {
    max-width: 1024px;
    padding: 28px 24px;
    padding-bottom: 48px;
  }
  .desktop-nav {
    display: flex;
  }
  .dock-nav {
    display: none !important;
  }
}

/* ------------------------------------------------------------------
   5. Dock móvil (barra flotante de pulgar)
   ------------------------------------------------------------------ */
.dock-nav {
  position: fixed;
  left: var(--dock-offset);
  right: var(--dock-offset);
  bottom: calc(var(--dock-offset) + var(--safe-bottom));
  z-index: 50;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  height: var(--dock-height);
  view-transition-name: dock;
  background: color-mix(in srgb, var(--color-surface-raised) 92%, transparent);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-dock);
  padding: 6px;
}

.dock-nav__item {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--tap-min);
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  user-select: none;
  transition: color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-press);
}

.dock-nav__item svg,
.dock-nav__item span {
  position: relative;
  z-index: 1;
}

.dock-nav__item svg {
  width: 21px;
  height: 21px;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--duration-base) var(--ease-settle);
}

.dock-nav__item:active {
  transform: scale(0.92);
}

.dock-nav__item.is-active {
  color: var(--brass-ink);
}

.dock-nav__item.is-active svg {
  stroke-width: 2.2;
}

/* Cápsula activa: con View Transitions se desliza entre páginas */
.dock-nav__item.is-active::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: var(--accent-primary-soft);
  box-shadow: inset 0 0 0 1px var(--accent-primary-border), 0 0 18px -4px var(--accent-glow);
  view-transition-name: dock-pill;
}

/* ------------------------------------------------------------------
   6. Superficies: tarjetas, hero de crédito, ledger
   ------------------------------------------------------------------ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* --- Ficha de crédito (hero del home) --- */
.credit-tile {
  position: relative;
  overflow: hidden;
  color: var(--ink);
  border-radius: var(--radius-card-lg);
  background: linear-gradient(166deg, var(--bone-hi) 0%, var(--bone) 42%, var(--bone-lo) 100%);
  box-shadow:
    var(--shadow-hero),
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -3px 0 rgba(112, 92, 52, 0.28);
  animation: tile-in 680ms var(--ease-settle) both;
  animation-delay: calc(var(--i, 1) * 70ms);
  transition: transform var(--duration-base) var(--ease-settle);
}

.credit-tile:active {
  transform: scale(0.988);
}

/* Destello único tras la entrada */
.credit-tile::after {
  content: '';
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: 0;
  width: 38%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  opacity: 0;
  pointer-events: none;
  animation: glint 1100ms 950ms var(--ease-in-out) 1 both;
}

.credit-tile__top,
.credit-tile__bottom {
  padding: 20px 22px;
}

.credit-tile__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.credit-tile__label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
}

.credit-tile__amount {
  margin: 10px 0 2px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-num);
  color: var(--ink);
  line-height: 1;
}

.credit-tile__currency {
  font-size: 0.42em;
  font-weight: 700;
  font-stretch: 100%;
  color: var(--ink-soft);
  letter-spacing: 0;
}

.credit-tile__amount {
  font-size: clamp(50px, 16vw, 76px);
}

.credit-tile__amount .display-num {
  font-weight: 850;
  font-stretch: 110%;
  letter-spacing: -0.035em;
}

.credit-tile.is-locked .credit-tile__amount .display-num {
  color: var(--ink-soft);
}

/* Ranura central con perno de latón, como una ficha real */
.credit-tile__groove {
  position: relative;
  height: 0;
  margin: 0 22px;
  border-top: 2px solid rgba(21, 32, 27, 0.2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.credit-tile__groove::after {
  content: '';
  position: absolute;
  left: 50%;
  top: -7px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fbe3a2 0%, var(--brass) 45%, var(--brass-lo) 100%);
  box-shadow: 0 1px 2px rgb(var(--sh) / calc(0.4 * var(--sh-k))), 0 0 0 2px var(--bone-lo);
}

.credit-tile__bottom {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* Cara de dominó: un punto por turno asistido (máx. 6) */
.pip-face {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 58px;
  height: 58px;
  padding: 5px;
  border-radius: 12px;
  background: rgba(21, 32, 27, 0.06);
  box-shadow: inset 0 2px 3px rgba(21, 32, 27, 0.16), 0 1px 0 rgba(255, 255, 255, 0.7);
}

.pip-face span {
  place-self: center;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: transparent;
}

.pip-face span.is-on {
  background: radial-gradient(circle at 35% 30%, #3b4b43 0%, var(--ink) 65%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  animation: pip-in 420ms var(--ease-settle) both;
  animation-delay: calc(560ms + var(--k, 0) * 70ms);
}

.credit-tile__meta {
  min-width: 0;
  flex: 1;
}

.credit-tile__meta strong {
  display: block;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  font-stretch: 108%;
  line-height: 1.2;
  color: var(--ink);
}

.credit-tile__meta span {
  display: block;
  margin-top: 2px;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--ink-soft);
}

/* Chips sobre hueso */
.chip-on-bone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.chip-on-bone svg {
  width: 13px;
  height: 13px;
}

.chip-on-bone--ok {
  color: #0a553b;
  background: rgba(10, 85, 59, 0.12);
  box-shadow: inset 0 0 0 1px rgba(10, 85, 59, 0.28);
}

.chip-on-bone--warn {
  color: #7d3706;
  background: rgba(125, 55, 6, 0.1);
  box-shadow: inset 0 0 0 1px rgba(125, 55, 6, 0.3);
}

.chip-on-bone .pulse-dot {
  width: 7px;
  height: 7px;
  background: #0f8a5f;
}

/* --- Ledger: la cuenta, como el ticket de una barra --- */
.ledger {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 6px 18px 4px;
}

.ledger__title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  font-stretch: 108%;
  padding: 14px 0 6px;
}

.ledger__row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}

.ledger__row + .ledger__row {
  border-top: 1px solid var(--color-border-subtle);
}

.ledger__icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ledger__icon svg {
  width: 18px;
  height: 18px;
}

.ledger__label {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.ledger__dots {
  flex: 1;
  min-width: 12px;
  align-self: flex-end;
  margin-bottom: 21px;
  border-bottom: 2px dotted var(--color-border-hover);
  opacity: 0.8;
}

.ledger__amount {
  font-family: var(--font-num);
  font-stretch: 105%;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--color-text);
}

.ledger__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--tap-min);
  margin: 0 -18px;
  padding: 0 18px;
  border-top: 1px solid var(--color-border-subtle);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
  font-size: 14px;
  font-weight: 700;
  color: var(--brass-ink);
  transition: background var(--duration-fast) var(--ease-out);
}

.ledger__foot svg {
  transition: transform var(--duration-base) var(--ease-settle);
}

.ledger__foot:active {
  background: var(--color-surface-active);
}

@media (hover: hover) and (pointer: fine) {
  .ledger__foot:hover svg {
    transform: translateX(3px);
  }
}

/* --- Home --- */
.home {
  display: grid;
  gap: 16px;
}

.home__greet {
  padding: 4px 2px 2px;
}

.home__greet p {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.home__greet h1 {
  margin-top: 2px;
  font-size: 34px;
  font-weight: 850;
  font-stretch: 112%;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.home__section-title {
  margin: 8px 2px 10px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  font-stretch: 108%;
}

@media (min-width: 900px) {
  .home {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 20px 28px;
    align-items: start;
  }
  .home__greet { grid-column: 1 / -1; }
  .home__tile { grid-column: 1; }
  .home__ledger { grid-column: 2; grid-row: 2 / span 2; }
  .home__action { grid-column: 1; }
  .home__admin { grid-column: 1 / -1; }
  .home__greet h1 { font-size: 44px; }
}

/* Lista de navegación agrupada (panel de gestión) */
.nav-list {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 12px 16px;
  transition: background var(--duration-fast) var(--ease-out);
}

.nav-row + .nav-row {
  border-top: 1px solid var(--color-border-subtle);
}

.nav-row:active {
  background: var(--color-surface-active);
}

.nav-row__chevron {
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: transform var(--duration-base) var(--ease-settle), color var(--duration-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .nav-row:hover {
    background: var(--color-surface-hover);
  }
  .nav-row:hover .nav-row__chevron {
    transform: translateX(3px);
    color: var(--brass-ink);
  }
}

/* Métricas y hero heredado (usado por liquidación y movimientos) */
.bento-hero {
  background:
    radial-gradient(circle at 88% 8%, rgba(230, 176, 74, 0.16) 0%, transparent 55%),
    linear-gradient(160deg, #1d2c26 0%, #111b17 100%);
  color: var(--color-text);
  border: 1px solid var(--accent-primary-border);
  border-radius: var(--radius-card-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-hero);
}

.bento-hero__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bento-hero__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.bento-hero__status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: rgb(var(--edge) / 0.07);
  color: var(--color-text);
  box-shadow: inset 0 0 0 1px rgb(var(--edge) / 0.12);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  display: inline-block;
  animation: pulse-radar 2.2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

.bento-hero__amount {
  font-family: var(--font-num);
  font-size: 46px;
  font-weight: 800;
  font-stretch: 108%;
  line-height: 1.05;
  margin-top: 12px;
  letter-spacing: -0.03em;
  color: var(--bone-hi);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.bento-hero__currency {
  font-size: 24px;
  font-weight: 600;
  color: var(--brass-ink);
  letter-spacing: 0;
}

.bento-hero__footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgb(var(--edge) / 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--color-text-secondary);
}

.bento-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

@media (min-width: 900px) {
  .bento-metrics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
}

.metric-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: transform var(--duration-fast) var(--ease-press), border-color var(--duration-fast) var(--ease-out);
}

.metric-card:active {
  transform: scale(0.975);
}

@media (hover: hover) and (pointer: fine) {
  .metric-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-border-hover);
  }
}

.metric-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-card__icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-card__icon svg {
  width: 18px;
  height: 18px;
}

.metric-card__val {
  font-family: var(--font-num);
  font-stretch: 105%;
  font-size: 22px;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.metric-card__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
}

/* ------------------------------------------------------------------
   7. Botones (mín. 44x44, feedback de pulsación)
   ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: var(--tap-min);
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 700;
  font-stretch: 105%;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-press), filter var(--duration-fast) var(--ease-out), box-shadow var(--duration-base) var(--ease-out);
  user-select: none;
  width: 100%;
  position: relative;
  overflow: hidden;
}

@media (min-width: 900px) {
  .btn {
    width: auto;
  }
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary,
.btn-blue {
  color: var(--on-accent);
  background: linear-gradient(180deg, var(--brass-hi) 0%, var(--brass) 55%, #d49c36 100%);
  border: 1px solid var(--brass-lo);
  box-shadow: 0 8px 16px -8px rgba(230, 176, 74, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.btn-primary:hover:not(:disabled),
.btn-blue:hover:not(:disabled) {
  filter: brightness(1.07);
}

.btn-primary:active:not(:disabled),
.btn-blue:active:not(:disabled) {
  box-shadow: 0 3px 8px -4px rgba(230, 176, 74, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-secondary {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border-hover);
  color: var(--color-text);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-surface-hover);
}

.btn-danger {
  color: #2b0a10;
  background: linear-gradient(180deg, #ff8d99 0%, var(--rose) 100%);
  border: 1px solid #b94455;
  box-shadow: 0 8px 16px -8px rgba(240, 106, 122, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-danger:hover:not(:disabled) {
  filter: brightness(1.07);
}

/* Estado de carga: la etiqueta se oculta y gira un anillo */
.btn.is-loading {
  pointer-events: none;
}

.btn.is-loading > * {
  opacity: 0;
  transition: opacity var(--duration-instant) linear;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  animation: spin 650ms linear infinite;
}

.btn .btn__arrow {
  transition: transform var(--duration-base) var(--ease-settle);
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover .btn__arrow {
    transform: translateX(3px);
  }
}

.btn-icon {
  width: var(--tap-min);
  height: var(--tap-min);
  min-width: var(--tap-min);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform var(--duration-fast) var(--ease-press), background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}

.btn-icon:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border-hover);
}

.btn-icon:active {
  transform: scale(0.92);
}

.btn-add {
  width: var(--tap-min);
  height: var(--tap-min);
  min-width: var(--tap-min);
  border-radius: 50%;
  background: var(--accent-primary-soft);
  border: 1px solid var(--accent-primary-border);
  color: var(--brass-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-press), background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}

.btn-add:hover {
  background: var(--brass);
  color: var(--on-accent);
}

.btn-add:active {
  transform: scale(0.88);
}

/* ------------------------------------------------------------------
   8. Chips y badges
   ------------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.badge-emerald { background: var(--emerald-soft); color: var(--emerald-dark); border: 1px solid var(--emerald-border); }
.badge-amber   { background: var(--amber-soft);   color: var(--amber-dark);   border: 1px solid var(--amber-border); }
.badge-rose    { background: var(--rose-soft);    color: var(--rose-dark);    border: 1px solid var(--rose-border); }
.badge-indigo  { background: var(--indigo-soft);  color: var(--indigo);       border: 1px solid var(--indigo-border); }
.badge-slate   { background: var(--color-bg-subtle); color: var(--color-text-secondary); border: 1px solid var(--color-border); }

/* ------------------------------------------------------------------
   9. Catálogo POS y filtros
   ------------------------------------------------------------------ */
.segmented-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 14px;
  margin-bottom: 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.segmented-tabs::-webkit-scrollbar {
  display: none;
}

.tab-pill {
  min-height: var(--tap-min);
  padding: 0 18px;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  user-select: none;
  transition: transform var(--duration-fast) var(--ease-press), background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}

.tab-pill:active {
  transform: scale(0.95);
}

.tab-pill:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.tab-pill.is-active {
  background: var(--accent-primary-soft);
  border-color: var(--accent-primary-border);
  color: var(--brass-ink);
}

.product-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-bottom: 10px;
  transition: transform var(--duration-fast) var(--ease-press), border-color var(--duration-fast) var(--ease-out);
}

.product-row:active {
  transform: scale(0.985);
}

@media (hover: hover) and (pointer: fine) {
  .product-row:hover {
    border-color: var(--color-border-hover);
  }
}

.product-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.product-icon svg {
  width: 22px;
  height: 22px;
}

.product-icon--comida { background: var(--cat-comida-soft); color: var(--cat-comida); }
.product-icon--coctel { background: var(--cat-coctel-soft); color: var(--cat-coctel); }
.product-icon--botella { background: var(--cat-botella-soft); color: var(--cat-botella); }

.product-content {
  flex: 1;
  min-width: 0;
}

.product-title {
  font-family: var(--font-body);
  font-size: 15.5px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}

.product-price-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin-top: 3px;
}

.product-price {
  font-family: var(--font-num);
  font-weight: 700;
  font-stretch: 105%;
  font-size: 16.5px;
  color: var(--emerald-dark);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.product-price--original {
  font-size: 12.5px;
  color: var(--color-text-muted);
  text-decoration: line-through;
  white-space: nowrap;
}

/* Carrito flotante */
.cart-drawer {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--dock-height) + var(--dock-offset) * 2 + var(--safe-bottom) + 8px);
  z-index: 45;
  max-width: 656px;
  margin: 0 auto;
  animation: slide-drawer 300ms var(--ease-drawer) both;
}

.cart-card {
  background: color-mix(in srgb, var(--color-surface-raised) 97%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  color: var(--color-text);
  border: 1px solid var(--accent-primary-border);
  border-radius: var(--radius-card-lg);
  padding: 16px 20px;
  box-shadow: 0 24px 38px -12px rgb(var(--sh) / calc(0.7 * var(--sh-k))), var(--lit);
}

.cart-handle {
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: rgb(var(--edge) / 0.3);
  margin: 0 auto 12px;
}

.cart-items-scroll {
  max-height: 28vh;
  overflow-y: auto;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ------------------------------------------------------------------
   10. Formularios
   ------------------------------------------------------------------ */
.field {
  margin-bottom: 14px;
  min-width: 0;
}

.field label {
  display: block;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--color-text-secondary);
  margin-bottom: 7px;
}

.input, select.input {
  width: 100%;
  min-height: var(--tap-min);
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-active);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px; /* 16px evita el zoom automático de iOS al enfocar */
  box-shadow: inset 0 2px 4px rgb(var(--sh) / calc(0.35 * var(--sh-k)));
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-base) var(--ease-out);
}

.input::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

.input:hover, select.input:hover {
  border-color: var(--color-border-hover);
}

.input:focus, select.input:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: inset 0 2px 4px rgb(var(--sh) / calc(0.35 * var(--sh-k))), 0 0 0 3px rgba(230, 176, 74, 0.2);
}

select.input option {
  background: var(--color-surface-raised);
  color: var(--color-text);
}

/* ------------------------------------------------------------------
   11. Utilidades
   ------------------------------------------------------------------ */
.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row--between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: 13.5px; }

.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }

/* Estado vacío: una ficha en blanco, sin puntos todavía */
.empty-state {
  text-align: center;
  padding: 32px 20px 30px;
  color: var(--color-text-muted);
  font-size: 14.5px;
  background: var(--color-surface);
  border: 1px dashed var(--color-border-hover);
  border-radius: var(--radius-card);
}

.empty-state::before {
  content: '';
  display: block;
  width: 28px;
  height: 44px;
  margin: 0 auto 14px;
  border-radius: 8px;
  border: 2px solid var(--color-border-hover);
  background: linear-gradient(transparent calc(50% - 1px), var(--color-border-hover) calc(50% - 1px), var(--color-border-hover) calc(50% + 1px), transparent calc(50% + 1px));
  transform: rotate(-8deg);
}

.empty-state:has(svg)::before {
  display: none;
}

/* Toasts */
.toast-flash {
  position: fixed;
  top: calc(60px + env(safe-area-inset-top, 0px));
  left: 16px;
  right: 16px;
  z-index: 60;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-modal);
  animation: toast-enter 320ms var(--ease-settle) both;
}

.toast-flash--error {
  background: var(--rose-soft);
  color: var(--rose-dark);
  border: 1px solid var(--rose-border);
}

.toast-flash--success {
  background: var(--emerald-soft);
  color: var(--emerald-dark);
  border: 1px solid var(--emerald-border);
}

/* ------------------------------------------------------------------
   12. Pantalla de ingreso
   ------------------------------------------------------------------ */
.login-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.login-stage {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(28px + env(safe-area-inset-top, 0px)) 24px 20px;
  min-height: 0;
}

/* Fichas de fondo: solo contorno, muy bajas de opacidad */
.login-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  color: var(--color-text);
}

.login-bg svg {
  position: absolute;
  opacity: 0;
  animation: bg-tile 900ms var(--ease-settle) both;
}

.login-bg svg:nth-child(1) { width: 150px; right: -34px; top: 6%;  --r: 16deg;  animation-delay: 380ms; }
.login-bg svg:nth-child(2) { width: 96px;  left: -22px;  top: 38%; --r: -14deg; animation-delay: 480ms; }
.login-bg svg:nth-child(3) { width: 120px; right: 12%;   top: 44%; --r: -28deg; animation-delay: 580ms; display: none; }

@keyframes bg-tile {
  from { opacity: 0; transform: translateY(24px) rotate(calc(var(--r) - 12deg)); }
  to   { opacity: 0.075; transform: rotate(var(--r)); }
}

.login-brand {
  position: relative;
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
}

.login-brand .mark {
  --mark-rot: -6deg;
  display: block;
  height: 92px;
  width: auto;
  color: var(--color-text);
  transform: rotate(var(--mark-rot));
  filter: drop-shadow(0 12px 16px rgb(var(--sh) / calc(0.6 * var(--sh-k))));
  animation: drop-in 760ms var(--ease-settle) both;
  view-transition-name: brand-mark;
}

.login-title {
  margin-top: 18px;
  font-family: var(--font-display);
  font-size: clamp(56px, 19vw, 84px);
  font-weight: 900;
  font-stretch: 125%;
  letter-spacing: -0.035em;
  line-height: 0.95;
  color: var(--color-text);
  animation: rise 640ms 160ms var(--ease-settle) both;
}

.login-subtitle {
  margin: 12px 0 0;
  max-width: 28ch;
  font-size: 16px;
  line-height: 1.45;
  color: var(--color-text-secondary);
  animation: rise 640ms 240ms var(--ease-settle) both;
}

.login-sheet {
  position: relative;
  width: 100%;
  background: linear-gradient(180deg, var(--color-surface-raised) 0%, var(--color-surface) 100%);
  border-radius: 26px 26px 0 0;
  padding: 26px 22px calc(22px + var(--safe-bottom));
  box-shadow: 0 -22px 40px -14px rgb(var(--sh) / calc(0.7 * var(--sh-k))), 0 -1px 0 0 rgb(var(--edge) / 0.1);
  animation: sheet-up 620ms 260ms var(--ease-drawer) both;
}

.login-sheet-inner {
  max-width: 400px;
  margin: 0 auto;
}

.login-sheet .field {
  animation: rise 520ms var(--ease-settle) both;
}

.login-sheet .field:nth-of-type(1) { animation-delay: 420ms; }
.login-sheet .field:nth-of-type(2) { animation-delay: 480ms; }
.login-sheet .btn { width: 100%; animation: rise 520ms 540ms var(--ease-settle) both; }

/* Línea de foco animada bajo cada campo (solo transform) */
.field--line {
  position: relative;
}

.field--line::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--duration-slow) var(--ease-settle);
  pointer-events: none;
}

.field--line:focus-within::after {
  transform: scaleX(1);
}

.field--line .input:focus {
  box-shadow: inset 0 2px 4px rgb(var(--sh) / calc(0.35 * var(--sh-k)));
}

.input-wrap {
  position: relative;
}

.input-wrap .input {
  padding-right: 52px;
}

.input-wrap .pw-toggle {
  position: absolute;
  right: 0;
  top: 0;
  width: var(--tap-min);
  height: var(--tap-min);
  display: grid;
  place-items: center;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-press);
}

.input-wrap .pw-toggle:hover { color: var(--color-text); }
.input-wrap .pw-toggle:active { transform: scale(0.88); }

.pw-toggle .eye-off { display: none; }
.pw-toggle[aria-pressed='true'] .eye-on { display: none; }
.pw-toggle[aria-pressed='true'] .eye-off { display: block; }

.login-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
}

.login-alert svg { flex-shrink: 0; margin-top: 1px; }

.login-alert--error {
  background: var(--rose-soft);
  color: var(--rose-dark);
  border: 1px solid var(--rose-border);
  animation: shake 440ms 280ms var(--ease-out) both;
}

.login-alert--success {
  background: var(--emerald-soft);
  color: var(--emerald-dark);
  border: 1px solid var(--emerald-border);
}

.login-footer-text {
  margin: 16px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
}

@media (min-width: 900px) {
  .login-body {
    flex-direction: row;
  }
  .login-stage {
    flex: 1.15;
    padding: 56px 64px;
    justify-content: center;
  }
  .login-brand {
    margin: 0 0 0 auto;
    max-width: 520px;
  }
  .login-brand .mark { height: 120px; }
  .login-title { font-size: clamp(84px, 8vw, 118px); }
  .login-bg svg:nth-child(1) { width: 260px; right: 8%; top: 8%; }
  .login-bg svg:nth-child(2) { width: 170px; left: 4%; top: auto; bottom: 8%; }
  .login-bg svg:nth-child(3) { display: block; width: 130px; right: -1%; bottom: -3%; }
  .login-sheet {
    flex: 1;
    max-width: 560px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    padding: 56px 48px;
    box-shadow: -1px 0 0 0 rgb(var(--edge) / 0.08), -30px 0 60px -30px rgb(var(--sh) / calc(0.7 * var(--sh-k)));
    animation: sheet-side 700ms 200ms var(--ease-drawer) both;
  }
  .login-sheet-inner { width: 100%; }
}

@keyframes sheet-side {
  from { opacity: 0.4; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}


/* ==========================================================================
   SELECTOR DE ÁREAS UNIFICADO (Asistencia, Consumos, Historial)
   Ficha de dominó idéntica en las 3 pantallas: 4 cols móvil, 6 cols desktop (>=900px).
   ========================================================================== */

.areas-grid,
.areas,
.cn-chips,
.hx-areas {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 8px !important;
  margin: 0 0 14px !important;
  padding: 0 !important;
  list-style: none !important;
}

@media (min-width: 900px) {
  .areas-grid,
  .areas,
  .cn-chips,
  .hx-areas {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}

.area-tile,
.area,
.cn-chip,
.hx-area {
  position: relative !important;
  display: grid !important;
  justify-items: center !important;
  align-content: center !important;
  gap: 3px !important;
  min-height: 74px !important;
  padding: 9px 3px 8px !important;
  border-radius: 14px !important;
  border: 1px solid var(--color-border) !important;
  background: var(--color-surface) !important;
  color: var(--color-text-secondary) !important;
  text-align: center !important;
  font-family: inherit !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
  transition: transform 150ms var(--ease-press, cubic-bezier(0.2, 0.8, 0.2, 1)),
              background-color 200ms var(--ease-out, cubic-bezier(0, 0, 0.2, 1)),
              color 200ms var(--ease-out, cubic-bezier(0, 0, 0.2, 1)),
              border-color 200ms var(--ease-out, cubic-bezier(0, 0, 0.2, 1)) !important;
}

.area-tile:active,
.area:active,
.cn-chip:active,
.hx-area:active {
  transform: scale(0.94) !important;
}

@media (hover: hover) and (pointer: fine) {
  .area-tile:hover:not([aria-pressed='true']),
  .area:hover:not([aria-pressed='true']),
  .cn-chip:hover:not([aria-pressed='true']),
  .hx-area:hover:not([aria-pressed='true']) {
    background: var(--color-surface-hover) !important;
    color: var(--color-text) !important;
  }
}

.area-tile[aria-pressed='true'],
.area[aria-pressed='true'],
.cn-chip[aria-pressed='true'],
.hx-area[aria-pressed='true'] {
  background: var(--active-grad) !important;
  border-color: var(--active-border) !important;
  color: var(--active-fg) !important;
  box-shadow: inset 0 -2px 0 rgba(112, 92, 52, 0.28), 0 6px 10px -6px rgb(var(--sh) / calc(0.7 * var(--sh-k))) !important;
}

.area-tile__ico,
.area__icon,
.cn-chip__ico,
.hx-area__ico {
  display: grid !important;
  place-items: center !important;
  color: var(--color-text-muted) !important;
  transition: color 200ms var(--ease-out, cubic-bezier(0, 0, 0.2, 1)),
              transform 260ms var(--ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1)) !important;
}

.area-tile[aria-pressed='true'] .area-tile__ico,
.area[aria-pressed='true'] .area__icon,
.cn-chip[aria-pressed='true'] .cn-chip__ico,
.hx-area[aria-pressed='true'] .hx-area__ico {
  color: var(--active-fg-soft) !important;
  transform: translateY(-1px) scale(1.06) !important;
}

.area-tile__name,
.area__name,
.cn-chip__t,
.hx-area__name {
  max-width: 100% !important;
  font-family: var(--font-display) !important;
  font-weight: 700 !important;
  font-size: 12.5px !important;
  line-height: 1.15 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.area-tile__n,
.area__n,
.cn-chip__n,
.hx-area__n {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: var(--color-text-muted) !important;
  font-variant-numeric: tabular-nums !important;
  line-height: 1 !important;
}

.area-tile[aria-pressed='true'] .area-tile__n,
.area[aria-pressed='true'] .area__n,
.cn-chip[aria-pressed='true'] .cn-chip__n,
.hx-area[aria-pressed='true'] .hx-area__n {
  color: var(--active-fg-soft) !important;
}


/* ==========================================================================
   Interruptor de tema (sol/luna). Solo transform + opacity; el cambio de color
   de la página lo anima theme.css (.theme-fx) durante ~300 ms.
   ========================================================================== */
.theme-toggle {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--tap-min);
  height: var(--tap-min);
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--duration-fast) var(--ease-press), background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.theme-toggle:active { transform: scale(0.92); }
.theme-toggle svg {
  grid-area: 1 / 1;
  width: 22px;
  height: 22px;
  transition: transform 380ms var(--ease-spring), opacity 220ms var(--ease-out);
}
.theme-toggle .ico-moon { opacity: 1; transform: none; }
.theme-toggle .ico-sun { opacity: 0; transform: rotate(-90deg) scale(0.4); }
:root[data-theme='light'] .theme-toggle .ico-moon { opacity: 0; transform: rotate(90deg) scale(0.4); }
:root[data-theme='light'] .theme-toggle .ico-sun { opacity: 1; transform: none; }
@media (hover: hover) and (pointer: fine) {
  .theme-toggle:hover { background: var(--color-surface-hover); color: var(--color-text); }
}
.theme-toggle--float {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 5;
}
@media (prefers-reduced-motion: reduce) {
  .theme-toggle, .theme-toggle svg { transition: opacity 120ms linear; }
  .theme-toggle .ico-moon, .theme-toggle .ico-sun,
  :root[data-theme='light'] .theme-toggle .ico-moon, :root[data-theme='light'] .theme-toggle .ico-sun { transform: none; }
  html.theme-fx, html.theme-fx * { transition: none !important; }
}

/* Íconos con color inline del latón (home, otro agente): oscurecer en claro */
.ledger__icon[style*='--brass'] { color: var(--brass-ink) !important; }

/* Marca: la ficha toma el color del texto y los puntos el inverso (claro/oscuro) */
.mark { --mark-ink: var(--color-text-inverse); }
