/*
 * Relieve del panel: capa 3D sobre tema-nuevo.css y la paleta (tema-oceano.css).
 * Profundidad con perspectiva, vidrio esmerilado, biseles, cifras con relieve,
 * anillo en volumen, barra cilíndrica y un suelo en perspectiva al fondo.
 */

:root {
  --display: Sora, Outfit, Inter, system-ui, sans-serif;
  --vidrio: color-mix(in srgb, var(--surface) 62%, transparent);
  --vidrio-borde: color-mix(in srgb, #fff 14%, transparent);
  --bisel-luz: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 1px 0 0 rgba(255, 255, 255, 0.06);
  --bisel-sombra: inset 0 -1px 0 rgba(0, 0, 0, 0.35);
  --elevacion-1: 0 1px 1px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.12);
  --elevacion-2: 0 2px 2px rgba(0, 0, 0, 0.1), 0 8px 16px -4px rgba(0, 0, 0, 0.25),
    0 24px 48px -16px rgba(0, 0, 0, 0.45);
  --elevacion-3: 0 2px 2px rgba(0, 0, 0, 0.1), 0 12px 24px -6px rgba(0, 0, 0, 0.35),
    0 40px 80px -24px rgba(0, 0, 0, 0.6);
  --rejilla: color-mix(in srgb, var(--accent) 22%, transparent);
}

:root[data-theme='light'] {
  --vidrio: rgba(255, 255, 255, 0.62);
  --vidrio-borde: rgba(255, 255, 255, 0.9);
  --bisel-sombra: inset 0 -1px 0 rgba(30, 20, 80, 0.08);
  --elevacion-2: 0 1px 1px rgba(30, 20, 80, 0.05), 0 8px 16px -6px rgba(30, 20, 80, 0.12),
    0 24px 48px -20px rgba(30, 20, 80, 0.22);
  --elevacion-3: 0 1px 1px rgba(30, 20, 80, 0.05), 0 14px 28px -10px rgba(30, 20, 80, 0.2),
    0 40px 80px -30px rgba(30, 20, 80, 0.35);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --vidrio: rgba(255, 255, 255, 0.62);
    --vidrio-borde: rgba(255, 255, 255, 0.9);
    --bisel-sombra: inset 0 -1px 0 rgba(30, 20, 80, 0.08);
    --elevacion-2: 0 1px 1px rgba(30, 20, 80, 0.05), 0 8px 16px -6px rgba(30, 20, 80, 0.12),
      0 24px 48px -20px rgba(30, 20, 80, 0.22);
    --elevacion-3: 0 1px 1px rgba(30, 20, 80, 0.05), 0 14px 28px -10px rgba(30, 20, 80, 0.2),
      0 40px 80px -30px rgba(30, 20, 80, 0.35);
  }
}

/* --- Escena: manchas de luz que se mueven despacio y un suelo en perspectiva --- */

body {
  position: relative;
  background: var(--bg);
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: -20vmax;
  z-index: -2;
  background:
    radial-gradient(28vmax 28vmax at 20% 15%, var(--brillo-1), transparent 60%),
    radial-gradient(32vmax 30vmax at 85% 25%, var(--brillo-2), transparent 60%),
    radial-gradient(30vmax 26vmax at 60% 90%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%);
  filter: blur(30px) saturate(1.3);
  animation: deriva 26s ease-in-out infinite alternate;
}

body::after {
  content: '';
  position: fixed;
  left: -50%;
  right: -50%;
  bottom: -10vh;
  height: 70vh;
  z-index: -1;
  background:
    linear-gradient(var(--rejilla) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, var(--rejilla) 1px, transparent 1px) 0 0 / 64px 64px;
  transform: perspective(600px) rotateX(62deg);
  transform-origin: 50% 100%;
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent 75%);
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent 75%);
  pointer-events: none;
}

@keyframes deriva {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); }
  100% { transform: translate3d(-4vmax, 3vmax, 0) rotate(8deg); }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

h1,
h2,
.stat-value,
.hero-ring-value,
.days,
.key a {
  font-family: var(--display);
}

h1 {
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 30px color-mix(in srgb, var(--accent) 35%, transparent);
}

/* --- Logo: baldosa de 38 px y el nombre en dos líneas, más bajo que el título de antes --- */

h1.logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0;
  font-size: 1rem;
  text-shadow: none;
}

.logo-marca {
  display: block;
  flex: none;
  filter: drop-shadow(0 8px 12px color-mix(in srgb, var(--logo-a) 45%, transparent));
  transition: transform 0.2s ease;
}

.logo:hover .logo-marca {
  transform: translateY(-1px) rotate(-4deg);
}

.logo-texto {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-nombre {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.logo-flecha {
  background: linear-gradient(90deg, var(--logo-a), var(--logo-b));
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.logo-sub {
  margin-top: 0.22rem;
  color: var(--muted);
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* --- La tarjeta de arriba: losa con canto, en perspectiva, rejilla bento dentro --- */

.topbar {
  perspective: 1400px;
}

.hero {
  --rx: 4deg;
  --ry: 0deg;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 15rem;
  grid-template-areas:
    'kicker kicker kicker anillo'
    'f1 f2 f3 anillo'
    'frases frases frases anillo'
    'barra barra barra barra'
    'leyenda leyenda leyenda leyenda';
  column-gap: 1rem;
  padding: 1.6rem 1.8rem 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform 0.25s ease-out, box-shadow 0.25s ease-out;
  /* El canto: capas de sombra sólida hacia abajo dan grosor a la losa. */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -2px 0 rgba(0, 0, 0, 0.18),
    0 1px 0 color-mix(in srgb, var(--accent) 55%, #000),
    0 2px 0 color-mix(in srgb, var(--accent) 50%, #000),
    0 3px 0 color-mix(in srgb, var(--accent) 45%, #000),
    0 4px 0 color-mix(in srgb, var(--accent) 40%, #000),
    0 5px 0 color-mix(in srgb, var(--accent) 35%, #000),
    0 6px 0 color-mix(in srgb, var(--accent) 30%, #000),
    var(--elevacion-3),
    var(--hero-sombra);
}

/* Brillo de cristal en diagonal, que sigue al ratón con --mx. */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(40rem 20rem at var(--mx, 20%) -20%, rgba(255, 255, 255, 0.28), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 40%);
  pointer-events: none;
}

/* Grano fino: quita el aspecto de degradado de plantilla. */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  opacity: 0.12;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero-body,
.hero-main,
.hero .stats {
  display: contents;
}

.hero-kicker {
  grid-area: kicker;
  align-self: end;
  font-family: var(--display);
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.hero .stat:nth-child(1) { grid-area: f1; }
.hero .stat:nth-child(2) { grid-area: f2; }
.hero .stat:nth-child(3) { grid-area: f3; }

/* Fichas: vidrio oscuro flotando sobre la losa, con bisel y sombra propia. */
.hero .stat {
  position: relative;
  min-height: 8.2rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 45%),
    color-mix(in srgb, var(--anillo-centro) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  transform: translateZ(40px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -10px 20px -10px rgba(0, 0, 0, 0.5),
    0 18px 30px -12px rgba(0, 0, 0, 0.55),
    0 40px 60px -30px rgba(0, 0, 0, 0.6);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.hero .stat:hover {
  transform: translateZ(60px) translateY(-4px);
}

/* Cifra con relieve: capas de sombra que la extruyen hacia abajo. */
.hero .stat-value {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.25),
    0 2px 0 rgba(0, 0, 0, 0.22),
    0 3px 0 rgba(0, 0, 0, 0.19),
    0 4px 0 rgba(0, 0, 0, 0.16),
    0 10px 18px rgba(0, 0, 0, 0.45);
}

/* Con texto degradado no hay sombra que valga: se pinta el relieve con un filtro. */
.hero .stat-alerta .stat-value,
.hero .stat-filtrado .stat-value {
  text-shadow: none;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.3)) drop-shadow(0 3px 0 rgba(0, 0, 0, 0.2))
    drop-shadow(0 10px 14px rgba(0, 0, 0, 0.45));
}

/* Un punto de luz en la esquina de cada ficha, para marcar el plano. */
.hero .stat::after {
  content: '';
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--anillo) 55%, transparent 70%);
  box-shadow: 0 0 14px var(--anillo);
  opacity: 0.85;
}

.hero .stat-alerta::after {
  background: radial-gradient(circle at 35% 30%, #fff, #fb923c 55%, transparent 70%);
  box-shadow: 0 0 14px #fb923c;
}

.hero-insights {
  grid-area: frases;
  margin-top: 1.1rem;
  padding: 0.85rem 1rem 0.85rem 2rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(10, 6, 30, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transform: translateZ(20px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* El anillo: un toro en volumen, inclinado, con su sombra en el suelo. */
.hero-ring {
  grid-area: anillo;
  align-self: center;
  justify-self: center;
  width: 12.5rem;
  height: 12.5rem;
  margin-left: 0.5rem;
  background:
    radial-gradient(closest-side, transparent 66%, rgba(0, 0, 0, 0.35) 67%, transparent 70%),
    radial-gradient(closest-side, var(--anillo-centro) 64%, transparent 65%),
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.55), transparent 38%),
    radial-gradient(circle at 70% 85%, rgba(0, 0, 0, 0.45), transparent 45%),
    conic-gradient(from -90deg, var(--anillo) 0, color-mix(in srgb, var(--anillo) 70%, #fff) calc(var(--avance) * 0.5%), var(--anillo) calc(var(--avance) * 1%), rgba(255, 255, 255, 0.14) 0);
  transform: translateZ(70px) rotateX(18deg);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.45),
    inset 0 -6px 12px rgba(0, 0, 0, 0.45),
    0 30px 40px -20px rgba(0, 0, 0, 0.7);
}

/* Centro hundido: un plato con luz cenital. */
.hero-ring::before {
  content: '';
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.12), transparent 60%);
  box-shadow: inset 0 8px 16px rgba(0, 0, 0, 0.55), inset 0 -2px 2px rgba(255, 255, 255, 0.08);
}

.hero-ring::after {
  content: '';
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -28%;
  height: 18%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.55), transparent);
  filter: blur(6px);
  transform: rotateX(-18deg);
}

.hero-ring-value,
.hero-ring-label {
  position: relative;
  z-index: 1;
}

.hero-ring-value {
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3), 0 8px 16px rgba(0, 0, 0, 0.5);
}

/* La barra, como un tubo de cristal con los tramos dentro. */
.hero-bar {
  grid-area: barra;
  height: 18px;
  margin-top: 1.4rem;
  padding: 3px;
  gap: 4px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.5), inset 0 -1px 0 rgba(255, 255, 255, 0.15),
    0 1px 0 rgba(255, 255, 255, 0.18);
  transform: translateZ(10px);
}

.hero-bar > span {
  border-radius: 999px;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0, rgba(255, 255, 255, 0.1) 45%, rgba(0, 0, 0, 0.25) 100%);
  box-shadow: 0 0 12px -2px currentColor;
}

.hero-bar-new { color: #3b82f6; }
.hero-bar-indeterminate { color: #f97316; }
.hero-bar-done { color: #2dd4bf; }

.hero-legend {
  grid-area: leyenda;
}

.hero-dot {
  border-radius: 50%;
  background-image: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.8), transparent 60%);
  box-shadow: 0 0 8px currentColor;
}

/* --- Paneles de cristal flotando --- */

.topbar-actions,
.panel {
  border: 1px solid var(--vidrio-borde);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 30%),
    var(--vidrio);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: var(--bisel-luz), var(--bisel-sombra), var(--elevacion-2);
}

/* Controles hundidos en el cristal: el campo es un hueco, no una raya. */
.search,
select,
input[type='text'],
input:not([type]),
input[type='date'],
.multi-toggle {
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.28), inset 0 -1px 0 rgba(255, 255, 255, 0.06);
}

.search:focus,
select:focus,
input:focus {
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.28), 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* Botones que se pulsan: tienen canto y bajan al hacer clic. */
button,
.link-button {
  position: relative;
  border: 1px solid var(--vidrio-borde);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 100%, #fff 6%), var(--surface-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 2px 0 color-mix(in srgb, var(--surface-2) 60%, #000),
    0 6px 14px -6px rgba(0, 0, 0, 0.5);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

button:hover:not(:disabled),
.link-button:hover {
  transform: translateY(-1px);
}

button:active:not(:disabled),
.link-button:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 0 transparent, 0 2px 6px -2px rgba(0, 0, 0, 0.5);
}

button[type='submit'],
.link-button.primary {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 55%),
    var(--boton);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.2),
    0 3px 0 color-mix(in srgb, var(--accent) 45%, #000), 0 12px 24px -8px var(--boton-sombra);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}

.tema {
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  border-color: transparent;
}

.tema button {
  border: none;
  background: none;
  box-shadow: none;
}

.tema button[aria-pressed='true'] {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 60%), var(--boton);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 10px -4px var(--boton-sombra);
}

/* --- La tabla: cada TK es una baldosa que se levanta al pasar --- */

.tabla-panel {
  border-spacing: 0 12px;
}

thead th {
  background: transparent;
  backdrop-filter: none;
}

.tabla-panel tbody tr {
  transition: transform 0.2s ease, filter 0.2s ease;
}

.tabla-panel tbody td,
tbody tr:nth-child(even) td {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 60%),
    color-mix(in srgb, var(--surface-2) 75%, transparent);
  border-color: var(--vidrio-borde);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 10px 18px -12px rgba(0, 0, 0, 0.6);
}

.tabla-panel tbody td:first-child {
  border-radius: 20px 0 0 20px;
}

.tabla-panel tbody td:last-child {
  border-radius: 0 20px 20px 0;
}

.tabla-panel tbody tr:hover {
  transform: translateY(-3px);
  filter: drop-shadow(0 16px 18px rgba(0, 0, 0, 0.35));
}

.tabla-panel tbody tr:hover td {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), transparent 60%),
    color-mix(in srgb, var(--surface-2) 92%, var(--accent) 8%);
}

.tabla-panel tr.stale td {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 60%),
    color-mix(in srgb, #f97316 13%, var(--surface-2));
}

.tabla-panel tr.stale td:first-child {
  box-shadow: inset 4px 0 0 #fb923c, inset 0 1px 0 rgba(255, 255, 255, 0.07), -6px 0 20px -8px #fb923c;
}

/* Etiquetas como gemas: brillo arriba, canto abajo. */
.estado-chip,
.priority,
.days {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 60%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 3px 8px -3px rgba(0, 0, 0, 0.5);
}

.days {
  padding: 0.25rem 0.75rem;
  font-size: 1.05rem;
}

.days-alerta {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 55%),
    linear-gradient(90deg, #fb923c, #f43f5e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 0 #9f1239, 0 8px 18px -6px #f43f5e;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

.key a {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.note-button {
  border-style: solid;
  background: color-mix(in srgb, var(--bg) 40%, transparent);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* --- Ventanas: cristal sobre un fondo desenfocado --- */

dialog,
.note-dialog {
  border: 1px solid var(--vidrio-borde);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--bisel-luz), var(--elevacion-3);
}

/* --- Pantallas estrechas: la rejilla se apila --- */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
      'kicker kicker kicker'
      'anillo anillo anillo'
      'f1 f2 f3'
      'frases frases frases'
      'barra barra barra'
      'leyenda leyenda leyenda';
    column-gap: 0.5rem;
    padding: 1.2rem 1rem;
  }

  .hero-ring {
    width: 8.5rem;
    height: 8.5rem;
    margin: 0.8rem 0 1.4rem;
  }

  .hero-ring-value {
    font-size: 1.8rem;
  }

  .hero .stat {
    min-height: 0;
    padding: 0.8rem 0.7rem;
  }

  .hero .stat-value {
    font-size: 2rem;
  }

  .hero .stat::after {
    display: none;
  }
}

/* Dentro de la tabla los botones son texto o huecos, no teclas: sin canto ni relieve. */
tbody button,
tbody .link-button,
button.comment-button,
.link-button.quiet {
  border-color: transparent;
  background: none;
  box-shadow: none;
  transform: none;
}

tbody button.note-button {
  border: 1px dashed var(--vidrio-borde);
  background: color-mix(in srgb, var(--bg) 40%, transparent);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* El suelo y las manchas no deben ensanchar la página. */
html {
  overflow-x: clip;
}

/* En el móvil, relieve sí pero sin perspectiva: las capas inclinadas se ven borrosas en
 * pantallas pequeñas y no hay ratón que las mueva. */
@media (max-width: 900px) {
  .hero,
  .hero .stat,
  .hero-insights,
  .hero-bar {
    transform: none;
  }

  .hero {
    transform-style: flat;
  }

  .hero-ring {
    transform: none;
  }

  h1 {
    font-size: 1.55rem;
  }

  body::after {
    left: 0;
    right: 0;
  }
}

/* ============================================================
 * Versión compacta de la tarjeta de arriba: el mismo relieve en una franja baja.
 * Fichas, frases y anillo en una fila; la barra, fina, debajo; la leyenda junto a la fecha.
 * ============================================================ */

.hero {
  grid-template-columns: repeat(3, minmax(0, 0.8fr)) minmax(0, 1.7fr) 6.6rem;
  grid-template-areas:
    'kicker kicker kicker leyenda anillo'
    'f1 f2 f3 frases anillo'
    'barra barra barra barra anillo';
  column-gap: 0.75rem;
  row-gap: 0.6rem;
  align-items: stretch;
  padding: 0.9rem 1.2rem 1rem;
  border-radius: 22px;
}

.hero-kicker {
  margin: 0;
  font-size: 0.82rem;
  align-self: center;
}

.hero-legend {
  align-self: center;
  justify-content: flex-end;
  margin: 0;
  font-size: 0.78rem;
}

.hero .stat {
  min-height: 0;
  padding: 0.6rem 0.85rem 0.65rem;
  border-radius: 16px;
  transform: translateZ(28px);
}

.hero .stat:hover {
  transform: translateZ(40px) translateY(-2px);
}

.hero .stat-label {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

.hero .stat-value {
  font-size: 2rem;
}

.hero .stat::after {
  top: 0.7rem;
  right: 0.75rem;
  width: 7px;
  height: 7px;
}

.hero-insights {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0.5rem 0.8rem 0.5rem 1.6rem;
  border-radius: 14px;
  font-size: 0.8rem;
  line-height: 1.35;
  transform: translateZ(14px);
}

.hero-insights li + li {
  margin-top: 0;
}

.hero-ring {
  align-self: center;
  width: 6.4rem;
  height: 6.4rem;
  margin: 0;
  transform: translateZ(40px) rotateX(14deg);
}

.hero-ring-value {
  font-size: 1.35rem;
}

.hero-ring-label {
  font-size: 0.62rem;
}

.hero-ring::after {
  bottom: -22%;
}

.hero-bar {
  height: 10px;
  margin: 0.1rem 0 0;
  padding: 2px;
  gap: 3px;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 5rem;
    grid-template-areas:
      'kicker kicker kicker anillo'
      'f1 f2 f3 anillo'
      'frases frases frases frases'
      'barra barra barra barra'
      'leyenda leyenda leyenda leyenda';
    padding: 0.8rem 0.8rem 0.9rem;
  }

  .hero-ring {
    width: 4.8rem;
    height: 4.8rem;
    margin: 0;
    transform: none;
  }

  .hero-ring-value {
    font-size: 1.05rem;
  }

  .hero-ring-label {
    display: none;
  }

  .hero-legend {
    justify-content: flex-start;
  }

  .hero .stat {
    padding: 0.5rem 0.55rem;
  }

  .hero .stat-label {
    font-size: 0.55rem;
    letter-spacing: 0.04em;
  }

  .hero .stat-value {
    font-size: 1.5rem;
  }
}

@media (max-width: 900px) {
  /* `.stat` trae un ancho mínimo de la hoja base: en tres columnas estrechas se montaban. */
  .hero .stat {
    min-width: 0;
  }

  .hero .stat-label {
    overflow-wrap: anywhere;
  }

  .search {
    flex: 1 1 100%;
    min-width: 0;
  }

  .topbar-actions,
  .topbar-actions > * {
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
      'kicker kicker anillo'
      'f1 f2 f3'
      'frases frases frases'
      'barra barra barra'
      'leyenda leyenda leyenda';
  }

  .hero-ring {
    justify-self: end;
    width: 4rem;
    height: 4rem;
  }

  .hero-ring-value {
    font-size: 0.9rem;
  }

  .hero .stat-label {
    overflow-wrap: normal;
    hyphens: auto;
    font-size: 0.55rem;
  }

  .hero-insights {
    font-size: 0.8rem;
  }

  .hero-legend {
    font-size: 0.72rem;
  }
}
