/* ===================== Home DETO (frames Figma 506:11 / 506:1056 / 506:2100) ===================== */

/* ---------- Saludo ---------- */
.welcome { display: flex; flex-direction: column; gap: 2px; }
.welcome__title { font-size: 28px; line-height: 35px; font-weight: var(--fw-extrabold); letter-spacing: -0.7px; color: var(--c-ink); white-space: nowrap; }
.welcome__text { font-size: 13px; line-height: 19.5px; font-weight: var(--fw-medium); color: var(--c-muted); white-space: nowrap; }

/* ---------- KPIs ---------- */
.kpis {
  margin-top: 14px; min-height: 94px; padding: 11px 8px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  box-shadow: var(--sh-kpi);
}
.kpi {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; align-items: center;
  padding: 5px 13px;
}
.kpi + .kpi { border-left: 1px solid var(--c-divider); }
.kpi__icon {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-20);
  background: var(--c-peach); border: 1px solid var(--c-peach-border); box-shadow: var(--sh-kpi-icon);
}
.kpi__icon-box { display: grid; place-items: center; overflow: clip; }
.kpi__icon-box--28 { width: 28px; height: 28px; }
.kpi__icon-box--24 { width: 24px; height: 24px; }
.kpi__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi__label { height: 16.5px; font-size: 11px; line-height: 16.5px; font-weight: var(--fw-medium); color: var(--c-ink-3); white-space: nowrap; overflow: clip; }
.kpi__value { font-size: 30px; line-height: 30px; font-weight: var(--fw-extrabold); color: var(--c-ink); white-space: nowrap; }
.kpi__chip {
  position: absolute; top: 43.5px; right: 15px; height: 21.5px; padding: 4px 9px; border-radius: var(--r-12);
  font-size: 9px; line-height: 13.5px; font-weight: var(--fw-bold); white-space: nowrap;
}
.kpi__chip--up { background: var(--c-chip-up); color: var(--c-brand); }
.kpi__chip--warn { background: var(--c-warn-bg); color: var(--c-warn-fg); }

/* ---------- Grilla principal ---------- */
.dashboard { margin-top: 14px; display: grid; grid-template-columns: minmax(0, 629.72fr) minmax(0, 406.27fr); gap: 14px; align-items: start; }
.dashboard__main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ---------- Tendencias destacadas ---------- */
.trends { display: flex; flex-direction: column; min-height: 430px; padding-bottom: 10px; }
.trends__head { display: flex; align-items: flex-start; justify-content: space-between; min-height: 64px; padding: 10px 14px 5px; }
.trends__title { font-size: 20px; line-height: 27px; font-weight: var(--fw-bold); color: var(--c-ink); white-space: nowrap; }
.trends__subtitle { padding-top: 2px; font-size: 10px; line-height: 16px; font-weight: var(--fw-medium); color: var(--c-muted); white-space: nowrap; }
.trends__arrows { display: flex; gap: 6px; }

.arrow-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-19);
  background: #fff; border: 1px solid var(--c-border); box-shadow: var(--sh-arrow);
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.arrow-btn:hover { border-color: #cbd5d1; background: #f8faf9; box-shadow: 0 3px 8px rgba(29, 71, 64, 0.1); transform: translateY(-1px); }
.arrow-btn:active { background: #eef2f0; transform: translateY(0); box-shadow: var(--sh-arrow); }

.trends__body {
  display: grid; grid-template-columns: minmax(0, 481.07fr) minmax(0, 110.64fr); grid-auto-rows: minmax(320px, auto);
  gap: 10px; padding: 0 14px; overflow: clip;
}

/* Slide principal */
.slide {
  position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 320px; overflow: hidden;
  padding: 12px 14px 10px; border-radius: var(--r-19); background: var(--c-article); box-shadow: var(--sh-article);
}
.slide--from-next { animation: slide-next .38s ease both; }
.slide--from-prev { animation: slide-prev .38s ease both; }
@keyframes slide-next { from { opacity: .65; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slide-prev { from { opacity: .65; transform: translateX(-24px); } to { opacity: 1; transform: translateX(0); } }

.slide__tags { display: flex; align-items: center; gap: 6px; min-height: 26px; height: 26px; overflow: clip; width: 100%; position: relative; z-index: 4; }
.badge-trend {
  display: inline-flex; align-items: center; flex: none; padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--c-badge); box-shadow: var(--sh-arrow);
  font-size: 9px; line-height: 13.5px; font-weight: var(--fw-bold); color: #fff; white-space: nowrap;
}
.chip-glass {
  flex: none; padding: 4px 10px; border-radius: var(--r-12);
  background: rgba(255, 255, 255, 0.8); border: 1px solid rgba(255, 255, 255, 0.4);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  font-size: 9px; line-height: 13.5px; font-weight: var(--fw-medium); color: var(--c-ink-strong); white-space: nowrap;
}

.slide__main { display: grid; grid-template-columns: 148.27fr 181.23fr 123.56fr; min-height: 132px; width: 100%; }
.slide__summary { align-self: center; min-width: 0; }
.slide__name {
  width: 149px; font-size: 22px; line-height: 25px; font-weight: var(--fw-extrabold); letter-spacing: -0.7px; color: var(--c-ink);
  text-wrap: balance;
}
.growth { display: flex; align-items: center; height: 52px; padding-top: 3px; width: 148.27px; }
.growth__icon { flex: none; width: 27px; height: 27px; }
.growth__value { font-size: 24px; line-height: 26px; font-weight: var(--fw-extrabold); color: var(--c-brand); white-space: nowrap; }
.growth__label { font-size: 8px; line-height: 12px; font-weight: var(--fw-semibold); color: var(--c-ink-2); white-space: nowrap; }
.growth__note { font-size: 7px; line-height: 10.5px; font-weight: var(--fw-regular); color: var(--c-muted-2); white-space: nowrap; }

/* Gráfico interactivo */
.chart { position: relative; align-self: end; min-width: 0; height: 114px; padding-bottom: 14px; }
.chart__svg { display: block; width: 100%; height: 100px; overflow: visible; cursor: crosshair; }
.chart__svg:focus-visible { border-radius: 8px; outline: var(--focus); outline-offset: 2px; }
.chart__line { fill: none; stroke: var(--c-trend); stroke-width: 2.13; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart__guide { stroke: var(--c-brand); stroke-width: 1; stroke-dasharray: 3 3; opacity: .25; vector-effect: non-scaling-stroke; }
.chart__point { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; pointer-events: none; }
.chart__point::after { content: ""; position: absolute; inset: 2.1px; border-radius: 50%; background: var(--c-trend); }
.chart__tip {
  position: absolute; z-index: 7; min-width: 70px; display: flex; flex-direction: column; align-items: center;
  padding: 5px 8px; border: 1px solid #dfe5e1; border-radius: 7px; background: #fff; color: var(--c-brand);
  box-shadow: 0 4px 10px rgba(29, 71, 64, 0.14); pointer-events: none; transform: translate(-50%, calc(-100% - 8px));
}
.chart__tip--start { transform: translate(-12px, calc(-100% - 8px)); }
.chart__tip--end { transform: translate(calc(-100% + 12px), calc(-100% - 8px)); }
.chart__tip small { font-size: 7px; line-height: 10px; color: var(--c-muted); }
.chart__tip strong { font-size: 10px; line-height: 14px; font-weight: var(--fw-bold); }
.chart [hidden] { display: none; }

/* Ilustración del producto */
.art { position: relative; height: 128px; align-self: center; }
.art__blob { position: absolute; left: 3px; top: 13px; width: 124px; height: 120px; object-fit: cover; opacity: .83; }
.art__product { position: absolute; object-fit: contain; }
.art__product--box { left: 7.78px; top: 2px; width: 94px; height: 107px; }
.art__product--single { left: 3.78px; top: 7px; width: 102px; height: 116px; }
/* Sombra de Figma (0 5 12 rgba(29,71,64,.14)) rellena bajo las zonas transparentes del PNG */
.art__product--single::before { content: ""; position: absolute; inset: 0; background: rgba(29, 71, 64, 0.14); transform: translateY(5px); filter: blur(6px); }
.art__product--single img { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; }
.art__bar-wrap { position: absolute; left: -54.48px; top: 20.12px; width: 124.52px; height: 92.63px; display: flex; align-items: center; justify-content: center; }
.art__bar { flex: none; width: 118px; height: 43px; object-fit: cover; transform: rotate(27.5deg); }

/* Métricas + botón */
.slide__footer { display: flex; align-items: flex-end; gap: 12px; min-height: 108px; width: 100%; }
.metrics { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; grid-template-rows: 128px; }
.slide--b .metrics { grid-template-rows: 143px; }
.metric { position: relative; min-height: 96px; border-radius: var(--r-9); background: linear-gradient(180deg, #f1f9ea, #fbfef8); color: var(--c-brand); }
.metric__icon { position: absolute; left: 10.84px; top: var(--ti); width: 24px; height: 24px; }
.metric__icon-in { position: absolute; }
.metric__icon-in img { width: 100%; height: 100%; }
.metric__icon--search .metric__icon-in { inset: 8.25% 8.37% 8.43% 8.25%; }
.metric__icon--cart .metric__icon-in { inset: 8.33% 8.21% 8.24% 8.33%; }
.metric__icon--users .metric__icon-in { inset: 14.58% 4.29% 14.58% 4.17%; }
.metric__value { position: absolute; left: 45px; top: var(--tv); font-size: 19px; line-height: 22px; font-weight: var(--fw-extrabold); white-space: nowrap; }
.metric__label { position: absolute; left: 11px; top: var(--tl); width: 83px; font-size: 12px; line-height: 15px; font-weight: var(--fw-bold); color: var(--c-ink-2); }
.metric__sub { position: absolute; left: 11px; top: var(--ts); width: 83px; font-size: 11px; line-height: 14px; font-weight: var(--fw-regular); color: var(--c-muted-2); }
.metric--wide-sub .metric__sub { width: 100px; }
.metric--nowrap .metric__label { width: auto; white-space: nowrap; }

.btn-detail-wrap { flex: none; padding: 0 6px 4px 0; }
.btn-detail {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 15px;
  border-radius: var(--r-14); background: var(--c-brand); box-shadow: var(--sh-card);
  font-size: 10px; line-height: 15px; font-weight: var(--fw-semibold); color: #fff; white-space: nowrap;
  transition: background-color .15s ease, box-shadow .15s ease;
}
.btn-detail img { width: 15px; height: 15px; }
.btn-detail:hover { background: #163832; box-shadow: 0 3px 8px rgba(29, 71, 64, 0.25); }
.btn-detail:active { background: #0f2e29; box-shadow: var(--sh-card); }

/* Tarjeta lateral: siguiente tendencia */
.peek {
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; min-width: 0;
  padding: 14px 8px 18px; border-radius: var(--r-16); text-align: center;
  background: linear-gradient(180deg, #edf9dc 38%, #e4f6ce);
  transition: box-shadow .15s ease, transform .15s ease;
}
.peek:hover { box-shadow: 0 3px 10px rgba(29, 71, 64, 0.16); transform: translateY(-1px); }
.peek:active { transform: none; box-shadow: var(--sh-card); }
.peek .status { height: 18px; padding: 3px 7px; font-size: 8px; line-height: 12px; overflow: clip; }
.peek__art { position: relative; display: block; width: 82px; height: 116px; flex: none; }
/* Sombra de Figma (0 5 12 rgba(29,71,64,.12)): se rellena también bajo las zonas transparentes del PNG */
.peek__art::before { content: ""; position: absolute; inset: 0; background: rgba(29, 71, 64, 0.12); transform: translateY(5px); filter: blur(6px); }
.peek__img { position: relative; display: block; width: 82px; height: 116px; object-fit: contain; }
.peek__name { width: 95px; font-size: 11px; line-height: 14px; font-weight: var(--fw-extrabold); color: var(--c-ink); }

/* Dots */
.trends__dots { display: flex; align-items: center; justify-content: center; gap: 6px; height: 24px; }
.dot { position: relative; width: 8px; height: 8px; border-radius: 4px; background: rgba(29, 71, 64, 0.3); transition: width .2s ease, background-color .2s ease; }
.dot::after { content: ""; position: absolute; left: -3px; right: -3px; top: 50%; height: 44px; transform: translateY(-50%); } /* zona clickeable 14×44 (sin solaparse con el vecino) */
.dot:hover { background: rgba(29, 71, 64, 0.55); }
.dot[aria-current="true"] { width: 20px; border-radius: 10px; background: var(--c-brand); }
.dot:focus-visible { outline: var(--focus); outline-offset: 3px; }

/* ---------- LAB ---------- */
.lab { min-height: 216px; padding: 0 12px 12px; }
.section-title__soft { color: var(--c-muted-3); }
.lab__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 0 4px; }
.pilot {
  display: grid; grid-template-columns: 105px minmax(0, 1fr); column-gap: 11px; align-items: center; height: 162px; padding: 9px;
  background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-16); box-shadow: var(--sh-arrow);
}
.pilot__img { height: 122px; overflow: hidden; border-radius: var(--r-12); background: #f9fafb; }
.pilot__img img { width: 100%; height: 100%; object-fit: contain; }
.pilot__info { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 5px; min-width: 0; }
.pilot__title { width: 135px; font-size: 12px; line-height: 16px; font-weight: var(--fw-bold); color: var(--c-ink); }
.pilot__title--nowrap { width: auto; white-space: nowrap; }
.pilot__row { display: flex; align-items: center; gap: 5px; font-size: 9px; line-height: 13.5px; color: var(--c-muted-2); white-space: nowrap; }
.pilot__row img, .pilot__more img:first-child { flex: none; width: 14px; height: 14px; }
.pilot__more {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 6px;
  font-size: 9px; line-height: 13.5px; font-weight: var(--fw-bold); color: var(--c-orange); white-space: nowrap;
}
.pilot__more img:last-child { width: 12px; height: 12px; }
.pilot__more:hover { text-decoration: underline; }

/* ---------- Calendario comercial ---------- */
.calendar { height: 544px; padding: 0 15px 14px; display: flex; flex-direction: column; }
.calendar__nav { display: grid; grid-template-columns: 32px minmax(0, 1fr) 32px; align-items: center; min-height: 34px; }
.calendar__nav-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 16px; transition: background-color .15s ease; }
.calendar__nav-btn:hover { background: #eef2f0; }
.calendar__nav-btn:active { background: #e1e8e5; }
.calendar__month { text-align: center; font-size: 12px; line-height: 18px; font-weight: var(--fw-bold); color: var(--c-ink); }

.calendar__grid { margin-top: 4px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: 26px; column-gap: 4px; row-gap: 2px; }
.cal-head { display: grid; place-items: center; font-size: 9px; line-height: 13.5px; font-weight: var(--fw-semibold); color: var(--c-muted-3); }
.cal-day {
  position: relative; display: grid; place-items: center; border-radius: 18px;
  font-size: 9px; line-height: 13.5px; font-weight: var(--fw-medium); color: var(--c-ink-2);
  transition: background-color .15s ease;
}
.cal-day--out { color: var(--c-out-of-month); }
.cal-day:hover { background: rgba(29, 71, 64, 0.07); }
.cal-day:focus-visible { outline: var(--focus); outline-offset: -2px; }
.cal-day--event { z-index: 1; }
.cal-day--event:hover { background: transparent; }
.cal-day__mark { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 12px; background: var(--c-orange); font-weight: var(--fw-bold); color: #fff; }
.cal-day--event::after { content: ""; position: absolute; left: 22.66px; top: 24px; width: 5px; height: 5px; border-radius: 2.5px; background: var(--c-orange-dot); }

.calendar__events-head { display: flex; align-items: center; justify-content: space-between; min-height: 40px; height: 46px; padding-top: 6px; }
.calendar__events-title { font-size: 12px; line-height: 18px; font-weight: var(--fw-medium); color: var(--c-ink-strong); white-space: nowrap; }
.add-event {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 25px; padding: 0 14px; border-radius: var(--r-14);
  background: var(--c-lime-soft); font-size: 8px; line-height: 12px; font-weight: var(--fw-semibold); color: var(--c-brand); white-space: nowrap;
  transition: background-color .15s ease;
}
.add-event img { width: 12px; height: 12px; }
.add-event:hover { background: #d6f29b; }
.add-event:active { background: #cbeb85; }

.events { display: flex; flex-direction: column; gap: 10px; }
.event {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 18px; column-gap: 10px; align-items: center; min-height: 60px; padding: 8px 12px;
  background: var(--c-event-bg); border: 1px solid var(--c-event-border); border-radius: var(--r-16);
  transition: background-color .15s ease, border-color .15s ease;
}
.event:hover { background: #eef6e6; border-color: rgba(190, 228, 168, 0.8); }
.event:active { background: #e6f1dc; }
.event__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-20); background: var(--c-event-icon-bg); border: 1px solid var(--c-event-border); }
.event__text { display: flex; flex-direction: column; min-width: 0; }
.event__name { display: block; height: 16.5px; overflow: clip; font-size: 11px; line-height: 16.5px; font-weight: var(--fw-bold); color: var(--c-ink); white-space: nowrap; }
.event__date { display: block; height: 13.5px; overflow: clip; font-size: 9px; line-height: 13.5px; font-weight: var(--fw-regular); color: var(--c-muted-2); white-space: nowrap; }
.event__badge { height: 21.5px; padding: 4px 9px; border-radius: 13px; background: var(--c-lime-soft); font-size: 9px; line-height: 13.5px; font-weight: var(--fw-semibold); color: var(--c-brand); white-space: nowrap; }

/* ---------- Ajustes finos de texto ---------- */
/* Figma redondea la posición vertical del texto 1px más abajo que Chrome en estas líneas (lo medí sobre los frames) */
.welcome__title, .kpi__label, .kpi__value, .trends__title, .trends__subtitle,
.growth__value, .growth__note, .metric__value, .event__date { transform: translateY(1px); }
/* Flecha ↗ de los badges (Montserrat no la trae en su subset latino): ~0,56em de ancho + 0,3em de aire, como en Figma */
.arw {
  display: inline-block; width: .56em; height: .56em; margin-right: .3em; vertical-align: .04em;
  background-color: currentColor;
  -webkit-mask: url("../assets/icons/flecha-arriba-derecha.svg") center / contain no-repeat;
  mask: url("../assets/icons/flecha-arriba-derecha.svg") center / contain no-repeat;
}
/* Valores que envuelven en el frame (caja de 49px) */
.metric__value--wrap { width: 49px; white-space: normal; }
.btn-detail { min-width: 106.07px; }

/* MVP: nota de fuente de datos */
.welcome__source { margin: 4px 0 0; font-size: 10px; line-height: 14px; color: #4e6b63; font-weight: 600; }
.welcome__source:empty { display: none; }
.pilot__info .pilot__title { overflow-wrap: anywhere; }
/* MVP: nombres reales largos → máximo 3 líneas */
.slide__name, .pilot__title, .peek__name {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.pilot__title { -webkit-line-clamp: 2; }
.peek__name { -webkit-line-clamp: 4; }
