:root {
  --ccoo-red: #e30613;
  --ccoo-red-dark: #b9000b;
  --ccoo-red-soft: #fff0f1;
  --ink: #141827;
  --muted: #6d7485;
  --line: #e6e8ef;
  --card: #ffffff;
  --bg: #ffffff;
  --success-bg: #fff4f4;
  --shadow: none;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 15px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html {
  font-size: 90%;
  scroll-behavior: auto;
  background: #fff;
  width: 100%;
  height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  overscroll-behavior-y: auto;
}
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  width: 100%;
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  overscroll-behavior-y: auto;
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; }
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Estabilización móvil: evita saltos por foco, anclaje de scroll o gestos táctiles */
html,
body,
.app-shell {
  overflow-anchor: none;
}
button,
.chip,
.segmented button,
.item-button,
.group-button {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
button:focus,
button:focus-visible,
input:focus,
input:focus-visible {
  outline: none;
}

.app-shell {
  width: min(100%, 520px);
  margin: 0 auto;
  height: 100dvh;
  min-height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  padding: 18px 15px calc(24px + var(--safe-bottom));
  background: #fff;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  overscroll-behavior-y: contain;
}

.topbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin: 8px 0 22px;
}

.logo {
  width: 220px;
  max-width: 82vw;
  height: auto;
  flex: 0 0 auto;
  filter: none;
}

.title-block {
  width: 100%;
}

.section-kicker {
  margin: 0 0 4px;
  color: var(--ink);
  font-weight: 900;
  font-size: clamp(1.05rem, 4vw, 0.85rem);
  line-height: 1.15;
}

.title-block h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.34rem, 2.7vw, 1.02rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.segment-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  box-shadow: none;
}
.segmented button {
  border: 0;
  border-radius: 999px;
  padding: 11px 10px;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  transition: background .18s ease, color .18s ease;
}
.segmented button[aria-pressed="true"] {
  background: var(--ccoo-red);
  color: #fff;
  box-shadow: none;
}
.segmented button:active { transform: none; }

.card {
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(225,226,233,.9);
  border-radius: var(--radius-lg);
  box-shadow: none;
}
.summary-card {
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  gap: 18px;
  padding: 22px 18px;
  margin: 14px 0;
  background: var(--ccoo-red-soft);
}
.summary-icon {
  width: 78px;
  height: 78px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid #ffd9dc;
}
.summary-icon svg { width: 42px; height: 42px; fill: var(--ccoo-red); }
.kicker { color: var(--ccoo-red); font-weight: 850; margin: 0 0 2px; }
.big-number { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.big-number strong { font-size: clamp(4rem, 21vw, 6.5rem); letter-spacing: -0.08em; line-height: .82; color: var(--ccoo-red); }
.big-number span { color: var(--ccoo-red-dark); font-weight: 900; font-size: 1.4rem; }

.filters-card { padding: 14px; margin-bottom: 12px; }
.filter-row + .filter-row { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.filter-label { font-weight: 900; margin-bottom: 9px; color: #262b39; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid #d5d8e2;
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 13px;
  font-weight: 800;
  white-space: nowrap;
  min-height: 38px;
}
.chip[aria-pressed="true"] {
  border-color: var(--ccoo-red);
  background: var(--ccoo-red);
  color: #fff;
}

.current-card {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  gap: 15px;
  align-items: center;
  padding: 17px;
  margin: 12px 0;
  background: var(--ccoo-red-soft);
}
.island-icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid #ffd9dc;
  display: grid;
  place-items: center;
}
.island-icon-wrap img { width: 54px; height: 54px; object-fit: contain; }
.current-main .label { margin: 0 0 4px; color: var(--ccoo-red); font-weight: 850; }
.current-main h2 { margin: 0; font-size: clamp(1.6rem, 6vw, 2.15rem); letter-spacing: -0.055em; }
.current-number { text-align: right; border-left: 1px solid #f0a0a5; padding-left: 14px; min-width: 108px; }
.current-number strong { display: block; color: var(--ccoo-red); font-size: clamp(2.3rem, 11vw, 3.3rem); line-height: .9; letter-spacing: -0.075em; }
.current-number span { color: var(--ccoo-red-dark); font-weight: 900; }
.current-number small { display: block; color: var(--muted); margin-top: 4px; font-weight: 700; }

.chart-card { padding: 16px 16px 14px; margin: 12px 0; }
.section-title { margin: 0 0 13px; font-size: 1.05rem; letter-spacing: -0.02em; }
.bar-row { display: grid; grid-template-columns: 94px 1fr 44px; align-items: center; gap: 9px; margin: 10px 0; }
.bar-name { font-weight: 750; color: #293041; }
.bar-track { height: 11px; border-radius: 999px; overflow: hidden; background: #eef0f4; }
.bar-fill { height: 100%; background: var(--ccoo-red); border-radius: inherit; min-width: 4px; }
.bar-value { text-align: right; color: var(--ink); font-weight: 850; }

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 13px 0;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #d8dbe5;
  border-radius: 17px;
  box-shadow: none;
}
.search-wrap svg { width: 23px; height: 23px; stroke: var(--muted); }
.search-wrap input { width: 100%; border: 0; outline: 0; color: var(--ink); font-weight: 700; }
.search-wrap input::placeholder { color: #80889a; }

.list-section { margin: 16px 0; }
.result-list { display: grid; gap: 10px; }
.item-card { overflow: hidden; }
.item-button {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 44px 1fr auto 18px;
  gap: 12px;
  align-items: center;
  border: 0;
  background: #fff;
  text-align: left;
  padding: 12px 14px;
  color: inherit;
}
.item-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--ccoo-red-soft);
}
.item-icon svg { width: 23px; height: 23px; fill: var(--ccoo-red); }
.item-name { font-weight: 900; line-height: 1.18; }
.item-section { color: var(--muted); font-size: .79rem; margin-top: 3px; font-weight: 700; }
.item-total { color: var(--ccoo-red); font-weight: 950; white-space: nowrap; }
.chev { color: var(--muted); font-size: 1.2rem; }
.item-detail { display: none; padding: 0 14px 14px 70px; border-top: 1px solid var(--line); }
.item-card.open .item-detail { display: block; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 12px; }
.detail-pill { background: #fafafa; border: 1px solid var(--line); border-radius: 12px; padding: 9px; font-weight: 750; }
.detail-pill small { display: block; color: var(--muted); font-weight: 700; }
.note { color: var(--muted); font-size: .86rem; line-height: 1.35; margin: 12px 2px; }
.empty { padding: 18px; text-align: center; color: var(--muted); font-weight: 800; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(255,255,255,.95);
  border-top: 1px solid var(--line);
  box-shadow: none;
  padding: 9px 12px calc(9px + var(--safe-bottom));
  backdrop-filter: blur(16px);
  z-index: 10;
  overscroll-behavior-y: contain;
}
.nav-btn {
  border: 0;
  background: transparent;
  display: grid;
  justify-items: center;
  gap: 4px;
  color: var(--muted);
  font-weight: 850;
  padding: 6px 0;
}
.nav-btn svg { width: 24px; height: 24px; stroke: currentColor; }
.nav-btn.active { color: var(--ccoo-red); }

@media (min-width: 760px) {
  .app-shell { padding-top: 36px; }
  .app-grid { display: grid; grid-template-columns: 1fr; }
  body { background: #fff; }
}

@media (max-width: 380px) {
  .topbar { align-items: flex-start; }
  .logo { width: 76px; }
  .summary-card { grid-template-columns: 64px 1fr; gap: 12px; }
  .summary-icon { width: 62px; height: 62px; border-radius: 20px; }
  .current-card { grid-template-columns: 62px 1fr; }
  .current-number { grid-column: 1 / -1; border-left: 0; border-top: 1px solid #f0a0a5; padding: 12px 0 0; text-align: left; }
}

/* Jerarquia de cossos, escales i categories */
.group-list { gap: 12px; }
.group-card { overflow: hidden; border-color: rgba(227, 6, 19, .18); }
.group-button {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 18px;
  gap: 12px;
  align-items: center;
  border: 0;
  background: var(--ccoo-red-soft);
  color: inherit;
  text-align: left;
  padding: 15px 16px;
}
.group-title {
  display: block;
  font-weight: 950;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.group-subtitle {
  display: block;
  color: var(--muted);
  font-weight: 800;
  font-size: .82rem;
  margin-top: 4px;
}
.group-total {
  color: var(--ccoo-red);
  font-weight: 950;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.group-body {
  display: none;
  padding: 10px;
  border-top: 1px solid rgba(227, 6, 19, .16);
  background: #fff;
}
.group-card.open > .group-body { display: grid; gap: 10px; }
.scale-block {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fafafa;
  overflow: hidden;
}
.scale-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  color: #2b3141;
  font-size: .86rem;
  font-weight: 950;
  line-height: 1.2;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.scale-title strong {
  color: var(--ccoo-red);
  white-space: nowrap;
  font-size: .82rem;
}
.scale-items { display: grid; gap: 8px; padding: 8px; }
.nested-item { box-shadow: none; border-color: #eceef4; }
.nested-item .item-button { min-height: 56px; grid-template-columns: 38px 1fr auto 18px; padding: 10px 12px; }
.nested-item .item-icon { width: 34px; height: 34px; border-radius: 12px; }
.nested-item .item-icon svg { width: 20px; height: 20px; }
.nested-item .item-detail { padding-left: 58px; }

.bottom-nav-two { grid-template-columns: repeat(2, 1fr); }


@media (max-width: 420px) {
  .logo { width: 210px; }
  .section-kicker { font-size: 1rem; }
  .title-block h1 { font-size: 0.82rem; white-space: normal; }
}


/* Ajustes táctiles: sin rebote visual, sin desplazamiento horizontal y fondo blanco */
.nav-btn:active,
.chip:active,
.item-button:active,
.group-button:active,
.segmented button:active {
  transform: none;
}
.nav-btn svg,
.summary-icon svg,
.item-icon svg,
.island-icon-wrap img {
  pointer-events: none;
}
.app-shell,
.card,
.bottom-nav {
  max-width: 100%;
}


/* Ajustes solicitados: tipografía más pequeña, sin negritas y sin sombras */
*,
*::before,
*::after {
  font-weight: 400 !important;
  text-shadow: none !important;
}

.logo,
.segmented,
.segmented button[aria-pressed="true"],
.card,
.search-wrap,
.bottom-nav,
.nested-item {
  box-shadow: none !important;
  filter: none !important;
}


/* Ajuste escritorio: layout fluido y sin huecos grandes, manteniendo la base móvil */
@media (min-width: 900px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-y: auto;
  }

  body {
    background: #fff;
  }

  .app-shell {
    width: min(calc(100% - 56px), 1320px);
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    padding: 32px 28px 44px;
    display: grid;
    grid-template-columns: minmax(310px, 430px) minmax(520px, 1fr);
    grid-template-rows: auto auto auto auto 1fr;
    column-gap: clamp(24px, 4vw, 56px);
    row-gap: 16px;
    align-items: start;
  }

  .topbar {
    grid-column: 1 / -1;
    grid-row: 1;
    flex-direction: row;
    align-items: center;
    gap: 24px;
    margin: 0 0 6px;
  }

  .logo {
    width: 260px;
    max-width: 280px;
  }

  .section-kicker {
    font-size: 1.05rem;
  }

  .title-block h1 {
    font-size: clamp(1.35rem, 1.9vw, 1.85rem);
    white-space: normal;
  }

  .segment-stack {
    grid-column: 1;
    grid-row: 2;
    margin: 0;
  }

  .summary-card {
    grid-column: 1;
    grid-row: 3;
  }

  .filters-card {
    grid-column: 1;
    grid-row: 4;
  }

  .current-card {
    grid-column: 1;
    grid-row: 5;
  }

  .chart-card {
    grid-column: 2;
    grid-row: 2;
  }

  .list-section {
    grid-column: 2;
    grid-row: 3 / span 3;
  }

  .summary-card,
  .filters-card,
  .current-card,
  .chart-card,
  .search-wrap,
  .list-section {
    margin-top: 0;
    margin-bottom: 0;
  }

  .summary-card {
    grid-template-columns: 74px 1fr;
    padding: 18px;
  }

  .summary-icon {
    width: 70px;
    height: 70px;
  }

  .big-number strong {
    font-size: clamp(3.4rem, 6vw, 5.5rem);
  }

  .filters-card {
    overflow: hidden;
  }

  .chips {
    flex-wrap: wrap;
    overflow: visible;
  }

  .current-card {
    grid-template-columns: 68px 1fr;
  }

  .current-number {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid #f0a0a5;
    padding: 12px 0 0;
    text-align: left;
  }

  .current-number strong {
    font-size: clamp(2.1rem, 4vw, 3rem);
  }

  .bar-row {
    grid-template-columns: 130px 1fr 56px;
  }

  .result-list:not(.group-list) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-body {
    padding: 12px;
  }

  .scale-items {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }

  .bottom-nav {
    display: none !important;
  }
}

@media (min-width: 1200px) {
  .app-shell {
    width: min(calc(100% - 72px), 1440px);
    grid-template-columns: minmax(340px, 460px) minmax(620px, 1fr);
    column-gap: clamp(32px, 5vw, 72px);
  }
}

@media (min-width: 1500px) {
  .app-shell {
    width: min(calc(100% - 96px), 1560px);
    grid-template-columns: minmax(360px, 500px) minmax(760px, 1fr);
  }
}


/* Ajuste solicitado: quitar caja de búsqueda y evitar desbordes en pantallas pequeñas */
.search-wrap {
  display: none !important;
}

@media (max-width: 899px) {
  .app-shell {
    width: 100%;
    max-width: 100vw;
    padding-left: clamp(10px, 4vw, 15px);
    padding-right: clamp(10px, 4vw, 15px);
  }

  .chips {
    flex-wrap: wrap;
    overflow-x: visible;
    min-width: 0;
  }

  .chip {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .segmented,
  .card,
  .item-button,
  .group-button,
  .scale-block,
  .result-list,
  .list-section {
    min-width: 0;
  }

  .current-card {
    grid-template-columns: minmax(56px, 72px) minmax(0, 1fr);
  }

  .current-number {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid #f0a0a5;
    padding: 12px 0 0;
    text-align: left;
    min-width: 0;
  }

  .item-button,
  .nested-item .item-button {
    grid-template-columns: 38px minmax(0, 1fr) auto 16px;
  }

  .item-name,
  .group-title,
  .scale-title span {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 340px) {
  .app-shell {
    padding-left: 8px;
    padding-right: 8px;
  }

  .summary-card {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .summary-icon,
  .island-icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 18px;
  }

  .big-number strong {
    font-size: clamp(3rem, 18vw, 4rem);
  }

  .item-total,
  .group-total {
    white-space: normal;
    text-align: right;
  }
}
