/* Mobile-only refinements (max-width: 768px) */
@media (max-width: 768px) {
  .questionnaire-container {
    padding: 8px 12px 12px;
  }

  .questionnaire-content {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 14px 12px;
    margin: 8px auto 24px;
  }

  .bfm-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 16px;
    margin: 12px 0;
  }

  .bfm-header,
  .bfm-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
  }

  .bfm-logo {
    margin: 0 auto;
    width: auto;
    text-align: center;
    align-self: center;
    padding-left: 12px; /* slight nudge right */
  }

  .bfm-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  .bfm-form-actions,
  .actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    flex-direction: column;
    align-items: stretch;
  }

  .bfm-btn-primary,
  .bfm-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Ensure Next on top, Back below, full width on mobile */
  .bfm-btn-primary {
    order: 1;
    width: 100%;
  }
  .bfm-btn-back,
  .bfm-btn-secondary {
    order: 2;
    width: 100%;
  }

  /* Dashboard weight stats centering */
  .weight-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    text-align: center;
    justify-items: center;
  }

  .chart-wrapper {
    width: 100%;
    overflow-x: auto;
  }

  .scroll-table {
    width: 100%;
    overflow-x: hidden;
    display: block;
    padding-left: 16px; /* nudge table slightly to the right */
  }

  .weekly-table {
    width: calc(100% - 16px);
    min-width: calc(100% - 16px);
    table-layout: fixed;
    margin: 0 auto;
  }

  .weekly-table th,
  .weekly-table td {
    width: 33.33%;
    text-align: center;
    word-break: break-word;
    padding: 10px 8px;
  }
}
