/* =====================================
   GLOBAL TOUCH IMPROVEMENTS (ALL MOBILE)
   ===================================== */

nav {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Prevent accidental text selection */
button, nav a {
  user-select: none;
}

/* =====================================
   iPAD OPTIMISATION (PRIMARY TARGET)
   ===================================== */

@media (min-width: 768px) and (max-width: 1024px) {

  button, select, input, textarea {
    min-height: 44px;
    font-size: 16px;
  }

  body {
    font-size: 17px;
  }

  main {
    padding: 24px;
  }

  nav {
    padding: 16px 24px;
  }

  nav a {
    font-size: 17px;
    margin-right: 24px;
  }

  /* Tables: more breathing room */
  table th, table td {
    padding: 14px 12px;
  }

  /* Tabs: easier to hit */
  .tab {
    padding: 14px 20px;
    font-size: 16px;
  }

  /* Modals: thumb-friendly */
  .modal-content {
    width: 90%;
    max-width: 520px;
  }

  .modal-content input,
  .modal-content select,
  .modal-content textarea {
    font-size: 16px;
  }

  .modal-actions button {
    margin-left: 10px;
  }

  /* Filters stack nicely */
  .filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .filters select {
    flex: 1 1 200px;
  }

  /* Dashboard cards */
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =====================================
   PHONE OPTIMISATION (SECONDARY)
   ===================================== */

@media (max-width: 767px) {

  button, select, input, textarea {
    min-height: 44px;
    font-size: 16px;
  }

  nav {
    flex-wrap: wrap;
  }

  nav a {
    display: inline-block;
    margin: 6px 10px 6px 0;
    font-size: 16px;
  }

  main {
    padding: 16px;
  }

  h1 {
    font-size: 22px;
  }

  /* Tables → Cards */
  table thead {
    display: none;
  }

  table tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
  }

  table td {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border: none;
  }

  table td::before {
    content: attr(data-label);
    font-weight: bold;
  }

  /* Dashboard cards full width */
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
