@media (max-width: 760px) {
  /* Shared mobile shell */
  html,
  body,
  #root {
    min-height: 100%;
    background: #f5f3f1;
  }

  .workspace {
    max-width: 100%;
    padding-top: 12px;
  }

  /* Keep customer-detail exit available while the drawer is scrolled. */
  .drawer > .drawer-head .close {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top));
    right: 10px;
    z-index: 35;
    width: 46px !important;
    height: 46px !important;
    color: #fff;
    background: rgb(23 23 23 / 94%) !important;
    border: 1px solid rgb(255 255 255 / 18%) !important;
    box-shadow: 0 8px 24px rgb(0 0 0 / 28%);
    backdrop-filter: blur(10px);
  }

  .drawer > .drawer-head .close:active {
    background: #a81219 !important;
    transform: scale(.96);
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .topbar > div:first-child {
    min-width: 0;
  }

  .topbar h1 {
    margin-bottom: 5px;
    font-size: 22px;
  }

  .topbar p {
    font-size: 12px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .top-actions button {
    width: 100%;
    padding: 0 10px;
  }

  .top-actions .primary-button:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  /* Dashboard */
  .hero-grid {
    margin-bottom: 12px;
  }

  .focus-card {
    min-height: 190px;
    padding: 19px 18px;
  }

  .focus-card h2 {
    max-width: calc(100% - 10px);
    font-size: 20px;
  }

  .focus-card p {
    max-width: 92%;
    font-size: 12px;
    line-height: 1.55;
  }

  .focus-card button {
    position: relative;
    z-index: 2;
    width: 100%;
  }

  .focus-card button span {
    margin-left: 10px;
  }

  .focus-visual {
    right: 18px;
    bottom: 18px;
    opacity: .55;
  }

  .metric-grid {
    align-items: stretch;
  }

  .metric-grid article {
    min-height: 112px;
    padding: 14px 11px;
  }

  .metric-grid p {
    max-width: calc(100% - 32px);
    font-size: 10px;
    line-height: 1.35;
  }

  .metric-grid small {
    line-height: 1.4;
  }

  /* Customer list and filters */
  .table-card {
    border-radius: 14px;
    box-shadow: 0 3px 16px rgb(30 20 18 / 5%);
  }

  .table-heading {
    padding: 15px 12px 11px;
  }

  .table-heading h2 {
    font-size: 17px;
  }

  .table-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    padding: 0;
  }

  .table-tools label,
  .table-tools .level-filter,
  .table-tools .type-filter {
    width: 100%;
    min-width: 0;
    height: 44px;
  }

  .table-tools label:first-child {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .table-tools button {
    width: 100%;
  }

  .tabs {
    gap: 9px;
    padding: 8px 12px 9px;
    border-top: 1px solid #eee9e6;
  }

  .tabs button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 11px;
    border: 1px solid #e4deda;
    border-radius: 18px;
    background: #faf8f7;
    font-size: 11px;
  }

  .tabs .tab-active {
    color: #fff !important;
    background: #171717;
    border-color: #171717;
  }

  .tabs .tab-active::after {
    display: none;
  }

  .table-wrap {
    border-top: 1px solid #eee9e6;
  }

  .table-wrap table {
    min-width: 880px;
  }

  .table-wrap th {
    height: 38px;
    font-size: 9px;
  }

  .table-wrap td {
    height: 58px;
    font-size: 11px;
  }

  .table-card::after {
    padding: 9px 12px 11px;
    color: #806f6e;
    background: #faf8f7;
    border-top: 1px solid #eee9e6;
    font-size: 11px;
    text-align: center;
  }

  /* Bottom navigation */
  .sidebar {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: calc(70px + env(safe-area-inset-bottom));
    padding: 7px 6px calc(5px + env(safe-area-inset-bottom));
    background: rgb(255 255 255 / 97%);
    box-shadow: 0 -7px 24px rgb(30 17 17 / 10%);
    backdrop-filter: blur(12px);
  }

  .sidebar nav:first-of-type button:nth-child(-n+4),
  .sidebar .asa-mobile-more-button {
    height: 56px;
    border-radius: 11px;
    font-size: 10px;
    font-weight: 650;
  }

  .sidebar nav button > span,
  .asa-mobile-more-button span {
    font-size: 18px;
  }

  .asa-mobile-menu-backdrop {
    background: rgb(15 10 10 / 52%);
    backdrop-filter: blur(2px);
  }

  .asa-mobile-menu-panel {
    left: 8px;
    right: 8px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    padding: 14px;
    border-radius: 18px;
    box-shadow: 0 22px 60px rgb(0 0 0 / 28%);
  }

  .asa-mobile-menu-panel header b {
    font-size: 17px;
  }

  .asa-mobile-menu-panel header button {
    width: 44px;
    height: 44px;
    border: 1px solid #e6dfdc;
    border-radius: 50%;
    background: #f8f5f3;
  }

  .asa-mobile-menu-items {
    gap: 9px;
  }

  .asa-mobile-menu-items button {
    min-height: 50px;
    padding: 10px 12px;
    border-color: #e4deda;
    font-size: 13px;
    line-height: 1.35;
  }

  /* Warranty area */
  .warranty-top {
    display: grid;
    gap: 12px;
  }

  .warranty-top h1 {
    font-size: 22px;
  }

  .warranty-metric {
    min-height: 104px;
    border-radius: 13px;
  }

  .warranty-card {
    border-radius: 14px;
    box-shadow: 0 3px 16px rgb(30 20 18 / 5%);
  }

  .warranty-card-head {
    display: grid;
    gap: 12px;
  }

  .warranty-search {
    width: 100%;
    height: 46px;
  }

  .warranty-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .warranty-summary {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .warranty-edit-bar {
    display: grid;
    gap: 9px;
  }

  .warranty-edit-bar button {
    min-height: 44px;
  }

  .device-info button,
  .delete-warranty {
    min-height: 42px;
  }

  /* Modals and login */
  .modal {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
    border-radius: 15px;
  }

  .modal > header h2 {
    font-size: 18px;
  }

  .form-actions {
    gap: 8px;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .login-card {
    box-shadow: 0 24px 70px rgb(0 0 0 / 42%);
  }
}

@media (max-width: 390px) {
  .metric-grid,
  .warranty-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid strong,
  .warranty-metric strong {
    font-size: 20px;
  }

  .table-tools {
    grid-template-columns: 1fr;
  }

  .table-tools label:first-child {
    grid-column: auto;
  }

  .asa-mobile-menu-items {
    grid-template-columns: 1fr;
  }
}
