/* Desktop + tablet (≥768): centered dialogs, form layout, admin tables. Tokens align with .blog-feed-post-dialog. */

@media (min-width: 768px) {
  :root {
    --hf-dialog-width-sm: 28rem;
    --hf-dialog-width-md: 42rem;
    --hf-dialog-width-lg: 56rem;
    --hf-dialog-max-height: min(
      92dvh,
      calc(100svh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1rem)
    );
    --hf-dialog-backdrop: rgba(0, 0, 0, 0.72);
  }

  .hf-dialog-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    max-height: var(--hf-dialog-max-height);
    overflow: hidden;
  }

  .hf-dialog-shell-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--wb-border, rgba(255, 255, 255, 0.22));
    flex-shrink: 0;
  }

  .hf-dialog-shell-body {
    flex: 1 1 auto;
    overflow: auto;
    min-height: 0;
    padding: 14px 16px;
  }

  .hf-dialog-shell-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 16px 14px;
    border-top: 1px solid var(--wb-border, rgba(255, 255, 255, 0.22));
    flex-shrink: 0;
  }

  /* Tier 1: native dialogs — match feed editor sizing */
  dialog.about-creator-modal,
  dialog.about-creator-edit-modal,
  dialog.book-cal-modal,
  dialog.logout-provisional-dialog {
    width: min(100vw - 2rem, var(--hf-dialog-width-md));
    max-width: calc(100vw - 1rem);
    max-height: var(--hf-dialog-max-height);
    margin: auto;
    padding: 0;
    border: 1px solid var(--wb-border, rgba(255, 255, 255, 0.22));
    border-radius: 12px;
    background: var(--wb-surface, #111);
    color: var(--wb-text, #fff);
    overflow: hidden;
  }

  dialog.about-creator-modal.hf-dialog--lg,
  dialog.about-creator-edit-modal.hf-dialog--lg {
    width: min(100vw - 2rem, var(--hf-dialog-width-lg));
  }

  dialog.logout-provisional-dialog--confirm {
    width: min(100vw - 2rem, var(--hf-dialog-width-sm));
  }

  dialog.about-creator-modal::backdrop,
  dialog.about-creator-edit-modal::backdrop,
  dialog.book-cal-modal::backdrop,
  dialog.logout-provisional-dialog::backdrop,
  dialog.blog-feed-post-dialog::backdrop {
    background: var(--hf-dialog-backdrop);
  }

  dialog.about-creator-modal[open]:not(.about-creator-edit-modal) {
    display: block;
    align-items: unset;
    justify-content: unset;
    height: auto;
    background: var(--wb-surface, #111);
  }

  dialog.logout-provisional-dialog--confirm[open] {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin: auto;
    height: fit-content;
    max-height: var(--hf-dialog-max-height);
    background: var(--wb-surface, #111);
    border-radius: 12px;
    overflow: hidden;
  }

  dialog.about-creator-modal[open] .about-creator-modal-panel,
  dialog.about-creator-edit-modal[open] .about-creator-modal-panel,
  dialog.book-cal-modal[open] .about-creator-modal-panel,
  dialog.logout-provisional-dialog[open] .logout-provisional-dialog-panel {
    display: flex;
    flex-direction: column;
    max-height: var(--hf-dialog-max-height);
    width: 100%;
    margin: 0;
    border-radius: 12px;
  }

  dialog.sp-watch-settings-modal {
    width: min(100vw - 2rem, var(--hf-dialog-width-md));
    max-height: var(--hf-dialog-max-height);
    margin: auto;
  }

  /* Tier 2: div backdrops — centered panels (tablet + desktop) */
  .pay-booking-modal-backdrop,
  .hf-modal-overlay {
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
  }

  .pay-booking-modal-backdrop .pay-booking-modal-panel,
  .hf-modal-overlay > div,
  .hf-modal-overlay .hf-modal-panel {
    width: min(100%, var(--hf-dialog-width-sm)) !important;
    max-width: min(100vw - 2rem, var(--hf-dialog-width-md)) !important;
    max-height: var(--hf-dialog-max-height) !important;
    margin: 0 auto !important;
    border-radius: 16px !important;
    padding-bottom: 1rem !important;
  }

  .hf-modal-overlay .hf-modal-panel.hf-dialog--lg,
  .hf-modal-overlay > .hf-dialog--lg {
    max-width: min(100vw - 2rem, var(--hf-dialog-width-lg)) !important;
  }
}

@media (min-width: 1024px) {
  /* Form pairs on wide layouts */
  .account-form-grid:not(.account-form-grid--single),
  .edit-grid:not(.edit-grid--single),
  .security-form-row.security-form-row--split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
  }

  .account-settings-main .admin-feed-form label,
  .account-settings-main .account-form-grid > label,
  .admin-cms .admin-feed-form label {
    max-width: 36rem;
  }

  .auth-card,
  .pay-checkout-card,
  .register-form-wrap {
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
  }

  /* Admin tables: sticky header + row hover */
  .admin-cms .table-wrap {
    overflow: auto;
    max-height: min(70vh, 720px);
  }

  .admin-cms table.data-table thead th,
  .admin-cms table.users-table thead th,
  .admin-cms table.security-table thead th,
  .admin-cms table.payments-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--wb-bg, #000);
    box-shadow: 0 1px 0 var(--wb-border, rgba(255, 255, 255, 0.22));
  }

  .admin-cms table.data-table tbody tr:hover,
  .admin-cms table.users-table tbody tr:hover,
  .admin-cms table.security-table tbody tr:hover,
  .admin-cms table.payments-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
  }

  .browse-card:hover,
  .catalog-tile:hover,
  .grid .card:hover {
    border-color: var(--wb-text, #fff);
    transform: translateY(-1px);
    transition: border-color 0.15s ease, transform 0.15s ease;
  }

  .admin-cms .table-wrap a:hover,
  .admin-cms table tbody td button.btn-ghost:hover {
    color: var(--wb-text, #fff);
  }
}
