/* SaaS Showcase — real app shells */
.section--demos {
  background: linear-gradient(180deg, transparent, rgba(0, 74, 173, 0.05) 50%, transparent);
  overflow-x: clip;
  max-width: 100%;
}

.saas-showcase {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.25rem;
  align-items: start;
  max-width: 100%;
  overflow-x: clip;
}

.saas-catalog {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.saas-catalog__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1rem;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.saas-catalog__item:hover {
  border-color: rgba(0, 229, 255, 0.35);
}

.saas-catalog__item.active {
  border-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.08);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.2);
}

.saas-catalog__mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.saas-catalog__mark--crm { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.saas-catalog__mark--flow { background: linear-gradient(135deg, #059669, #047857); }
.saas-catalog__mark--pulse { background: linear-gradient(135deg, #7c3aed, #6d28d9); }

.saas-catalog__info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.saas-catalog__info strong { font-size: 0.85rem; color: var(--text-primary); }
.saas-catalog__info small { font-size: 0.7rem; color: var(--text-secondary); }

.saas-window {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  max-width: 100%;
}

.saas-window__chrome {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1rem;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

.saas-window__dots { display: flex; gap: 6px; }
.saas-window__dots span { width: 10px; height: 10px; border-radius: 50%; }
.saas-window__dots span:nth-child(1) { background: #ef4444; }
.saas-window__dots span:nth-child(2) { background: #eab308; }
.saas-window__dots span:nth-child(3) { background: #22c55e; }

.saas-window__url {
  flex: 1;
  font-size: 0.72rem;
  color: #94a3b8;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-family: ui-monospace, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saas-window__env {
  font-size: 0.65rem;
  font-weight: 600;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
}

.saas-window__viewport {
  min-height: 520px;
  background: #f1f5f9;
}

.saas-showcase__footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.saas-showcase__footer p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

.app {
  --app-sidebar: #1e293b;
  --app-sidebar-text: #94a3b8;
  --app-bg: #f1f5f9;
  --app-surface: #ffffff;
  --app-border: #e2e8f0;
  --app-text: #0f172a;
  --app-muted: #64748b;
  --app-primary: #2563eb;
  --app-primary-hover: #1d4ed8;
  --app-success: #059669;
  --app-warning: #d97706;

  display: flex;
  height: 520px;
  font-size: 12px;
  color: var(--app-text);
  text-align: left;
}

.app__sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--app-sidebar);
  padding: 0.75rem 0;
}

.app__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem 1rem;
  border-bottom: 1px solid #334155;
  margin-bottom: 0.5rem;
}

.app__brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
}

.app__brand-name { font-size: 0.8rem; font-weight: 700; color: #f8fafc; }
.app__brand-name small { display: block; font-size: 0.6rem; font-weight: 500; color: var(--app-sidebar-text); }

.app__nav { display: flex; flex-direction: column; gap: 2px; padding: 0 0.5rem; }

.app__nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--app-sidebar-text);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.app__nav-item:hover:not(.active) { background: rgba(255, 255, 255, 0.06); color: #e2e8f0; }

.app__nav-item svg { width: 16px; height: 16px; opacity: 0.7; }
.app__nav-item.active { background: rgba(255, 255, 255, 0.1); color: #fff; }
.app__nav-item.active svg { opacity: 1; }

.app__main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--app-bg); }

.app__topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  flex-wrap: wrap;
}

.app__breadcrumb { font-size: 0.72rem; color: var(--app-muted); }
.app__breadcrumb strong { color: var(--app-text); font-weight: 600; }

.app__search {
  flex: 1;
  min-width: 120px;
  max-width: 240px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.65rem;
  background: #f8fafc;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  color: var(--app-muted);
  font-size: 0.72rem;
}

.app__search svg { width: 14px; height: 14px; flex-shrink: 0; }

.app__search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 0.72rem;
  font-family: inherit;
  color: var(--app-text);
  outline: none;
}

.app__search-input::placeholder { color: var(--app-muted); }

.crm-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}

.crm-toolbar__btn {
  padding: 0.3rem 0.55rem;
  font-size: 0.65rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--app-border);
  border-radius: 5px;
  background: var(--app-surface);
  color: var(--app-muted);
  cursor: pointer;
}

.crm-toolbar__btn.active {
  background: var(--app-primary);
  border-color: var(--app-primary);
  color: #fff;
}

.crm-list { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 8px; overflow: auto; max-height: 400px; }

.flow-inventory {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.flow-stock {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 0.75rem;
}

.flow-stock__sku { font-size: 0.65rem; color: var(--app-muted); margin-bottom: 0.2rem; }
.flow-stock__name { font-size: 0.78rem; font-weight: 600; margin-bottom: 0.45rem; }
.flow-stock__bar { height: 6px; background: #e2e8f0; border-radius: 99px; overflow: hidden; margin-bottom: 0.35rem; }
.flow-stock__bar span { display: block; height: 100%; border-radius: 99px; }
.flow-stock__bar span.ok { background: #22c55e; }
.flow-stock__bar span.low { background: #f59e0b; }
.flow-stock__bar span.critical { background: #ef4444; }
.flow-stock__qty { font-size: 0.68rem; color: var(--app-muted); }

.app-reports {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

.app-report-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.app-report-card:hover { border-color: var(--app-primary); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1); }
.app-report-card h4 { font-size: 0.78rem; font-weight: 600; margin-bottom: 0.25rem; }
.app-report-card p { font-size: 0.68rem; color: var(--app-muted); margin: 0; }
.app-report-card__meta { margin-top: 0.5rem; font-size: 0.62rem; font-weight: 600; color: var(--app-primary); }

.pulse-overview { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.65rem; margin-bottom: 0.75rem; }
.pulse-overview__block h5 { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--app-muted); margin-bottom: 0.45rem; }

.app__topbar-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }

.app__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 6px;
  border: 1px solid var(--app-border);
  background: var(--app-surface);
  color: var(--app-text);
  cursor: pointer;
}

.app__btn--primary { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
.app__btn--primary:hover { background: var(--app-primary-hover); }

.app__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app__content { flex: 1; padding: 0.85rem 1rem; overflow: auto; }

.crm-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0.65rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.crm-col { background: #e8edf3; border-radius: 8px; max-height: 400px; display: flex; flex-direction: column; }
.crm-col__head {
  display: flex;
  justify-content: space-between;
  padding: 0.55rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--app-muted);
}

.crm-col__sum { font-size: 0.62rem; font-weight: 600; background: rgba(255,255,255,0.75); padding: 0.1rem 0.35rem; border-radius: 4px; }
.crm-col__body { flex: 1; overflow-y: auto; padding: 0 0.45rem 0.45rem; display: flex; flex-direction: column; gap: 0.45rem; }

.crm-deal {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 0.6rem 0.65rem;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition: box-shadow 0.15s, transform 0.15s;
}

.crm-deal:hover { box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1); transform: translateY(-1px); }
.crm-deal__top { display: flex; gap: 0.45rem; margin-bottom: 0.45rem; }

.crm-deal__logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.crm-deal__title { font-size: 0.75rem; font-weight: 600; line-height: 1.3; }
.crm-deal__contact { font-size: 0.65rem; color: var(--app-muted); }
.crm-deal__amount { font-size: 0.8rem; font-weight: 700; color: var(--app-primary); margin-bottom: 0.4rem; }
.crm-deal__prob { height: 4px; background: #e2e8f0; border-radius: 99px; overflow: hidden; margin-bottom: 0.45rem; }
.crm-deal__prob span { display: block; height: 100%; background: linear-gradient(90deg, #3b82f6, #2563eb); border-radius: 99px; }
.crm-deal__foot { display: flex; justify-content: space-between; align-items: center; }
.crm-deal__tag { font-size: 0.58rem; font-weight: 600; padding: 0.15rem 0.4rem; border-radius: 4px; background: #eff6ff; color: #1d4ed8; }
.crm-deal__owner { width: 22px; height: 22px; border-radius: 50%; background: #64748b; color: #fff; font-size: 0.55rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.crm-deal--exit { animation: deal-exit 0.35s ease forwards; }
@keyframes deal-exit { to { opacity: 0; transform: scale(0.92); } }

.flow-layout { display: grid; grid-template-columns: 1fr 290px; gap: 0.75rem; height: 100%; }
.app__table-wrap { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 8px; overflow: auto; max-height: 380px; }
.app__table { width: 100%; border-collapse: collapse; font-size: 0.72rem; }
.app__table th { text-align: left; padding: 0.55rem 0.75rem; background: #f8fafc; border-bottom: 1px solid var(--app-border); font-weight: 600; color: var(--app-muted); font-size: 0.65rem; text-transform: uppercase; position: sticky; top: 0; }
.app__table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid #f1f5f9; }
.app__table tbody tr { cursor: pointer; transition: background 0.12s; }
.app__table tbody tr:hover { background: #f8fafc; }
.app__table tr.selected { background: #eff6ff; }
.app__table tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--app-primary); }

.app__badge { display: inline-block; font-size: 0.62rem; font-weight: 600; padding: 0.2rem 0.45rem; border-radius: 99px; }
.app__badge--pending { background: #fef3c7; color: #b45309; }
.app__badge--progress { background: #dbeafe; color: #1d4ed8; }
.app__badge--done { background: #d1fae5; color: #047857; }

.flow-detail { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 8px; display: flex; flex-direction: column; }
.flow-detail__head { padding: 0.75rem; border-bottom: 1px solid var(--app-border); }
.flow-detail__head h4 { font-size: 0.85rem; font-weight: 700; margin-bottom: 0.2rem; }
.flow-detail__head p { font-size: 0.68rem; color: var(--app-muted); margin: 0; }
.flow-detail__body { flex: 1; padding: 0.75rem; overflow-y: auto; }
.flow-timeline__item { display: flex; gap: 0.6rem; position: relative; padding-bottom: 0.85rem; }
.flow-timeline__item:not(:last-child)::before { content: ""; position: absolute; left: 9px; top: 20px; bottom: 0; width: 2px; background: #e2e8f0; }
.flow-timeline__item.done:not(:last-child)::before { background: #93c5fd; }
.flow-timeline__dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #e2e8f0; background: #fff; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 0.55rem; z-index: 1; }
.flow-timeline__item.done .flow-timeline__dot { border-color: var(--app-primary); background: var(--app-primary); color: #fff; }
.flow-timeline__item.active .flow-timeline__dot { border-color: var(--app-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2); }
.flow-timeline__text strong { display: block; font-size: 0.72rem; font-weight: 600; }
.flow-timeline__text span { font-size: 0.65rem; color: var(--app-muted); }
.flow-detail__actions { padding: 0.65rem 0.75rem; border-top: 1px solid var(--app-border); }

.pulse-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.65rem; margin-bottom: 0.75rem; }
.pulse-kpi { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 8px; padding: 0.7rem 0.85rem; }
.pulse-kpi__label { font-size: 0.65rem; color: var(--app-muted); margin-bottom: 0.25rem; }
.pulse-kpi__row { display: flex; justify-content: space-between; align-items: baseline; }
.pulse-kpi__value { font-size: 1.05rem; font-weight: 700; }
.pulse-kpi__delta { font-size: 0.65rem; font-weight: 600; }
.pulse-kpi__delta.up { color: var(--app-success); }
.pulse-kpi__delta.down { color: #dc2626; }
.pulse-kpi__spark { margin-top: 0.35rem; height: 22px; }
.pulse-kpi__spark svg { width: 100%; height: 100%; }

.pulse-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 0.75rem; }
.pulse-chart-card, .pulse-table-card { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 8px; padding: 0.75rem; }
.pulse-chart-card h4, .pulse-table-card h4 { font-size: 0.75rem; font-weight: 600; margin-bottom: 0.55rem; }
.pulse-chart-card svg { width: 100%; height: 130px; }
.pulse-segment { display: inline-flex; background: #f1f5f9; border-radius: 6px; padding: 2px; margin-bottom: 0.55rem; }
.pulse-segment button { padding: 0.3rem 0.65rem; font-size: 0.68rem; font-weight: 600; font-family: inherit; border: none; background: transparent; color: var(--app-muted); border-radius: 4px; cursor: pointer; }
.pulse-segment button.active { background: #fff; color: var(--app-text); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

@media (max-width: 900px) {
  .saas-showcase { grid-template-columns: 1fr; }
  .saas-catalog { flex-direction: row; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; max-width: 100%; }
  .saas-catalog::-webkit-scrollbar { display: none; }
  .saas-catalog__item { min-width: 155px; padding: 0.65rem 0.75rem; }
  .saas-catalog__mark { width: 34px; height: 34px; }
  .flow-layout { grid-template-columns: 1fr; }
  .pulse-grid { grid-template-columns: 1fr; }

  .saas-window {
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  }

  .saas-window__chrome {
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
  }

  .saas-window__dots { display: none; }
  .saas-window__env { display: none; }
  .saas-window__url { font-size: 0.62rem; padding: 0.3rem 0.5rem; }

  .saas-window__viewport {
    min-height: 0;
    overflow: hidden;
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .saas-showcase__footer { flex-direction: column; align-items: stretch; text-align: center; }

  /* App: sidebar estrecho (gris) + contenido ancho (blanco) */
  .app {
    flex-direction: row;
    height: 480px;
    min-height: 480px;
    font-size: 11px;
  }

  .app__sidebar {
    width: 58px;
    min-width: 58px;
    max-width: 58px;
    flex-shrink: 0;
    padding: 0.35rem 0;
  }

  .app__brand {
    padding: 0.35rem 0.2rem 0.45rem;
    justify-content: center;
    flex-direction: column;
    gap: 0;
    margin-bottom: 0.3rem;
    border-bottom: 1px solid #334155;
  }

  .app__brand-mark {
    width: 30px;
    height: 30px;
    font-size: 0.55rem;
  }

  .app__brand-name { display: none; }

  .app__nav {
    flex-direction: column;
    padding: 0 0.2rem;
    gap: 0.2rem;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .app__nav-item {
    justify-content: center;
    align-items: center;
    padding: 0.42rem 0.15rem;
    font-size: 0;
    border-radius: 8px;
  }

  .app__nav-item svg {
    width: 18px;
    height: 18px;
    opacity: 1;
  }

  .app__main {
    flex: 1;
    min-width: 0;
    width: auto;
  }

  .app__topbar {
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.5rem 0.55rem;
  }

  .app__breadcrumb {
    width: 100%;
    font-size: 0.62rem;
  }

  .app__search {
    flex: 1 1 100%;
    min-width: 0;
    max-width: none;
    font-size: 0.65rem;
    padding: 0.38rem 0.5rem;
  }

  .app__topbar-actions {
    width: 100%;
    margin-left: 0;
    gap: 0.35rem;
  }

  .app__btn {
    padding: 0.4rem 0.55rem;
    font-size: 0.65rem;
    flex: 1;
  }

  .app__avatar { display: none; }

  .app__content {
    padding: 0.5rem 0.55rem;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .crm-board {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    gap: 0.45rem;
    padding-bottom: 0.25rem;
    max-width: 100%;
  }

  .crm-col {
    flex: 0 0 82%;
    max-width: none;
    max-height: none;
    min-height: 240px;
    scroll-snap-align: start;
  }

  .crm-toolbar__btn { font-size: 0.62rem; padding: 0.38rem 0.45rem; }
  .flow-layout { gap: 0.45rem; }
  .app__table-wrap { max-height: 200px; }
  .flow-inventory { grid-template-columns: 1fr; }
  .pulse-kpis { grid-template-columns: repeat(2, 1fr); gap: 0.45rem; }
  .pulse-overview { grid-template-columns: 1fr; }
  .app-reports { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .app { min-height: 450px; height: 450px; }
  .app__sidebar { width: 52px; min-width: 52px; max-width: 52px; }
  .app__btn--primary { font-size: 0.6rem; padding: 0.35rem 0.45rem; }
  .crm-col { flex: 0 0 88%; }
  .pulse-kpis { grid-template-columns: 1fr; }
}

/* Fallback JS: mismo layout compacto en móvil */
.saas-showcase--mobile .app { flex-direction: row; height: 480px; min-height: 480px; }
.saas-showcase--mobile .app__sidebar { width: 58px; min-width: 58px; max-width: 58px; }
.saas-showcase--mobile .app__brand-name { display: none; }
.saas-showcase--mobile .app__nav { flex-direction: column; }
.saas-showcase--mobile .app__nav-item { font-size: 0; justify-content: center; }
.saas-showcase--mobile .app__main { flex: 1; min-width: 0; }
.saas-showcase--mobile .crm-board { display: flex; overflow-x: auto; }
.saas-showcase--mobile .crm-col { flex: 0 0 82%; }
.saas-showcase--mobile .saas-window,
.saas-showcase--mobile .saas-window__viewport { overflow: hidden; max-width: 100%; }
