/* Phone-first overrides for the dashboard and its shared screens. */
@media (max-width: 760px) {
  body { font-size: 13px; overflow-x: hidden; }
  .app-shell { display: block; }
  .sidebar {
    position: sticky; inset: 0 auto auto 0; z-index: 40; width: 100%; height: auto;
    min-height: 68px; padding: 9px 12px; display: grid;
    grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
    border-left: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0; font-size: 0; }
  .brand-mark { width: 34px; height: 34px; font-size: 18px; }
  .company-name, .sidebar-user { display: none; }
  .sidebar nav { display: flex; overflow-x: auto; gap: 5px; min-width: 0; }
  .nav-link { flex: 0 0 auto; padding: 8px 10px; font-size: 0; }
  .nav-link span { margin: 0; font-size: 19px; }
  main { width: 100%; margin: 0; padding: 18px 14px 35px; }
  header { margin-bottom: 20px; padding: 14px; border-radius: 13px; }
  h1 { font-size: 21px; }
  h2 { font-size: 18px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 14px; min-width: 0; }
  .stat-card strong { font-size: 20px; overflow-wrap: anywhere; }
  .section-heading { margin: 24px 0 13px; gap: 10px; align-items: flex-end; }
  .section-heading .primary { padding: 9px 11px; white-space: nowrap; }
  .site-grid { grid-template-columns: 1fr; gap: 11px; }
  .site-card { padding: 15px; }
  .site-row { grid-template-columns: 1fr; gap: 13px; padding: 15px; }
  .site-row > * { min-width: 0; }
  .site-actions { justify-content: stretch; display: grid; grid-template-columns: 1fr 1fr; }
  .site-actions button { width: 100%; justify-self: stretch; }
  .people { flex-wrap: wrap; }
  .engineers-table, .workers-table { background: transparent!important; border: 0!important; overflow: visible; }
  .table-head { display: none!important; }
  .table-row, .workers-table .table-row {
    display: grid!important; grid-template-columns: 1fr 1fr!important; gap: 9px 12px;
    padding: 14px; margin-bottom: 10px; border: 1px solid var(--line)!important;
    border-radius: 12px; background: var(--panel, #fff)!important;
  }
  .table-row > span:nth-child(1) { grid-column: 1 / -1; }
  .table-row > span:nth-child(2), .table-row > span:nth-child(3), .table-row > span:nth-child(4) { display: block!important; }
  .table-row > span:nth-child(2)::before { content: 'الموقع: '; color: var(--muted); font-size: 11px; }
  .workers-table .table-row > span:nth-child(2)::before { content: 'الهاتف: '; }
  .workers-table .table-row > span:nth-child(3)::before { content: 'الوظيفة: '; color: var(--muted); font-size: 11px; }
  .table-row .link-button, .worker-actions { grid-column: 1 / -1; justify-self: start; }
  .worker-actions { display: flex; width: 100%; justify-content: flex-start; }
  .transfer-box { padding: 15px; gap: 14px; flex-direction: column; align-items: stretch; }
  .transfer-box > div { align-items: flex-start; }
  .transfer-box .primary { width: 100%; }
  .modal-backdrop { padding: 10px; align-items: end; }
  .modal-card { width: 100%; max-height: 90vh; overflow-y: auto; border-radius: 18px 18px 12px 12px; padding: 22px 17px; }
  .modal-actions { position: sticky; bottom: -22px; padding: 13px 0 1px; background: var(--panel, #fff); }
  .modal-actions button { flex: 1; }
  .approval-fab, #owner-chat, #admin-permissions { bottom: 14px!important; left: 14px!important; }
  #owner-chat { left: 126px!important; }
  #admin-permissions { left: 14px!important; bottom: 62px!important; }
  .ops-card { padding: 15px!important; }
  .ops-row { gap: 10px!important; align-items: flex-start!important; }
  .site-manager-layout, .site-profile-grid, .manager-layout { grid-template-columns: 1fr!important; }
  .site-picker { display: flex; overflow-x: auto; gap: 7px; padding-bottom: 4px; }
  .site-picker button { min-width: 170px; }
  .notify-panel { left: 12px; right: 12px; width: auto; top: 74px; }
  .eng-app { display: block!important; }
  .eng-side { position: sticky!important; inset: 0 auto auto 0!important; z-index: 40; width: 100%!important; height: auto!important; padding: 9px 12px!important; display: flex!important; align-items: center; gap: 12px; }
  .eng-side .company-name { display: none!important; }
  .eng-side .nav-text { display: none!important; }
  .eng-nav { display: flex!important; margin: 0!important; gap: 3px!important; overflow-x: auto; }
  .eng-nav button { white-space: nowrap; padding: 9px!important; font-size: 18px!important; }
  .eng-main { width: 100%!important; margin: 0!important; padding: 18px 14px 35px!important; }
}
@media (max-width: 380px) {
  .summary-grid { grid-template-columns: 1fr; }
  .site-actions { grid-template-columns: 1fr; }
  .table-row, .workers-table .table-row { grid-template-columns: 1fr!important; }
}
