/* ---------------------------------------------------------------
   Responsive — desktop dashboard collapses to a card-based mobile flow
   Breakpoints: 1200 (dense desktop), 960 (tablet), 720 (mobile)
   --------------------------------------------------------------- */

.only-mobile { display: none; }

@media (max-width: 1200px) {
  .page { padding: var(--s-6); }
  .topbar { padding: 0 var(--s-6); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  :root { --sidebar-w: 76px; }

  .sidebar__brand-name,
  .sidebar__brand-text,
  .navlink span,
  .navlink__count,
  .studio-chip__text,
  .sidebar__section-label {
    display: none;
  }

  .sidebar__brand { justify-content: center; padding: var(--s-5) 0 var(--s-4); }
  .navlink { justify-content: center; padding: 10px; }
  .studio-chip { justify-content: center; }

  .drawer__body--split { grid-template-columns: minmax(0, 1fr); }
  .quote-panel { position: static; }

  .grid--form,
  .grid--pick { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  :root {
    --topbar-h: 62px;
  }

  /* `revert` restores each element's own default (block for div, inline for span);
     `initial` would force everything to inline and break block containers. */
  .only-mobile { display: revert; }
  .no-mobile { display: none !important; }

  /* Sidebar out, bottom nav in */
  .sidebar { display: none; }
  .bottomnav { display: flex; }

  .layout__main { padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px)); }

  .topbar {
    padding: 0 var(--s-4);
    gap: var(--s-2);
  }

  .page { padding: var(--s-4); }

  /* Type scales down a notch, stays readable */
  h1, .page__title { font-size: var(--fs-2xl); }
  .hero__title { font-size: 30px; }
  .hero { padding: var(--s-5); border-radius: var(--r-xl); }

  .kpi__value { font-size: var(--fs-2xl); }

  /* Everything single column */
  .grid--2,
  .grid--3,
  .grid--aside,
  .grid--form,
  .grid--half,
  .grid--pick,
  .grid--auto-260,
  .grid--auto-300,
  .grid--auto-340 {
    grid-template-columns: minmax(0, 1fr);
  }

  .grid--auto-220 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Nothing interactive drops below a comfortable tap target on a phone. */
  .btn--sm,
  .role-switch__btn,
  .link-btn {
    min-height: 44px;
  }

  /* Drawer becomes a fullscreen step flow */
  .drawer,
  .drawer--narrow {
    width: 100vw;
    top: 0;
    border-radius: 0;
  }

  .drawer__head { padding: var(--s-4); }
  .drawer__body { padding: var(--s-4); }
  .drawer__foot {
    padding: var(--s-4);
    padding-bottom: calc(var(--s-4) + env(safe-area-inset-bottom, 0px));
    flex-direction: column-reverse;
  }
  .drawer__foot .btn { width: 100%; }

  .modal {
    width: 100vw;
    max-height: 92vh;
    top: auto;
    bottom: 0;
    left: 0;
    transform: none;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    animation: sheetIn var(--dur) var(--ease-out) forwards;
  }

  @keyframes sheetIn {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .modal__foot { flex-direction: column-reverse; padding-bottom: calc(var(--s-6) + env(safe-area-inset-bottom, 0px)); }
  .modal__foot .btn { width: 100%; }

  /* Kanban scrolls horizontally, narrower columns */
  .kanban__col { flex-basis: 82vw; }

  /* Tables scroll rather than squash */
  .table { min-width: 620px; }

  /* Section heads wrap */
  .section__head { flex-direction: column; align-items: flex-start; gap: var(--s-3); }

  .page__head .row--between { flex-direction: column; align-items: flex-start; gap: var(--s-4); }

  /* Full-width primary actions read better on phones */
  .actions-stack { flex-direction: column; align-items: stretch; }
  .actions-stack .btn { width: 100%; }

  .toast-host { bottom: calc(var(--bottomnav-h) + var(--s-4)); }

  .quote-panel { position: static; }

  .track__step { min-width: 92px; }
}

@media (max-width: 400px) {
  .grid--auto-220 { grid-template-columns: minmax(0, 1fr); }
  .role-switch__btn span { display: none; }
}

/* Mobile step-flow shell — one question per screen */
.stepflow {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
  min-height: 100%;
}

.stepflow__progress {
  display: flex;
  gap: 6px;
}

.stepflow__pip {
  height: 5px;
  flex: 1 1 0;
  border-radius: var(--r-full);
  background: var(--bg-sunken);
}
.stepflow__pip--done { background: var(--violet-300); }
.stepflow__pip--current { background: var(--primary); }

.stepflow__question {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  color: var(--text-strong);
  letter-spacing: -0.02em;
  line-height: var(--lh-tight);
}

.stepflow__helper {
  color: var(--text-muted);
  font-size: var(--fs-md);
  margin-top: var(--s-2);
}

@media print {
  .sidebar,
  .topbar,
  .bottomnav,
  .drawer,
  .overlay { display: none !important; }
  .page { padding: 0; }
}
