/* Shared phone layout rules for accounts, books and the preserved workspace.
   Keep native controls at iOS's readable size without restricting user zoom. */
.practice-toolbar .practice-tools-toggle { display: none; }
.practice-toolbar-actions { display: contents; }

@media screen and (max-width: 1024px) {
  html input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),
  html select, html textarea {
    font-size: max(16px, 1rem) !important;
    min-width: 0;
    max-width: 100%;
  }
  html .practice-shell, html .practice-shell iframe { min-width: 0; max-width: 100%; }
  /* The shortcut and toolbar share one viewport with checkout, not extra height. */
  body:has(#app .practice-shell) { height: 100dvh; display: flex; flex-direction: column; }
  body:has(#app .practice-shell) > .cp-books-shortcut { flex-shrink: 0; }
  #app:has(.practice-shell) { flex: 1; min-width: 0; min-height: 0; }
  html .practice-shell { height: 100%; min-height: 0; }
  html .practice-toolbar { position: relative; gap: 8px; padding: 8px 12px; }
  html .practice-toolbar > strong { flex: 1; min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
  html .practice-toolbar > span { display: none; }
  html .practice-toolbar .practice-tools-toggle { display: inline-flex; min-height: 44px; align-items: center; }
  html .practice-toolbar-actions {
    display: none;
    position: absolute;
    inset: 100% 0 auto;
    z-index: 50;
    gap: 10px;
    padding: 16px;
    background: #102e3b;
    border-top: 1px solid #41616b;
    box-shadow: 0 10px 20px #102e3b33;
    max-height: 60dvh;
    overflow-y: auto;
  }
  html .practice-shell.tools-open .practice-toolbar-actions { display: flex; flex-wrap: wrap; }
  html .practice-toolbar-actions .idle-controls { flex-basis: 100%; }
}

@media screen and (max-width: 767px) {
  html #app > header { height: auto; min-height: 80px; gap: 12px; flex-wrap: wrap; }
  html #app > header .header-label { overflow-wrap: anywhere; }
  html .content, html .panel, html .team-grid > *, html .fields > *, html .form-grid > *,
  html .checkout-grid > *, html .dashboard-middle > *, html .shift-grid > * { min-width: 0; }
  html .heading-actions, html .staff-heading-actions { flex-wrap: wrap; max-width: 100%; }
  html .heading-actions > *, html .staff-heading-actions > * { max-width: 100%; }
  html .page-heading > div, html .task > div, html .member-row > div { min-width: 0; }
  html .page-heading h1, html .page-heading h2, html .task strong, html .member-row strong { overflow-wrap: anywhere; }
  html .checkout-grid, html .dashboard-middle, html .shift-grid, html .team-grid, html .two-col {
    grid-template-columns: minmax(0, 1fr);
  }
  html .topbar { height: auto; min-height: 67px; padding-block: 12px; }
  html .store-title { flex: 1; }
  html .store-title strong { min-width: 0; overflow-wrap: anywhere; }
  html .store-title .mobile-brand-icon { flex-shrink: 0; }
  html .stat > strong { white-space: normal; overflow-wrap: anywhere; }
  html .product-card-bottom { flex-wrap: wrap; gap: 10px; }
  html .product-card-bottom > div { min-width: 0; overflow-wrap: anywhere; }
  html .table-wrap { max-width: 100%; min-width: 0; overflow-x: auto; }
  html [data-slot=dialog-content], html [data-slot=alert-dialog-content] {
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    max-height: calc(100dvh - 24px);
    min-width: 0;
  }
  html .pack-picker-option { flex-wrap: wrap; }
  html .pack-picker-summary, html .pack-picker-actions { flex-wrap: wrap; }
  html .pack-picker-summary > div { min-width: 0; overflow-wrap: anywhere; }
  html .cashier-practice { padding: 20px 16px; min-width: 0; max-width: 100%; }
  html .payment-dialog { padding: 20px 16px; gap: 14px; overscroll-behavior-y: contain; }
  html .payment-dialog > .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html .payment-dialog .form-grid > * { min-width: 0; overflow-wrap: anywhere; }
  html .payment-due { flex-wrap: wrap; gap: 8px; padding: 12px; }
  html .payment-due > strong { min-width: 0; overflow-wrap: anywhere; }
  html .payment-dialog .field-label { min-width: 0; max-width: 100%; }
  html .payment-dialog [data-slot=select-trigger] { min-width: 0; max-width: 100%; }
  html .payment-dialog [data-slot=select-value] { min-width: 0; overflow-wrap: anywhere; white-space: normal; }
  html .payment-dialog .dialog-actions { flex-wrap: wrap; }
  html .payment-dialog .dialog-actions > button { flex: 1 1 100%; white-space: normal; min-height: 44px; }
  html .payment-dialog .small-note:empty { display: none; }
}

@media screen and (max-width: 600px) {
  html .form-grid { grid-template-columns: minmax(0, 1fr); }
  html .form-grid .span-2 { grid-column: 1 / -1; }
}

@media screen and (max-width: 480px) {
  html .stats-grid, html .stats { grid-template-columns: minmax(0, 1fr); }
  html .stats-grid.three .stat { grid-template-columns: minmax(0, 1fr); }
  html .stats-grid.three .stat > strong { grid-area: auto; margin-top: 12px; }
  html .product-grid { grid-template-columns: minmax(0, 1fr); }
  html .payment-methods, html .account-dialog .payment-methods {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  html .brand-arrival.signature-approved { max-width: 100%; }
  html .idle-controls, html .idle-controls label { max-width: 100%; flex-wrap: wrap; }
}
