/* Phone layout, shared by the admin app and the employee portal. */
.emp-mobile-bar,
.emp-nav-backdrop {
  display: none;
}

@media (max-width: 767.98px) {
  /* iPhones zoom the whole page when a focused input is under 16px. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
  select,
  textarea,
  .form-control,
  .form-select,
  .form-control-sm,
  .form-select-sm {
    font-size: 16px !important;
  }

  /* Comfortable tap targets. */
  .btn,
  .btn-sm,
  .form-control-sm,
  .form-select-sm,
  .page-link {
    min-height: 40px;
  }
  .btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .btn-link.btn-sm {
    min-width: 40px;
  }
  .btn-close {
    width: 24px;
    height: 24px;
  }
  input[type="checkbox"].form-check-input,
  input[type="radio"].form-check-input {
    width: 20px;
    height: 20px;
  }

  .page-title {
    font-size: 24px !important;
    overflow-wrap: anywhere;
  }
  .modal-dialog {
    margin: 8px;
  }
  .modal-footer {
    gap: 8px;
  }

  /* Employee portal: the menu becomes a drawer, so each page opens on its content. */
  .emp-mobile-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 1030;
    min-height: 56px;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
  }
  .emp-mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    flex: none;
  }
  .emp-mobile-title {
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .emp-sidebar {
    position: fixed !important;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(84vw, 300px) !important;
    max-width: none !important;
    flex: none !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow-y: auto;
    z-index: 1060;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    visibility: hidden;
  }
  body.emp-nav-open .emp-sidebar {
    transform: translateX(0);
    visibility: visible;
  }
  body.emp-nav-open {
    overflow: hidden;
  }
  .emp-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(15, 23, 42, 0.5);
  }
  body.emp-nav-open .emp-nav-backdrop {
    display: block;
  }
  .emp-main {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding: 16px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .emp-sidebar {
    transition: none;
  }
}

/* Wide tables become a stack of cards, one per row, so nothing is hidden off to the side. */
@media (max-width: 575.98px) {
  table.mobile-cards,
  table.mobile-cards > tbody,
  table.mobile-cards > tbody > tr,
  table.mobile-cards > tbody > tr > td {
    display: block;
    width: 100% !important;
    max-width: 100%;
  }
  table.mobile-cards > thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  table.mobile-cards > tbody > tr {
    margin-bottom: 12px;
    padding: 4px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
  }
  table.mobile-cards > tbody > tr > td {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 4px 12px;
    padding: 8px 0 !important;
    border: 0 !important;
    border-bottom: 1px solid #f1f5f9 !important;
    text-align: right !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    background: transparent !important;
    box-shadow: none !important;
  }
  table.mobile-cards > tbody > tr > td:last-child {
    border-bottom: 0 !important;
  }
  table.mobile-cards > tbody > tr > td[data-empty] {
    display: none;
  }
  table.mobile-cards > tbody > tr > td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 38%;
    max-width: 38%;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
  }
  /* A cell with no heading, such as row actions, or a message spanning the whole table. */
  table.mobile-cards > tbody > tr > td:not([data-label]) {
    justify-content: flex-end;
  }
  table.mobile-cards > tbody > tr > td[colspan] {
    justify-content: center;
    text-align: center !important;
  }
  table.mobile-cards > tbody > tr > td input.form-control,
  table.mobile-cards > tbody > tr > td input.form-control-sm,
  table.mobile-cards > tbody > tr > td select {
    flex: 1 1 55%;
    min-width: 0;
    width: auto !important;
  }
  .table-responsive:has(> table.mobile-cards) {
    overflow-x: visible;
  }
}
