/* Mobile layout: touch controls, clear hierarchy and compact cards. */
@media (max-width: 900px) {
 .app-shell > .topbar { position: sticky; top: 0; z-index: 40; background: #0a213e; color: #fff; border: 0; border-radius: 0 0 18px 18px; }
 .app-shell .topbar-main { display: grid; grid-template-columns: minmax(0,1fr) auto; width: 100%; gap: 12px; padding: 14px 16px; }
 .mobile-brand .brand { color: white; }
 .mobile-brand .brand-copy { display: block !important; }
 .mobile-brand .brand strong { font-size: .88rem; }
 .mobile-brand .brand-mark { width: 34px; height: 34px; }
 .app-shell .current-page { display: block; grid-column: 1 / -1; grid-row: 2; font-size: 1.03rem; line-height: 1.35; }
 .app-shell .topbar-actions { grid-column: 2; grid-row: 1; }
 .app-shell .company-picker select { width: min(33vw,145px); min-height: 40px; background: #17385b; border-color: #315171; color: #fff; font-size: .75rem; }
 .mobile-logout { display: none; }
 .app-shell > .main-content { width: 100%; min-width: 0; margin: 0; padding: 16px 12px calc(92px + env(safe-area-inset-bottom)); }
 .mobile-section-tabs .desktop-section-tabs { position: static; gap: 7px; padding: 0 0 12px; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; scrollbar-width: none; }
 .mobile-section-tabs .desktop-section-tabs a { min-height: 42px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: .75rem; }
 .mobile-section-tabs .desktop-section-tabs a.active { color: #fff; background: #0877ef; border-color: #0877ef; }
 .mobile-nav { min-height: 72px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; box-shadow: 0 -4px 20px #0a213e0d; }
 .mobile-nav-group { min-width: 0; min-height: 54px; gap: 5px; font-size: .63rem; font-weight: 650; border-radius: 11px; }
 .mobile-nav-group svg { width: 22px; height: 22px; }
 .mobile-nav-group span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 760px) {
 .list-surface { border-radius: 14px; box-shadow: none; }
 .list-surface .list-toolbar { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; }
 .list-surface .list-toolbar .search-box { flex: none; width: 100%; max-width: none; min-width: 0; height: 46px; }
 .list-toolbar .search-box input { font-size: 16px; }
 .list-toolbar .list-toolbar-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; gap: 8px; }
 .list-toolbar-actions .btn { width: 100%; min-height: 44px; padding: 8px; font-size: .77rem; border-radius: 10px; }
 .list-toolbar-actions .btn svg { width: 18px; height: 18px; }
 .list-toolbar-actions .btn-list-primary { grid-column: 1 / -1; grid-row: 1; background: #0877ef; box-shadow: none; }
 .data-panel-embedded .mobile-card-list { padding: 10px; gap: 10px; }
 .record-card { border-radius: 12px; box-shadow: none; }
 .record-card-summary { min-height: 96px; padding: 14px 52px 14px 12px; }
 .record-card-summary-fields { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
 .record-card-summary-field:first-child { grid-column: 1 / -1; }
 .record-card-summary-field dt, .record-card-details dt { font-size: .65rem; letter-spacing: .02em; }
 .record-card-summary-field dd { font-size: .88rem; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
 .record-card-select { top: 10px; right: 8px; width: 40px; height: 40px; }
 .record-card-select input { width: 19px; height: 19px; accent-color: #0877ef; }
 .record-card-chevron { top: auto; bottom: 10px; right: 14px; }
 .record-card-details dd { font-size: .87rem; font-weight: 500; }
 .record-card-details .row-action { width: 44px; height: 44px; }
 .modal-backdrop { padding: 0; align-items: end; }
 .modal-backdrop .modal { width: 100%; max-height: 94dvh; border-radius: 20px 20px 0 0; }
 .modal > header { padding: 14px 16px; }
 .modal > header h2 { font-size: 1rem; }
 .modal > header .icon-btn { width: 44px; height: 44px; }
 .modal .modal-body { padding: 14px 12px; overscroll-behavior: contain; }
 .modal > footer { padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
 .modal > footer .btn { min-height: 46px; flex: 1; }
 .modal-body .form-grid, .modal-body .document-main-grid, .modal-body .document-secondary-grid, .signature-picker-grid { grid-template-columns: minmax(0,1fr); gap: 10px; }
 .modal-body .span-2 { grid-column: 1; }
 .modal-body .field input, .modal-body .field select, .modal-body .field textarea,
 .modal-body .document-main-grid .field input, .modal-body .document-main-grid .field select,
 .modal-body .document-secondary-grid .field input,
 .document-item-row .field input, .document-item-row .field select { min-height: 44px; padding: 10px; font-size: 16px; }
 .modal-body .field > span, .modal-body .document-main-grid .field > span, .modal-body .document-secondary-grid .field > span, .document-item-row .field > span { font-size: .7rem; white-space: normal; letter-spacing: .025em; }
 .document-items { padding: 10px; }
 .document-items .repeat-heading { align-items: center; gap: 8px; }
 .document-items .repeat-heading .btn { min-height: 44px; font-size: .75rem; }
 .document-item-row { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; position: relative; padding: 14px 0; }
 .document-item-row .item-product { grid-column: 1 / -1; padding-right: 48px; }
 .document-item-row .remove-item { position: absolute; right: 0; top: 30px; width: 44px; height: 44px; }
 .document-item-row .field { min-width: 0; }
 .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
 .metric-card { min-width: 0; padding: 14px 12px; flex-direction: column; align-items: flex-start; gap: 10px; }
 .metric-card strong { font-size: 1.6rem; }
 .metric-card span { font-size: .73rem; }
 .metric-card small { font-size: .65rem; }
 .quick-grid { grid-template-columns: minmax(0,1fr); gap: 10px; }
 .quick-card { min-height: 76px; padding: 16px; }
 .quick-card strong { font-size: .88rem; }
 .quick-card small { font-size: .75rem; }
 .mobile-menu-groups { display: grid; gap: 12px; }
 .mobile-menu-groups nav { display: grid; gap: 7px; }
 .mobile-menu-groups a { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: .85rem; }
 .login-panel { padding: 16px; }
 .login-card { padding: 26px 20px; border-radius: 18px; }
 .login-card input { font-size: 16px; }
}

/* Approved compact mobile layout. */
@media(max-width:900px) {
 .app-shell .topbar-main { gap: 9px; padding: 12px; }
 .app-shell .current-page { font-size: .95rem; }
 .app-shell > .main-content { padding-top: 12px; }
 .mobile-nav-group span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
 .mobile-nav { min-height: 64px; }
 .mobile-nav-group { min-height: 46px; }
 .mobile-nav-group svg { width: 24px; height: 24px; }
}
@media(max-width:760px) {
 .list-surface .list-toolbar { display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 8px; padding: 10px; }
 .list-toolbar .list-toolbar-actions { display: contents; }
 .list-toolbar .search-box { grid-column: 1; grid-row: 1; }
 .list-toolbar-actions .btn { width: 44px; height: 44px; min-height: 44px; padding: 0; }
 .list-toolbar-actions .btn-list-primary { grid-column: 2; grid-row: 1; border-radius: 10px; }
 .list-toolbar-actions .btn-pill { grid-row: 2; }
 .list-toolbar-actions [data-action="print-list"] { display: none; }
 .list-toolbar-actions .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
 .list-toolbar-actions .btn svg { width: 20px; height: 20px; }
 .list-toolbar-actions .btn-pill { grid-column: 1 / -1; justify-self: start; }
 .list-toolbar-actions [data-action="open-list-sort"] { margin-left: 52px; }
 .list-toolbar-actions [data-action="export-list"] { margin-left: 104px; }
 .list-toolbar-actions [data-action="open-list-filters"] { margin-left: 0; }
 .record-card-summary { min-height: 74px; padding: 12px 32px 12px 12px; }
 .record-card-summary-fields { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
 .record-card-summary-field:first-child { grid-column: auto; }
 .record-card-summary-field dt { font-size: .6rem; }
 .record-card-summary-field dd { font-size: .8rem; }
 .record-card-chevron { top: 12px; bottom: auto; right: 7px; }
 .compact-material-summary { width: 100%; min-width: 0; }
 .compact-material-summary > strong { display: block; font-size: .86rem; line-height: 1.4; overflow-wrap: anywhere; }
 .compact-material-summary > div { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
 .compact-material-summary span { color: var(--text-muted); font-size: .75rem; }
 .compact-material-summary b { color: #0877ef; font-size: .85rem; }
 .record-card-details footer { margin-top: 10px; padding-top: 8px; }
 .data-panel-embedded .mobile-card-list { gap: 8px; padding: 8px; }
}
