/* Sumiller PWA — layout móvil dedicado (siempre activo en la PWA) */

:root {
  --text-primary: var(--text, #f1f5f9);
  --text-secondary: var(--text2, #94a3b8);
  --text-muted: var(--muted, #64748b);
  --bg-primary: var(--bg, #0b0d17);
  --bg-secondary: var(--bg2, #111422);
  --border-light: rgba(255, 255, 255, 0.1);
  --sum-pwa-nav-h: calc(64px + env(safe-area-inset-bottom));
  --sum-pwa-pad: 16px;
  --sum-pwa-gap: 12px;
  --sum-pwa-radius: 12px;
}

.sumiller-pwa-root,
.sumiller-pwa-root * {
  box-sizing: border-box;
}

.sumiller-pwa-root {
  max-width: 100vw;
  overflow-x: hidden;
}

/* —— Shell PWA —— */
body.sumiller-view {
  overflow: hidden;
}

body.sumiller-view #app {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

body.sumiller-view .topbar,
body.sumiller-view .ronin-voice-float {
  display: none !important;
}

body.sumiller-view .main.sumiller-active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  background: #0b0e14;
}

.sumiller-pwa-root,
.sumiller-pwa-root .sumiller-screen,
.sumiller-pwa-root .sumiller-wizard-shell {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.sumiller-screen--loading {
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 14px;
}

/* Anula grid escritorio */
.sumiller-pwa-root .sumiller-screen {
  display: flex !important;
  flex-direction: column;
  position: relative;
  background: linear-gradient(180deg, #0b0e14 0%, #090b10 100%);
  overflow: hidden;
}

.sumiller-pwa-root .sum-main-col {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sumiller-pwa-root .sum-aside {
  display: none !important;
}

/* —— Cabecera compacta —— */
.sumiller-pwa-root .sum-top {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) var(--sum-pwa-pad) 10px;
  background: rgba(8, 10, 16, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
}

.sumiller-pwa-root .sum-top-left {
  width: 100%;
  min-width: 0;
}

.sumiller-pwa-root .sum-top-brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  flex-wrap: nowrap;
}

.sumiller-pwa-root .sum-pwa-menu {
  display: inline-flex !important;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}

.sumiller-pwa-root .sum-brand {
  min-width: 0;
  flex: 1;
}

.sumiller-pwa-root .sum-brand strong {
  font-size: 11px;
  letter-spacing: 0.08em;
}

.sumiller-pwa-root .sum-brand small {
  font-size: 8px;
}

.sumiller-pwa-root .sum-top h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 4px 0 0;
  line-height: 1.2;
}

.sumiller-pwa-root .sum-top--home h1 {
  display: none;
}

.sumiller-pwa-root .sum-top-sub {
  display: none;
}

.sumiller-pwa-root .sum-top-actions {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.sumiller-pwa-root .sum-pwa-filter {
  display: none !important;
}

.sumiller-pwa-root .sum-icon-btn:not(.sum-pwa-menu) {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.sumiller-pwa-root .sum-search-wrap {
  display: none;
  flex: 1;
  min-width: 0;
  min-height: 40px;
}

.sumiller-pwa-root .sum-top.sum-search-open .sum-top-actions {
  flex-wrap: wrap;
}

.sumiller-pwa-root .sum-top.sum-search-open .sum-search-wrap {
  display: flex;
  order: 4;
  flex: 1 1 100%;
}

.sumiller-pwa-root .sum-btn-primary {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  font-size: 12px;
  white-space: nowrap;
  border-radius: 10px;
}

/* —— Subnav horizontal —— */
.sumiller-pwa-root .sum-subnav {
  display: flex !important;
  flex-shrink: 0;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 0 var(--sum-pwa-pad) 10px;
  margin: 0;
  background: rgba(8, 10, 16, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.sumiller-pwa-root .sum-subnav ul {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 6px;
  margin: 0;
  padding: 0 0 4px;
  list-style: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.sumiller-pwa-root .sum-subnav ul::-webkit-scrollbar {
  display: none;
}

.sumiller-pwa-root .sum-subnav-tools {
  display: none !important;
}

.sumiller-pwa-root .sum-nav-item {
  padding: 8px 12px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}

.sumiller-pwa-root .sum-nav-item.active {
  border-color: rgba(167, 139, 250, 0.45);
  background: rgba(138, 99, 255, 0.22);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.28), 0 0 12px rgba(138, 99, 255, 0.22);
}

.sumiller-pwa-root .sum-nav-item.active svg {
  opacity: 1;
  color: #c4b5fd;
}

/* —— Contenido scroll —— */
.sumiller-pwa-root .sum-main-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: var(--sum-pwa-gap) var(--sum-pwa-pad) var(--sum-pwa-nav-h);
}

.sumiller-pwa-root .sum-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.sumiller-pwa-root .sum-stat-card {
  padding: 12px;
  min-height: 84px;
}

.sumiller-pwa-root .sum-stat-value {
  font-size: 22px;
}

.sumiller-pwa-root .sum-stat-delta {
  font-size: 9px;
}

.sumiller-pwa-root .sum-featured {
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 16px;
  border-radius: 14px;
  margin-bottom: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sumiller-pwa-root .sum-featured-media {
  max-width: 140px;
  margin: 0 auto;
  min-height: 160px;
  border-radius: 12px;
  overflow: hidden;
}

.sumiller-pwa-root .sum-featured-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sumiller-pwa-root .sum-featured-body h2 {
  font-size: 17px;
  text-align: center;
  line-height: 1.25;
}

.sumiller-pwa-root .sum-featured-body .sum-meta {
  text-align: center;
  font-size: 12px;
}

.sumiller-pwa-root .sum-quick-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sumiller-pwa-root .sum-featured-actions {
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.sumiller-pwa-root .sum-btn-ghost {
  font-size: 12px;
  padding: 9px 12px;
}

.sumiller-pwa-root .sum-main-extras {
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
}

.sumiller-pwa-root .sum-bodega-grid,
.sumiller-pwa-root .sum-region-grid,
.sumiller-pwa-root .sum-grape-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sumiller-pwa-root .sum-cellar-row {
  margin-bottom: 14px;
}

.sumiller-pwa-root .sum-cellar-card {
  min-width: 120px;
}

/* —— Barra inferior —— */
.sumiller-pwa-root .sum-mobile-nav {
  display: flex !important;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 130;
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(8, 10, 16, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  justify-content: space-around;
  align-items: flex-end;
  gap: 2px;
}

.sumiller-pwa-root .sum-mobile-nav button {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 500;
  padding: 6px 4px 4px;
  min-width: 48px;
  cursor: pointer;
}

.sumiller-pwa-root .sum-mobile-nav button.active {
  color: #c4b5fd;
}

.sumiller-pwa-root .sum-mobile-fab {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  margin-top: -18px;
  margin-bottom: 2px;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.5);
  cursor: pointer;
  flex-shrink: 0;
}

/* —— Pestañas cata —— */
.sumiller-pwa-root #sum-tasting-panel {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
}

.sumiller-pwa-root #sum-tasting-panel .st-tabs {
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 0;
  padding: 0 8px;
}

.sumiller-pwa-root #sum-tasting-panel .st-tabs::-webkit-scrollbar {
  display: none;
}

.sumiller-pwa-root #sum-tasting-panel .st-tab {
  flex-shrink: 0;
  font-size: 9px;
  padding: 10px 8px;
  letter-spacing: 0.06em;
}

.sumiller-pwa-root #sum-tasting-panel .st-body {
  min-height: 0;
  padding: 12px;
}

.sumiller-pwa-root #sum-tasting-panel .st-nc,
.sumiller-pwa-root #sum-tasting-panel .st-mar,
.sumiller-pwa-root #sum-tasting-panel .st-info,
.sumiller-pwa-root #sum-tasting-panel .st-hist,
.sumiller-pwa-root #sum-tasting-panel .st-etiq-body {
  grid-template-columns: 1fr !important;
}

.sumiller-pwa-root #sum-tasting-panel .st-nc-main {
  border-right: none;
  padding-right: 0;
}

.sumiller-pwa-root #sum-tasting-panel .st-mar-tips,
.sumiller-pwa-root #sum-tasting-panel .st-info-mini-grid,
.sumiller-pwa-root #sum-tasting-panel .st-lugar-grid,
.sumiller-pwa-root #sum-tasting-panel .st-hist-right {
  grid-template-columns: 1fr !important;
}

.sumiller-pwa-root #sum-tasting-panel .st-footer {
  grid-template-columns: 1fr;
  gap: 8px;
}

.sumiller-pwa-root #sum-tasting-panel .st-btn-save {
  width: 100%;
}

/* —— Wizard pantalla completa —— */
body.sumiller-view .sumiller-wizard-shell {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #0a0c12;
}

body.sumiller-view .sumiller-wizard-shell .saw-root {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.sumiller-view .saw-header {
  padding: calc(10px + env(safe-area-inset-top)) 14px 8px;
  flex-shrink: 0;
}

body.sumiller-view .saw-stepper {
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding-left: 12px;
  padding-right: 12px;
}

body.sumiller-view .saw-stepper::-webkit-scrollbar {
  display: none;
}

body.sumiller-view .saw-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 14px 10px;
}

body.sumiller-view .saw-footer {
  flex-shrink: 0;
  background: rgba(8, 10, 16, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

body.sumiller-view .saw-footer-inner {
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  flex-wrap: wrap;
  gap: 8px;
}

body.sumiller-view .saw-footer-right .saw-btn {
  min-width: 0;
  padding: 10px 12px;
  font-size: 11px;
}

/* —— Cuadrícula responsive (PWA) —— */
.sumiller-pwa-root .sum-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sum-pwa-gap);
}

.sumiller-pwa-root .sum-stat-card:nth-child(5) {
  grid-column: 1 / -1;
}

.sumiller-pwa-root .sum-stat-card {
  border-radius: var(--sum-pwa-radius);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sumiller-pwa-root .sum-section-head {
  align-items: center;
  margin-bottom: var(--sum-pwa-gap);
  padding: 0 2px;
}

.sumiller-pwa-root .sum-section-head h3 {
  font-size: 10px;
  letter-spacing: 0.1em;
}

.sumiller-pwa-root .sum-meta-box {
  min-height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.sumiller-pwa-root .sum-featured-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.sumiller-pwa-root .sum-featured-actions .sum-btn-primary,
.sumiller-pwa-root .sum-featured-actions .sum-btn-ghost {
  width: 100%;
  justify-content: center;
  margin: 0;
}

.sumiller-pwa-root .sum-bodega-grid,
.sumiller-pwa-root .sum-region-grid,
.sumiller-pwa-root .sum-grape-grid,
.sumiller-pwa-root .sum-pairings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sum-pwa-gap);
}

.sumiller-pwa-root .sum-bodega-card,
.sumiller-pwa-root .sum-region-card,
.sumiller-pwa-root .sum-grape-card,
.sumiller-pwa-root .sum-pairing-card {
  border-radius: var(--sum-pwa-radius);
  width: 100%;
  min-width: 0;
}

.sumiller-pwa-root .sum-pairing-card h3 {
  font-size: 13px;
  margin: 0 0 8px;
}

.sumiller-pwa-root .sum-cellar-wrap {
  margin: 0 -2px;
}

.sumiller-pwa-root .sum-cellar-card {
  flex: 0 0 132px;
}

/* Barra inferior — columnas iguales */
.sumiller-pwa-root .sum-mobile-nav {
  display: grid !important;
  grid-template-columns: 1fr 1fr 56px 1fr 1fr;
  align-items: end;
  justify-items: center;
  gap: 0;
  padding-left: 6px;
  padding-right: 6px;
}

.sumiller-pwa-root .sum-mobile-nav button:not(.sum-mobile-fab) {
  width: 100%;
  max-width: 72px;
  text-align: center;
}

.sumiller-pwa-root .sum-mobile-fab {
  grid-column: 3;
  margin-top: -18px;
  justify-self: center;
}

/* Pestañas cata — filas y bloques apilados */
.sumiller-pwa-root #sum-tasting-panel .st-box {
  width: 100%;
  max-width: 100%;
  border-radius: var(--sum-pwa-radius);
}

.sumiller-pwa-root #sum-tasting-panel .st-nc-row,
.sumiller-pwa-root #sum-tasting-panel .st-nc-conclusion-row {
  grid-template-columns: 1fr !important;
  gap: 8px;
  padding: 12px 0;
}

.sumiller-pwa-root #sum-tasting-panel .st-nc-row .st-nc-dots,
.sumiller-pwa-root #sum-tasting-panel .st-nc-row .st-dots-10 {
  justify-content: flex-start;
  margin-top: 4px;
}

.sumiller-pwa-root #sum-tasting-panel .st-nc-aside {
  padding-left: 0;
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sumiller-pwa-root #sum-tasting-panel .st-block-head--actions {
  grid-template-columns: 1fr;
  gap: 8px;
}

.sumiller-pwa-root #sum-tasting-panel .st-btn-edit-mar {
  width: 100%;
  text-align: center;
}

.sumiller-pwa-root #sum-tasting-panel .st-mar-carousel-wrap {
  flex-direction: column;
  align-items: stretch;
}

.sumiller-pwa-root #sum-tasting-panel .st-mar-arrow {
  display: none;
}

.sumiller-pwa-root #sum-tasting-panel .st-mar-carousel {
  width: 100%;
  margin: 0;
}

.sumiller-pwa-root #sum-tasting-panel .st-mar-card {
  flex: 0 0 min(78vw, 200px);
}

.sumiller-pwa-root #sum-tasting-panel .st-info-gen,
.sumiller-pwa-root #sum-tasting-panel .st-dl-icons div {
  grid-template-columns: 1fr !important;
  gap: 6px;
}

.sumiller-pwa-root #sum-tasting-panel .st-info-mini-grid,
.sumiller-pwa-root #sum-tasting-panel .st-style-grid,
.sumiller-pwa-root #sum-tasting-panel .st-vis-grid,
.sumiller-pwa-root #sum-tasting-panel .st-style-picks {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.sumiller-pwa-root #sum-tasting-panel .st-analytic {
  grid-template-columns: 72px 1fr;
  gap: 8px;
}

.sumiller-pwa-root #sum-tasting-panel .st-hist-row,
.sumiller-pwa-root #sum-tasting-panel .st-hist-item {
  grid-template-columns: 1fr !important;
}

.sumiller-pwa-root #sum-tasting-panel .st-etiq-body {
  gap: var(--sum-pwa-gap);
}

.sumiller-pwa-root #sum-tasting-panel .st-tasting-field,
.sumiller-pwa-root #sum-tasting-panel input,
.sumiller-pwa-root #sum-tasting-panel textarea,
.sumiller-pwa-root #sum-tasting-panel select {
  max-width: 100%;
}

.sumiller-pwa-root #sum-tasting-panel .st-footer {
  padding: 12px;
  gap: 10px;
}

.sumiller-pwa-root #sum-tasting-panel .st-footer-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.sumiller-pwa-root #sum-tasting-panel .st-footer-nav .st-btn-nav {
  width: 100%;
  justify-content: center;
}

/* Wizard — grillas en columna */
body.sumiller-view .saw-step1-top,
body.sumiller-view .saw-step1-bottom,
body.sumiller-view .saw-step2,
body.sumiller-view .saw-step3,
body.sumiller-view .saw-step4,
body.sumiller-view .saw-step5,
body.sumiller-view .saw-grid-2,
body.sumiller-view .saw-grid-3,
body.sumiller-view .saw-analysis-grid,
body.sumiller-view .saw-photo-grid,
body.sumiller-view .saw-photo-grid--6,
body.sumiller-view .saw-visual-split,
body.sumiller-view .saw-review-pairs {
  grid-template-columns: 1fr !important;
}

body.sumiller-view .saw-step3 > * {
  grid-column: 1 !important;
  grid-row: auto !important;
}

body.sumiller-view .saw-hero-card {
  grid-template-columns: 72px 1fr;
}

body.sumiller-view .saw-hero-score {
  grid-column: 1 / -1;
}

body.sumiller-view .saw-footer-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

body.sumiller-view .saw-footer-right {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

body.sumiller-view .saw-footer-right .saw-btn {
  width: 100%;
  justify-content: center;
}

/* Tablet PWA */
@media (min-width: 600px) {
  .sumiller-pwa-root .sum-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sumiller-pwa-root .sum-stat-card:nth-child(4),
  .sumiller-pwa-root .sum-stat-card:nth-child(5) {
    grid-column: span 1;
  }

  .sumiller-pwa-root .sum-stat-card:nth-child(5) {
    grid-column: 2 / 3;
  }

  .sumiller-pwa-root .sum-bodega-grid,
  .sumiller-pwa-root .sum-region-grid,
  .sumiller-pwa-root .sum-grape-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sumiller-pwa-root .sum-quick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sumiller-pwa-root #sum-tasting-panel .st-info-mini-grid,
  .sumiller-pwa-root #sum-tasting-panel .st-mar-tips {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* —— Pantallas estrechas —— */
@media (max-width: 380px) {
  .sumiller-pwa-root .sum-top h1 {
    font-size: 15px;
  }

  .sumiller-pwa-root .sum-top-brand-row .sum-brand small {
    display: none;
  }

  .sumiller-pwa-root .sum-btn-primary {
    font-size: 11px;
    padding: 9px 10px;
  }

  .sumiller-pwa-root .sum-featured-actions {
    grid-template-columns: 1fr;
  }

  .sumiller-pwa-root .sum-quick-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sumiller-pwa-root .sum-bodega-grid,
  .sumiller-pwa-root .sum-region-grid,
  .sumiller-pwa-root .sum-grape-grid {
    grid-template-columns: 1fr;
  }

  .sumiller-pwa-root .sum-mobile-fab {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  body.sumiller-view .saw-footer-right {
    grid-template-columns: 1fr;
  }
}

/* Anula reglas escritorio que ocultan subnav en móvil */
@media (max-width: 900px) {
  html:not(.platform-desktop) .sumiller-pwa-root .sum-subnav {
    display: flex !important;
  }
}
