@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    overflow-x: auto;
    gap: 4px;
    padding: 5px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .side-grid { display: none; }
  .nav-item {
    flex: 1 0 80px;
    min-height: 46px;
    gap: 4px;
    border-left: 0;
    border-bottom: 3px solid transparent;
    border-radius: 6px;
    text-align: center;
  }
  .nav-item i { font-size: 17px; }
  .nav-item.active { border-bottom-color: var(--primary); }
  .topbar { min-height: 0; padding: 5px 10px; gap: 8px; }
  .topbar .brand { display: none; }
  .top-actions { flex: 1 1 100%; min-width: 0; justify-content: space-between; }
  .login-user-box { min-width: 0; max-width: 100%; padding: 4px 0; border: 0; border-radius: 0; }
  .login-user-name, .login-user-role { overflow-wrap: anywhere; white-space: normal; }
  .logout-btn { flex-shrink: 0; min-height: 44px; white-space: nowrap; }
  .content { padding: 12px 10px 24px; min-width: 0; }
  .my-attendance-layout, .attendance-management-layout, .profile-3col {
    grid-template-columns: minmax(0, 1fr);
  }
  .my-attendance-card, .my-attendance-stats-col, .profile-card { padding: 12px; }
  .my-attendance-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 12px; }
  .my-attendance-head .month-nav { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .my-attendance-head .month-btn { width: 100%; height: 44px; }
  .my-attendance-head .month-picker-field { min-width: 0; height: 44px; }
  .my-attendance-head .month-picker-field input { flex: 1; width: 0; min-width: 0; }
  .self-check-card { flex-wrap: wrap; gap: 10px; }
  .self-check-info, .self-check-actions { flex-basis: 100%; }
  .self-check-actions .btn { flex: 1; min-height: 44px; white-space: nowrap; }
  .my-calendar-grid, .my-calendar-header { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .my-day { min-height: 76px; padding: 3px; gap: 3px; }
  .day-num { padding-right: 0; }
  .my-day-card { min-height: 0; height: auto; padding: 4px 1px; overflow-wrap: anywhere; }
  .my-day-card .big { font-size: 13px; }
  .my-day-note { overflow-wrap: anywhere; }
  .profile-head { flex-wrap: wrap; gap: 10px; }
  .profile-tabstrip, .staff-toolbar, .filter-card, .attendance-list-toolbar,
  .staff-pagination, .payroll-toolbar, .payroll-toolbar-left, .payroll-toolbar-right {
    flex-wrap: wrap;
  }
  .content .control { min-width: 0; max-width: 100%; }
  .staff-toolbar .search-control, .filter-card .search-control { flex: 1 0 100%; }
  .attendance-list-toolbar > div { min-width: 0; }
  .att-bulk-actions { flex-wrap: wrap; }
  .att-mini-btn { height: auto; min-height: 36px; }
  .mobile-table-scroll { overflow-x: auto; max-width: 100%; }
  .mobile-table-scroll > .staff-list-head, .mobile-table-scroll > #staffTable { min-width: 970px; }
  .mobile-table-scroll > .attendance-list-head, .mobile-table-scroll > .attendance-list-body { min-width: 750px; }
  .payroll-workflow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-step { height: auto; min-height: 58px; }
  .workflow-step b, .workflow-step small { white-space: normal; }
  .my-payslip-tools { flex-wrap: wrap; }
  .my-payslip-tools .control, .my-payslip-tools .secondary-btn { min-height: 44px; }
  .payslip-modal-box { display: flex; flex-direction: column; max-height: 94dvh; }
  .payslip-modal-box .modal-header, .payslip-modal-box .modal-footer { flex-shrink: 0; }
  .payslip-modal-box .modal-footer { flex-wrap: wrap; }
  .payslip-modal-body { display: flex; flex-direction: column; min-height: 0; }
  #payslipFrame { min-height: 0; flex: 1 1 auto; }
}
