/* Last-in-cascade responsive polish for ALL four app appearances.
   Desktop invoice sheets and print exports intentionally retain their layout. */
.mobile-sidebar-tools { display:none; }
@media (max-width: 800px) {
  html,body { max-width:100%; }
  body:has(.sidebar.open) { overflow:hidden; }
  .shell,html[data-ui-theme="vibrant"] .shell { display:block; min-width:0; width:100%; }
  .main-wrap,.page,#pageContent { min-width:0; max-width:100%; }
  .sidebar,html[data-ui-theme="vibrant"] .sidebar {
    width:min(310px,86vw); left:calc(-1 * min(310px,86vw) - 24px);
    position:fixed; top:0; bottom:0; height:100dvh;
    overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain;
    padding-bottom:max(22px,env(safe-area-inset-bottom)); z-index:110;
  }
  .sidebar.open,html[data-ui-theme="vibrant"] .sidebar.open { left:0; }
  .mobile-shade.active { z-index:109; }
  .mobile-sidebar-tools { display:grid; gap:9px; margin:19px 9px 14px; padding:15px; border:1px solid #416268; border-radius:14px; color:#d5ebea; }
  .mobile-sidebar-tools label { font-size:11px; font-weight:800; }
  .mobile-sidebar-tools select,.mobile-sidebar-tools button { width:100%; border:1px solid #607b7b; border-radius:10px; padding:11px 12px; min-height:44px; text-align:left; background:#fff; color:#193d37; font:inherit; font-size:13px; font-weight:700; }
  .mobile-sidebar-tools button { background:#214d48; border-color:#517c75; color:#fff; }
  .topbar,html[data-ui-theme="vibrant"] .topbar {
    height:auto; min-height:105px; padding:10px 15px 11px;
    display:grid; grid-template-columns:40px minmax(0,1fr); gap:9px 10px;
    align-items:center; top:0;
  }
  .topbar>.mobile-menu { grid-column:1; grid-row:1; display:grid!important; width:40px;height:40px; }
  .topbar>.desktop-sidebar-toggle { display:none!important; }
  .topbar>.crumb { grid-column:2;grid-row:1; min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
  .topbar>.crumb>strong { min-width:0; overflow:hidden; text-overflow:ellipsis; }
  .topbar>.top-actions { grid-column:1/-1;grid-row:2; min-width:0; width:100%; display:flex; flex-wrap:nowrap; gap:8px; justify-content:space-between; }
  .top-actions .tour-launch,.top-actions .theme-quick-control,.top-actions .local-badge { display:none!important; }
  .top-actions .business-switch-trigger { min-width:0; max-width:none; flex:1 1 auto; justify-content:space-between; min-height:42px; }
  .top-actions .business-switch-trigger span:first-child { min-width:0; max-width:none; }
  .top-actions .search-trigger { flex:0 0 42px; width:42px; min-width:42px; padding:0; height:42px; justify-content:center; }
  .top-actions .search-trigger span:not(:first-child),.top-actions .search-trigger kbd { display:none!important; }
  .top-actions .top-add { flex:0 0 auto; height:42px; padding:0 12px; font-size:12px; gap:5px; }
  .top-actions .auth-signout { flex:0 0 auto; white-space:nowrap; min-height:42px; padding:6px; font-size:11px; }
  .page,html[data-ui-theme="vibrant"] .page { width:100%; max-width:100%; overflow-x:clip; }
  .page :is(.panel,.business-panel,.premium-page,.studio-workspace,.studio-editor,.studio-preview-panel,.studio-templates,.gst-panel,.owner-intelligence,.owner-intelligence-grid) { min-width:0; }
  .table-wrap,.business-stock-table,.gst-table-wrap,.studio-paper-wrap { max-width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .modal-layer { padding:max(12px,env(safe-area-inset-top)) 10px max(12px,env(safe-area-inset-bottom)); }
  .modal { max-width:100%; max-height:calc(100dvh - 24px); }
  .modal-body { overscroll-behavior:contain; }
  .toast { left:12px; right:12px; top:auto; bottom:calc(12px + env(safe-area-inset-bottom)); max-width:none; }
}
@media (max-width: 600px) {
  .topbar,html[data-ui-theme="vibrant"] .topbar { padding:8px 12px 10px; gap:7px; }
  .topbar>.crumb { font-size:12px; }
  .top-actions .top-add { font-size:11px; padding:0 10px; }
  .top-actions .top-add svg { width:16px;height:16px; }
  .top-actions .business-switch-trigger { padding:8px 9px; font-size:11px; }
  .top-actions .auth-signout { font-size:10px; }
  .page,html[data-ui-theme="vibrant"] .page { padding:17px 12px 30px; }
  .premium-page-title,.owner-intelligence-head,.business-panel-head { flex-wrap:wrap; }
  .bold-deck,.bold-hero-row,.bold-lower-row { min-width:0; }
  .bold-mini-chart { display:none; }
  .bold-sales-copy { width:100%; }
  .studio-hero,.voice-copilot,.studio-guided-edit-only { min-width:0; }
  .studio-paper-wrap #studioPaper { min-width:0; width:100%; }
  .studio-guided-nav { max-width:100%; }
  .studio-guided-nav button { min-width:0; }
  .modal-head,.modal-footer { gap:10px; }
  .modal-footer { flex-wrap:wrap; }
  .modal-footer .end-buttons { width:100%; margin:0; flex-wrap:wrap; }
  .modal-footer .end-buttons>.btn { flex:1; }
  .auth-scene { grid-template-columns:minmax(0,1fr); }
  .auth-showcase { min-height:0; padding:18px 18px 19px; gap:15px; }
  .auth-showcase h1 { font-size:clamp(22px,7vw,31px); line-height:1.16; margin:7px 0; }
  .auth-showcase>.auth-brand { font-size:20px; }
  .auth-brand svg { width:29px;height:29px; }
  .auth-showcase .auth-mark { font-size:9px; }
  .auth-points { padding-top:10px; gap:6px; }
  .auth-points span { font-size:9px; padding:5px 7px; }
  .auth-showcase>small { display:none; }
  .auth-panel { padding:13px 12px 35px; place-items:start center; }
  .auth-card { padding:22px 17px; width:100%; border-radius:16px; }
  .auth-card h2 { font-size:26px; }
  .auth-field input,.auth-field select,.auth-field textarea { font-size:16px; min-height:48px; }
  .auth-inline { flex-wrap:wrap; }
  .auth-business-list { max-height:none; }
  .auth-business-choice { min-width:0; }
  .auth-business-choice>span:nth-child(2) { min-width:0; }
  .auth-business-choice strong,.auth-business-choice small { overflow-wrap:anywhere; }
  input,select,textarea { max-width:100%; }
  input[type="text"],input[type="tel"],input[type="email"],input[type="password"],input[type="number"],input[type="date"],select,textarea { font-size:16px; }
}
@media (max-width: 390px) {
  .topbar>.top-actions { gap:5px; }
  .top-actions .business-switch-trigger { padding:7px; }
  .top-actions .search-trigger { flex-basis:38px; width:38px; min-width:38px; height:40px; }
  .top-actions .top-add { padding:0 8px; height:40px; }
  .top-actions .auth-signout { padding:3px; }
  .auth-card { padding:18px 13px; }
  .auth-stepper { flex-wrap:wrap; }
}
@media print { .mobile-sidebar-tools { display:none!important; } }
